Closed jtgrasb closed 4 months ago
Thank you for reporting this.
My main guess is that it is due to the increased resolution of the tabulation, meaning that v2.1 is more reliable.
You could check that by solving in v2.1 with
solver = cpt.BEMSolver(green_function=cpt.Delhommeau(
tabulation_nr=400, tabulation_nz=80,
tabulation_nb_integration_points=251,
tabulation_method="legacy"))
which should give the same result as v2.0 or by solving with
solver = cpt.BEMSolver(green_function=cpt.Delhommeau(tabulation_nr=0))
which should give the same result in both versions, and be closer to v2.1 than v2.0. (Beware that the latter setting is up to 100 times slower, so maybe reduce the number of frequencies.)
Otherwise, could you share a code snippet for me to investigate?
it is due to the increased resolution of the tabulation
Which is surprisingly missing from the changelog... I need to fix that.
Thank you for the quick response. I checked the two cases you suggested and found the expected results
solver = cpt.BEMSolver(green_function=cpt.Delhommeau( tabulation_nr=400, tabulation_nz=80, tabulation_nb_integration_points=251, tabulation_method="legacy"))
gives me the same results as v2.0. And
solver = cpt.BEMSolver(green_function=cpt.Delhommeau(tabulation_nr=0))
gives me the same results for both. I've included a code snippet for a similar thin cylinder.
And here is the resultant added mass plots using v2.1. I believe the large negative added mass terms at low frequencies are leading to instabilities in our model. I am working on comparing these results to WAMIT for this same geometry.
Confirming that when I run the same geometry in WAMIT, I do not get the low frequency peaks in added mass as shown below (different units cause the difference in magnitude):
Ok, I can confirm that the default result of 2.1 is wrong here. By comparing with the output for $\omega=0$, the asymptotic is clearly wrong.
But for some reasons, the current development version on the master branch gives good results :confused:
Works also well with cpt.BEMSolver(green_function=cpt.XieDelhommeau())
, so this might be the low-frequency counterparts of #298
I can also observe that the low-frequency asymptotics was wrong for the Green function of 2.0 (diverging for $\omega < 0.01$ rad/s). That is expected and I was intending to fix that it in the future at the same time as #298.
It is completely unexpected to me that the change of version 2.1 would make it much worse.
```python import numpy as np import xarray as xr import matplotlib.pyplot as plt import pygmsh import gmsh import capytaine as cpt print(cpt.__version__) # create mesh r = .35 # cylinder radius h = .1 # cylinder height freeboard = h/2 mesh_size_factor = 0.5 with pygmsh.occ.Geometry() as geom: gmsh.option.setNumber('Mesh.MeshSizeFactor', mesh_size_factor) cyl = geom.add_cylinder([0, 0, 0],[0, 0, -h],r) geom.translate(cyl, [0, 0, freeboard]) mesh = geom.generate_mesh() fb = cpt.FloatingBody.from_meshio(mesh, name="Pioneer") # fb.show_matplotlib() fb.keep_immersed_part() fb.add_all_rigid_body_dofs() # fb.show_matplotlib() # set frequencies wCapy = np.linspace(0.0, 0.1, 100) depth = np.infty density = 1025.0 # call Capytaine solver problems = xr.Dataset(coords={ 'omega': wCapy, 'radiating_dof': list(fb.dofs), 'water_depth': [depth], 'rho': [density], }) for solver in [ cpt.BEMSolver(green_function=cpt.Delhommeau(tabulation_nr=0)), cpt.BEMSolver(green_function=cpt.XieDelhommeau(tabulation_nr=0)), cpt.BEMSolver(green_function=cpt.Delhommeau()), cpt.BEMSolver(green_function=cpt.XieDelhommeau()), cpt.BEMSolver(green_function=cpt.Delhommeau(tabulation_nr=400, tabulation_nz=80, tabulation_method="legacy")), ]: ds = solver.fill_dataset(problems, [fb], n_jobs=2, hydrostatics=False) ds.added_mass.sel(radiating_dof="Heave", influenced_dof="Heave").plot(x="omega", label=str(solver)) plt.legend() plt.show() ```
The low frequency asymptotics should be better in the next version (2.2)
I am using Capytaine to run the boundary element method for a 2-body attenuator type WEC. Recently, I updated from v2.0 to v2.1 and noticed that I am now getting different results, specifically for the added mass at low frequencies. You can see the added mass plotted for one of the bodies in the surge, heave, and pitch dofs below. v2.0: v2.1:
For context, the body shown is a small disk-like cylinder with the radius of about 0.15 m and height of about 0.075 m. and a relatively small draft (~.03 m). What is causing this change in the added mass between the two Capytaine versions? Should the results from v2.1 be trusted over v2.0?