Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
wr1 committed Nov 8, 2024
1 parent d500ab1 commit 956ddca
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 66 deletions.
57 changes: 48 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,64 @@
[![Deploy](https://github.com/wr1/b3p/actions/workflows/publish.yml/badge.svg)](https://github.com/wr1/b3p/actions/workflows/publish.yml)
[![Test](https://github.com/wr1/b3p/actions/workflows/test.yml/badge.svg)](https://github.com/wr1/b3p/actions/workflows/test.yml
![PyPI](https://img.shields.io/pypi/v/b3p)


# b3p
Command line tools to create models for composite (wind turbine) blades.

## Functionality
- Interpolating a blade through a series of airfoils
<!-- - Aligning airfoils to create maximum building height over a straight shearweb -->
- Building 3D models of wind turbine blades
- Creating a quad mesh for the blade
- Assigning scalable *slab based* laminate plans to the structure
- Assembling a shell mesh with laminate properties
- Writing mesh information to VTK files

## How to run
## Install
From pypi
```sh
pip install -e .
pip install b3p
```
From source
```sh
git clone https://github.com/wr1/b3p.git
cd b3p
pip install -e .
```


## How to run
<!-- ```sh
pip install b3p
cd examples
make
``` -->
```sh
Usage: b3p COMMAND

╭─ Commands ──────────────────────────────────────────────────╮
│ 2d Create 2d meshes for calculation of 6x6 matrices │
│ build Build the blade model, geometry, mesh, drape │
│ ccx Run the ccx analysis │
│ clean Clean the working directory. │
│ shell Start an interactive shell. │
│ --help,-h Display this message and exit. │
│ --version Display application version. │
╰─────────────────────────────────────────────────────────────╯
```
which outputs the following targets
In a cloned repository:
```sh
cd examples
# build the blade model, geometry, mesh, drape
b3p build blade_test.yml
# run the ccx fea analysis
b3p ccx blade_test.yml

```





<!-- which outputs the following targets
```
help Show this help
build make self contained yaml file
Expand All @@ -30,7 +69,7 @@ all run all steps
To run all steps type:
```
make all
```
``` -->
## Output
Plot of geometric input parameters for the example blade
![test_blade](https://user-images.githubusercontent.com/8971152/148471383-7f652a84-447a-4db0-81e2-2e27b1785745.png)
Expand All @@ -45,7 +84,7 @@ Visualisation of a 2d cross section mesh
![zstrain](https://user-images.githubusercontent.com/8971152/151350188-0a6f31bf-5f0e-457b-b6cb-438bb10b4c91.png)


## Input file format
Take a look at ```examples/blade_test.yml```
<!-- ## Input file format
Take a look at ```examples/blade_test.yml``` -->


50 changes: 0 additions & 50 deletions b3p/mesh2ccx.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,11 @@ def material_db_to_ccx(materials, matmap=None, force_iso=False):
for i in materials:
if i > 1e-6:
material_properties = mat_db[mm_inv[int(i)]]

# print(material_properties)
matblock += (
f'** material: {mm_inv[int(i)]} {i} {material_properties["name"]}\n'
)
# matblock += f"** {str(material_properties)}\n"

if (
# "vf" in material_properties
# or
"C" in material_properties and not force_iso
):
print(material_properties["name"], "is assumed to be orthotropic")
Expand All @@ -99,7 +94,6 @@ def material_db_to_ccx(materials, matmap=None, force_iso=False):
D[2, 5] = C[2, 3]
D[3, 3] = C[5, 5]
D[5, 5] = C[3, 3]
# D *= 1e6
matblock += (
f"{D[0,0]:.4g},{D[0,1]:.4g},{D[1,1]:.4g},"
+ f"{D[0,2]:.4g},{D[1,2]:.4g},{D[2,2]:.4g},"
Expand All @@ -122,7 +116,6 @@ def material_db_to_ccx(materials, matmap=None, force_iso=False):

else:
print(material_properties["name"], "is assumed to be isotropic")
# print(material_properties)
nu = min(
0.45,
max(
Expand Down Expand Up @@ -204,23 +197,8 @@ def nodebuffer(grid):


def element_buffer(grid):
# n_el = grid.GetNumberOfCells()

# buf = ""
# for i in range(n_el):
# cell = grid.GetCell(i)
# # print(dir(cell))
# type = cell.GetCellType()
# if type == 23:
# conn = list(cell.GetPointIds())
# buf += f"*element,type=s8r,elset=e{i+1}\n"
# buf += f"{i+1},{','.join(map(str, conn))}\n"
# print(type)

conn = grid.cells_dict

print(conn)

extypes = [23]

vtk_ccx = {23: "s8r"}
Expand All @@ -233,23 +211,6 @@ def element_buffer(grid):
buf += f"*element,type={ccxtype},elset=e{n+1}\n"
buf += f"{n+1},{','.join(map(str, conn[tp][n]) )}\n"

# for i in conn['23']

# print(conn)
# # grid.cell_connectivity.reshape((grid.GetNumberOfCells(), -1)) + 1

# # print(np.unique(grid.celltypes))
# # print(conn)
# eltype = "s8r" if quadratic else "s4"
# buf = ""
# for n, i in enumerate(conn):
# type = grid.celltypes[n]
# print(type)
# if type == 23:
# eltype = "s8r"
# buf += f"*element,type={eltype},elset=e{n+1}\n"
# buf += f"{n+1},{','.join(map(str, i))}\n"

return buf


Expand Down Expand Up @@ -298,11 +259,6 @@ def get_loadcases(mesh, multiplier=1.0, buckling=False):
lbuf += "%i,2,%f\n" % (n + 1, j[1])

lbuf += "*node output,output=3d\nU\n*element output\nE,S\n*node print,nset=root,totals=yes\nrf\n*end step\n"
# \n*node print,nset=nall\nrf
# if buckling:
# lbuf += (
# "*step\n*buckle\n5\n*el file\n*node file,output=3d\nu\n*end step\n"
# )

loadcases[i] = lbuf

Expand All @@ -320,8 +276,6 @@ def root_clamp(mesh):
lbuf += ","
lbuf += "\n"
lbuf += "*boundary,op=new\nroot,1,3\n"
# for j in root[0]:
# lbuf += "%i,1,3\n" % (j + 1)
return lbuf


Expand Down Expand Up @@ -415,8 +369,6 @@ def mesh2ccx(

tic = time.perf_counter()

# print(plydat.shape)

blx = [
make_shell_section(i, plydat[:, i, :], merge_adjacent_layers, zeroangle)
for i in range(plydat.shape[1])
Expand Down Expand Up @@ -466,10 +418,8 @@ def mesh2ccx(

return output_files


def main():
fire.Fire(mesh2ccx)


if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion tests/test_bondline_model.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .test_build import run_test_build, workdir
from .test_build import run_test_build, workdir

7 changes: 1 addition & 6 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ def run_tbuild():
"""Run step s1."""
cd = os.getcwd()
os.chdir(example_dir)
cli = b3p_cli.build("blade_test.yml")
# cli.build()
# cli.bondline()
# cli.ccxprep()
# cli.ccxrun()
# cli.mesh2d(90.0, parallel=False)
b3p_cli.build("blade_test.yml")
os.chdir(cd)


Expand Down

0 comments on commit 956ddca

Please sign in to comment.