Skip to content
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 list for constitutive matrices and stress vectors #12380

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,20 @@ void UPwSmallStrainFICElement<TDim, TNumNodes>::InitializeNonLinearIteration(con

const auto b_matrices = this->CalculateBMatrices(Variables.DN_DXContainer, Variables.NContainer);
const auto deformation_gradients = this->CalculateDeformationGradients();
const auto determinants_of_deformation_gradients =
GeoMechanicsMathUtilities::CalculateDeterminants(deformation_gradients);
const auto strain_vectors = this->CalculateStrains(
auto strain_vectors = this->CalculateStrains(
deformation_gradients, b_matrices, Variables.DisplacementVector, Variables.UseHenckyStrain);
std::vector<Matrix> constitutive_matrices;
this->CalculateAnyOfMaterialResponse(deformation_gradients, ConstitutiveParameters,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At very first sight this function name is not very descriptive for me. I have to learn what it does reading the function itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I was struggling with the name. Would CalculateAnyOfStressesStrainsOrConstitutiveMatrices be better?

Variables.NContainer, Variables.DN_DXContainer,
strain_vectors, mStressVector, constitutive_matrices);

// Loop over integration points
for (unsigned int GPoint = 0; GPoint < NumGPoints; ++GPoint) {
this->CalculateKinematics(Variables, GPoint);
Variables.B = b_matrices[GPoint];
Variables.B = b_matrices[GPoint];
Variables.F = deformation_gradients[GPoint];
Variables.ConstitutiveMatrix = constitutive_matrices[GPoint];

// Compute infinitessimal strain
Variables.F = deformation_gradients[GPoint];
Variables.detF = determinants_of_deformation_gradients[GPoint];
Variables.StrainVector = strain_vectors[GPoint];

// set gauss points variables to constitutivelaw parameters
this->SetConstitutiveParameters(Variables, ConstitutiveParameters);

ConstitutiveParameters.SetStressVector(mStressVector[GPoint]);
mConstitutiveLawVector[GPoint]->CalculateMaterialResponseCauchy(ConstitutiveParameters);
this->SaveGPConstitutiveTensor(ConstitutiveTensorContainer, Variables.ConstitutiveMatrix, GPoint);

// Compute DtStress
Expand Down Expand Up @@ -200,27 +194,19 @@ void UPwSmallStrainFICElement<TDim, TNumNodes>::FinalizeNonLinearIteration(const

const auto b_matrices = this->CalculateBMatrices(Variables.DN_DXContainer, Variables.NContainer);
const auto deformation_gradients = this->CalculateDeformationGradients();
const auto determinants_of_deformation_gradients =
GeoMechanicsMathUtilities::CalculateDeterminants(deformation_gradients);
const auto strain_vectors = this->CalculateStrains(
auto strain_vectors = this->CalculateStrains(
deformation_gradients, b_matrices, Variables.DisplacementVector, Variables.UseHenckyStrain);
std::vector<Matrix> constitutive_matrices;
this->CalculateAnyOfMaterialResponse(deformation_gradients, ConstitutiveParameters,
Variables.NContainer, Variables.DN_DXContainer,
strain_vectors, mStressVector, constitutive_matrices);

// Loop over integration points
for (unsigned int GPoint = 0; GPoint < NumGPoints; ++GPoint) {
this->CalculateKinematics(Variables, GPoint);
Variables.B = b_matrices[GPoint];

// Compute infinitessimal strain
Variables.F = deformation_gradients[GPoint];
Variables.detF = determinants_of_deformation_gradients[GPoint];
Variables.StrainVector = strain_vectors[GPoint];

// set gauss points variables to constitutivelaw parameters
this->SetConstitutiveParameters(Variables, ConstitutiveParameters);

// Compute ConstitutiveTensor
ConstitutiveParameters.SetStressVector(mStressVector[GPoint]);
mConstitutiveLawVector[GPoint]->CalculateMaterialResponseCauchy(ConstitutiveParameters);
Variables.B = b_matrices[GPoint];
Variables.F = deformation_gradients[GPoint];
Variables.ConstitutiveMatrix = constitutive_matrices[GPoint];

// Compute DtStress
noalias(Variables.StrainVector) = prod(Variables.B, Variables.VelocityVector);
Expand Down Expand Up @@ -463,24 +449,21 @@ void UPwSmallStrainFICElement<TDim, TNumNodes>::CalculateAll(MatrixType& rLeftHa
const auto integration_coefficients =
this->CalculateIntegrationCoefficients(IntegrationPoints, Variables.detJContainer);
const auto deformation_gradients = this->CalculateDeformationGradients();
const auto determinants_of_deformation_gradients =
GeoMechanicsMathUtilities::CalculateDeterminants(deformation_gradients);
const auto strain_vectors = this->CalculateStrains(
auto strain_vectors = this->CalculateStrains(
deformation_gradients, b_matrices, Variables.DisplacementVector, Variables.UseHenckyStrain);
std::vector<Matrix> constitutive_matrices;
this->CalculateAnyOfMaterialResponse(deformation_gradients, ConstitutiveParameters,
Variables.NContainer, Variables.DN_DXContainer,
strain_vectors, mStressVector, constitutive_matrices);

// Loop over integration points
for (unsigned int GPoint = 0; GPoint < NumGPoints; ++GPoint) {
// Compute Np, GradNpT, B and StrainVector
this->CalculateKinematics(Variables, GPoint);
Variables.B = b_matrices[GPoint];

// Compute infinitessimal strain
Variables.F = deformation_gradients[GPoint];
Variables.detF = determinants_of_deformation_gradients[GPoint];
Variables.StrainVector = strain_vectors[GPoint];

// set gauss points variables to constitutivelaw parameters
this->SetConstitutiveParameters(Variables, ConstitutiveParameters);
Variables.B = b_matrices[GPoint];
Variables.F = deformation_gradients[GPoint];
avdg81 marked this conversation as resolved.
Show resolved Hide resolved
Variables.StrainVector = strain_vectors[GPoint];
Variables.ConstitutiveMatrix = constitutive_matrices[GPoint];

GeoElementUtilities::CalculateNuMatrix<TDim, TNumNodes>(Variables.Nu, Variables.NContainer, GPoint);
GeoElementUtilities::InterpolateVariableWithComponents<TDim, TNumNodes>(
Comment on lines 468 to 469
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We checked that these functions don't change anything that the constitutive law uses (i.e. only Nu, while the constitutive law uses Np). Since we changed the order here, I'd like to double check with you: do you think this is correct @WPK4FEM?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there is a difference between Nu and Np ( e.g. for reason of different interpolation orders of u and Pw ) the constitutive law ( relation between strain and stress ) should be using Nu. For same order interpolation Nu and Np will be equal, still the correct one should be used.

Expand All @@ -489,10 +472,6 @@ void UPwSmallStrainFICElement<TDim, TNumNodes>::CalculateAll(MatrixType& rLeftHa
// Compute ShapeFunctionsSecondOrderGradients
this->CalculateShapeFunctionsSecondOrderGradients(FICVariables, Variables);

// Compute constitutive tensor and stresses
ConstitutiveParameters.SetStressVector(mStressVector[GPoint]);
mConstitutiveLawVector[GPoint]->CalculateMaterialResponseCauchy(ConstitutiveParameters);

this->CalculateRetentionResponse(Variables, RetentionParameters, GPoint);

// set shear modulus from stiffness matrix
Expand Down
Loading
Loading