-
Notifications
You must be signed in to change notification settings - Fork 258
Make deviator() and second_invariant() consistent with plane strain assumption in 2D #6471
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?
Changes from 6 commits
79e2084
f6a9696
c64e01b
24a2169
69857a4
ff0c142
0af008e
5001113
fc3c34d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Changed: The deviator and second invariant of symmetric tensors are modified to | ||
| be consistent with the plane strain assumption in 2D. It changes the outputs of | ||
| compressible material models that are dependent on the deviatoric strain rate. | ||
|
||
| <br> | ||
| (Yimin Jin, 2025/06/17) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1379,6 +1379,38 @@ namespace aspect | |
| // Declare the existence of a specialization: | ||
| template <> | ||
| const Tensor<3,3> &levi_civita<3>(); | ||
|
|
||
| /** | ||
| * Compute the deviator of a symmetric tensor. This function is equivalent to | ||
| * dealii::deviator in 3D, while in 2D it is consistent with the plane strain assumption. | ||
| * Specifically, the deviator of the stress tensor $\mathbf\tau$ in 2D is given by | ||
| * $\text{dev}(\mathbf\tau) = \mathbf\tau - \frac{1}{3}\text{trace}(\mathbf\tau)\mathbf 1$ | ||
| * under the plane strain assumption. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add one sentence that in 3D this returns the usual definition of a deviatoric tensor.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comments for the two functions are revised accordingly. |
||
| * | ||
| * It should be noted that the consistent deviator of a consistently deviatoric tensor is | ||
| * not itself in 2D, which implies that it is invalid to apply this function to a symmetric | ||
| * tensor more than once. | ||
| */ | ||
| template <int dim> | ||
| SymmetricTensor<2,dim> | ||
| consistent_deviator(const SymmetricTensor<2,dim> &input); | ||
|
|
||
| /** | ||
| * Compute the second invariant of a deviatoric tensor of rank 2. This function is | ||
| * equivalent to dealii::second_invariant in 3D, while in 2D it is consistent with the | ||
| * plane strain assumption. Specifically, the second invariant of the deviatoric | ||
| * stress tensor $\tau_{II}$ in 2D is given by $\tau_{II} = -\frac{1}{2}(\tau_{11}^2 + | ||
| * \tau_{22}^2 + \tau_{33}^2 + 2\tau_{12}^2) = -\frac{1}{2}[\tau_{11}^2 + \tau_{22}^2 + | ||
| * (\tau_{11} + \tau_{22})^2 + 2\tau_{12}^2]$ under the plane strain assumption. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add one sentence that in 3D this function simply returns the usual second invariant. |
||
| * | ||
| * It should be noted that this function provides the correct result in 2D only when the | ||
| * input tensor is deviatoric in the sense of plane strain, which cannot be examined | ||
| * without extra information (the trace of a plane strain deviatoric tensor is not | ||
| * zero). Thus, extra care must be taken when using this function. | ||
| */ | ||
| template <int dim> | ||
| double | ||
| consistent_second_invariant_of_deviatoric_tensor(const SymmetricTensor<2,dim> &input); | ||
| } | ||
|
|
||
| } | ||
|
|
||
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 personally not really a fan of using functions like this for something so simple. You are basically inlining the following code here: https://github.com/dealii/dealii/blob/93160909dbf3bbfe986ad5320b675737f89d6e00/include/deal.II/base/utilities.h#L944-L961
Since it is an inline constexpr, and with compiler optimizations, it is probably almost as fast, or as fast as writing it out yourself. You can argue both ways about which one is more clear to read, so it is fine to keep it, but I did want to mention it.
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 did not read the source code of
Utilities::fixed_power()when I made the change. Now I think you are right: using the function may not be faster. I have changed it to explicit form in a new commit.