-
Notifications
You must be signed in to change notification settings - Fork 10
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
Infiltration models #190
base: main
Are you sure you want to change the base?
Infiltration models #190
Conversation
Documentation preview: https://applied-material-modeling.github.io/neml2/pr-preview/pr-190 |
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 looks really great! I made a lot of minor comments... for starters.
void diagnose(std::vector<Diagnosis> &) const override; | ||
|
||
protected: | ||
virtual void update_forces() override; |
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.
Typicallyvirtual
+ override
is considered redundant, because override
by itself means the function is virtual. So:
virtual void update_forces() override; | |
void update_forces() override; |
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.
updated
/** | ||
* The value of the driving force, depending on `_control` this is either the prescribed strain or | ||
* the prescribed stress. | ||
*/ | ||
Scalar _driving_force; | ||
VariableName _driving_force_name; |
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.
We used the name "driving force" because for solid mechanics, the force could either be strain or stress. But I suppose there is a more specific name for this, maybe something like "_inlet_mass_flow_rate"?
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.
We will also need doxygen documentation for most, if not all, members. They are the comments right above each member. There is a specific format for the comment, see eg https://www.doxygen.nl/manual/docblocks.html
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.
Also the variable name could be const, i.e.
Scalar _driving_force;
const VariableName _driving_force_name;
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.
updated
LiquidInfiltrationDriver::expected_options() | ||
{ | ||
OptionSet options = TransientDriver::expected_options(); | ||
options.doc() = "Driver for Liquid Infiltration Process"; |
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.
options.doc() = "Driver for Liquid Infiltration Process"; | |
options.doc() = "Driver for the liquid infiltration process"; |
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.
updated
OptionSet options = TransientDriver::expected_options(); | ||
options.doc() = "Driver for Liquid Infiltration Process"; | ||
|
||
options.set<CrossRef<torch::Tensor>>("prescribed_liquid_inlet_rate"); |
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.
options.set<CrossRef<torch::Tensor>>("prescribed_liquid_inlet_rate"); | |
options.set<CrossRef<Scalar>>("prescribed_liquid_inlet_rate"); |
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.
updated
options.set("prescribed_liquid_inlet_rate").doc() = | ||
"Liquid saturate rate (mol/V) introducted to the RVE at the inlet"; |
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.
Maybe say this rate has units of molar mass per volume. "mol/V" might be a misleading. Also I don't think we should mention "RVE" in particular, because the driver could work for any infiltration model, not just ones derived from an RVE.
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.
Updated. Fixed for all other files as well.
} | ||
|
||
neml_assert(found, "No buffer named '", tensor_name, "' in file ", fname); | ||
t = t.to(torch::kFloat64); |
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.
We should try not to hard-code the dtype to be float64.
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.
So we can issue a comments/ errors to the user to make sure they get the correct dtype?
{ | ||
OptionSet options = FromTorchScript::expected_options(); | ||
|
||
options.set<Size>("batch_dim") = -1; |
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.
Why default to -1?
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 feel like when people provided the tensors, I don't think they have a specific batch dimension in mind. I could change it to {}.
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.
We don't need to check in this file, do we?
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 was thinking using this file as an example to show how TorchScript can be used to generate files as user input tensors. Might be helpful or we can add this code as an example in the documentation.
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.
If we reuse most of the code from regression_solid_mechanics
, we should think about how to reduce code duplication.
…t functionality and updated NewtonWithLineSearch file
Co-authored-by: Gary (Tianchen) Hu <[email protected]>
…e, add in *.h Doxygen
…gfucnction file, add in *.h Doxygen
…gfucnction file, move files around, add in *.h Doxygen,
@hdt5kt feel free to edit the description of this PR.