Skip to content

Commit a844ca8

Browse files
updating plane stress
1 parent d4debc3 commit a844ca8

File tree

2 files changed

+32
-161
lines changed

2 files changed

+32
-161
lines changed

applications/ConstitutiveLawsApplication/custom_constitutive/thermal/small_strains/elastic/thermal_linear_plane_stress.cpp

Lines changed: 13 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -29,91 +29,6 @@ namespace Kratos
2929
/***********************************************************************************/
3030
/***********************************************************************************/
3131

32-
void ThermalLinearPlaneStress::CalculateMaterialResponsePK2(ConstitutiveLaw::Parameters& rValues)
33-
{
34-
KRATOS_TRY
35-
36-
Flags& r_constitutive_law_options = rValues.GetOptions();
37-
ConstitutiveLaw::StrainVectorType& r_strain_vector = rValues.GetStrainVector();
38-
39-
if (r_constitutive_law_options.IsNot(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) {
40-
// Since we are in small strains, any strain measure works, e.g. CAUCHY_GREEN
41-
CalculateCauchyGreenStrain(rValues, r_strain_vector);
42-
}
43-
44-
// We add the thermal contribution
45-
AdvancedConstitutiveLawUtilities<3>::SubstractThermalStrain(r_strain_vector, mReferenceTemperature, rValues);
46-
47-
// We add the initial strains
48-
AddInitialStrainVectorContribution<StrainVectorType>(r_strain_vector);
49-
50-
51-
if (r_constitutive_law_options.Is(ConstitutiveLaw::COMPUTE_STRESS)) {
52-
ConstitutiveLaw::StressVectorType &r_stress_vector = rValues.GetStressVector();
53-
CalculatePK2Stress(r_strain_vector, r_stress_vector, rValues);
54-
AddInitialStressVectorContribution<StressVectorType>(r_stress_vector);
55-
}
56-
57-
if (r_constitutive_law_options.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR)) {
58-
ConstitutiveLaw::VoigtSizeMatrixType &r_constitutive_matrix = rValues.GetConstitutiveMatrix();
59-
CalculateElasticMatrix(r_constitutive_matrix, rValues);
60-
}
61-
62-
KRATOS_CATCH("")
63-
}
64-
65-
/***********************************************************************************/
66-
/***********************************************************************************/
67-
68-
int ThermalLinearPlaneStress::Check(
69-
const Properties& rMaterialProperties,
70-
const GeometryType& rElementGeometry,
71-
const ProcessInfo& rCurrentProcessInfo
72-
) const
73-
{
74-
KRATOS_ERROR_IF_NOT(rElementGeometry[0].SolutionStepsDataHas(TEMPERATURE)) << "The TEMPERATURE variable is not available at the nodes." << std::endl;
75-
KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(THERMAL_EXPANSION_COEFFICIENT)) << "The THERMAL_EXPANSION_COEFFICIENT is not set in the material properties." << std::endl;
76-
KRATOS_ERROR_IF(rMaterialProperties[THERMAL_EXPANSION_COEFFICIENT] < 0.0) << "The THERMAL_EXPANSION_COEFFICIENT is negative..." << std::endl;
77-
KRATOS_ERROR_IF_NOT(rElementGeometry.Has(REFERENCE_TEMPERATURE) || rMaterialProperties.Has(REFERENCE_TEMPERATURE)) << "The REFERENCE_TEMPERATURE is not given in the material properties nor via SetValue()" << std::endl;
78-
BaseType::Check(rMaterialProperties, rElementGeometry, rCurrentProcessInfo);
79-
return 0;
80-
}
81-
82-
/***********************************************************************************/
83-
/***********************************************************************************/
84-
85-
double& ThermalLinearPlaneStress::CalculateValue(
86-
ConstitutiveLaw::Parameters& rParameterValues,
87-
const Variable<double>& rThisVariable, double& rValue
88-
)
89-
{
90-
if (rThisVariable == REFERENCE_TEMPERATURE) {
91-
rValue = mReferenceTemperature;
92-
} else {
93-
BaseType::CalculateValue(rParameterValues, rThisVariable, rValue);
94-
}
95-
return (rValue);
96-
}
97-
98-
/***********************************************************************************/
99-
/***********************************************************************************/
100-
101-
void ThermalLinearPlaneStress::InitializeMaterial(
102-
const Properties& rMaterialProperties,
103-
const GeometryType& rElementGeometry,
104-
const Vector& rShapeFunctionsValues
105-
)
106-
{
107-
if (rElementGeometry.Has(REFERENCE_TEMPERATURE)) {
108-
mReferenceTemperature = rElementGeometry.GetValue(REFERENCE_TEMPERATURE);
109-
} else if (rMaterialProperties.Has(REFERENCE_TEMPERATURE)) {
110-
mReferenceTemperature = rMaterialProperties[REFERENCE_TEMPERATURE];
111-
}
112-
}
113-
114-
/***********************************************************************************/
115-
/***********************************************************************************/
116-
11732
void ThermalLinearPlaneStress::CalculatePK2Stress(
11833
const Vector& rStrainVector,
11934
ConstitutiveLaw::StressVectorType& rStressVector,
@@ -149,4 +64,17 @@ void ThermalLinearPlaneStress::CalculateElasticMatrix(
14964
/***********************************************************************************/
15065
/***********************************************************************************/
15166

67+
void ThermalLinearPlaneStress::SubstractThermalStrain(
68+
ConstitutiveLaw::StrainVectorType &rStrainVector,
69+
const double ReferenceTemperature,
70+
ConstitutiveLaw::Parameters &rParameters,
71+
const bool IsPlaneStrain
72+
)
73+
{
74+
AdvancedConstitutiveLawUtilities<3>::SubstractThermalStrain(rStrainVector, ReferenceTemperature, rParameters, false);
75+
}
76+
77+
/***********************************************************************************/
78+
/***********************************************************************************/
79+
15280
} // Namespace Kratos

applications/ConstitutiveLawsApplication/custom_constitutive/thermal/small_strains/elastic/thermal_linear_plane_stress.h

Lines changed: 19 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// External includes
1919

2020
// Project includes
21-
#include "custom_constitutive/linear_plane_stress.h"
21+
#include "thermal_linear_plane_strain.h"
2222

2323
namespace Kratos
2424
{
@@ -49,14 +49,14 @@ namespace Kratos
4949
* @author Alejandro Cornejo
5050
*/
5151
class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) ThermalLinearPlaneStress
52-
: public LinearPlaneStress
52+
: public ThermalLinearPlaneStrain
5353
{
5454
public:
5555

5656
///@name Type Definitions
5757
///@{
5858

59-
using BaseType = LinearPlaneStress;
59+
using BaseType = ThermalLinearPlaneStrain;
6060

6161
/// Counted pointer of LinearPlaneStrain
6262
KRATOS_CLASS_POINTER_DEFINITION(ThermalLinearPlaneStress);
@@ -88,8 +88,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) ThermalLinearPlaneStress
8888
* Copy constructor.
8989
*/
9090
ThermalLinearPlaneStress(const ThermalLinearPlaneStress &rOther)
91-
: BaseType(rOther),
92-
mReferenceTemperature(rOther.mReferenceTemperature)
91+
: BaseType(rOther)
9392
{
9493
}
9594

@@ -101,54 +100,6 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) ThermalLinearPlaneStress
101100
///@name Operations
102101
///@{
103102

104-
/**
105-
* @brief Computes the material response:
106-
* @details PK2 stresses and algorithmic ConstitutiveMatrix
107-
* @param rValues The internal values of the law
108-
* @see Parameters
109-
*/
110-
void CalculateMaterialResponsePK2(ConstitutiveLaw::Parameters &rValues) override;
111-
112-
/**
113-
* @brief This function provides the place to perform checks on the completeness of the input.
114-
* @details It is designed to be called only once (or anyway, not often) typically at the beginning of the calculations, so to verify that nothing is missing from the input or that no common error is found.
115-
* @param rMaterialProperties The properties of the material
116-
* @param rElementGeometry The geometry of the element
117-
* @param rCurrentProcessInfo The current process info instance
118-
* @return 0 if OK, 1 otherwise
119-
*/
120-
int Check(
121-
const Properties& rMaterialProperties,
122-
const GeometryType& rElementGeometry,
123-
const ProcessInfo& rCurrentProcessInfo
124-
) const override;
125-
126-
/**
127-
* @brief It calculates the value of a specified variable (double case)
128-
* @param rParameterValues the needed parameters for the CL calculation
129-
* @param rThisVariable the variable to be returned
130-
* @param rValue a reference to the returned value
131-
* @return rValue output: the value of the specified variable
132-
*/
133-
double& CalculateValue(
134-
ConstitutiveLaw::Parameters& rParameterValues,
135-
const Variable<double>& rThisVariable,
136-
double& rValue
137-
) override;
138-
139-
/**
140-
* This is to be called at the very beginning of the calculation
141-
* (e.g. from InitializeElement) in order to initialize all relevant
142-
* attributes of the constitutive law
143-
* @param rMaterialProperties the Properties instance of the current element
144-
* @param rElementGeometry the geometry of the current element
145-
* @param rShapeFunctionsValues the shape functions values in the current integration point
146-
*/
147-
void InitializeMaterial(
148-
const Properties &rMaterialProperties,
149-
const GeometryType &rElementGeometry,
150-
const Vector &rShapeFunctionsValues) override;
151-
152103
/**
153104
* @brief It calculates the stress vector
154105
* @param rStrainVector The strain vector in Voigt notation
@@ -173,6 +124,19 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) ThermalLinearPlaneStress
173124
ConstitutiveLaw::Parameters& rValues
174125
) override;
175126

127+
/**
128+
* @brief It calculates and substracts the thermal strain
129+
* @param rStrainVector The strain vector
130+
* @param ReferenceTemperature the reference temeprature
131+
* @param ReferenceTemperature Parameters of the constitutive law
132+
* @param IsPlaneStrain indicator of plane strain
133+
*/
134+
void SubstractThermalStrain(
135+
ConstitutiveLaw::StrainVectorType &rStrainVector,
136+
const double ReferenceTemperature,
137+
ConstitutiveLaw::Parameters &rParameters,
138+
const bool IsPlaneStrain = false) override;
139+
176140
///@}
177141
///@name Access
178142
///@{
@@ -219,7 +183,6 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) ThermalLinearPlaneStress
219183
///@name Member Variables
220184
///@{
221185

222-
double mReferenceTemperature = 0.0;
223186

224187
///@}
225188
///@name Private Operators
@@ -235,39 +198,19 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) ThermalLinearPlaneStress
235198
///@{
236199
///@}
237200

238-
/**
239-
* @brief Retrieves the reference temperature
240-
* @return The reference temperature
241-
*/
242-
double& GetReferenceTemperature()
243-
{
244-
return mReferenceTemperature;
245-
}
246-
247-
/**
248-
* @brief Sets the reference temperature
249-
* @param ToRefTemperature The reference temperature
250-
*/
251-
void SetReferenceTemperature(const double ToRefTemperature)
252-
{
253-
mReferenceTemperature = ToRefTemperature;
254-
}
255-
256201
///@}
257202
///@name Serialization
258203
///@{
259204
friend class Serializer;
260205

261206
void save(Serializer& rSerializer) const override
262207
{
263-
KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, ElasticIsotropic3D)
264-
rSerializer.save("ReferenceTemperature", mReferenceTemperature);
208+
KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, ThermalLinearPlaneStrain)
265209
}
266210

267211
void load(Serializer& rSerializer) override
268212
{
269-
KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, ElasticIsotropic3D)
270-
rSerializer.load("ReferenceTemperature", mReferenceTemperature);
213+
KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, ThermalLinearPlaneStrain)
271214
}
272215

273216

0 commit comments

Comments
 (0)