Add viscosity additional outputs#6974
Conversation
|
I have talked with @alarshi before, so I assume she would be willing to take a look. Just to brief on it, I largely model it from the "PlasticAdditionalOutputs" class that exists in the "visco plastic" rheology module and is created by the "visco plastic" material model. |
538639c to
aa876fa
Compare
| */ | ||
| void | ||
| fill_viscosity_outputs( | ||
| const unsigned int i, |
There was a problem hiding this comment.
Here I changed it to "const unsigned int point_index", following the example of the fill_plastic_outputs
|
Thanks @tjhei for looking into this. I have:
And below are a few comments and questions from me. Here, I checked all the tests that should be updated for the "visco plastic" material model with "named additional outputs" as outputs. Therefore, they should be the one fails after I run the updated code. visco_plastic_additional_plastic_outputs Tests that failed in docker run matched all the expected ones. Following this step, I fixed the test outputs from the newly generated files. |
aa876fa to
f473194
Compare
|
I also removed the new test I created in the draft, as the additional viscosity outputs are well tested in all the tests mentioned before. |
| { | ||
| switch (viscous_flow_law) | ||
| { | ||
| case diffusion: |
There was a problem hiding this comment.
Currently, I assign the value to max limit, if the viscosity is not computed by the viscous flow law (e.g. the dislocation creep would not be calculated if the flow law is diffusion). I'm not entirely sure this is the best approach. I have tested that assigning values to nan doesn't work and will trigger error in the post-processor.
The values will be written as "inf" in outputs.
There was a problem hiding this comment.
Hmm, I see. Does the issue persist after #6973 was merged?
But in either case, I am not sure if having both dislocation and diffusion viscosity outputs for each viscous flow law is the right approach. See my comment above.
There was a problem hiding this comment.
Oh, this and 6973 are separated.
| output_parameters.drucker_prager_parameters.resize(volume_fractions.size()); | ||
| output_parameters.dilation_lhs_terms.resize(volume_fractions.size(), numbers::signaling_nan<double>()); | ||
| output_parameters.dilation_rhs_terms.resize(volume_fractions.size(), numbers::signaling_nan<double>()); | ||
| output_parameters.diffusion_viscosities.resize(volume_fractions.size(), numbers::signaling_nan<double>()); |
There was a problem hiding this comment.
However, in the calculation step, it seems the nan value won't trigger issue, as indicated by the examples of other variables.
|
Hi @lhy11009, thanks for working on this! I had a similar need about a year ago and implemented a prototype that also added For reference, the commit is here: I think this kind of user-side selection could be useful here as well, especially for controlling creep/plastic/elastic-related outputs and avoiding unnecessary output/test changes when new named outputs are added. |
|
Hi, @tiannh7 , thanks for looking into my PR! It's great to know that this will be useful to all of us. I agreed to your comments. After looking into your commits, I think the key is to have this block as your commits: This is indeed a better behavior than the current PR. The current PR will just try to output everything under the "named additional outputs" without letting the user select what we want.
|
f473194 to
e66d521
Compare
alarshi
left a comment
There was a problem hiding this comment.
@lhy11009 : Thank you for adding this functionality and investigating and fixing the failing tests!
Sorry for the delay in getting back to you. I added some comments as I was reviewing your PR, but before you address them, it would be good to get someone else's feedback as well.
I misunderstood our initial discussion. I thought you wanted to do something similar to what is done in grain_size material model (see disl_viscosities_out in https://github.com/geodynamics/aspect/blob/main/source/material_model/grain_size.cc), that has both diffusion and dislocation mechanisms so the respective outputs help visualize where the two regimes are dominant.
But, looking at your PR, you want to output pure dislocation and diffusion creep viscosities for all compositions, right? Since visco_plastic material model will output both dislocation and diffusion viscosities even when they are not computed, e.g., diffusion viscosity when the chosen flow law is dislocation creep, you assigned infinite values to diffusion and dislocation viscosity when they are not computed. Hmm, I think your reasoning is correct: if we want the material to deform only following dislocation creep, we can set a very high diffusion creep viscosity. I am not sure how to think about the infinite values for the FK flow law, as the viscosity is computed differently and does not use the Arrhenius equation.
With my limited understanding of the visco_plastic material model, I only suggested some implementation changes and not what the outputs are telling us.
|
|
||
| /** | ||
| * Diffusion viscosities. | ||
| */ |
There was a problem hiding this comment.
Here, it would be helpful to add the details. As I understand, these are the diffusion viscosities that are computed in Rheology::DiffusionCreep::compute_viscosity() function before yielding. The values are only relevant when diffusion creep is present, i.e., viscous flow law is either diffusion or composite.
Or something along these lines.
| /** | ||
| * Dislocation viscosities. | ||
| */ |
| { | ||
| switch (viscous_flow_law) | ||
| { | ||
| case diffusion: |
There was a problem hiding this comment.
Hmm, I see. Does the issue persist after #6973 was merged?
But in either case, I am not sure if having both dislocation and diffusion viscosity outputs for each viscous flow law is the right approach. See my comment above.
| if (const std::shared_ptr<ViscosityAdditionalOutputs<dim>> | ||
| viscosity_out = out.template get_additional_output_object<ViscosityAdditionalOutputs<dim>>()) | ||
| { | ||
| switch (viscous_flow_law) |
There was a problem hiding this comment.
Since you are doing almost the same operation in the each case, you could replace ln 1057-1114 by initializing the viscosities using a default value (std::max in your case) and a flag to decide whether to output diffusion viscosities or/and dislocation viscosities.
Something like
bool compute_dislocation_viscosity = (viscous_flow_law != dislocation && viscous_flow_law != frank_kamenetskii); and
if (compute_dislocation_viscosity)
viscosity_out->dislocation_viscosities[i]
= MaterialUtilities::average_value(
volume_fractions,
isostrain_viscosities.dislocation_viscosities,
viscosity_averaging);
and similarly for the diffusion_viscosities output.
Co-authored-by: Arushi Saxena <saxena.arushi314@gmail.com>
Co-authored-by: Arushi Saxena <saxena.arushi314@gmail.com>
Yes, this is a very helpful summary. Ideally, we should have just the one viscosity (diffusion or dislocation) output if that is what get calculated, but both of them are created in the same class, so I am not sure how to assign value to just one and make the post-processer not output the other one (post-processer would throw error if I don't initialize both of them) |
|
Thanks, @alarshi for the comments. I think this would be very helpful. I would look for a more generic way to just include the ones computed. I would bring up the question in the next user meeting. |
Pull Request Checklist. Please read and check each box with an X. Delete any part not applicable. Ask on the forum if you need help with any step.
Add outputs of diffusion and dislocation viscosity outputs from the "visco plastic" rheology module
For all pull requests:
For new features/models or changes of existing features: