-
Notifications
You must be signed in to change notification settings - Fork 249
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] extract SetConstitutiveParameters function #12382
Changes from all commits
d3e8619
69ed65c
ac78a56
5afd2b5
da7efa4
4fc57b8
a4cec35
14bcb8a
0e75b3c
7717dc0
ce42098
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 |
---|---|---|
|
@@ -26,4 +26,19 @@ int ConstitutiveLawUtilities::GetStateVariableIndex(const Variable<double>& rThi | |
return index - 1; | ||
} | ||
|
||
void ConstitutiveLawUtilities::SetConstitutiveParameters(ConstitutiveLaw::Parameters& rConstitutiveParameters, | ||
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. Very nice addition. I think it could also be used in the 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. Thank you for pointing. Added there. |
||
Vector& rStrainVector, | ||
Matrix& rConstitutiveMatrix, | ||
const Vector& rN, | ||
const Matrix& rGradNpT, | ||
const Matrix& rF, | ||
double detF) | ||
{ | ||
rConstitutiveParameters.SetStrainVector(rStrainVector); | ||
rConstitutiveParameters.SetConstitutiveMatrix(rConstitutiveMatrix); | ||
rConstitutiveParameters.SetShapeFunctionsValues(rN); | ||
rConstitutiveParameters.SetShapeFunctionsDerivatives(rGradNpT); | ||
rConstitutiveParameters.SetDeformationGradientF(rF); | ||
rConstitutiveParameters.SetDeterminantF(detF); | ||
} | ||
} // namespace Kratos |
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. Clear unit test! To reflect the name of the file it tests, we could also rename it to test_constitutive_law_utilities.cpp |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// KRATOS___ | ||
// // ) ) | ||
// // ___ ___ | ||
// // ____ //___) ) // ) ) | ||
// // / / // // / / | ||
// ((____/ / ((____ ((___/ / MECHANICS | ||
// | ||
// License: geo_mechanics_application/license.txt | ||
// | ||
// Main authors: Gennady Markelov | ||
// | ||
|
||
#include "custom_utilities/constitutive_law_utilities.hpp" | ||
#include "includes/checks.h" | ||
#include "testing/testing.h" | ||
#include <boost/numeric/ublas/assignment.hpp> | ||
|
||
using namespace Kratos; | ||
|
||
namespace Kratos::Testing | ||
{ | ||
|
||
KRATOS_TEST_CASE_IN_SUITE(SetSixConstitutiveParametersCorrectResults, KratosGeoMechanicsFastSuite) | ||
{ | ||
ConstitutiveLaw::Parameters ConstitutiveParameters; | ||
|
||
Vector strain_vector(3); | ||
strain_vector <<= 1.0, 2.0, 3.0; | ||
Matrix constitutive_matrix = IdentityMatrix(5, 5); | ||
Vector N(3); | ||
N <<= 0.1, 0.2, 0.5; | ||
const Matrix shape_functions_derivatives = ScalarMatrix(3, 3, 5.0); | ||
const Matrix deformation_gradient_F = ScalarMatrix(3, 3, 10.0); | ||
constexpr double determinant_of_F = 10.0; | ||
ConstitutiveLawUtilities::SetConstitutiveParameters( | ||
ConstitutiveParameters, strain_vector, constitutive_matrix, N, shape_functions_derivatives, | ||
deformation_gradient_F, determinant_of_F); | ||
|
||
KRATOS_CHECK_VECTOR_NEAR(ConstitutiveParameters.GetStrainVector(), strain_vector, 1e-12) | ||
|
||
KRATOS_CHECK_MATRIX_NEAR(ConstitutiveParameters.GetConstitutiveMatrix(), constitutive_matrix, 1e-12) | ||
|
||
KRATOS_CHECK_VECTOR_NEAR(ConstitutiveParameters.GetShapeFunctionsValues(), N, 1e-12) | ||
|
||
KRATOS_CHECK_MATRIX_NEAR(ConstitutiveParameters.GetShapeFunctionsDerivatives(), | ||
shape_functions_derivatives, 1e-12) | ||
|
||
KRATOS_CHECK_MATRIX_NEAR(ConstitutiveParameters.GetDeformationGradientF(), deformation_gradient_F, 1e-12) | ||
|
||
KRATOS_CHECK_NEAR(ConstitutiveParameters.GetDeterminantF(), determinant_of_F, 1e-12); | ||
} | ||
|
||
} // namespace Kratos::Testing |
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 call we need to retain, because the constitutive matrix was not calculated before the loop
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.
Thanks.