-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTPZElasticityPhaseField.h
188 lines (161 loc) · 6.15 KB
/
TPZElasticityPhaseField.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#ifndef TPZElasticityPhaseField_H
#define TPZElasticityPhaseField_H
#include "Elasticity/TPZElasticity2D.h"
#include "TPZMatCombinedSpaces.h"
#include "TPZMatErrorCombinedSpaces.h"
#include "TPZPhaseField.h"
class TPZPhaseField;
class TPZElasticityPhaseField : public TPZElasticity2D, public TPZMatCombinedSpacesT<STATE>, public TPZMatErrorCombinedSpaces<STATE> {
public:
/**
* @brief Default constructor
*/
TPZElasticityPhaseField();
/**
* @brief Class constructor
* @param [in] id material id
* @param [in] dim problem dimension
*/
TPZElasticityPhaseField(int id, int dim);
// TPZElasticityPhaseField(const TPZElasticityPhaseField ©) : TPZElasticity2D(copy), TPZMatCombinedSpacesT<STATE>(copy), TPZMatErrorCombinedSpaces<STATE>(copy) {
// }
// TPZElasticityPhaseField &operator=(const TPZElasticityPhaseField ©) {
// TPZElasticity2D::operator=(copy);
// TPZMatCombinedSpacesT<STATE>::operator=(copy);
// TPZMatErrorCombinedSpaces<STATE>::operator=(copy);
// return *this;
// }
// /**
// * @brief Returns the problem dimension
// */
// [[nodiscard]] int Dimension() const override {
// return this->fDim;
// }
/**
* @brief Returns the number of state variables
*/
[[nodiscard]] int NStateVariables() const override {
return 2;
}
/**
* @brief Returns a 'std::string' with the name of the material
*/
[[nodiscard]] std::string Name() const override { return "TPZElasticityPhaseField"; }
/*
* @brief Fill requirements for volumetric contribute
*/
void FillDataRequirements(TPZVec<TPZMaterialDataT<STATE>> &datavec) const override;
/*
* @brief Fill requirements for boundary contribute
*/
void FillBoundaryConditionDataRequirements(int type, TPZVec<TPZMaterialDataT<STATE>> &datavec) const override;
virtual int NEvalErrors() const override { return 4; }
/** @name Contribute */
/** @{ */
/**
* @brief It computes a contribution to the stiffness matrix
* and load vector at one integration point.
* @param[in] datavec stores all input data
* @param[in] weight is the weight of the integration rule
* @param[out] ek is the element matrix
* @param[out] ef is the rhs vector
*/
virtual void Contribute(const TPZVec<TPZMaterialDataT<STATE>> &datavec,
REAL weight, TPZFMatrix<STATE> &ek,
TPZFMatrix<STATE> &ef) override;
/**@}*/
/** @name ContributeBC
@ingroup Contribute*/
/**@{*/
/**
* @brief It computes a contribution to the stiffness matrix
* and load vector at one BC integration point.
* @param[in] datavec stores all input data
* @param[in] weight is the weight of the integration rule
* @param[out] ek is the element matrix
* @param[out] ef is the rhs vector
* @param[in] bc is the boundary condition material
*/
virtual void ContributeBC(const TPZVec<TPZMaterialDataT<STATE>> &datavec,
REAL weight, TPZFMatrix<STATE> &ek,
TPZFMatrix<STATE> &ef,
TPZBndCondT<STATE> &bc) override;
/**@}*/
/** @brief Returns the solution associated with a given index
based on the finite element approximation.
@param[in] datavec Stores all the input data.
@param[in] var Index of the queried solution
@param[out] sol FEM Solution at the integration point
*/
virtual void Solution(const TPZVec<TPZMaterialDataT<STATE>> &datavec,
int var, TPZVec<STATE> &sol) override;
/**
* @brief Returns an integer associated with a post-processing variable name
* @param [in] name string containing the name of the post-processing variable. Ex: "Pressure".
*/
[[nodiscard]] int VariableIndex(const std::string &name) const override;
/**
* @brief Returns an integer with the dimension of a post-processing variable
* @param [in] var index of the post-processing variable, according to TPZDarcyFlow::VariableIndex method.
*/
[[nodiscard]] int NSolutionVariables(int var) const override;
//! @name Error
/** @{*/
/*!
\brief Calculates the error at a given point x.
\param[in] datavec input data
\param[out] errors The calculated errors.
*/
virtual void Errors(const TPZVec<TPZMaterialDataT<STATE>> &data,
TPZVec<REAL> &errors) override;
/**
* @brief Returns an unique class identifier
*/
[[nodiscard]] int ClassId() const override;
/** @brief Writes this object to the TPZStream buffer. Include the classid if `withclassid = true` */
virtual void Write(TPZStream &buf, int withclassid) const override {
}
/** @brief Reads an objects from the TPZStream buffer. */
virtual void Read(TPZStream &buf, void *context) override {
}
/**
* @brief Creates another material of the same type
*/
[[nodiscard]] TPZMaterial *NewMaterial() const override;
/**
* @brief Prints data associated with the material.
*/
void Print(std::ostream &out) const override;
/** @brief Creates an associated boundary condition.
@param[in] reference The volumetric material associated with the BC.
@param[in] id Boundary condition identifier.
@param[in] type Type of the boundary condition.
@param[in] val1 Value to be set at the element matrix.
@param[in] val2 Value to be set at the rhs vector.
*/
virtual TPZBndCondT<STATE> *CreateBC(TPZMaterial *reference,
int id, int type,
const TPZFMatrix<STATE> &val1,
const TPZVec<STATE> &val2) override {
return new TPZBndCondBase<STATE, TPZMatCombinedSpacesBC<STATE>, TPZMatErrorCombinedSpacesBC<STATE>>(reference, id, type, val1, val2);
}
/**
* @brief Sets the phase field material
* @param[in] phaseFieldMat Pointer to the phase field material
*/
void SetPhaseFieldMaterial(TPZPhaseField* phaseFieldMat) {
fPhaseFieldMat = phaseFieldMat;
}
/**
* @brief Sets the current time
* @param[in] time Current time
*/
void SetTime(REAL time) {
fTime = time;
}
protected:
TPZPhaseField* fPhaseFieldMat;
/// Current time normalized between 0 and 1. Used for incremental displacement
REAL fTime = 0.;
};
#endif