v0.13.2
Loading...
Searching...
No Matches
PlasticOpsSmallStrains.hpp
Go to the documentation of this file.
1
2
3/** \file PlasticOpsSmallStrains.hpp
4 * \example PlasticOpsSmallStrains.hpp
5 */
6
7namespace PlasticOps {
8
10 const std::string row_field_name, const std::string col_field_name,
11 boost::shared_ptr<CommonData> common_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), mDPtr(m_D_ptr) {
16 sYmm = false;
17}
18
20get_mat_vector_dtensor_sym(size_t rr, MatrixDouble &mat, FTensor::Number<2>) {
22 &mat(2 * rr + 0, 0), &mat(2 * rr + 0, 1), &mat(2 * rr + 0, 2),
23 &mat(2 * rr + 1, 0), &mat(2 * rr + 1, 1), &mat(2 * rr + 1, 2)};
24}
25
27get_mat_vector_dtensor_sym(size_t rr, MatrixDouble &mat, FTensor::Number<3>) {
29 &mat(3 * rr + 0, 0), &mat(3 * rr + 0, 1), &mat(3 * rr + 0, 2),
30 &mat(3 * rr + 0, 3), &mat(3 * rr + 0, 4), &mat(3 * rr + 0, 5),
31
32 &mat(3 * rr + 1, 0), &mat(3 * rr + 1, 1), &mat(3 * rr + 1, 2),
33 &mat(3 * rr + 1, 3), &mat(3 * rr + 1, 4), &mat(3 * rr + 1, 5),
34
35 &mat(3 * rr + 2, 0), &mat(3 * rr + 2, 1), &mat(3 * rr + 2, 2),
36 &mat(3 * rr + 2, 3), &mat(3 * rr + 2, 4), &mat(3 * rr + 2, 5)};
37}
38
40 EntitiesFieldData::EntData &row_data,
41 EntitiesFieldData::EntData &col_data) {
43
45
46 const size_t nb_integration_pts = row_data.getN().size1();
47 const size_t nb_row_base_functions = row_data.getN().size2();
48
49 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*mDPtr);
50 auto t_L = symm_L_tensor();
51
53 t_DL(i, j, L) = t_D(i, j, k, l) * t_L(k, l, L);
54
55 auto t_w = getFTensor0IntegrationWeight();
56 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
57 for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
58 double alpha = getMeasure() * t_w;
59 ++t_w;
60
61 size_t rr = 0;
62 for (; rr != AssemblyDomainEleOp::nbRows / SPACE_DIM; ++rr) {
63
64 auto t_mat =
66
68 t_tmp(i, L) = (t_DL(i, j, L)) * (alpha * t_row_diff_base(j));
69
70 auto t_col_base = col_data.getFTensor0N(gg, 0);
71 for (size_t cc = 0; cc != AssemblyDomainEleOp::nbCols / size_symm; ++cc) {
72
73 t_mat(i, L) -= (t_col_base * t_tmp(i, L));
74
75 ++t_mat;
76 ++t_col_base;
77 }
78
79 ++t_row_diff_base;
80 }
81
82 for (; rr < nb_row_base_functions; ++rr)
83 ++t_row_diff_base;
84
85 }
86
88}
89
91 const std::string row_field_name, const std::string col_field_name,
92 boost::shared_ptr<CommonData> common_data_ptr,
93 boost::shared_ptr<MatrixDouble> m_D_ptr)
94 : AssemblyDomainEleOp(row_field_name, col_field_name,
95 DomainEleOp::OPROWCOL),
96 commonDataPtr(common_data_ptr), mDPtr(m_D_ptr) {
97 sYmm = false;
98}
99
100MoFEMErrorCode
101OpCalculatePlasticFlowLhs_dU::iNtegrate(EntitiesFieldData::EntData &row_data,
102 EntitiesFieldData::EntData &col_data) {
104
106
107 const size_t nb_integration_pts = getGaussPts().size2();
108 const size_t nb_row_base_functions = row_data.getN().size2();
109
110 auto t_res_flow_dstrain = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM>(
111 commonDataPtr->resFlowDstrain);
112
113 auto next = [&]() {
114 ++t_res_flow_dstrain;
115 };
116
117 auto t_L = symm_L_tensor();
118 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
120 t_diff_grad;
121 t_diff_grad(i, j, k, l) = t_kd(i, k) * t_kd(j, l);
122
123 auto t_w = getFTensor0IntegrationWeight();
124 auto t_row_base = row_data.getFTensor0N();
125 for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
126
127 double alpha = getMeasure() * t_w;
128 ++t_w;
130 t_res_tens(L, i, j) =
131 alpha * ((t_L(m, n, L) * (t_res_flow_dstrain(m, n, k, l))) *
132 t_diff_grad(k, l, i, j));
133 next();
134
135 size_t rr = 0;
136 for (; rr != AssemblyDomainEleOp::nbRows / size_symm; ++rr) {
137 auto t_mat =
139 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
140 for (size_t cc = 0; cc != AssemblyDomainEleOp::nbCols / SPACE_DIM; ++cc) {
141 t_mat(L, l) += t_row_base * (t_res_tens(L, l, k) * t_col_diff_base(k));
142 ++t_mat;
143 ++t_col_diff_base;
144 }
145 ++t_row_base;
146 }
147
148 for (; rr < nb_row_base_functions; ++rr)
149 ++t_row_base;
150 }
151
153}
154
156 const std::string row_field_name, const std::string col_field_name,
157 boost::shared_ptr<CommonData> common_data_ptr,
158 boost::shared_ptr<MatrixDouble> m_D_ptr)
159 : AssemblyDomainEleOp(row_field_name, col_field_name,
160 DomainEleOp::OPROWCOL),
161 commonDataPtr(common_data_ptr), mDPtr(m_D_ptr) {
162 sYmm = false;
163}
164
165MoFEMErrorCode
166OpCalculateConstraintsLhs_dU::iNtegrate(EntitiesFieldData::EntData &row_data,
167 EntitiesFieldData::EntData &col_data) {
169
171
172 const auto nb_integration_pts = getGaussPts().size2();
173 const auto nb_row_base_functions = row_data.getN().size2();
174
175 auto t_c_dstrain =
176 getFTensor2SymmetricFromMat<SPACE_DIM>(commonDataPtr->resCdStrain);
177 auto t_diff_grad_symmetrise = diff_symmetrize();
178
179 auto next = [&]() {
180 ++t_c_dstrain;
181 };
182
183 auto get_mat_scalar_dvector = [&]() {
184 if constexpr (SPACE_DIM == 2)
186 &locMat(0, 1)};
187 else
189 &locMat(0, 0), &locMat(0, 1), &locMat(0, 2)};
190 };
191
192 auto t_w = getFTensor0IntegrationWeight();
193 auto t_row_base = row_data.getFTensor0N();
194 for (auto gg = 0; gg != nb_integration_pts; ++gg) {
195 double alpha = getMeasure() * t_w;
196 ++t_w;
197
199 t_res_mat(i, j) =
200 ((t_c_dstrain(k, l)) * t_diff_grad_symmetrise(k, l, i, j));
201 next();
202
203 auto t_mat = get_mat_scalar_dvector();
204 size_t rr = 0;
205 for (; rr != AssemblyDomainEleOp::nbRows; ++rr) {
206 const double row_base = alpha * t_row_base;
207 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
208 for (size_t cc = 0; cc != AssemblyDomainEleOp::nbCols / SPACE_DIM; cc++) {
209 t_mat(i) += row_base * (t_res_mat(i, j) * t_col_diff_base(j));
210 ++t_mat;
211 ++t_col_diff_base;
212 }
213 ++t_row_base;
214 }
215 for (; rr != nb_row_base_functions; ++rr)
216 ++t_row_base;
217 }
218
220}
221
222}; // 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 nbRows
number of dofs on rows
MatrixDouble locMat
local entity block matrix
int nbCols
number if dof on column
OpCalculateConstraintsLhs_dU(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr)
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOps.hpp:261
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
OpCalculatePlasticFlowLhs_dU(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr)
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOps.hpp:206
OpCalculatePlasticInternalForceLhs_dEP(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< MatrixDouble > mDPtr
Definition: PlasticOps.hpp:176