Skip to content
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

Fix stress #3897

Merged
merged 7 commits into from Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/modules/changes/20201119_glerum
@@ -0,0 +1,6 @@
Fixed: The visualization postprocessors that output stresses now use the
correct sign for the shear stress term (under the convention of positive
compressive stress), i.e. -2*eta*strain_rate+pressure*I instead of
2*eta*strain_rate+pressure*I.
<br>
(Anne Glerum, Sungho Lee, 2020/11/19)
10 changes: 6 additions & 4 deletions source/postprocess/visualization/shear_stress.cc
Expand Up @@ -73,7 +73,8 @@ namespace aspect

const double eta = out.viscosities[q];

const SymmetricTensor<2,dim> shear_stress = 2*eta*compressible_strain_rate;
// Compressive stress is positive in geoscience applications
const SymmetricTensor<2,dim> shear_stress = -2.*eta*compressible_strain_rate;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "compressible_strain_rate" variable is actually the incompressible part of the strain rate. Ditto for the other two files. Suggest changing the name to incompressible_strain_rate?

This is my only quibble :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for having a look. It depends on what the material model returns for (this->get_material_model().is_compressible() whether the strain rate in compressible_strain_rate is in fact compressible or the incompressible part. So the name is not always correct. But that's not really related to this PR, so I'll leave that for now, OK?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the relevant code above is:

= (this->get_material_model().is_compressible()
?
strain_rate - 1./3 * trace(strain_rate) * unit_symmetric_tensor()
:
strain_rate);

Even if the material is compressible, the pressure is removed (-1/3 * trace(strain_rate)) and thus you have the deviatoric strain rate. If an incompressible formulation is used, then should the strain rate by default be deviatoric?

If the above is correct, would deviatoric_strain_rate be the most accurate name?

No preference on whether this is resolved now or in a follow-up PR, but will leave that up to @bobmyhill.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naliboff Yes, that's what I was trying to say. Thanks for clarifying!
I'm fine for the rename to be a separate PR.


for (unsigned int d=0; d<dim; ++d)
for (unsigned int e=0; e<dim; ++e)
Expand Down Expand Up @@ -103,13 +104,14 @@ namespace aspect
"A visualization output object that generates output "
"for the 3 (in 2d) or 6 (in 3d) components of the shear stress "
"tensor, i.e., for the components of the tensor "
"$2\\eta\\varepsilon(\\mathbf u)$ "
"$-2\\eta\\varepsilon(\\mathbf u)$ "
"in the incompressible case and "
"$2\\eta\\left[\\varepsilon(\\mathbf u)-"
"$-2\\eta\\left[\\varepsilon(\\mathbf u)-"
"\\tfrac 13(\\textrm{tr}\\;\\varepsilon(\\mathbf u))\\mathbf I\\right]$ "
"in the compressible case. The shear "
"stress differs from the full stress tensor "
"by the absence of the pressure.")
"by the absence of the pressure. Note that the convention "
"of positive compressive stress is followed. ")
}
}
}
10 changes: 6 additions & 4 deletions source/postprocess/visualization/stress.cc
Expand Up @@ -73,7 +73,8 @@ namespace aspect

const double eta = out.viscosities[q];

const SymmetricTensor<2,dim> stress = 2*eta*compressible_strain_rate +
// Compressive stress is positive in geoscience applications
const SymmetricTensor<2,dim> stress = -2.*eta*compressible_strain_rate +
in.pressure[q] * unit_symmetric_tensor<dim>();
for (unsigned int d=0; d<dim; ++d)
for (unsigned int e=0; e<dim; ++e)
Expand Down Expand Up @@ -103,11 +104,12 @@ namespace aspect
"A visualization output object that generates output "
"for the 3 (in 2d) or 6 (in 3d) components of the stress "
"tensor, i.e., for the components of the tensor "
"$2\\eta\\varepsilon(\\mathbf u)+pI$ "
"$-2\\eta\\varepsilon(\\mathbf u)+pI$ "
"in the incompressible case and "
"$2\\eta\\left[\\varepsilon(\\mathbf u)-"
"$-2\\eta\\left[\\varepsilon(\\mathbf u)-"
"\\tfrac 13(\\textrm{tr}\\;\\varepsilon(\\mathbf u))\\mathbf I\\right]+pI$ "
"in the compressible case.")
"in the compressible case. Note that the convention of positive "
"compressive stress is followed. ")
}
}
}
10 changes: 6 additions & 4 deletions source/postprocess/visualization/surface_stress.cc
Expand Up @@ -63,7 +63,8 @@ namespace aspect

const double eta = out.viscosities[q];

const SymmetricTensor<2,dim> stress = 2*eta*compressible_strain_rate +
// Compressive stress is positive in geoscience applications
const SymmetricTensor<2,dim> stress = -2.*eta*compressible_strain_rate +
in.pressure[q] * unit_symmetric_tensor<dim>();
for (unsigned int i=0; i<SymmetricTensor<2,dim>::n_independent_components; ++i)
computed_quantities[q](i) = stress[stress.unrolled_to_component_indices(i)];
Expand Down Expand Up @@ -144,11 +145,12 @@ namespace aspect
"on the surface of the domain "
"for the 3 (in 2d) or 6 (in 3d) components of the stress "
"tensor, i.e., for the components of the tensor "
"$2\\eta\\varepsilon(\\mathbf u)+pI$ "
"$-2\\eta\\varepsilon(\\mathbf u)+pI$ "
"in the incompressible case and "
"$2\\eta\\left[\\varepsilon(\\mathbf u)-"
"$-2\\eta\\left[\\varepsilon(\\mathbf u)-"
"\\tfrac 13(\\textrm{tr}\\;\\varepsilon(\\mathbf u))\\mathbf I\\right]+pI$ "
"in the compressible case.")
"in the compressible case. Note that the convention of positive "
"compressive stress is followed. ")
}
}
}