-
Notifications
You must be signed in to change notification settings - Fork 242
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
Add Darcy field convection timestep #5856
Add Darcy field convection timestep #5856
Conversation
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 left some comments that should fix the issue. Nice test. Can you also add a changelog entry?
{ | ||
if (this->introspection().compositional_name_exists("porosity")) | ||
{ | ||
const unsigned int porosity_idx = this->introspection().compositional_index_for_name("porosity"); |
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.
move this to the top of the file, where you also compute consider_darcy_timestep
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.
Unless I'm misunderstanding your comments, I don't know if it's possible to not compute the porosity_idx here because you need to divide by the porosity to calculate the Darcy velocity
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.
But you can compute the porosirty_idx above, and use it here. See my comment above.
c23977f
to
99f42b2
Compare
Thanks for the comments @gassmoeller, I still wasn't able to get Just to outline my thought process, I think that the following line: is important because the field type could be "porosity" but not be advected with the
up to where we calculate consider_darcy_timestep. |
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.
Looks much better. A few more comments.
I think your fluid_out
is empty, because your material model does not actually create a MeltOutputs
object in the create_additional_named_outputs
function. You need to modify ReactiveFluidTransport
to do that (currently it only fills the values in evaluate
if the MeltOutputs
exist, but they never exist, so it never fills them).
{ | ||
if (this->introspection().compositional_name_exists("porosity")) | ||
{ | ||
const unsigned int porosity_idx = this->introspection().compositional_index_for_name("porosity"); |
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.
But you can compute the porosirty_idx above, and use it here. See my comment above.
99f42b2
to
cbf218b
Compare
Got the melt outputs working thanks @gassmoeller! |
A point on the MeltOutputs: They are not additional named outputs, they are a separate type of outputs (AdditionalMaterialOutputs). In all other places, it is the responsibility of the caller to create them, not the material model itself. None of the melt models create their own MeltOutputs in the create_additional_named_outputs function. To be consistent with the rest of ASPECT, the melt outputs should be created in the place where you need them, with |
cbf218b
to
2a27f3d
Compare
@jdannberg I had tried this actually but for whatever reason at the time it didn't work and I clearly didn't try that hard to get it working, but now it seems to work! |
7cb2242
to
fcf6142
Compare
@gassmoeller Unfortunately I'm running into a git issue, the test |
A bit hard to debug remotely, but if I check out your branch from this PR, I clearly see the commit from #5799 in the commit history. Are you sure it is functionality from #5799 that is missing for this PR to pass the tests? |
@gassmoeller Yes there are two tests that fail, the first is |
The only way I can see that happening is if either you (in this PR) or someone else (in another PR) undid the changes. Can you check here if you maybe undid your changes accidentally? |
fcf6142
to
ca30245
Compare
@gassmoeller It never once occurred to me that I might've accidentally deleted the code and committed it! Thanks for catching that |
2b99c79
to
17f388b
Compare
/rebuild |
Is this ready for a review? |
@gassmoeller yes! |
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.
Looks good, just two small comments left.
@jdannberg could you take a look at the equation for the darcy flow? I am not qualified for that.
in.reinit(fe_values, cell, this->introspection(), this->get_solution()); | ||
this->get_material_model().create_additional_named_outputs(out); | ||
this->get_material_model().evaluate(in, out); | ||
this->get_material_model().fill_additional_material_model_inputs(in, this->get_solution(), fe_values, this->introspection()); |
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 line would need to happen before the call to evaluate
, right?
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 just tried putting the line:
this->get_material_model().fill_additional_material_model_inputs(in, this->get_solution(), fe_values, this->introspection());
before evalute
, after evalute
, and not including at all, and it seems to give the same solution for all 3 cases so I'll remove it and see if it causes any of the other tests to fail.
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.
the line:
this->get_material_model().create_additional_named_outputs(out);
also doesn't seem to be required, so I'll remove this line too.
17f388b
to
8559e4f
Compare
8559e4f
to
d1cb2c6
Compare
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.
Sorry for the dealy, looks good to go.
Add the functionality to limit the time step based on the Darcy velocity. Currently, when the 'darcy field' advection method is used, a field is advected with the Darcy velocity but the time step is not limited by this velocity. This leads to convergence issues, since the Darcy velocity is always equal to or greater than the solid velocity. This adds the functionality to
convection_time_step.cc
to limit the time step based on the Darcy velocity.The implementation I have in this PR is currently working in that it gives the proper limited time step, however the fluid parameters are currently hard-coded in because when I try to access
MeltOutputs
through a variablefluid_out
,fluid_out
is anullptr
. @jdannberg am I missing something obvious here? Once I can access the Melt variables, I think this PR is basically good to go.This addresses one of the issues in #4748