diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_kelvin.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_kelvin.cpp index 6a0af8f3f05b..fa626e1528f0 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_kelvin.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_kelvin.cpp @@ -121,8 +121,8 @@ void ViscousGeneralizedKelvin::ComputeViscoElasticity(Cons const Flags& r_flags = rValues.GetOptions(); // We compute the strain in case not provided + Vector& r_strain_vector = rValues.GetStrainVector(); if (r_flags.IsNot( ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) { - Vector& r_strain_vector = rValues.GetStrainVector(); this->CalculateValue(rValues, STRAIN, r_strain_vector); } @@ -146,7 +146,6 @@ void ViscousGeneralizedKelvin::ComputeViscoElasticity(Cons Vector elastic_strain(VoigtSize); // Apply increments - const Vector& r_strain_vector = rValues.GetStrainVector(); for (IndexType i = 0; i < number_sub_increments; ++i) { noalias(aux) = (std::exp(-dt / delay_time) * prod(inverse_constitutive_matrix, aux_stress_vector)) / delay_time; noalias(inelastic_strain) = std::exp(-dt / delay_time) * inelastic_strain + aux; @@ -158,7 +157,8 @@ void ViscousGeneralizedKelvin::ComputeViscoElasticity(Cons noalias(integrated_stress_vector) = aux_stress_vector; if (r_flags.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR)) { - rValues.SetConstitutiveMatrix(constitutive_matrix); + Matrix& r_constitutive_matrix = rValues.GetConstitutiveMatrix(); + noalias(r_constitutive_matrix) = constitutive_matrix; } } else { // Elastic Matrix @@ -210,8 +210,8 @@ void ViscousGeneralizedKelvin::FinalizeMaterialResponseCau const Flags& r_flags = rValues.GetOptions(); // We compute the strain in case not provided + Vector& r_strain_vector = rValues.GetStrainVector(); if (r_flags.IsNot( ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) { - Vector& r_strain_vector = rValues.GetStrainVector(); this->CalculateValue(rValues, STRAIN, r_strain_vector); } @@ -233,7 +233,6 @@ void ViscousGeneralizedKelvin::FinalizeMaterialResponseCau Vector elastic_strain(VoigtSize); // Apply increments - const Vector& r_strain_vector = rValues.GetStrainVector(); for (IndexType i = 0; i < number_sub_increments; ++i) { noalias(aux) = (std::exp(-dt / delay_time) * prod(inverse_constitutive_matrix, aux_stress_vector)) / delay_time; noalias(inelastic_strain) = std::exp(-dt / delay_time) * inelastic_strain + aux; @@ -241,8 +240,8 @@ void ViscousGeneralizedKelvin::FinalizeMaterialResponseCau noalias(aux_stress_vector) = prod(constitutive_matrix, elastic_strain); } - mPrevInelasticStrainVector = inelastic_strain; - mPrevStressVector = aux_stress_vector; + noalias(mPrevInelasticStrainVector) = inelastic_strain; + noalias(mPrevStressVector) = aux_stress_vector; } /***********************************************************************************/ diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_maxwell.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_maxwell.cpp index 245fb4cf03ec..168c6793da60 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_maxwell.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_maxwell.cpp @@ -101,32 +101,18 @@ void ViscousGeneralizedMaxwell::CalculateMaterialResponseC /***********************************************************************************/ /***********************************************************************************/ -template -void ViscousGeneralizedMaxwell::FinalizeSolutionStep( - const Properties &rMaterialProperties, - const GeometryType &rElementGeometry, - const Vector& rShapeFunctionsValues, - const ProcessInfo &rCurrentProcessInfo) -{ - // Deprecated -} - -/***********************************************************************************/ -/***********************************************************************************/ - template void ViscousGeneralizedMaxwell::ComputeViscoElasticity(ConstitutiveLaw::Parameters& rValues) { const Properties& material_props = rValues.GetMaterialProperties(); Vector& integrated_stress_vector = rValues.GetStressVector(); // To be updated - const ProcessInfo& process_info = rValues.GetProcessInfo(); - const double time_step = process_info[DELTA_TIME]; + const double time_step = rValues.GetProcessInfo()[DELTA_TIME]; const Flags& r_flags = rValues.GetOptions(); // We compute the strain in case not provided + Vector& r_strain_vector = rValues.GetStrainVector(); if (r_flags.IsNot( ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) { - Vector& r_strain_vector = rValues.GetStrainVector(); - this->CalculateValue(rValues, STRAIN, r_strain_vector); + BaseType::CalculateValue(rValues, STRAIN, r_strain_vector); } // We compute the stress @@ -136,9 +122,8 @@ void ViscousGeneralizedMaxwell::ComputeViscoElasticity(Con // Elastic Matrix Matrix constitutive_matrix; - this->CalculateValue(rValues, CONSTITUTIVE_MATRIX, constitutive_matrix); + BaseType::CalculateValue(rValues, CONSTITUTIVE_MATRIX, constitutive_matrix); - const Vector& r_strain_vector = rValues.GetStrainVector(); const Vector& r_previous_strain = this->GetPreviousStrainVector(); const Vector& r_previous_stress = this->GetPreviousStressVector(); const Vector& r_strain_increment = r_strain_vector - r_previous_strain; @@ -149,13 +134,14 @@ void ViscousGeneralizedMaxwell::ComputeViscoElasticity(Con noalias(integrated_stress_vector) = r_previous_stress * std::exp(-time_step / delay_time) + prod(constitutive_matrix, r_auxiliary_strain); if (r_flags.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR)) { - rValues.SetConstitutiveMatrix(constitutive_matrix); + Matrix& r_constitutive_matrix = rValues.GetConstitutiveMatrix(); + noalias(r_constitutive_matrix) = constitutive_matrix; } } else { // Elastic Matrix if( r_flags.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ) { Matrix& r_constitutive_matrix = rValues.GetConstitutiveMatrix(); - this->CalculateValue(rValues, CONSTITUTIVE_MATRIX, r_constitutive_matrix); + BaseType::CalculateValue(rValues, CONSTITUTIVE_MATRIX, r_constitutive_matrix); } } } @@ -203,9 +189,9 @@ void ViscousGeneralizedMaxwell::FinalizeMaterialResponseCa const Flags& r_flags = rValues.GetOptions(); // We compute the strain in case not provided + Vector& r_strain_vector = rValues.GetStrainVector(); if (r_flags.IsNot( ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) { - Vector& r_strain_vector = rValues.GetStrainVector(); - this->CalculateValue(rValues, STRAIN, r_strain_vector); + BaseType::CalculateValue(rValues, STRAIN, r_strain_vector); } @@ -214,9 +200,8 @@ void ViscousGeneralizedMaxwell::FinalizeMaterialResponseCa // Elastic Matrix Matrix constitutive_matrix; - this->CalculateValue(rValues, CONSTITUTIVE_MATRIX, constitutive_matrix); + BaseType::CalculateValue(rValues, CONSTITUTIVE_MATRIX, constitutive_matrix); - const Vector& r_strain_vector = rValues.GetStrainVector(); const Vector& r_previous_strain = this->GetPreviousStrainVector(); const Vector& r_previous_stress = this->GetPreviousStressVector(); const Vector& r_strain_increment = r_strain_vector - r_previous_strain; @@ -226,21 +211,8 @@ void ViscousGeneralizedMaxwell::FinalizeMaterialResponseCa noalias(integrated_stress_vector) = r_previous_stress * std::exp(-time_step / delay_time) + prod(constitutive_matrix, r_auxiliary_strain); - mPrevStressVector = integrated_stress_vector; - mPrevStrainVector = r_strain_vector; -} - -/***********************************************************************************/ -/***********************************************************************************/ - -template -Vector& ViscousGeneralizedMaxwell::CalculateValue( - ConstitutiveLaw::Parameters& rParameterValues, - const Variable& rThisVariable, - Vector& rValue - ) -{ - return BaseType::CalculateValue(rParameterValues, rThisVariable, rValue); + noalias(mPrevStressVector) = integrated_stress_vector; + noalias(mPrevStrainVector) = r_strain_vector; } /***********************************************************************************/ diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_maxwell.h b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_maxwell.h index bafb22149f63..52514cc2fd4d 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_maxwell.h +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/viscous/viscous_generalized_maxwell.h @@ -150,20 +150,6 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) ViscousGeneralizedMaxwell */ void CalculateMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) override; - /** - * to be called at the end of each solution step - * (e.g. from Element::FinalizeSolutionStep) - * @param rMaterialProperties the Properties instance of the current element - * @param rElementGeometry the geometry of the current element - * @param rShapeFunctionsValues the shape functions values in the current integration point - * @param the current ProcessInfo instance - */ - void FinalizeSolutionStep( - const Properties &rMaterialProperties, - const GeometryType &rElementGeometry, - const Vector &rShapeFunctionsValues, - const ProcessInfo &rCurrentProcessInfo) override; - /** * Finalize the material response in terms of 1st Piola-Kirchhoff stresses * @see Parameters @@ -188,19 +174,6 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) ViscousGeneralizedMaxwell */ void FinalizeMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) override; - /** - * @brief Calculates the value of a specified variable (Vector) - * @param rParameterValues the needed parameters for the CL calculation - * @param rThisVariable the variable to be returned - * @param rValue a reference to the returned value - * @param rValue output: the value of the specified variable - */ - Vector& CalculateValue( - ConstitutiveLaw::Parameters& rParameterValues, - const Variable& rThisVariable, - Vector& rValue - ) override; - /** * @brief Calculates the value of a specified variable (Matrix) * @param rParameterValues the needed parameters for the CL calculation