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 NamedAdditionalOutput for strain weakened plastic parameters #1763
Add NamedAdditionalOutput for strain weakened plastic parameters #1763
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.
Only a few comments. Have you checked that the tests give reasonable output? Also please add an entry to the changelog so that people are aware of the new output.
source/material_model/interface.cc
Outdated
{ | ||
std::vector<std::string> names; | ||
names.push_back("weakened_cohesions"); | ||
names.push_back("weakened_friction_angles"); |
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 am not quite happy with the term weakened
, what if people implement a healing algorithm that might make the values higher than the initial values? Would you be ok with current_...
?
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 with @gassmoeller here. While the original intent was only to do strain weakening, it would be good to leave the door open for implementing strain hardening and not having to rename these terms. Another term that could be used is modified...
.
source/material_model/interface.cc
Outdated
: | ||
NamedAdditionalMaterialOutputs<dim>(make_plastic_additional_outputs_names()), | ||
cohesions(n_points, -1.0), | ||
friction_angles(n_points, -1.0) |
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.
Please replace the -1 by numbers::signaling_nan<double>()
in both lines. -1 was a leftover from early days in the seismic velocities, and we would like to get rid of it.
source/material_model/interface.cc
Outdated
@@ -747,6 +747,46 @@ namespace aspect | |||
return vs; | |||
} | |||
|
|||
namespace |
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.
Which material models will use this property? I am asking, because I would prefer this to be moved in some place other than the interface (it is only relevant for plastic material models). If there is only one (or several, but they are all derived from one base model), then please move all this code into the header and source file of that class (see e.g. the handling of MeltOutputs
in melt.h and melt.cc).
const double strain_fraction = ( cut_off_strain_ii - start_strain_weakening_intervals[j] ) / | ||
( start_strain_weakening_intervals[j] - end_strain_weakening_intervals[j] ); | ||
const double weakened_coh = cohesions[j] + ( cohesions[j] - cohesions[j] * cohesion_strain_weakening_factors[j] ) * strain_fraction; | ||
const double weakened_phi = angles_internal_friction[j] + ( angles_internal_friction[j] - angles_internal_friction[j] * friction_strain_weakening_factors[j] ) * strain_fraction; |
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.
Same here, I would prefer current
over weakened
@@ -353,6 +365,7 @@ namespace aspect | |||
// of compositional field viscosities is consistent with any averaging scheme. | |||
out.viscosities[i] = average_value(composition, composition_viscosities, viscosity_averaging); | |||
|
|||
|
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.
remove this empty line
/run-tests |
@anne-glerum - nice, thank you for adding this in! This does not interfere with any plans I had for visco_plastic. Honestly, I think it easier to just make a new material model that is both significantly restructured to accommodate all the features we have discussed (viscoelasticity, new brittle and viscous deformation mechanisms, brittle vs total strain, etc). |
I agree. |
I've moved the code in interface to the visco_plastic header and source files. There could be another plastic model for which this output is interesting however, namely the dynamic_friction model, @alarshi? |
Also, the output of the tests looks good: the cohesion and friction is weakened by the specified initial strain by the right amount in the right area. I'll run a 'real' model over time today to be sure. |
@anne-glerum: Cool! I will try this after merge. Thank you! |
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.
Two tiny things I missed yesterday, otherwise good to go.
source/material_model/interface.cc
Outdated
@@ -747,6 +747,7 @@ namespace aspect | |||
return vs; | |||
} | |||
|
|||
|
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.
Please remove this line
evaluate(const MaterialModel::MaterialModelInputs<dim> &in, | ||
MaterialModel::MaterialModelOutputs<dim> &out) const | ||
calculate_weakening(const double &strain_ii, | ||
const unsigned int &j) const |
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.
hand over the doubles by-value (i.e. remove the &), for simple data types like double this is equally fast (or even faster), and the chance is lower that you accidentally change them inside of the function.
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.
same for the unsigned int of course
If the |
I do not feel very strongly about it. Usually we try to only put stuff in the interface class that is of importance for all (or a very significant fraction of all) material models. The fact that |
I do not feel strongly on this point either, but one reason to keep these functions within |
e5d847e
to
6a2fae1
Compare
Alright, then I think it's done :) Just checked it on a rift model and calculating the current values in paraview gives the same results. |
6a2fae1
to
a6f7556
Compare
Create weakening function Move PlasticAdditionalOuput to interface Implement weakening function Also use new function in viscosity calculation Correct averaging and unweakened values Add new output to test Reformulate after rebase on master Add new output to weakening tests Add function description
a6f7556
to
960880d
Compare
Looks good. |
A visualization output that shows the cohesion and friction angle as weakened by the current value of the tracked strain.
@naliboff any comments? I hope this way it doesn't interfere with your plans to separate the viscosity calculation out into several functions too much.