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] Removed initialization of material response from InitializeSolutionStep #13027

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -160,7 +160,6 @@ void UPwBaseElement::Initialize(const ProcessInfo& rCurrentProcessInfo)
mConstitutiveLawVector[i]->SetValue(STATE_VARIABLES, mStateVariablesFinalized[i], rCurrentProcessInfo);
mConstitutiveLawVector[i]->InitializeMaterialResponseCauchy(cl_values);
}
mIsInitialised = true;

KRATOS_CATCH("")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwBaseElement : public Element

std::vector<Vector> mStressVector;
std::vector<Vector> mStateVariablesFinalized;
bool mIsInitialised = false;

virtual void CalculateMaterialStiffnessMatrix(MatrixType& rStiffnessMatrix, const ProcessInfo& CurrentProcessInfo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,45 +246,7 @@ int UPwSmallStrainElement<TDim, TNumNodes>::Check(const ProcessInfo& rCurrentPro
template <unsigned int TDim, unsigned int TNumNodes>
void UPwSmallStrainElement<TDim, TNumNodes>::InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo)
{
KRATOS_TRY

ConstitutiveLaw::Parameters ConstitutiveParameters(this->GetGeometry(), this->GetProperties(),
rCurrentProcessInfo);
ConstitutiveParameters.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN);
ConstitutiveParameters.Set(ConstitutiveLaw::INITIALIZE_MATERIAL_RESPONSE);

ElementVariables Variables;
this->InitializeElementVariables(Variables, rCurrentProcessInfo);

const auto b_matrices = CalculateBMatrices(Variables.DN_DXContainer, Variables.NContainer);
const auto deformation_gradients = CalculateDeformationGradients();
const auto determinants_of_deformation_gradients =
GeoMechanicsMathUtilities::CalculateDeterminants(deformation_gradients);
const auto strain_vectors = StressStrainUtilities::CalculateStrains(
deformation_gradients, b_matrices, Variables.DisplacementVector, Variables.UseHenckyStrain,
this->GetStressStatePolicy().GetVoigtSize());

const auto number_of_integration_points =
this->GetGeometry().IntegrationPointsNumber(this->GetIntegrationMethod());
for (unsigned int GPoint = 0; GPoint < number_of_integration_points; ++GPoint) {
this->CalculateKinematics(Variables, GPoint);
Variables.B = b_matrices[GPoint];
Variables.F = deformation_gradients[GPoint];
Variables.StrainVector = strain_vectors[GPoint];

ConstitutiveLawUtilities::SetConstitutiveParameters(
ConstitutiveParameters, Variables.StrainVector, Variables.ConstitutiveMatrix, Variables.Np,
Variables.GradNpT, Variables.F, determinants_of_deformation_gradients[GPoint]);

noalias(Variables.StressVector) = mStressVector[GPoint];
ConstitutiveParameters.SetStressVector(Variables.StressVector);
mConstitutiveLawVector[GPoint]->InitializeMaterialResponseCauchy(ConstitutiveParameters);
}

// Reset hydraulic discharge
this->ResetHydraulicDischarge();

KRATOS_CATCH("")
}

template <unsigned int TDim, unsigned int TNumNodes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwSmallStrainElement : public UPwBa
using SizeType = std::size_t;
using UPwBaseElement::CalculateDerivativesOnInitialConfiguration;
using UPwBaseElement::mConstitutiveLawVector;
using UPwBaseElement::mIsInitialised;
using UPwBaseElement::mRetentionLawVector;
using UPwBaseElement::mStateVariablesFinalized;
using UPwBaseElement::mStressVector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,44 +162,6 @@ int SmallStrainUPwDiffOrderElement::Check(const ProcessInfo& rCurrentProcessInfo
KRATOS_CATCH("")
}

void SmallStrainUPwDiffOrderElement::InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo)
{
KRATOS_TRY

ConstitutiveLaw::Parameters ConstitutiveParameters(GetGeometry(), GetProperties(), rCurrentProcessInfo);
ConstitutiveParameters.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN);
ConstitutiveParameters.Set(ConstitutiveLaw::INITIALIZE_MATERIAL_RESPONSE);

ElementVariables Variables;
this->InitializeElementVariables(Variables, rCurrentProcessInfo);

const auto b_matrices = CalculateBMatrices(Variables.DNu_DXContainer, Variables.NuContainer);
const auto deformation_gradients = CalculateDeformationGradients();
const auto determinants_of_deformation_gradients =
GeoMechanicsMathUtilities::CalculateDeterminants(deformation_gradients);
const auto strain_vectors = StressStrainUtilities::CalculateStrains(
deformation_gradients, b_matrices, Variables.DisplacementVector, Variables.UseHenckyStrain,
GetStressStatePolicy().GetVoigtSize());

const auto number_of_integration_points = GetGeometry().IntegrationPointsNumber(GetIntegrationMethod());
for (unsigned int GPoint = 0; GPoint < number_of_integration_points; ++GPoint) {
this->CalculateKinematics(Variables, GPoint);
Variables.B = b_matrices[GPoint];
Variables.F = deformation_gradients[GPoint];
Variables.StrainVector = strain_vectors[GPoint];

ConstitutiveLawUtilities::SetConstitutiveParameters(
ConstitutiveParameters, Variables.StrainVector, Variables.ConstitutiveMatrix, Variables.Nu,
Variables.DNu_DX, Variables.F, determinants_of_deformation_gradients[GPoint]);

noalias(Variables.StressVector) = mStressVector[GPoint];
ConstitutiveParameters.SetStressVector(Variables.StressVector);
mConstitutiveLawVector[GPoint]->InitializeMaterialResponseCauchy(ConstitutiveParameters);
}

KRATOS_CATCH("")
}

void SmallStrainUPwDiffOrderElement::CalculateMassMatrix(MatrixType& rMassMatrix, const ProcessInfo& rCurrentProcessInfo)
{
KRATOS_TRY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUPwDiffOrderElement : pub
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(SmallStrainUPwDiffOrderElement);

using UPwBaseElement::mConstitutiveLawVector;
using UPwBaseElement::mIsInitialised;
using UPwBaseElement::mRetentionLawVector;
using UPwBaseElement::mStateVariablesFinalized;
using UPwBaseElement::mStressVector;
Expand Down Expand Up @@ -71,8 +70,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUPwDiffOrderElement : pub

int Check(const ProcessInfo& rCurrentProcessInfo) const override;

void InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;

void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;

void CalculateMassMatrix(MatrixType& rMassMatrix, const ProcessInfo& rCurrentProcessInfo) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SteadyStatePwElement : public Transi
/// The definition of the sizetype
using SizeType = std::size_t;
using BaseType::mConstitutiveLawVector;
using BaseType::mIsInitialised;
using BaseType::mRetentionLawVector;

using ElementVariables = typename BaseType::ElementVariables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ void TransientPwElement<TDim, TNumNodes>::Initialize(const ProcessInfo& rCurrent
r_retention_law = RetentionLawFactory::Clone(r_properties);
}

mIsInitialised = true;

KRATOS_CATCH("")
}

Expand Down Expand Up @@ -258,9 +256,6 @@ void TransientPwElement<TDim, TNumNodes>::InitializeSolutionStep(const ProcessIn
{
KRATOS_TRY

if (!mIsInitialised) this->Initialize(rCurrentProcessInfo);

// reset hydraulic discharge
this->ResetHydraulicDischarge();

KRATOS_CATCH("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) TransientPwElement : public UPwSmall
/// The definition of the sizetype
using SizeType = std::size_t;
using BaseType::mConstitutiveLawVector;
using BaseType::mIsInitialised;
using BaseType::mRetentionLawVector;

using ElementVariables = typename BaseType::ElementVariables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ KRATOS_TEST_CASE_IN_SUITE(TransientPwElement_InitializeSolution, KratosGeoMechan
r_model_part.AddNodalSolutionStepVariable(HYDRAULIC_DISCHARGE);
auto p_element = CreateTransientPwElementWithPWDofs<2, 3>(r_model_part, std::make_shared<Properties>());
const auto dummy_process_info = ProcessInfo{};
p_element->Initialize(dummy_process_info);

// Act
p_element->InitializeSolutionStep(dummy_process_info);
Expand All @@ -462,6 +463,7 @@ KRATOS_TEST_CASE_IN_SUITE(TransientPwElement_FinalizeSolutionStep, KratosGeoMech
auto p_element = CreateTransientPwElementWithPWDofs<2, 3>(r_model_part, std::make_shared<Properties>());
SetBasicPropertiesAndVariables(p_element);
const auto dummy_process_info = ProcessInfo{};
p_element->Initialize(dummy_process_info);
p_element->InitializeSolutionStep(dummy_process_info);

// Act
Expand All @@ -482,6 +484,7 @@ KRATOS_TEST_CASE_IN_SUITE(TransientPwElement_CalculateOnIntegrationPoints_Vector
auto p_element = CreateTransientPwElementWithPWDofs<2, 3>(r_model_part, std::make_shared<Properties>());
SetBasicPropertiesAndVariables(p_element);
const auto dummy_process_info = ProcessInfo{};
p_element->Initialize(dummy_process_info);
p_element->InitializeSolutionStep(dummy_process_info);

// Act
Expand Down Expand Up @@ -560,6 +563,7 @@ KRATOS_TEST_CASE_IN_SUITE(TransientPwElement_CalculateOnIntegrationPoints_1DArra
auto p_element = CreateTransientPwElementWithPWDofs<2, 3>(r_model_part, std::make_shared<Properties>());
SetBasicPropertiesAndVariables(p_element);
const auto dummy_process_info = ProcessInfo{};
p_element->Initialize(dummy_process_info);
p_element->InitializeSolutionStep(dummy_process_info);

// Act
Expand Down Expand Up @@ -596,6 +600,7 @@ KRATOS_TEST_CASE_IN_SUITE(TransientPwElement_CalculateOnIntegrationPoints_Matrix
auto p_element = CreateTransientPwElementWithPWDofs<2, 3>(r_model_part, std::make_shared<Properties>());
SetBasicPropertiesAndVariables(p_element);
const auto dummy_process_info = ProcessInfo{};
p_element->Initialize(dummy_process_info);
p_element->InitializeSolutionStep(dummy_process_info);

// Act
Expand Down Expand Up @@ -638,6 +643,7 @@ KRATOS_TEST_CASE_IN_SUITE(TransientPwElement2D3N_CalculateLocalSystem, KratosGeo
p_element->GetProperties().SetValue(POROSITY, 0.1);
p_element->GetProperties().SetValue(IGNORE_UNDRAINED, false);
const auto dummy_process_info = ProcessInfo{};
p_element->Initialize(dummy_process_info);
p_element->InitializeSolutionStep(dummy_process_info);

// Act
Expand Down Expand Up @@ -673,6 +679,7 @@ KRATOS_TEST_CASE_IN_SUITE(TransientPwElement3D4N_CalculateLocalSystem, KratosGeo
p_element->GetProperties().SetValue(POROSITY, 0.1);
p_element->GetProperties().SetValue(IGNORE_UNDRAINED, false);
const auto dummy_process_info = ProcessInfo{};
p_element->Initialize(dummy_process_info);
p_element->InitializeSolutionStep(dummy_process_info);

// Act
Expand Down
Loading