|
39 | 39 | "\n",
|
40 | 40 | "import gmsh, pygmsh\n",
|
41 | 41 | "import capytaine as cpy\n",
|
| 42 | + "from capytaine.io.meshio import load_from_meshio\n", |
42 | 43 | "import autograd.numpy as np\n",
|
43 | 44 | "import matplotlib.pyplot as plt\n",
|
44 | 45 | "import xarray as xr\n",
|
|
103 | 104 | "Here we create the mesh based on the dimensions provided by Oregon State University using `pygmsh`, available [here](https://pypi.org/project/pygmsh/).\n",
|
104 | 105 | "This is the same package used by `geom.py` (click [here](https://sandialabs.github.io/WecOptTool/api_docs/wecopttool.geom.html) for API documentation) containing the predefined WaveBot and AquaHarmonics meshes used in the previous tutorials.\n",
|
105 | 106 | "\n",
|
106 |
| - "The float has a hole where the spar passes through it, though OSU has found that this hole creates a large spike in the BEM results at about 4.5 rad/s.\n", |
107 |
| - "There is not much energy in the waves at this frequency in the wave spectrum we will be using, so this spike should not significantly affect our results.\n", |
108 |
| - "If you would like to remove this spike and create smoother BEM results, set `hole = False` in the cell below." |
| 107 | + "The float has a hole where the spar passes through it. \n", |
| 108 | + "In previous versions of this tutorial, the hole was larger than the spar and led to a large spike in the BEM results. \n", |
| 109 | + "The spike has been resolved by making the hole smaller so that the float is flush with the spar.\n", |
| 110 | + "Like the other tutorials, a lid is added to remove any irregular frequency spikes. " |
109 | 111 | ]
|
110 | 112 | },
|
111 | 113 | {
|
|
121 | 123 | "h1 = 0.5 \n",
|
122 | 124 | "h2 = 0.21\n",
|
123 | 125 | "freeboard = 0.3\n",
|
124 |
| - "r3 = 0.10/2 + 0.05 # hole radius\n", |
125 |
| - "hole = True # set to False to remove spike in BEM results\n", |
| 126 | + "r3 = 0.05 # hole radius\n", |
126 | 127 | "with pygmsh.occ.Geometry() as geom:\n",
|
127 | 128 | " gmsh.option.setNumber('Mesh.MeshSizeFactor', mesh_size_factor)\n",
|
128 | 129 | " cyl = geom.add_cylinder([0, 0, 0], [0, 0, -h1], r1)\n",
|
129 | 130 | " cone = geom.add_cone([0, 0, -h1], [0, 0, -h2], r1, r2)\n",
|
130 | 131 | " geom.translate(cyl, [0, 0, freeboard])\n",
|
131 | 132 | " geom.translate(cone, [0, 0, freeboard]) \n",
|
132 |
| - " if hole:\n", |
133 |
| - " tmp = geom.boolean_union([cyl, cone])\n", |
134 |
| - " bar = geom.add_cylinder([0, 0, 10], [0,0,-20], r3)\n", |
135 |
| - " geom.boolean_difference(tmp, bar)\n", |
136 |
| - " else:\n", |
137 |
| - " geom.boolean_union([cyl, cone])\n", |
| 133 | + " tmp = geom.boolean_union([cyl, cone])\n", |
| 134 | + " bar = geom.add_cylinder([0, 0, 10], [0,0,-20], r3)\n", |
| 135 | + " geom.boolean_difference(tmp, bar)\n", |
138 | 136 | " mesh_float = geom.generate_mesh()"
|
139 | 137 | ]
|
140 | 138 | },
|
|
152 | 150 | "metadata": {},
|
153 | 151 | "outputs": [],
|
154 | 152 | "source": [
|
| 153 | + "# lid\n", |
| 154 | + "mesh_obj = load_from_meshio(mesh_float, 'float')\n", |
| 155 | + "lid_mesh = mesh_obj.generate_lid(z=-1e-2)\n", |
| 156 | + "\n", |
155 | 157 | "# floating body\n",
|
156 |
| - "float_fb = cpy.FloatingBody.from_meshio(mesh_float, name='float')\n", |
| 158 | + "float_fb = cpy.FloatingBody(mesh=mesh_obj, lid_mesh=lid_mesh, name=\"float\")\n", |
157 | 159 | "float_fb.add_translation_dof(name='Heave')"
|
158 | 160 | ]
|
159 | 161 | },
|
|
221 | 223 | "metadata": {},
|
222 | 224 | "outputs": [],
|
223 | 225 | "source": [
|
| 226 | + "# lid\n", |
| 227 | + "mesh_obj = load_from_meshio(mesh_spar, 'float')\n", |
| 228 | + "lid_mesh = mesh_obj.generate_lid(z=-1e-2)\n", |
| 229 | + "\n", |
224 | 230 | "# floating body\n",
|
225 |
| - "spar_fb = cpy.FloatingBody.from_meshio(mesh_spar, name='spar')\n", |
| 231 | + "spar_fb = cpy.FloatingBody(mesh=mesh_obj, lid_mesh=lid_mesh, name=\"spar\")\n", |
226 | 232 | "spar_fb.add_translation_dof(name='Heave')"
|
227 | 233 | ]
|
228 | 234 | },
|
|
0 commit comments