Changing to use viscous viscosity for tidal heating rate calculation when using Visco Plastic material model - #7168
Conversation
|
You have some merge conflicts. Can you resolve those? |
882ba7c to
24771d3
Compare
|
@bangerth Yes I have check the conflicts and resolved them! There was a recent merge on visco_plastic.cc while I was working on few days older version than that. |
gassmoeller
left a comment
There was a problem hiding this comment.
I think this PR needs some structural changes. I am ok with the feature you are aiming for, but the current PR does not follow our usual separation of concerns, and I dont think it is working as you intended. Take a look at my comments and implement them as far as you get. Then find one of us to talk about it.
| /** | ||
| * Returns true if the tidal heating plugin is found in the | ||
| * list of active heating models. | ||
| */ | ||
| bool | ||
| tidal_heating_enabled() const; |
There was a problem hiding this comment.
please dont introduce this function, the other functions of this type should be deprecated and not used any longer. I will point out below how to do this differently.
| * outputs. | ||
| */ | ||
| std::unique_ptr<HeatingModel::TidalHeating<dim>> tidal_heating; | ||
|
|
There was a problem hiding this comment.
This is most likely not what you want. You want to get access to the existing heating model plugin, not create your own copy of a heating model inside the material model. I will point out below how you get access without creating a copy.
| template <int dim> | ||
| bool | ||
| Manager<dim>::tidal_heating_enabled() const | ||
| { | ||
| return this->template has_matching_active_plugin<HeatingModel::TidalHeating<dim>>() ; | ||
| } |
There was a problem hiding this comment.
Oh, so you know already how to do this. No need to create this function then. Just call this->get_heating_model_manager().template has_matching_active_plugin<HeatingModel::TidalHeating<dim>>() in the place where you call this function at the moment.
| double viscous_viscosities = material_model_outputs.viscosities[q]; | ||
|
|
||
| if (this->get_parameters().enable_elasticity) | ||
| { | ||
| const std::shared_ptr<const HeatingModel::ViscousAdditionalOutputs<dim>> viscous_out = | ||
| material_model_outputs.template get_additional_output_object<HeatingModel::ViscousAdditionalOutputs<dim>>(); | ||
| if (viscous_out != nullptr) | ||
| { | ||
| viscous_viscosities = viscous_out->viscous_viscosity[q]; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| heating_model_outputs.heating_source_terms[q] = 2. * viscous_viscosities * local_tidal_strain_rate * local_tidal_strain_rate | ||
| / ( 1. + ( (tidal_frequency * viscous_viscosities) / elastic_shear_modulus ) * ( (tidal_frequency * viscous_viscosities) / elastic_shear_modulus ) ); |
There was a problem hiding this comment.
viscous_viscosity always sounds silly to me. And I think instead you could write
// determine the viscosity, if elasticity is enabled, only consider viscous deformation
double viscosity = material_model_outputs.viscosities[q];
if (...)
...
viscosity = ....
| } | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
did you delete this line on purpose? please reintroduce it
|
|
||
|
|
||
| // Step 1e: multiply the viscosity by a constant (default value is 1) | ||
| // Step 1f: multiply the viscosity by a constant (default value is 1) |
There was a problem hiding this comment.
this is a correct fix, but it is unrelated to this PR. Please open a separate PR for it (it will be quick to merge).
| // Fill the additional viscous outputs that will be used for tidal heating. | ||
| if (in.requests_property(MaterialProperties::additional_outputs) && this->get_parameters().enable_elasticity) | ||
| tidal_heating->fill_additional_viscous_outputs(i, volume_fractions, out, isostrain_viscosities, rheology->viscosity_averaging); | ||
|
|
There was a problem hiding this comment.
but at the moment you do not know if tidal heating is actually used in this model. This compiles at the moment because you always create a copy of tidal heating inside visco plastic, but this is not the correct approach. What you really want to do conceptually is:
if (in.requests_property(MaterialProperties::additional_outputs) && viscous_outputs exist)
.. fill additional viscous outputs
The conditional statement would look like this:
if (in.requests_property(MaterialProperties::additional_outputs) && out.template has_additional_output_object<MaterialModel::ViscousAdditionalOutputs<dim>>())
{
fill_additional_viscous_outputs(i, volume_fractions, out, isostrain_viscosities, rheology->viscosity_averaging);
}
And the fill additional viscous outputs function should live inside this class (it is a feature that this class offers, it is not a feature of tidal heating to know how to compute viscous viscosity).
There is nothing that makes viscous outputs specific to the tidal heating model, it just happens to be the single plugin that needs this output at the moment. But that may change in the future (and then we do not want to depend on tidal heating if it is not even active in that model). So move everything possible into this class.
| TidalHeating<dim>::create_additional_material_model_outputs (MaterialModel::MaterialModelOutputs<dim> &out) const | ||
| { | ||
| if (out.template has_additional_output_object<ViscousAdditionalOutputs<dim>>() == false) | ||
| { | ||
| const unsigned int n_points = out.n_evaluation_points(); | ||
| out.additional_outputs.push_back( | ||
| std::make_unique<ViscousAdditionalOutputs<dim>> (n_points)); | ||
| } | ||
| } |
There was a problem hiding this comment.
This is the only function of the ones below that should stay in this file and class.
| template <int dim> | ||
| ViscousAdditionalOutputs<dim>::ViscousAdditionalOutputs(const unsigned int n_points) | ||
| : MaterialModel::NamedAdditionalMaterialOutputs<dim>({"viscous_viscosity"}), | ||
| viscous_viscosity(n_points, std::numeric_limits<double>::max()) | ||
| {} | ||
|
|
||
| template <int dim> | ||
| std::vector<double> | ||
| ViscousAdditionalOutputs<dim>::get_nth_output(const unsigned int idx) const | ||
| { | ||
| (void) idx; | ||
| AssertIndexRange (idx, 1); | ||
|
|
||
| return viscous_viscosity; | ||
| } | ||
|
|
||
| template <int dim> | ||
| void | ||
| TidalHeating<dim>::fill_additional_viscous_outputs (const unsigned int i, | ||
| const std::vector<double> &volume_fractions, | ||
| MaterialModel::MaterialModelOutputs<dim> &out, | ||
| const MaterialModel::IsostrainViscosities &isostrain_viscosities, | ||
| const MaterialModel::MaterialUtilities::CompositionalAveragingOperation &average_type) const | ||
| { | ||
| const std::shared_ptr<ViscousAdditionalOutputs<dim>> viscous_out = | ||
| out.template get_additional_output_object<ViscousAdditionalOutputs<dim>>(); | ||
| if (viscous_out != nullptr) | ||
| { | ||
| viscous_out->viscous_viscosity[i] = | ||
| MaterialModel::MaterialUtilities::average_value(volume_fractions, | ||
| isostrain_viscosities.composition_viscous_viscosities, | ||
| average_type); | ||
| } | ||
| } |
There was a problem hiding this comment.
All of this should move over to visco_plastic.
| output_parameters.composition_yielding.resize(volume_fractions.size(), false); | ||
| output_parameters.composition_viscosities.resize(volume_fractions.size(), numbers::signaling_nan<double>()); | ||
| output_parameters.composition_viscous_viscosities.resize(volume_fractions.size(), numbers::signaling_nan<double>()); | ||
| 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>()); |
There was a problem hiding this comment.
we need to find a way to avoid accumulating more and more vectors in this structure. I commented on that in #7133. Whatever the solution to that PR will also need to be applied here.
da51363 to
6dae6e2
Compare
|
Hi @gassmoeller , |
6dae6e2 to
dcf44dd
Compare
dcf44dd to
5f36abf
Compare
5f36abf to
fe86f15
Compare
|
Hi @gassmoeller , |
fe86f15 to
4390fd1
Compare
gassmoeller
left a comment
There was a problem hiding this comment.
Yes, the direction of this PR is correct. I have some comments on file names, and I still have not thought of a good solution for the IsostrainViscosities structure, but I need to think about that when I am more awake. Please for now implement my suggestions, they should get you to a working state, which is mostly complete.
There was a problem hiding this comment.
keep the name of the file consistent with the name of the class, not the purpose you are using it for. This class can be used by other users for other purposes.
I would suggest renaming to viscosity_without_elasticity
| #ifndef _aspect_material_model_additional_outputs_viscosity_for_tidal_heating_h | ||
| #define _aspect_material_model_additional_outputs_viscosity_for_tidal_heating_h |
There was a problem hiding this comment.
viscosity_without_elasticity in both lines
| #ifndef _aspect_material_model_additional_outputs_viscosity_for_tidal_heating_h | ||
| #define _aspect_material_model_additional_outputs_viscosity_for_tidal_heating_h | ||
|
|
||
| #include <aspect/simulator_access.h> |
There was a problem hiding this comment.
do you need simulator_access?
|
|
||
| #include <aspect/simulator_access.h> | ||
| #include <aspect/material_model/interface.h> | ||
| #include <aspect/material_model/visco_plastic.h> |
There was a problem hiding this comment.
you definitely do not need visco_plastic here
| #include <aspect/heating_model/tidal_heating.h> | ||
|
|
||
| #include <aspect/material_model/additional_outputs/viscosity_for_tidal_heating.h> | ||
| #include <aspect/material_model/visco_plastic.h> |
There was a problem hiding this comment.
i dont think you need the visco_plastic header here
| * viscosity = material_model_outputs.viscosities when elasticity is not enabled. If enabled, material_model_outputs.viscosities_without_elasticity. | ||
| * Because tidal heating equation is already a form of viscoelastic shear heating while orbiting, |
There was a problem hiding this comment.
Please rewrite this so that it explains viscosity. I.e. something like
viscosity should only contain the viscous part of the deformation rate, i.e. not plastic or elastic contributions to the effective viscosity. This is because tidal heating is a form of viscous dissipation that only occurs due to viscous deformation. (or something similar, maybe I misunderstood the justification)
There was a problem hiding this comment.
same as above, rename the file to align with the class name
|
|
||
| template <int dim> | ||
| void | ||
| ViscoPlastic<dim>::fill_viscosity_for_tidal_heating_outputs (const unsigned int i, |
There was a problem hiding this comment.
this function should be called fill_viscosity_without_elasticity_outputs.
| Changed: Now tidal heating module only uses viscous viscosity regardless of enabling elasticity in material model Visco Plastic. | ||
| Because the tidal heating rate equation is already a form of viscoelastic shear heating while orbiting, | ||
| inserting viscoelastic viscosity again to the shear heating equation is incorrect. |
There was a problem hiding this comment.
| Changed: Now tidal heating module only uses viscous viscosity regardless of enabling elasticity in material model Visco Plastic. | |
| Because the tidal heating rate equation is already a form of viscoelastic shear heating while orbiting, | |
| inserting viscoelastic viscosity again to the shear heating equation is incorrect. | |
| Changed: Now the tidal heating module only uses the viscosity without elastic contributions from the material model visco plastic. |
e5b0834 to
87e3814
Compare
Hiya, I create a PR to change viscosity used to calculate tidal heating rate in visco_plastic.cc.

$\eta$ is viscosity, $\bar{\dot{\epsilon}^2}$ is the time-averaged square of tidal strain rate, $\omega$ is tidal frequency, and $\mu_E$ is the elastic shear modulus.
The heating rate equation follows eq 12 of Tobie et al. (2003) (https://doi.org/10.1029/2003JE002099).
where
Currently, ASPECT uses output viscosity. It means, when elasticity is enabled, effective elasticity is used. However, tidal heating rate equation is already a simplified viscoelastic shear heating equation and it is aimed for the period of orbiting. It means the process of making VE viscosity is used twice; one time for making VE viscosity of convective time scale and the other time for making VE viscosity of orbiting time scale. Also, it is likely that elastic stress that is accumulated over convective time scale does not affect day-scale deformation of tidal heating. Therefore, using effective viscosity for the tidal heating rate calculation only implies lowered viscosity causing undesirable larger tidal heating.
@Geoniette and I had a discussion and decided to change the viscosity used for tidal heating as viscous viscosity.
In visco_plastic.cc of rheology, I made composition_viscous_viscosities that saves non_yielding_viscosity right before viscoelasticity is included to non_yielding_viscosity and that is truncated by maximum and minimum viscosity settings. Then, composition_viscous_viscosities is saved to additional output which will be used for tidal heating calculation in visco_plastic.cc of material_model. I put if-statement to use this viscous_viscosities when elasticity is enabled in tidal_heating.cc.
The changes follow as the figure below. The result is a simple setting of ice with linear temperature increase by depth at time=0. First row shows the tidal heating rate, and second row shows the viscosity. Two left columns show the viscosities and heating rates based on current implementation under viscoelasticity and viscosity. Two right columns shows the heating rate and viscosity based on new implementation under viscoelasticity with two different elastic shear modulus. Comparing first and second columns, you can see that tidal heating rate is larger when elasticity is included as mentioned. Third column is the new implementation of same viscoelasticity setting with the first column and shows same tidal heating rate with second column of viscous deformation setting. Third and fourth columns show tidal heating rate under different elastic shear modulus (1e9 and 1e7 Pa). These show that tidal heating rate is dependent on viscous viscosity, regardless of elasticity setting!
Cheers,
Hyunseong