-
Notifications
You must be signed in to change notification settings - Fork 248
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
[GeoMechanicsApplication] A 3D elastic constitutive law is lacking in GeoMechanicsApplication #12816
Merged
Merged
[GeoMechanicsApplication] A 3D elastic constitutive law is lacking in GeoMechanicsApplication #12816
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2ce1e36
renamed GeoLinearElasticPlaneStrain2DLaw to GeoIncrementalLinerLaw
markelov208 c6e43b4
added elastic_3D law and unit tests
markelov208 27e4090
clang-format
markelov208 e927d15
used GeoLinearElastic3DLaw
markelov208 82fe15f
Merge branch 'master' into geo/12814_3D_elastic_constitutive_law
markelov208 9889c47
Merge branch 'master' into geo/12814_3D_elastic_constitutive_law
markelov208 8ce1180
fixed comments
markelov208 b683398
used GeoIncrementalLinearElastic3DLaw
markelov208 95893d9
response to reviews
markelov208 b081e1e
Merge branch 'master' into geo/12814_3D_elastic_constitutive_law
markelov208 96954f7
formatted
markelov208 4077a4a
Merge branch 'master' into geo/12814_3D_elastic_constitutive_law
markelov208 7477196
fixed an
markelov208 2d19354
removed two lines with ///
markelov208 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,16 @@ | |
// Main authors: Wijtze Pieter Kikstra | ||
// Richard Faasse | ||
|
||
#include "custom_constitutive/linear_elastic_plane_strain_2D_law.h" | ||
#include "custom_constitutive/incremental_linear_elastic_law.h" | ||
#include "constitutive_law_dimension.h" | ||
#include "geo_mechanics_application_variables.h" | ||
|
||
namespace Kratos | ||
{ | ||
|
||
GeoLinearElasticPlaneStrain2DLaw::GeoLinearElasticPlaneStrain2DLaw() = default; | ||
GeoIncrementalLinearElasticLaw::GeoIncrementalLinearElasticLaw() = default; | ||
|
||
GeoLinearElasticPlaneStrain2DLaw::GeoLinearElasticPlaneStrain2DLaw(std::unique_ptr<ConstitutiveLawDimension> pConstitutiveDimension) | ||
GeoIncrementalLinearElasticLaw::GeoIncrementalLinearElasticLaw(std::unique_ptr<ConstitutiveLawDimension> pConstitutiveDimension) | ||
: GeoLinearElasticLaw{}, | ||
mpConstitutiveDimension(std::move(pConstitutiveDimension)), | ||
mStressVector(ZeroVector(mpConstitutiveDimension->GetStrainSize())), | ||
|
@@ -29,7 +29,7 @@ GeoLinearElasticPlaneStrain2DLaw::GeoLinearElasticPlaneStrain2DLaw(std::unique_p | |
{ | ||
} | ||
|
||
GeoLinearElasticPlaneStrain2DLaw::GeoLinearElasticPlaneStrain2DLaw(const GeoLinearElasticPlaneStrain2DLaw& rOther) | ||
GeoIncrementalLinearElasticLaw::GeoIncrementalLinearElasticLaw(const GeoIncrementalLinearElasticLaw& rOther) | ||
: GeoLinearElasticLaw(rOther), | ||
mStressVector(rOther.mStressVector), | ||
mStressVectorFinalized(rOther.mStressVectorFinalized), | ||
|
@@ -41,7 +41,7 @@ GeoLinearElasticPlaneStrain2DLaw::GeoLinearElasticPlaneStrain2DLaw(const GeoLine | |
mpConstitutiveDimension = rOther.mpConstitutiveDimension->Clone(); | ||
} | ||
|
||
GeoLinearElasticPlaneStrain2DLaw& GeoLinearElasticPlaneStrain2DLaw::operator=(const GeoLinearElasticPlaneStrain2DLaw& rOther) | ||
GeoIncrementalLinearElasticLaw& GeoIncrementalLinearElasticLaw::operator=(const GeoIncrementalLinearElasticLaw& rOther) | ||
{ | ||
GeoLinearElasticLaw::operator=(rOther); | ||
mStressVector = rOther.mStressVector; | ||
|
@@ -55,24 +55,23 @@ GeoLinearElasticPlaneStrain2DLaw& GeoLinearElasticPlaneStrain2DLaw::operator=(co | |
return *this; | ||
} | ||
|
||
GeoLinearElasticPlaneStrain2DLaw::GeoLinearElasticPlaneStrain2DLaw(GeoLinearElasticPlaneStrain2DLaw&& rOther) noexcept = default; | ||
GeoLinearElasticPlaneStrain2DLaw& GeoLinearElasticPlaneStrain2DLaw::operator=( | ||
GeoLinearElasticPlaneStrain2DLaw&& rOther) noexcept = default; | ||
GeoLinearElasticPlaneStrain2DLaw::~GeoLinearElasticPlaneStrain2DLaw() = default; | ||
GeoIncrementalLinearElasticLaw::GeoIncrementalLinearElasticLaw(GeoIncrementalLinearElasticLaw&& rOther) noexcept = default; | ||
GeoIncrementalLinearElasticLaw& GeoIncrementalLinearElasticLaw::operator=(GeoIncrementalLinearElasticLaw&& rOther) noexcept = default; | ||
GeoIncrementalLinearElasticLaw::~GeoIncrementalLinearElasticLaw() = default; | ||
|
||
ConstitutiveLaw::Pointer GeoLinearElasticPlaneStrain2DLaw::Clone() const | ||
ConstitutiveLaw::Pointer GeoIncrementalLinearElasticLaw::Clone() const | ||
{ | ||
return Kratos::make_shared<GeoLinearElasticPlaneStrain2DLaw>(*this); | ||
return Kratos::make_shared<GeoIncrementalLinearElasticLaw>(*this); | ||
} | ||
|
||
bool& GeoLinearElasticPlaneStrain2DLaw::GetValue(const Variable<bool>& rThisVariable, bool& rValue) | ||
bool& GeoIncrementalLinearElasticLaw::GetValue(const Variable<bool>& rThisVariable, bool& rValue) | ||
{ | ||
// This Constitutive Law has been checked with Stenberg Stabilization | ||
if (rThisVariable == STENBERG_SHEAR_STABILIZATION_SUITABLE) rValue = true; | ||
return rValue; | ||
} | ||
|
||
void GeoLinearElasticPlaneStrain2DLaw::GetLawFeatures(Features& rFeatures) | ||
void GeoIncrementalLinearElasticLaw::GetLawFeatures(Features& rFeatures) | ||
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 implementation reads like SetFeatureOptions. 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. Indeed ;) It is used across Kratos. |
||
{ | ||
rFeatures.mOptions.Set(mpConstitutiveDimension->GetSpatialType()); | ||
rFeatures.mOptions.Set(INFINITESIMAL_STRAINS); | ||
|
@@ -85,19 +84,19 @@ void GeoLinearElasticPlaneStrain2DLaw::GetLawFeatures(Features& rFeatures) | |
rFeatures.mSpaceDimension = WorkingSpaceDimension(); | ||
} | ||
|
||
SizeType GeoLinearElasticPlaneStrain2DLaw::WorkingSpaceDimension() | ||
SizeType GeoIncrementalLinearElasticLaw::WorkingSpaceDimension() | ||
{ | ||
return mpConstitutiveDimension->GetDimension(); | ||
} | ||
|
||
SizeType GeoLinearElasticPlaneStrain2DLaw::GetStrainSize() const | ||
SizeType GeoIncrementalLinearElasticLaw::GetStrainSize() const | ||
{ | ||
return mpConstitutiveDimension->GetStrainSize(); | ||
} | ||
|
||
bool GeoLinearElasticPlaneStrain2DLaw::IsIncremental() { return true; } | ||
bool GeoIncrementalLinearElasticLaw::IsIncremental() { return true; } | ||
|
||
void GeoLinearElasticPlaneStrain2DLaw::CalculateElasticMatrix(Matrix& C, ConstitutiveLaw::Parameters& rValues) | ||
void GeoIncrementalLinearElasticLaw::CalculateElasticMatrix(Matrix& C, ConstitutiveLaw::Parameters& rValues) | ||
{ | ||
KRATOS_TRY | ||
|
||
|
@@ -115,9 +114,9 @@ void GeoLinearElasticPlaneStrain2DLaw::CalculateElasticMatrix(Matrix& C, Constit | |
KRATOS_CATCH("") | ||
} | ||
|
||
void GeoLinearElasticPlaneStrain2DLaw::CalculatePK2Stress(const Vector& rStrainVector, | ||
Vector& rStressVector, | ||
ConstitutiveLaw::Parameters& rValues) | ||
void GeoIncrementalLinearElasticLaw::CalculatePK2Stress(const Vector& rStrainVector, | ||
Vector& rStressVector, | ||
ConstitutiveLaw::Parameters& rValues) | ||
{ | ||
KRATOS_TRY | ||
|
||
|
@@ -134,9 +133,9 @@ void GeoLinearElasticPlaneStrain2DLaw::CalculatePK2Stress(const Vector& rStrainV | |
KRATOS_CATCH("") | ||
} | ||
|
||
bool GeoLinearElasticPlaneStrain2DLaw::RequiresInitializeMaterialResponse() { return true; } | ||
bool GeoIncrementalLinearElasticLaw::RequiresInitializeMaterialResponse() { return true; } | ||
|
||
void GeoLinearElasticPlaneStrain2DLaw::InitializeMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) | ||
void GeoIncrementalLinearElasticLaw::InitializeMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) | ||
{ | ||
KRATOS_TRY | ||
if (!mIsModelInitialized) { | ||
|
@@ -148,21 +147,21 @@ void GeoLinearElasticPlaneStrain2DLaw::InitializeMaterialResponseCauchy(Constitu | |
KRATOS_CATCH("") | ||
} | ||
|
||
bool GeoLinearElasticPlaneStrain2DLaw::RequiresFinalizeMaterialResponse() { return true; } | ||
bool GeoIncrementalLinearElasticLaw::RequiresFinalizeMaterialResponse() { return true; } | ||
|
||
void GeoLinearElasticPlaneStrain2DLaw::FinalizeMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) | ||
void GeoIncrementalLinearElasticLaw::FinalizeMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) | ||
{ | ||
mStrainVectorFinalized = rValues.GetStrainVector(); | ||
mStressVectorFinalized = mStressVector; | ||
} | ||
|
||
void GeoLinearElasticPlaneStrain2DLaw::FinalizeMaterialResponsePK2(ConstitutiveLaw::Parameters& rValues) | ||
void GeoIncrementalLinearElasticLaw::FinalizeMaterialResponsePK2(ConstitutiveLaw::Parameters& rValues) | ||
{ | ||
// Small deformation so we can call the Cauchy method | ||
FinalizeMaterialResponseCauchy(rValues); | ||
} | ||
|
||
void GeoLinearElasticPlaneStrain2DLaw::save(Serializer& rSerializer) const | ||
void GeoIncrementalLinearElasticLaw::save(Serializer& rSerializer) const | ||
{ | ||
KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, GeoLinearElasticLaw) | ||
rSerializer.save("StressVector", mStressVector); | ||
|
@@ -172,7 +171,7 @@ void GeoLinearElasticPlaneStrain2DLaw::save(Serializer& rSerializer) const | |
rSerializer.save("mIsModelInitialized", mIsModelInitialized); | ||
} | ||
|
||
void GeoLinearElasticPlaneStrain2DLaw::load(Serializer& rSerializer) | ||
void GeoIncrementalLinearElasticLaw::load(Serializer& rSerializer) | ||
{ | ||
KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, GeoLinearElasticLaw) | ||
rSerializer.load("StressVector", mStressVector); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
applications/GeoMechanicsApplication/custom_constitutive/three_dimensional.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// KRATOS___ | ||
// // ) ) | ||
// // ___ ___ | ||
// // ____ //___) ) // ) ) | ||
// // / / // // / / | ||
// ((____/ / ((____ ((___/ / MECHANICS | ||
// | ||
// License: geo_mechanics_application/license.txt | ||
// | ||
// Main authors: Richard Faasse | ||
// Gennady Markelov | ||
// | ||
|
||
#include "three_dimensional.h" | ||
|
||
#include "geo_mechanics_application_constants.h" | ||
#include "includes/constitutive_law.h" | ||
|
||
namespace Kratos | ||
{ | ||
|
||
Matrix ThreeDimensional::FillConstitutiveMatrix(double c1, double c2, double c3) const | ||
{ | ||
Matrix result = ZeroMatrix(GetStrainSize(), GetStrainSize()); | ||
|
||
result(INDEX_3D_XX, INDEX_3D_XX) = c1; | ||
result(INDEX_3D_XX, INDEX_3D_YY) = c2; | ||
result(INDEX_3D_XX, INDEX_3D_ZZ) = c2; | ||
|
||
result(INDEX_3D_YY, INDEX_3D_XX) = c2; | ||
result(INDEX_3D_YY, INDEX_3D_YY) = c1; | ||
result(INDEX_3D_YY, INDEX_3D_ZZ) = c2; | ||
|
||
result(INDEX_3D_ZZ, INDEX_3D_XX) = c2; | ||
result(INDEX_3D_ZZ, INDEX_3D_YY) = c2; | ||
result(INDEX_3D_ZZ, INDEX_3D_ZZ) = c1; | ||
|
||
result(INDEX_3D_XY, INDEX_3D_XY) = c3; | ||
result(INDEX_3D_YZ, INDEX_3D_YZ) = c3; | ||
result(INDEX_3D_XZ, INDEX_3D_XZ) = c3; | ||
|
||
return result; | ||
} | ||
|
||
std::unique_ptr<ConstitutiveLawDimension> ThreeDimensional::Clone() const | ||
{ | ||
return std::make_unique<ThreeDimensional>(); | ||
} | ||
|
||
std::size_t ThreeDimensional::GetStrainSize() const { return VOIGT_SIZE_3D; } | ||
|
||
std::size_t ThreeDimensional::GetDimension() const { return N_DIM_3D; } | ||
|
||
Flags ThreeDimensional::GetSpatialType() const { return ConstitutiveLaw::THREE_DIMENSIONAL_LAW; } | ||
|
||
} // namespace Kratos |
32 changes: 32 additions & 0 deletions
32
applications/GeoMechanicsApplication/custom_constitutive/three_dimensional.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// KRATOS___ | ||
// // ) ) | ||
// // ___ ___ | ||
// // ____ //___) ) // ) ) | ||
// // / / // // / / | ||
// ((____/ / ((____ ((___/ / MECHANICS | ||
// | ||
// License: geo_mechanics_application/license.txt | ||
// | ||
// Main authors: Richard Faasse | ||
// Gennady Markelov | ||
// | ||
|
||
#pragma once | ||
|
||
#include "constitutive_law_dimension.h" | ||
#include "includes/kratos_export_api.h" | ||
|
||
namespace Kratos | ||
{ | ||
|
||
class KRATOS_API(GEO_MECHANICS_APPLICATION) ThreeDimensional : public ConstitutiveLawDimension | ||
{ | ||
public: | ||
[[nodiscard]] Matrix FillConstitutiveMatrix(double c1, double c2, double c3) const override; | ||
[[nodiscard]] std::unique_ptr<ConstitutiveLawDimension> Clone() const override; | ||
[[nodiscard]] std::size_t GetStrainSize() const override; | ||
[[nodiscard]] std::size_t GetDimension() const override; | ||
[[nodiscard]] Flags GetSpatialType() const override; | ||
}; | ||
|
||
} // namespace Kratos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Perhaps we should find out what Stenberg shear stabilization is and whether it is applicable for elasticity. We are moving this around, but we are not really using 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.
Looked at Stenberg stabilization. Only seems applicable for thick shell formulation used in Structural Mechanics Applications. I consider it to be part of another PR to limit its use to meaningful use in GeoMechanics.