-
Notifications
You must be signed in to change notification settings - Fork 166
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
Variable hydro documentation #1343
base: dev
Are you sure you want to change the base?
Conversation
This is now ready for an initial review. As I was the one who created the feature, I don't have a good sense of what users will need detailed documentation on. I could use a review and suggestions about additional content to cover. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akeeste I reviewed this content, and I have several recommendations. I'll put my commends in the review, and then we can discuss how to rework the documentation. I'm happy to help rewrite the text.
a specific scenario, state, signal, or discretization required. It is the | ||
user's responsibility to implement a specific variable hydrodynamics case | ||
using best practices and validate the results with higher fidelity data. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is that first one that users will read. I recommend simplifying it to clearly describe what/how variable hydro works, and then provide an example. Here's my initial attempt:
Variable hydrodynamics allows WEC-Sim bodies to simulate bodies with hydrodynamic data from multiple BEM runs for a single body. Hydrodynamic data from each BEM run is parsed into H5 files, which are then initialized in the instance of the body class, for example body(1) = bodyClass({'H5FILE_1.h5','H5FILE_2.h5',...);
. This feature allows users to simulate bodies with different initial conditions, for example body that is floating or submerged. Users then specify the condition to switch when each H5 is used. The condition must be based on a WEC-Sim state...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akeeste I used ChatGPT to refine the overview and here's the suggestion:
Overview
Variable Hydrodynamics enables WEC-Sim bodies to utilize hydrodynamic data from multiple BEM runs within a single body instance. Each BEM run's data is stored in H5 files, which are initialized in the body class, for example:
body(1) = bodyClass({'H5FILE_1.h5', 'H5FILE_2.h5', ...});
This feature allows users to simulate different initial conditions, such as floating or submerged states. Users specify the conditions that trigger the use of each H5 file, based on a WEC-Sim state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this text could be more concise, I'll revise this text.
The ChatGPT response is certainly concise, bit its inaccurate when for some of the details (H5 files aren't being initialized, the feature is not about initial conditions)
docs/_include/variable_hydro.rst
Outdated
multiple hydrodynamic datasets at various pitch angles (-50:10:50). It is most convenient | ||
to treat these angles in numerical order in BEM simulations, indexing logic, and other | ||
data processing. In this case the initial position is at a pitch angle of 0 so ``body.variableHydro.hydroForceIndexInitial=6;``. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This level of detail seems more appropriate for the developer documentation. I recommend simplifying the user docs to only what the user needs to know to implement the feature, which is that they need to specify which index to start with. I don't even know how critical it is for a user to understand the bus signals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the ChatGPT recommendation for Implementation
Implementation
To implement Variable Hydrodynamics, follow these steps:
-
Initialize the Body: Create a body instance with a cell array of H5 files containing the hydrodynamic data. For example:
body(1) = bodyClass({'H5FILE_1.h5', 'H5FILE_2.h5', 'H5FILE_3.h5', ...});
-
Enable Variable Hydrodynamics: Set the variableHydro.option flag to enable the feature:
body(1).variableHydro.option = 1;
-
Set Initial Hydrodynamic Coefficient Index: Use the hydroForceIndexInitial flag to define the default index for hydrodynamic coefficients, typically representing the body’s starting condition:
body(1).variableHydro.hydroForceIndexInitial = <initial_index>;
-
Simulink Integration: Load the hydrodynamic force data into Simulink using a custom bus. Create a GoTo block named body1_hydroForceIndex (or similar) to allow the body block to read the index signal for selecting the appropriate hydrodynamic coefficients.
-
User-Defined Logic: Implement your own logic in Simulink to determine when to switch between H5 files based on the specified conditions.
Note: Variable hydrodynamics can be applied to individual bodies in a simulation, and it is not necessary for all bodies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the suggested numbering of steps for a user's implementation. I combined this with the detailed paragraphs to walk a user through set-up.
docs/_include/variable_hydro.rst
Outdated
* Validate using high fidelity data | ||
* The hydroData directory may become very large | ||
* All BEM data is contained within the ``body`` variable. Pre-processing remains very fast, so it's not recommended to save ``body`` to an output file or the file size may increase drastically. | ||
* Conditions that require a varying mass, center of gravity, or center of buoyancy are not yet implemented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment, I this this is better suited as a note that this feature should be used with extreme caution. I also recommend moving a lot of these recommendations to the README in the variable hydro application case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change this to a note or paragraph, but I don't think the notes will be read if moved to the Application readme. Those documents tend to contain very basic information about a specific case, whereas these tips will be applicable to any simulation with variable hydrodynamics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend using ChatGPT to improve our documentation. I fed it your text, my text, and then asked it to make docs clearer and more concise. I think it did a pretty good job.
a specific scenario, state, signal, or discretization required. It is the | ||
user's responsibility to implement a specific variable hydrodynamics case | ||
using best practices and validate the results with higher fidelity data. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akeeste I used ChatGPT to refine the overview and here's the suggestion:
Overview
Variable Hydrodynamics enables WEC-Sim bodies to utilize hydrodynamic data from multiple BEM runs within a single body instance. Each BEM run's data is stored in H5 files, which are initialized in the body class, for example:
body(1) = bodyClass({'H5FILE_1.h5', 'H5FILE_2.h5', ...});
This feature allows users to simulate different initial conditions, such as floating or submerged states. Users specify the conditions that trigger the use of each H5 file, based on a WEC-Sim state.
docs/_include/variable_hydro.rst
Outdated
multiple hydrodynamic datasets at various pitch angles (-50:10:50). It is most convenient | ||
to treat these angles in numerical order in BEM simulations, indexing logic, and other | ||
data processing. In this case the initial position is at a pitch angle of 0 so ``body.variableHydro.hydroForceIndexInitial=6;``. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the ChatGPT recommendation for Implementation
Implementation
To implement Variable Hydrodynamics, follow these steps:
-
Initialize the Body: Create a body instance with a cell array of H5 files containing the hydrodynamic data. For example:
body(1) = bodyClass({'H5FILE_1.h5', 'H5FILE_2.h5', 'H5FILE_3.h5', ...});
-
Enable Variable Hydrodynamics: Set the variableHydro.option flag to enable the feature:
body(1).variableHydro.option = 1;
-
Set Initial Hydrodynamic Coefficient Index: Use the hydroForceIndexInitial flag to define the default index for hydrodynamic coefficients, typically representing the body’s starting condition:
body(1).variableHydro.hydroForceIndexInitial = <initial_index>;
-
Simulink Integration: Load the hydrodynamic force data into Simulink using a custom bus. Create a GoTo block named body1_hydroForceIndex (or similar) to allow the body block to read the index signal for selecting the appropriate hydrodynamic coefficients.
-
User-Defined Logic: Implement your own logic in Simulink to determine when to switch between H5 files based on the specified conditions.
Note: Variable hydrodynamics can be applied to individual bodies in a simulation, and it is not necessary for all bodies.
@kmruehl I made some revisions to the documentation based on your suggest. See above comments. Given the challenges of using this feature, I think it is worth leaving more detail and explanation for users than less. Let me know if you think there is any topic missing. |
@akeeste thanks, I'll review it again. Also, do you know why the documentation build isn't passing? |
Some issue with one of the images I pushed, but otherwise the test's error message is unclear. My build works locally. I'll test again with the most up to date conda environment |
@kmruehl The issue is fixed. Linux filenames are case sensitive but windows filenames are not so the build passed locally and failed on Actions. |
This PR adds documentation on the variable hydro advanced feature:
hydroForceIndexInitial
,option
, etc)