FIX: Correct 2D Von Mises Stress Calculation in CFEAElasticity (#2603)#2665
FIX: Correct 2D Von Mises Stress Calculation in CFEAElasticity (#2603)#2665pcarruscag merged 10 commits intosu2code:tmp_developfrom
Conversation
pcarruscag
left a comment
There was a problem hiding this comment.
Thanks. Can you look into the plain strain case too?
|
@pcarruscag I have added support for Plane Strain as requested. Implementation Details:
|
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
|
@pcarruscag I have applied the requested changes:
Builds are passing locally. Ready for final review! |
pcarruscag
left a comment
There was a problem hiding this comment.
I'll approve the tests to run, but there will be plenty of segmentation faults.
| static su2double VonMisesStress(unsigned short nDim, const T& stress, su2double Nu, bool isPlaneStrain) { | ||
| if (nDim == 2) { | ||
| su2double Sxx = stress[0], Syy = stress[1], Sxy = stress[2]; |
There was a problem hiding this comment.
If the 4th element of "stress" is Szz you don't need to pass Nu and isPlainStrain to this function.
|
@pcarruscag Done. I have refactored the implementation as requested to ensure memory safety.
I updated all 3 call sites to pack the stress vector correctly before passing it to the utility, preventing any potential segfaults. |
Issue:
As reported in Issue #2603, the 2D implementation of the Von Mises stress calculation in
CFEAElasticity::VonMisesStresswas mathematically incorrect.The previous code implemented:
$$\sigma_{vm} = \sqrt{S_1^2 + S_2^2 - 2S_1S_2} = \sqrt{(S_1 - S_2)^2} = |S_1 - S_2|$$
This formula corresponds to the Tresca equivalent stress (twice the maximum shear stress), not the Von Mises stress.
Fix:
$$\sigma_{vm} = \sqrt{S_1^2 + S_2^2 - S_1S_2}$$
Updated the formula to the correct 2D Plane Stress Von Mises definition:
Verification:
Verified that the term
-2*S1*S2was the source of the discrepancy. The updated implementation now aligns with standard continuum mechanics definitions for plane stress.