Skip to content

Commit

Permalink
Check minimum computable mesh in tutorial 1
Browse files Browse the repository at this point in the history
  • Loading branch information
jtgrasb committed Oct 26, 2023
1 parent c74e4fc commit 4825ad5
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions examples/tutorial_1_WaveBot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,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."
"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 @@ -158,6 +156,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 Expand Up @@ -862,7 +886,7 @@
"kernelspec": {
"display_name": "wot_dev",
"language": "python",
"name": "python3"
"name": "wecopttool2_0_0"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -874,7 +898,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.10"
"version": "3.10.9"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit 4825ad5

Please sign in to comment.