Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check minimum computable wavelength in tutorial 1 (Capytaine v2) #288

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions examples/tutorial_1_WaveBot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### BEM\n",
"With our Capytaine floating body created, we can now run the Boundary Element Method solver in Capytaine to get the hydrostatic and hydrodynamic coefficients of our WEC object. This is wrapped into the `wecopttool.run_bem` function.\n",
"\n",
"#### Frequency and mesh check\n",
"We will analyze 50 frequencies with a spacing of 0.05 Hz. These frequencies will be used for the Fourier representation of both the wave and the desired PTO force in the pseudo-spectral problem. See the Theory section of the Documentation for more details on the pseudo-spectral problem formulation.\n",
"\n",
"If you would like to save our BEM data to a NetCDF file for future use, see the `wecopttool.write_netcdf` function.\n",
"\n",
"The run_bem() function now calculates the hydrostatics and stores them as part of bem_data. The inertia and stiffness can still be defined manually as part of the `FloatingBody` if desired."
"The `fb.minimal_computable_wavelength` parameter checks the mesh to determine the minimum wavelength that can be reliably computed using Capytaine. This warning is ignored here because the BEM results have been validated, but can be used as a guide for mesh refinement to ensure accurate BEM results."
]
},
{
Expand All @@ -141,6 +137,32 @@
"nfreq = 50\n",
"freq = wot.frequency(f1, nfreq, False) # False -> no zero frequency\n",
"\n",
"min_computable_wavelength = fb.minimal_computable_wavelength\n",
"g = 9.81\n",
"min_period = 1/(f1*nfreq)\n",
"min_wavelength = (g*(min_period)**2)/(2*np.pi)\n",
"\n",
"if min_wavelength < min_computable_wavelength:\n",
" print(f'Warning: Minimum wavelength in frequency spectrum ({min_wavelength}) is smaller'\n",
" f' than the minimum computable wavelength ({min_computable_wavelength}).')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### BEM\n",
"With our Capytaine floating body created, we can now run the Boundary Element Method solver in Capytaine to get the hydrostatic and hydrodynamic coefficients of our WEC object. This is wrapped into the `wecopttool.run_bem` function.\n",
"\n",
"If you would like to save our BEM data to a NetCDF file for future use, see the `wecopttool.write_netcdf` function."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"bem_data = wot.run_bem(fb, freq)"
]
},
Expand Down
Loading