-
Notifications
You must be signed in to change notification settings - Fork 89
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
feat: averaging of stress components using quadrature #3279
base: develop
Are you sure you want to change the base?
Conversation
src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsFields.hpp
Outdated
Show resolved
Hide resolved
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 should make the stress NO_PLOT
.
The new average stress or the old stresses? |
the old ones should disappear I guess. |
So are we ok with the overall increased memory footprint? The advantage of the old stresses is that the average is never stored explicitly |
well, yes, but it's also wrong and we certainly don't want the output to depend on FE. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3279 +/- ##
===========================================
- Coverage 56.46% 56.45% -0.01%
===========================================
Files 1059 1059
Lines 89458 89468 +10
===========================================
- Hits 50512 50510 -2
- Misses 38946 38958 +12 ☔ View full report in Codecov by Sentry. |
src/coreComponents/physicsSolvers/solidMechanics/kernels/StrainHelper.hpp
Outdated
Show resolved
Hide resolved
GEOS_HOST_DEVICE | ||
void quadraturePointKernel( localIndex const k, |
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 file contains two functions quadraturePointKernel
once for the strain and one for the stress. In my opinion only one function should exist to perform the averaging of a second order symmetric stress tensor -- and probably of any scalar (rank 0), vector (rank 1), ... . The class AverageOverQuadraturePointsBase
should be responsible for this task, and the quantity to be averaged should either provided directly or with a lambda function that evaluates such property.
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 could generalize it and come up with a single kernel. We could try to make it accept a list of views instead of a specific one. It would also mean that we do all averaging in a single kernel launch which it is indeed better. We could use something similar to the elementViewAccessors
and create an array1d
of all scalars, one for all vectors and one for all tensors to be averaged and have the averagingKernel
only ask for the keys of the fields that need to be averaged.
The strain probably remains a bit of a special case though and i don't know that we do any averaging for other quantities.
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.
In the long term, such computations should be managed by a numerical quadrature library (i.e. --> Shiva)
|
||
for( int icomp = 0; icomp < 6; ++icomp ) | ||
{ | ||
m_avgStress[k][icomp] += detJxW*m_stress[k][q][icomp]/m_elementVolume[k]; |
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.
Here we divide by the cell element volume (m_elementVolume[k]
) to compute the increment to the average value. In AverageOverQuadraturePointsBase
the cell element contribution is directly included in the weight definition. Both correct, but it would be nice to be consistent
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.
IMO we should divide only once at the 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.
Generally speaking, I would argue that m_elementVolume[k]
should not even be required and computed directly in the quadrature process. For this specific case:
real64 cellVolume{0.0}
for( int icomp = 0; icomp < 6; ++icomp )
{
m_avgStress[k][icomp] += detJxW*m_stress[k][q][icomp];
cellVolume += detJxW;
}
m_avgStress[k][icomp] /= cellVolume;
what's the status of this PR? |
@CusiniM I just didnt know if this is still something folks want in develop. I originally did it to see if it helped with some stress oscillations in NL but it didnt. |
@herve-gross @jhuang2601 |
Implementation of a new averaged stress output per cell, where the averaging for each component is done using the quadrature rule of the finite element.
The new field is averageStress (6 components per cell) and is registered/owned by the solid mechanics solver, like the average strain (which I have made some minor changes to in order to unify with this new stress). This average stress is stored in addition to the stress at the quadrature points, but the stress owned by the constitutive law is no longer output (using the arithmetic mean).
An annoying rebaseline will be required, as this is gonna change all of the mechanics/poromechanics.