-
Notifications
You must be signed in to change notification settings - Fork 108
feat: Add Young Modulus & Poisson import from VTK mesh #4021
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
Changes from 5 commits
af7af1c
1f61580
efdbab8
3e75b3c
bf7f647
7a1ddbc
c6f04da
bb862da
9e43576
2158cf8
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 |
|---|---|---|
|
|
@@ -54,6 +54,10 @@ ElasticIsotropic::ElasticIsotropic( string const & name, Group * const parent ): | |
| registerField< fields::solid::bulkModulus >( &m_bulkModulus ); | ||
|
|
||
| registerField< fields::solid::shearModulus >( &m_shearModulus ); | ||
|
|
||
| registerField< fields::solid::youngModulus >( &m_youngModulus ); | ||
|
|
||
| registerField< fields::solid::poissonRatio >( &m_poissonRatio ); | ||
| } | ||
|
|
||
| void ElasticIsotropic::postInputInitialization() | ||
|
|
@@ -147,6 +151,62 @@ void ElasticIsotropic::postInputInitialization() | |
| setApplyDefaultValue( m_defaultShearModulus ); | ||
| } | ||
|
|
||
| void ElasticIsotropic::initializePostInitialConditionsPreSubGroups() | ||
| { | ||
| SolidBase::initializePostInitialConditionsPreSubGroups(); | ||
|
|
||
| // If per-cell Young's modulus and Poisson's ratio were imported from an external mesh | ||
| // (indicated by youngModulus[k] > 0 and poissonRatio[k] in (-0.5, 0.5)), | ||
| // convert them to bulk and shear modulus on a cell-by-cell basis. | ||
|
Comment on lines
+155
to
+160
|
||
| arrayView1d< real64 const > const youngMod = m_youngModulus; | ||
| arrayView1d< real64 const > const nu = m_poissonRatio; | ||
| arrayView1d< real64 > const bulkMod = m_bulkModulus; | ||
| arrayView1d< real64 > const shearMod = m_shearModulus; | ||
|
|
||
| localIndex numConverted = 0; | ||
| localIndex numInvalidE = 0; | ||
|
|
||
| for( localIndex k = 0; k < m_youngModulus.size(); ++k ) | ||
| { | ||
| // youngModulus default is 0: negative values are invalid, zero means not imported | ||
| if( youngMod[k] < 0.0 ) | ||
| { | ||
| GEOS_WARNING( GEOS_FMT( "ElasticIsotropic '{}': element {} has negative Young's modulus ({:.6e}). " | ||
|
dkachuma marked this conversation as resolved.
Outdated
|
||
| "Skipping per-cell conversion; default bulk/shear modulus will be used.", | ||
| getName(), k, youngMod[k] ) ); | ||
| ++numInvalidE; | ||
| continue; | ||
| } | ||
|
|
||
| // youngModulus default is 0: not imported — skip silently | ||
| if( !( youngMod[k] > 0.0 ) ) | ||
| continue; | ||
|
|
||
| // E was imported and is positive: nu must also be valid | ||
| GEOS_ERROR_IF( nu[k] <= -0.5 || nu[k] >= 0.5, | ||
|
Contributor
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. For most common materials, Poisson’s ratio falls within the range of 0 to 0.5.
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. I agree with you, but there was some checks already done around line 80-84 that were with this range : So I kept them as it is. |
||
| GEOS_FMT( "ElasticIsotropic '{}': element {} has Young's modulus imported ({:.6e}) " | ||
| "but Poisson's ratio ({:.6f}) is outside the valid range (-0.5, 0.5). " | ||
| "Both youngModulus and poissonRatio must be provided together.", | ||
| getName(), k, youngMod[k], nu[k] ) ); | ||
|
|
||
| bulkMod[k] = conversions::youngModAndPoissonRatio::toBulkMod( youngMod[k], nu[k] ); | ||
| shearMod[k] = conversions::youngModAndPoissonRatio::toShearMod( youngMod[k], nu[k] ); | ||
| ++numConverted; | ||
| } | ||
|
|
||
| GEOS_WARNING_IF( numInvalidE > 0, | ||
|
dkachuma marked this conversation as resolved.
Outdated
|
||
| GEOS_FMT( "ElasticIsotropic '{}': {} element(s) had non-positive Young's modulus and were skipped.", | ||
| getName(), numInvalidE ) ); | ||
|
|
||
| // Back-compute E and nu for all cells from the final K/G so that output fields are meaningful | ||
| // for both imported and default cells. | ||
| for( localIndex k = 0; k < m_bulkModulus.size(); ++k ) | ||
| { | ||
| m_youngModulus[k] = conversions::bulkModAndShearMod::toYoungMod( bulkMod[k], shearMod[k] ); | ||
| m_poissonRatio[k] = conversions::bulkModAndShearMod::toPoissonRatio( bulkMod[k], shearMod[k] ); | ||
| } | ||
| } | ||
|
|
||
| REGISTER_CATALOG_ENTRY( ConstitutiveBase, ElasticIsotropic, string const &, Group * const ) | ||
| } | ||
| } /* namespace geos */ | ||
Uh oh!
There was an error while loading. Please reload this page.