v0.13.1
Loading...
Searching...
No Matches
PlasticOpsLargeStrains.hpp
Go to the documentation of this file.
1/** \file PlasticOpsLargeStrains.hpp
2 * \example PlasticOpsLargeStrains.hpp
3 */
4
5namespace PlasticOps {
6
9 const std::string row_field_name, const std::string col_field_name,
10 boost::shared_ptr<CommonData> common_data_ptr,
11 boost::shared_ptr<HenckyOps::CommonData> common_henky_data_ptr,
12 boost::shared_ptr<MatrixDouble> m_D_ptr)
13 : AssemblyDomainEleOp(row_field_name, col_field_name,
14 DomainEleOp::OPROWCOL),
15 commonDataPtr(common_data_ptr),
16 commonHenckyDataPtr(common_henky_data_ptr), mDPtr(m_D_ptr) {
17 sYmm = false;
18}
19
21 EntitiesFieldData::EntData &row_data,
22 EntitiesFieldData::EntData &col_data) {
24
26
27 const size_t nb_integration_pts = row_data.getN().size1();
28 const size_t nb_row_base_functions = row_data.getN().size2();
29
30 if (AssemblyDomainEleOp::rowType == MBVERTEX &&
32 resDiff.resize(SPACE_DIM * SPACE_DIM * size_symm, nb_integration_pts,
33 false);
34 auto t_res_diff =
35 getFTensor3FromMat<SPACE_DIM, SPACE_DIM, size_symm>(resDiff);
36 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*mDPtr);
37 auto t_logC_dC = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM>(
38 commonHenckyDataPtr->matLogCdC);
39 auto t_grad = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(
40 *(commonHenckyDataPtr->matGradPtr));
41 auto t_L = symm_L_tensor();
42 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
43 for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
45 t_F(i, j) = t_grad(i, j) + t_kd(i, j);
47 t_DLogC_dC;
48 t_DLogC_dC(i, j, k, l) = t_D(m, n, k, l) * t_logC_dC(m, n, i, j);
50 t_FDLogC_dC;
51 t_FDLogC_dC(i, j, k, l) = t_F(i, m) * t_DLogC_dC(m, j, k, l);
53 t_res_diff(i, j, L) = t_FDLogC_dC(i, j, k, l) * t_L(k, l, L);
54 ++t_logC_dC;
55 ++t_grad;
56 ++t_res_diff;
57 }
58 }
59
60 auto t_w = getFTensor0IntegrationWeight();
61 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
62 auto t_res_diff =
63 getFTensor3FromMat<SPACE_DIM, SPACE_DIM, size_symm>(resDiff);
64
65 for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
66 double alpha = getMeasure() * t_w;
67
68 size_t rr = 0;
69 for (; rr != AssemblyDomainEleOp::nbRows / SPACE_DIM; ++rr) {
70
71 auto t_mat =
73
75 t_tmp(i, L) = (t_res_diff(i, j, L) * (alpha * t_row_diff_base(j)));
76
77 auto t_col_base = col_data.getFTensor0N(gg, 0);
78 for (size_t cc = 0; cc != AssemblyDomainEleOp::nbCols / size_symm; ++cc) {
79
80 t_mat(i, L) -= (t_col_base * t_tmp(i, L));
81
82 ++t_mat;
83 ++t_col_base;
84 }
85
86 ++t_row_diff_base;
87 }
88
89 for (; rr < nb_row_base_functions; ++rr)
90 ++t_row_diff_base;
91
92 ++t_w;
93 ++t_res_diff;
94 }
95
97}
98
100 const std::string row_field_name, const std::string col_field_name,
101 boost::shared_ptr<CommonData> common_data_ptr,
102 boost::shared_ptr<HenckyOps::CommonData> comman_henky_data_ptr,
103 boost::shared_ptr<MatrixDouble> m_D_ptr)
104 : AssemblyDomainEleOp(row_field_name, col_field_name,
105 DomainEleOp::OPROWCOL),
106 commonDataPtr(common_data_ptr),
107 commonHenckyDataPtr(comman_henky_data_ptr), mDPtr(m_D_ptr) {
108 sYmm = false;
109}
110
112 EntitiesFieldData::EntData &row_data,
113 EntitiesFieldData::EntData &col_data) {
115
117
118 const auto nb_integration_pts = getGaussPts().size2();
119 const auto nb_row_base_functions = row_data.getN().size2();
120
121 if (AssemblyDomainEleOp::colType == MBVERTEX &&
123
124 resDiff.resize(size_symm * SPACE_DIM * SPACE_DIM, nb_integration_pts,
125 false);
126 auto t_res_diff =
127 getFTensor3FromMat<size_symm, SPACE_DIM, SPACE_DIM>(resDiff);
128
129 auto t_res_flow_dstrain = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM>(
130 commonDataPtr->resFlowDstrain);
131 auto t_grad =
132 getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*(commonDataPtr->mGradPtr));
133 auto t_logC_dC = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM>(
134 commonHenckyDataPtr->matLogCdC);
135
136 auto next = [&]() {
137 ++t_res_flow_dstrain;
138 ++t_grad;
139 ++t_logC_dC;
140 ++t_res_diff;
141 };
142
143 auto t_L = symm_L_tensor();
144 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
146 t_diff_grad;
147 t_diff_grad(i, j, k, l) = t_kd(i, k) * t_kd(j, l);
148
149 for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
153 t_dC_dF;
154
155 t_diff_ls_dlogC_dC(i, j, k, l) =
156 (t_res_flow_dstrain(i, j, m, n)) * (t_logC_dC(m, n, k, l) / 2);
157
158 t_F(i, j) = t_grad(i, j) + t_kd(i, j);
159 t_dC_dF(i, j, k, l) = (t_kd(i, l) * t_F(k, j)) + (t_kd(j, l) * t_F(k, i));
160
162 t_res_diff(L, i, j) =
163 (t_L(m, n, L) * t_diff_ls_dlogC_dC(m, n, k, l)) * t_dC_dF(k, l, i, j);
164 next();
165 }
166 }
167
168 auto t_res_diff =
169 getFTensor3FromMat<size_symm, SPACE_DIM, SPACE_DIM>(resDiff);
170
171 auto t_w = getFTensor0IntegrationWeight();
172 auto t_row_base = row_data.getFTensor0N();
173 for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
174 double alpha = getMeasure() * t_w;
175 ++t_w;
176
177 size_t rr = 0;
178 for (; rr != AssemblyDomainEleOp::nbRows / size_symm; ++rr) {
179 const auto row_base = alpha * t_row_base;
180 auto t_mat =
182 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
183 for (auto cc = 0; cc != AssemblyDomainEleOp::nbCols / SPACE_DIM; ++cc) {
184 t_mat(L, l) += row_base * (t_res_diff(L, l, k) * t_col_diff_base(k));
185 ++t_mat;
186 ++t_col_diff_base;
187 }
188 ++t_row_base;
189 }
190
191 for (; rr < nb_row_base_functions; ++rr)
192 ++t_row_base;
193
194 ++t_res_diff;
195 }
196
198}
199
201 const std::string row_field_name, const std::string col_field_name,
202 boost::shared_ptr<CommonData> common_data_ptr,
203 boost::shared_ptr<HenckyOps::CommonData> comman_henky_data_ptr,
204 boost::shared_ptr<MatrixDouble> m_D_ptr)
205 : AssemblyDomainEleOp(row_field_name, col_field_name,
206 DomainEleOp::OPROWCOL),
207 commonDataPtr(common_data_ptr),
208 commonHenckyDataPtr(comman_henky_data_ptr), mDPtr(m_D_ptr) {
209 sYmm = false;
210}
211
213 EntitiesFieldData::EntData &row_data,
214 EntitiesFieldData::EntData &col_data) {
216 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
217
219 false);
220 locMat.clear();
221
222 const auto nb_integration_pts = getGaussPts().size2();
223 const auto nb_row_base_functions = row_data.getN().size2();
224
225 if (AssemblyDomainEleOp::colType == MBVERTEX &&
227
228 resDiff.resize(SPACE_DIM * SPACE_DIM, nb_integration_pts, false);
229 auto t_res_diff = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(resDiff);
230 auto t_grad =
231 getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*(commonDataPtr->mGradPtr));
232 auto t_logC_dC = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM>(
233 commonHenckyDataPtr->matLogCdC);
234 auto t_c_dstrain =
235 getFTensor2SymmetricFromMat<SPACE_DIM>(commonDataPtr->resCdStrain);
236
237 auto next = [&]() {
238 ++t_grad;
239 ++t_logC_dC;
240 ++t_c_dstrain;
241 ++t_res_diff;
242 };
243
244 auto t_diff_grad_symmetrise = diff_symmetrize();
245
246 for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
250 t_dC_dF;
251
252 t_diff_ls_dlog_c(k, l) =
253 (t_c_dstrain(i, j)) * (t_logC_dC(i, j, k, l) / 2);
254 t_F(i, j) = t_grad(i, j) + t_kd(i, j);
255 t_dC_dF(i, j, k, l) = (t_kd(i, l) * t_F(k, j)) + (t_kd(j, l) * t_F(k, i));
256
258 t_res_diff(i, j) = (t_diff_ls_dlog_c(k, l) * t_dC_dF(k, l, i, j));
259 next();
260 }
261 }
262
263 auto t_res_diff = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(resDiff);
264
265 auto t_w = getFTensor0IntegrationWeight();
266 auto t_row_base = row_data.getFTensor0N();
267 for (auto gg = 0; gg != nb_integration_pts; ++gg) {
268 double alpha = getMeasure() * t_w;
269 ++t_w;
270
271 auto t_mat = getFTensor1FromPtr<SPACE_DIM>(locMat.data().data());
272 size_t rr = 0;
273 for (; rr != AssemblyDomainEleOp::nbRows; ++rr) {
274 const auto row_base = alpha * t_row_base;
275 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
276 for (size_t cc = 0; cc != AssemblyDomainEleOp::nbCols / SPACE_DIM; cc++) {
277 t_mat(i) += row_base * (t_res_diff(i, j) * t_col_diff_base(j));
278 ++t_mat;
279 ++t_col_diff_base;
280 }
281 ++t_row_base;
282 }
283 for (; rr != nb_row_base_functions; ++rr)
284 ++t_row_base;
285
286 ++t_res_diff;
287 }
288
290}
291
292}; // namespace PlasticOps
constexpr int SPACE_DIM
Kronecker Delta class.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
constexpr auto t_kd
auto symm_L_tensor()
Definition: PlasticOps.hpp:315
FTensor::Index< 'j', SPACE_DIM > j
Definition: PlasticOps.hpp:93
FTensor::Index< 'L', size_symm > L
Definition: PlasticOps.hpp:106
FTensor::Index< 'l', SPACE_DIM > l
Definition: PlasticOps.hpp:95
FTensor::Index< 'k', SPACE_DIM > k
Definition: PlasticOps.hpp:94
FTensor::Index< 'i', SPACE_DIM > i
[Common data]
Definition: PlasticOps.hpp:92
FTensor::Index< 'm', SPACE_DIM > m
Definition: PlasticOps.hpp:96
auto diff_symmetrize()
Definition: PlasticOps.hpp:333
static FTensor::Tensor2< FTensor::PackPtr< double *, 3 >, 2, 3 > get_mat_vector_dtensor_sym(size_t rr, MatrixDouble &mat, FTensor::Number< 2 >)
FTensor::Index< 'n', SPACE_DIM > n
Definition: PlasticOps.hpp:97
static auto get_mat_tensor_sym_dvector(size_t rr, MatrixDouble &mat, FTensor::Number< 2 >)
[Lambda functions]
Definition: PlasticOps.hpp:587
constexpr auto size_symm
Definition: plastic.cpp:33
int rowSide
row side number
int colSide
column side number
int nbRows
number of dofs on rows
EntityType colType
column type
MatrixDouble locMat
local entity block matrix
int nbCols
number if dof on column
EntityType rowType
row type
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOps.hpp:275
boost::shared_ptr< HenckyOps::CommonData > commonHenckyDataPtr
Definition: PlasticOps.hpp:276
OpCalculateConstraintsLhs_LogStrain_dU(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< HenckyOps::CommonData > comman_henky_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
OpCalculatePlasticFlowLhs_LogStrain_dU(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< HenckyOps::CommonData > comman_henky_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr)
boost::shared_ptr< HenckyOps::CommonData > commonHenckyDataPtr
Definition: PlasticOps.hpp:221
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOps.hpp:220
boost::shared_ptr< HenckyOps::CommonData > commonHenckyDataPtr
Definition: PlasticOps.hpp:191
OpCalculatePlasticInternalForceLhs_LogStrain_dEP(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< HenckyOps::CommonData > common_henky_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)