Skip to content

Conversation

@akeeste
Copy link
Contributor

@akeeste akeeste commented Nov 19, 2020

This PR adds read capytaine functionality to BEMIO. The BEMIO examples used for NEMOH and WAMIT have been recreated with Capytaine. The current read_capytaine script accomplishes as much as possible given Capytaine's current functionality. A method to add hydrostatics data is included in examples/BEMIO/CAPYTAINE/call_capy.py. This function must be used to output hydrostatics data in the correct format for read_capytaine.m

As Capytaine is still under development, it is important to know how it is being run for these cases to work correctly with BEMIO.
The specific python file that calls Capytaine and creates the .nc output is included in each case for this reason.

Files:
run_cases.py - Runs Capytaine for all cases
call_capytaine.py - Takes in input parameters, setups up Capytaine, runs hydrodynamics, and runs Capytaine
CASE.py - Setups up the input parameters that are sent to call_capytaine
CASE.nc - Capytaine output file for each case. This is read by the BEMIO function Read_CAPYTAINE.m

Notes:

  • Hydrostatics included with additional meshmagick function (see call_capy.py)
  • GBM should be supported, but has not been tested yet with B2B

@akeeste akeeste added the BEM/BEMIO related to BEMIO or BEM hydro data label Nov 19, 2020
@akeeste akeeste self-assigned this Nov 19, 2020
Copy link
Collaborator

@kmruehl kmruehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akeeste nice work! I didn't realize that you created all of the BEMIO runs too, that's great. I know it's still in progress, but you've gotten a lot done already.

@@ -0,0 +1,54 @@
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akeeste are these the Capytaine input files?

Copy link
Contributor Author

@akeeste akeeste Dec 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The *.py scripts in each case directory set all of the Capytaine input parameters and run capytaine for each case (assuming Capytaine is already installed).

@@ -0,0 +1,9220 @@
Rhino->WAMIT file export (mesh)
1 9.81 ULEN GRAV
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the same mesh as used for WAMIT, perhaps we should point to the WAMIT directory so we aren't uploading the same file twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes these are the same meshes in the other BEMIO examples. I can change case scripts to point to these meshes instead.

@author: akeeste

This script runs all of the current cases for WEC-Sim bemio examples.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This runs all BEMIO runs, or just the Capytaine ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script runs Capytaine for each case not BEMIO. I included this and call_capytaine.py so that everyone can see how Capytaine is being run for each case because there is an additional function required (hydrostatics)

@kmruehl kmruehl closed this Dec 23, 2020
@kmruehl kmruehl deleted the branch WEC-Sim:dev December 23, 2020 23:05
@kmruehl
Copy link
Collaborator

kmruehl commented Dec 24, 2020

@akeeste we need to re-open this PR. I went ahead and created a new dev branch and re-opened the PR

@kmruehl kmruehl added the Feature new feature request label Dec 24, 2020
@kmruehl kmruehl reopened this Dec 24, 2020
@dav-og dav-og self-requested a review January 6, 2021 23:34
@akeeste akeeste marked this pull request as ready for review January 13, 2021 23:15
@akeeste
Copy link
Contributor Author

akeeste commented Jan 15, 2021

@dav-og when you have some time, can you test the read_capytaine() function in this PR with any previous Capytaine output that you have? I want to ensure its working before we merge with master for the MECC groups

@dav-og
Copy link
Contributor

dav-og commented Jan 22, 2021

@dav-og when you have some time, can you test the read_capytaine() function in this PR with any previous Capytaine output that you have? I want to ensure its working before we merge with master for the MECC groups

Hey Adam,

I ran your function on some old .nc files I had which don't have the hydrostatic stiffness matrix (C) included, so I get the following error message from normalize:

Warning: Hydrostatics data not included in Capytaine output. No value for C.
In Read_CAPYTAINE (line 205)
Reference to non-existent field 'C'.
Error in Normalize (line 50)
hydro(F).C = hydro(F).C/(hydro(F).g*hydro(F).rho);

Not sure what the best approach to this is 🤔. Obviously the user needs C to run WEC-Sim...But most of the time I would just use meshmagick to compute C separately, so ideally I'd prefer to have the option to pass C separately from the .nc file (i.e. just read from a text file such as 'KH.dat', as we do for Nemoh).

Other options for me in this instance could be to re-run Capytaine (which seems uneccessary just for C...especially if there are a lot of panels and/or frequencies to compute). Or manually edit the .nc files in hdfview or Python to include C...which could introduce errors/become tedious if you have a lot of .nc files.

I think if you want to merge this function as is, thats fine - I guess most people will just run Capytaine with hydrostatics and the function will read it straight from the .nc file? But if we could eventually have the option to read a separate 'KH.dat' file, as we do with Nemoh, I think that would be handy 👍

@akeeste
Copy link
Contributor Author

akeeste commented Jan 22, 2021

@dav-og
Thanks for running this! I actually did change the read_capytaine function and made the hydrostatics (cg,cb,vo,C) use the same KH.dat and Hydrostatics.dat files that read_NEMOH() uses. I agree that since hydrostatics is not formally implemented in Capytaine, then we shouldn't require them in the .nc file. That would get messy and hard to fix..

I think the warning message is a bit ambiguous, I will change it to an error and point to those .dat files more obviously.

@dav-og
Copy link
Contributor

dav-og commented Jan 22, 2021

Sounds good!

@kmruehl kmruehl merged commit ff731db into WEC-Sim:dev Jan 29, 2021
@kmruehl kmruehl deleted the read_capytaine branch January 29, 2021 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BEM/BEMIO related to BEMIO or BEM hydro data Feature new feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants