-
Notifications
You must be signed in to change notification settings - Fork 258
CPO-induced anisotropic viscosity cookbook #6615
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
base: main
Are you sure you want to change the base?
Conversation
gassmoeller
left a comment
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.
Very cool to have a cookbook for this feature. Sorry it took a while to get to this. I have left a first batch of comments, I havent yet looked at the code implementation in details, because I left some questions that would be useful to discuss beforehand.
Please in addition to my comments:
- Add a test case in
tests/that runs the added cookbook reasonably fast. You can see how this is done intests/magnetic_stripes.cc/prm. - Add a changelog entry in
doc/modules
Let me know when someone can take another look.
|
|
||
| ## Introduction | ||
|
|
||
| The directional-dependence (anisotropy) in the viscous properties of olivine crystals suggests that the effective viscosity for olivine rocks/aggregates is different when deformations occur in different directions relative to the CPO. This CPO-induced anisotropic viscosity material model computes anisotropic viscosity based on the CPO evolution predicted by D-Rex ({cite}`fraters_billen_2021_cpo`; {cite}`kaminski2004`) and modifies the subsequent deformation. |
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 write out CPO at least once and explain what it means.
|
|
||
| $$\dot \varepsilon_{ij} = \gamma J(\sigma_{ij})^{(n-1)} A_{ij} \sigma_{ij}$$ | ||
|
|
||
| where $\gamma$ is the part of fluidity which is temperature- and grain-size dependent: |
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 explain fluidity
|
|
||
| $$\gamma=\gamma_0 exp \left(\frac{-Q}{RT} \right) /d^m$$ | ||
|
|
||
| $\gamma_0=1.1\times 10^{5}$ is the isotropic fluidity, $Q=530 kJ/mol$ is the activation energy, $R=8.314 m^3 \cdot Pa \cdot K^{−1} \cdot mol^{−1}$ is the gas constant, $d=0.001 m$ is the grain size, and $m=0.73$ is the grain size exponent. These values are taken from {cite:t}`hansen:etal:2016` and {cite:t}`HK04`. $J(\sigma_{ij})$ is the equivalent yield stress, where $\sigma_{ij}$ is the deviatoric (anisotropic) stress computed using the tensorial and scalar component of the anisotropic viscosity: |
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.
is suppose the values of gamma_0 and the other quantities is for some special material (olivine) this should be stated somewhere here. Also mention that these are based on rock experiments.
|
|
||
| $$J(\sigma_{ij})$$ and $A_{ij}$ are computed using Hill coefficients $H, J, K, L, M,$ and $N$ {cite}`hill:1948`, which are obtained from regression analysis of a texture database constructed with olivine textures from laboratory experiments, shear box models, and subduction models (Kiraly et al., in rev.). | ||
|
|
||
| In this material model plugin, strain rate, density, temperature, and other parameters are taken as input to compute the viscosity, which is passed into the Stokes system to compute the stress (Figure 1). As a result, we adapt eq. (1) to be: |
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 you need to reference equations you can do so using the commands explained here: https://aspect-documentation--6615.org.readthedocs.build/en/6615/user/extending/write-a-cookbook/quickref.html#id1. Eq(1) is not numbered, because you didnt use the {math} environment. And the same for the figure. Also check the other equation and figure references in this file.
| In this material model plugin, strain rate, density, temperature, and other parameters are taken as input to compute the viscosity, which is passed into the Stokes system to compute the stress (Figure 1). As a result, we adapt eq. (1) to be: | |
| In this material model plugin, strain rate, density, temperature, and other parameters are taken as input to compute the anisotropic viscosity, which is passed into the Stokes system to compute the stress (Figure 1). As a result, we adapt eq. (1) to be: |
| 0 & 0 & 0 & L & 0 & 0 \\ | ||
| 0 & 0 & 0 & 0 & M & 0 \\ | ||
| 0 & 0 & 0 & 0 & 0 & N | ||
| \end{matrix} \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.
This math environment doesnt properly close, see here: https://aspect-documentation--6615.org.readthedocs.build/en/6615/user/cookbooks/cookbooks/CPO_induced_anisotropic_viscosity/doc/CPO_induced_anisotropic_viscosity.html
You will likely need to use a full multiline math environment, see my comment below.
| ## References: | ||
| - Fraters, M. R. T., & Billen, M. I. (2021). | ||
| On the implementation and usability of crystal preferred orientation evolution in geodynamic modeling. Geochemistry, Geophysics, Geosystems, 22(10), e2021GC009846. | ||
|
|
||
| - Hansen, L. N., Conrad, C. P., Boneh, Y., Skemer, P., Warren, J. M., & Kohlstedt, D. L. (2016). | ||
| Viscous anisotropy of textured olivine aggregates: 2. Micromechanical model. Journal of Geophysical Research: Solid Earth, 121(10), 7137–7160. | ||
|
|
||
| - Hirth, G., & Kohlstedt, D. (2004). | ||
| Rheology of the upper mantle and the mantle wedge: A view from the experimentalists. In J. Eiler (Ed.), Geophysical Monograph Series (Vol. 138, pp. 83–105). American Geophysical Union. | ||
|
|
||
| - Hill, R. (1948). | ||
| A theory of the yielding and plastic flow of anisotropic metals. Proceedings of the Royal Society of London. Series A. Mathematical and Physical Sciences, 193(1033), 281–297. | ||
|
|
||
| - Kaminski, E., Ribe, N. M., & Browaeys, J. T. (2004). | ||
| D-Rex, a program for calculation of seismic anisotropy due to crystal lattice preferred orientation in the convective upper mantle. Geophysical Journal International, 158(2), 744–752. | ||
|
|
||
| - Signorelli, J., Hassani, R., Tommasi, A., & Mameri, L. (2021). | ||
| An effective parameterization of texture-induced viscous anisotropy in orthotropic materials with application for modeling geodynamical flows. Journal of Theoretical, Computational and Applied Mechanics, 6737. |
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 know you copied this from another cookbook, but these references should not be necessary. Make sure all the entries are part of references.bib and if they are correctly cited they will appear in our reference list: https://aspect-documentation--6615.org.readthedocs.build/en/6615/references.html. If you think it is useful that these entries appear here, you can instead add citations of these papers here (instead of manually writing the whole entries that can get out of date compared to the references list).
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 is the cookbook called CPO_induced..., but the plugin is called LPO_...? Please pick one, or explain why this is intentional.
Also regarding the name: Is the 3D part important? Wouldnt CPO_induced_anisotropic_viscosity.cc be a more explanatory file name?
| /*template <int matrix_size> | ||
| void check_eigenvalues_positive(const SymmetricTensor<2,matrix_size> &matrix);*/ |
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 these lines
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 rename this file to anisotropic_stress.cc and the same for the header and class name. Let's avoid arbitrary abbreviations wherever possible, it makes the code easier to read.
| { | ||
|
|
||
| /** | ||
| * Computes the Bingham average of the CPO particle properties. |
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.
Is this comment still correct? How is this plugin different from the one included in the main code? (I mean what is the purpose of the Euler angles, why are they better than what is done in the other plugin?).
Hi Rene, thanks for the feedback! I've addressed the comments above, added a test case in |
gassmoeller
left a comment
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.
Another batch of comments. I am not quite done, but have to stop review for today, I hope I can get back to it tomorrow.
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 also add the statistics file to the test output. This is useful because statistics reports the numbers with higher accuracy than the screen output (more digits).
|
|
||
| ## Introduction | ||
|
|
||
| Individual crystals of the mineral olivine reorganized their orientations into the crystal-preferred orientations (CPO) under deformation. The directional-dependence (anisotropy) in the viscous properties of olivine crystals suggests that the effective viscosity for olivine rocks/aggregates is different when deformations occur in different directions relative to the CPO. This CPO-induced anisotropic viscosity material model computes anisotropic viscosity based on the CPO evolution predicted by D-Rex ({cite}`fraters_billen_2021_cpo`; {cite}`kaminski2004`) and modifies the subsequent deformation. |
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.
| Individual crystals of the mineral olivine reorganized their orientations into the crystal-preferred orientations (CPO) under deformation. The directional-dependence (anisotropy) in the viscous properties of olivine crystals suggests that the effective viscosity for olivine rocks/aggregates is different when deformations occur in different directions relative to the CPO. This CPO-induced anisotropic viscosity material model computes anisotropic viscosity based on the CPO evolution predicted by D-Rex ({cite}`fraters_billen_2021_cpo`; {cite}`kaminski2004`) and modifies the subsequent deformation. | |
| Individual crystals of the mineral olivine reorganize their orientations into the crystal-preferred orientations (CPO) under deformation. The viscous properties of olivine crystals are direction-dependent (anisotropic), which suggests that the effective viscosity for olivine rocks/aggregates is different when deformations occur in different directions relative to the CPO. This cookbook model computes an anisotropic viscosity based on the CPO evolution predicted by D-Rex ({cite}`fraters_billen_2021_cpo`; {cite}`kaminski2004`) and includes this information in the subsequent modeling process. |
| Our constitutive equation for the relationship between the strain rate and stress using the anisotropic viscosity tensor is adapted from {cite:t}`signorelli:etal:2021`: | ||
|
|
||
| ```{math} | ||
| :label: eqn:one |
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 use names specific to the equations, these labels can be referenced from anywhere in the documentation, and one is not self-explanatory when called from another place in the documentation. What about anisotropic_general_stress, and then modify the other labels below accordingly.
|
|
||
| We compute the rotation matrix R on the particles and further convert it to Euler angles for computation and memory efficiency. These properties need to be interpolated from particles to fields to be used in the material model. As a result, the anisotropic viscosity material model requires at least one particle in each cell so that all cells can have the texture parameters (Euler angles and eigenvalues) for constructing the rotation matrix R and compute the Hill coefficients. In the material model, the interpolated Euler angles are converted to the rotation matrix again. We use the same notation R to describe the rotation matrix used in the material model in the following paragraphs. | ||
|
|
||
| The inverse of the A tensor then needs to be rotated to the model reference frame. Since $inv(A)$ is the Kelvin notation of the rank-4 tensor, we apply the Kelvin notation representation of the R rotation matrix, $R_K$, on $inv(A_{ij})$: |
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.
Did you decide on purpose to keep using inv(A) instead of
|
|
||
| $$\sigma_{ij} = \frac{1}{\gamma J(R\prime*\sigma_{ij}* R)^{(n-1)}} * (R_K * inv(A_{ij}) * R_K\prime) * \dot\varepsilon_i$$ | ||
|
|
||
| We save $\frac{1}{\gamma J(R\prime*\sigma_{ij}* R)^{(n-1)}}$ as the material model viscosity output, which we call the scalar viscosity. The tensorial part of anisotropic viscosity, $R_K * inv(A_{ij}) * R_K\prime$ is called the stress-strain director and is stored in the additional outputs. Due to the dependence of the scalar viscosity on stress and the stress is determined by the scalar viscosity from the previous time step, the computation of the scalar viscosity is not stable and its value naturally fluctuates up and down. This fluctuation ultimately causes a numerical instability associated with the prediction of the anisotropic viscosity. Therefore, we damp the scalar viscosity using a non-linear Newtonian iteration, and in each iteration, only half of the change in the scalar viscosity is applied until the result is stable. |
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 think you have not addressed my earlier comment: https://github.com/geodynamics/aspect/pull/6615/files#r2236059538, and you still do not explain what the prime in
| MaterialModel::MaterialModelOutputs<3> &out) const | ||
| { | ||
| const int dim=3; | ||
| const double sqrt2 = sqrt(2); |
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.
no need for this line, you can use numbers:SQRT2 instead (it is declared in #include <deal.II/base/numbers.h>.
|
|
||
|
|
||
|
|
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.
lets use 1 empty line for separating code inside functions. Also see here, for more coding conventions: https://dealii.org/developer/doxygen/deal.II/CodingConventions.html
|
|
||
| for (unsigned int q=0; q<in.n_evaluation_points(); ++q) | ||
| { | ||
| //change these according to diffusion dislocation material model I guess |
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.
| //change these according to diffusion dislocation material model I guess | |
| // Change these according to diffusion dislocation material model I guess |
| out.entropy_derivative_pressure[q] = eos_outputs.entropy_derivative_pressure[0]; | ||
| out.entropy_derivative_temperature[q] = eos_outputs.entropy_derivative_temperature[0]; | ||
|
|
||
| //Calculate effective viscosity |
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.
| //Calculate effective viscosity | |
| // Calculate effective viscosity |
| stress = 2*scalar_viscosity * V_r4 * deviatoric_strain_rate / 1e6; // Use stress in MPa //Added *2 2025.06.18. | ||
|
|
||
| while (std::abs(residual) > threshold && n_iterations < max_iteration) | ||
| { | ||
| stress = (1./2.) * (stress + 2*scalar_viscosity * V_r4 * deviatoric_strain_rate / 1e6); //Added *2 2025.06.18. |
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 the comments. Presumably you tested that the *2 is the correct thing to do? Then the comment is not really helpful.
Hi Rene, I've went through your comments. Looking forward for the next batch! |
gassmoeller
left a comment
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.
Next batch of comments, mostly on the .prm file and on the anisotropic viscosity assemblers. I will try to get to the heating plugin and the rest of the .cc file next, then you can simplify this PR further.
| @@ -0,0 +1,133 @@ | |||
| (sec:cookbooks:CPO_induced_anisotropic_viscosity)= | |||
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 just introduced a new system to mark the features used in cookbooks and benchmarks in #6713, could you add tags here as well? I think the following should be appropriate:
```{tags}
category:cookbook
feature:3d
feature:cartesian
feature:modular-equations
feature:compositional-fields
feature:particles
Sorry for the extra effort.
| "in the compressible case. If elasticity is used, the " | ||
| "elastic contribution is being accounted for. The shear " | ||
| "stress differs from the full stress tensor " | ||
| "by the absence of the pressure. Note that the convention " | ||
| "of positive compressive stress is followed. ") |
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 part needs an update. Instead of elasticity you know consider anisotropic viscosity. Also mention that this postprocessor only works with the specific material model of this cookbook.
| "A visualization output object that generates output " | ||
| "for the 6 (in 3d) components of the shear stress " | ||
| "tensor, i.e., for the components of the tensor " | ||
| "$-2\\eta\\varepsilon(\\mathbf u)$ " | ||
| "in the incompressible case and " | ||
| "$-2\\eta\\left[\\varepsilon(\\mathbf u)-" | ||
| "\\tfrac 13(\\textrm{tr}\\;\\varepsilon(\\mathbf u))\\mathbf I\\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.
Please update this to be consistent with the explanation you give in anisotropic_stress.h:38-47.
| * \frac 13 (\nabla \cdot \mathbf u) \mathbf I)$ * stress_strain_directors, and differs from the | ||
| * full stress by the absence of the pressure. The second term in the | ||
| * difference is zero if the model is incompressible. | ||
| * If elasticity is used, the elastic contribution is being accounted for. |
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.
Is this true? Where is elasticity accounted for?
| void initialize() override; | ||
| void evaluate (const MaterialModel::MaterialModelInputs<dim> &in, | ||
| MaterialModel::MaterialModelOutputs<dim> &out) const override; | ||
| static void declare_parameters (ParameterHandler &prm); | ||
| void parse_parameters (ParameterHandler &prm) override; | ||
| bool is_compressible () const override; | ||
| void create_additional_named_outputs(MaterialModel::MaterialModelOutputs<dim> &out) const 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.
Please add an empty line between each function declaration. Since they are all default functions of the material model, you dont necessarily need documentation here, but empty lines make it easier to read. Also put them in the same order as in the Simple material model, except initialize at the beginning (we are not consistent about the position of create_additional_named_outputs, put it after initialize or after parse_parameters.
Then sort the functions in the .cc file in the same order. This doesnt matter for functionality, but matters a lot for simplifying the maintenance of ASPECT over time.
| set Mobility = 10 ## Annotation CPO Mobility | ||
| set Stress exponents = 3.5 | ||
| set Exponents p = 1.5 | ||
| set Threshold GBS = 0.3 ## Annotation TGBS |
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.
| set Threshold GBS = 0.3 ## Annotation TGBS | |
| set Threshold GBS = 0.3 |
| set Threshold GBS = 0.3 ## Annotation TGBS | ||
| end | ||
| end | ||
| subsection CPO Bingham Average |
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.
| subsection CPO Bingham Average | |
| subsection CPO Bingham Average |
| end | ||
|
|
||
| subsection Solver parameters | ||
| set Temperature solver tolerance = 1e-10 |
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.
Is the temperature solver tolerance change necessary? It is a setting that is rather specific. If so, document why you changed it.
| # subsection Checkpointing | ||
| # set Steps between checkpoint = 50 | ||
| # end |
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
| { | ||
| using namespace dealii; | ||
|
|
||
| /** |
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.
When #6728 is merged you can delete lines 83 - 330 and instead include the header aspect/simulator/assemblers/stokes_anisotropic_viscosity.h. That should simplify your plugin.
…lder and locations for particle data in prm file
…lder and locations for particle data in prm file
a434d2a to
eb17df8
Compare
gassmoeller
left a comment
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.
A few more simplifications that are possible now that #6728 is merged.
And you need to indent and fix your tests. Let me know when you want me to take another look.
The test complains about ProcessGrid, are you missing a header (https://github.com/geodynamics/aspect/actions/runs/19302883915/job/55202043862?pr=6615#step:6:536)? Or is our tester not configured with Scalapack?
| namespace HeatingModel | ||
| { | ||
| template <int dim> | ||
| class ShearHeatingAnisotropicViscosity : public Interface<dim>, public ::aspect::SimulatorAccess<dim> | ||
| { | ||
| public: | ||
| /** | ||
| * Compute the heating model outputs for this class. | ||
| */ | ||
| void | ||
| evaluate (const MaterialModel::MaterialModelInputs<dim> &material_model_inputs, | ||
| const MaterialModel::MaterialModelOutputs<dim> &material_model_outputs, | ||
| HeatingModel::HeatingModelOutputs &heating_model_outputs) const override; | ||
|
|
||
| /** | ||
| * Allow the heating model to attach additional material model outputs. | ||
| */ | ||
| void | ||
| create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &material_model_outputs) const 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.
With the changes in #6728 you can now also delete this part. The shear heating plugin for anisotropic viscosity is now a normal heating plugin that you can activate in the Heating model subsection using set List of model names = anisotropic shear heating.
So in essence I dont think this header file is still necessary at all.
| */ | ||
|
|
||
| #include "cpo_induced_anisotropic_viscosity.h" | ||
| #include "../../cookbooks/anisotropic_viscosity/av_material.h" |
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 shouldnt be necessary any more
| namespace HeatingModel | ||
| { | ||
| template <int dim> | ||
| void | ||
| ShearHeatingAnisotropicViscosity<dim>:: | ||
| evaluate (const MaterialModel::MaterialModelInputs<dim> &material_model_inputs, | ||
| const MaterialModel::MaterialModelOutputs<dim> &material_model_outputs, | ||
| HeatingModel::HeatingModelOutputs &heating_model_outputs) const | ||
| { | ||
| Assert(heating_model_outputs.heating_source_terms.size() == material_model_inputs.position.size(), | ||
| ExcMessage ("Heating outputs need to have the same number of entries as the material model inputs.")); | ||
|
|
||
| // Some material models provide dislocation viscosities and boundary area work fractions | ||
| // as additional material outputs. If they are attached, use them. | ||
| const std::shared_ptr<const ShearHeatingOutputs<dim>> shear_heating_out | ||
| = material_model_outputs.template get_additional_output_object<ShearHeatingOutputs<dim>>(); | ||
|
|
||
| const std::shared_ptr<const MaterialModel::AnisotropicViscosity<dim>> anisotropic_viscosity | ||
| = material_model_outputs.template get_additional_output_object<MaterialModel::AnisotropicViscosity<dim>>(); | ||
|
|
||
| for (unsigned int q=0; q<heating_model_outputs.heating_source_terms.size(); ++q) | ||
| { | ||
| // If there is an anisotropic viscosity, use it to compute the correct stress | ||
| const SymmetricTensor<2,dim> &directed_strain_rate = ((anisotropic_viscosity != nullptr) | ||
| ? | ||
| anisotropic_viscosity->stress_strain_directors[q] | ||
| * material_model_inputs.strain_rate[q] | ||
| : | ||
| material_model_inputs.strain_rate[q]); | ||
|
|
||
| const SymmetricTensor<2,dim> stress = | ||
| 2 * material_model_outputs.viscosities[q] * | ||
| (this->get_material_model().is_compressible() | ||
| ? | ||
| directed_strain_rate - 1./3. * trace(directed_strain_rate) * unit_symmetric_tensor<dim>() | ||
| : | ||
| directed_strain_rate); | ||
|
|
||
| const SymmetricTensor<2,dim> deviatoric_strain_rate = | ||
| (this->get_material_model().is_compressible() | ||
| ? | ||
| material_model_inputs.strain_rate[q] | ||
| - 1./3. * trace(material_model_inputs.strain_rate[q]) * unit_symmetric_tensor<dim>() | ||
| : | ||
| material_model_inputs.strain_rate[q]); | ||
|
|
||
| heating_model_outputs.heating_source_terms[q] = stress * deviatoric_strain_rate; | ||
|
|
||
| // If shear heating work fractions are provided, reduce the | ||
| // overall heating by this amount (which is assumed to be converted into other forms of energy) | ||
| if (shear_heating_out != nullptr) | ||
| heating_model_outputs.heating_source_terms[q] *= shear_heating_out->shear_heating_work_fractions[q]; | ||
|
|
||
| heating_model_outputs.lhs_latent_heat_terms[q] = 0.0; | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| template <int dim> | ||
| void | ||
| ShearHeatingAnisotropicViscosity<dim>:: | ||
| create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &material_model_outputs) const | ||
| { | ||
| const unsigned int n_points = material_model_outputs.viscosities.size(); | ||
|
|
||
| if (material_model_outputs.template has_additional_output_object<MaterialModel::AnisotropicViscosity<dim>>() == false) | ||
| { | ||
| material_model_outputs.additional_outputs.push_back( | ||
| std::make_unique<MaterialModel::AnisotropicViscosity<dim>> (n_points)); | ||
| } | ||
|
|
||
| this->get_material_model().create_additional_named_outputs(material_model_outputs); | ||
| } | ||
| } | ||
|
|
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 whole namespace heating model can be deleted now as it is now part of the base ASPECT.
| namespace HeatingModel | ||
| { | ||
| ASPECT_REGISTER_HEATING_MODEL(ShearHeatingAnisotropicViscosity, | ||
| "anisotropic shear heating for cpo_induced_anisotropic_viscosity", | ||
| "Implementation of a standard model for shear heating. " | ||
| "Adds the term: " | ||
| "$ 2 \\eta \\left( \\varepsilon - \\frac{1}{3} \\text{tr} " | ||
| "\\varepsilon \\mathbf 1 \\right) : \\left( \\varepsilon - \\frac{1}{3} " | ||
| "\\text{tr} \\varepsilon \\mathbf 1 \\right)$ to the " | ||
| "right-hand side of the temperature equation.") | ||
| } |
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.
delete this too
| namespace Assemblers | ||
| { | ||
| #define INSTANTIATE(dim) \ | ||
| template class StokesPreconditionerAnisotropicViscosity<dim>; \ | ||
| template class StokesIncompressibleTermsAnisotropicViscosity<dim>; \ | ||
|
|
||
| ASPECT_INSTANTIATE(INSTANTIATE) | ||
| } |
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.
everything here can be deleted as well.
This PR adds a cookbook demonstrating the use of CPO-induced anisotropic viscosity (AV), developed by me and @KiralyAgi. It includes:
Let me know if any changes are needed!