68 {
70
74
76
78 ->evalFEAtThePoint<DIM>(
83
84 auto process_scalar_field =
85 [](const std::string label,
86 const boost::shared_ptr<VectorDouble> scalarFieldPtr) {
87 if (scalarFieldPtr->size()) {
88 auto t_scalar_holder = getFTensor0FromVec(*scalarFieldPtr);
89
91 << "For " << label << " field, " << t_scalar_holder;
92 }
93 };
94
95 auto process_vector_field =
96 [](const std::string label,
97 const boost::shared_ptr<MatrixDouble> vecFieldPtr) {
98 if (vecFieldPtr->size1()) {
99 auto t_vec_holder = getFTensor1FromMat<DIM>(*vecFieldPtr);
100
101 std::string vec_holder_string = "";
102 for (
int i = 0;
i < DIM;
i++) {
103 vec_holder_string +=
104 " " + boost::lexical_cast<std::string>(t_vec_holder(
i));
105 }
106
108 << "For " << label << " field," << vec_holder_string;
109 }
110 };
111
112 auto process_sym_tensor_field =
113 [](const std::string label,
114 const boost::shared_ptr<MatrixDouble> symTensorFieldPtr) {
115 if (symTensorFieldPtr->size1()) {
116 auto t_sym_tensor_holder =
117 getFTensor2SymmetricFromMat<DIM>(*symTensorFieldPtr);
118
119 std::string sym_tensor_holder_string = "";
120 for (
int i = 0;
i < DIM;
i++) {
121 for (
int j =
i;
j < DIM;
j++) {
122 sym_tensor_holder_string +=
123 ", entry " + boost::lexical_cast<std::string>(
i) +
124 boost::lexical_cast<std::string>(
j) +
" = ";
125 sym_tensor_holder_string +=
126 boost::lexical_cast<std::string>(t_sym_tensor_holder(
i,
j));
127 }
128 }
129
131 << "For " << label << " field" << sym_tensor_holder_string;
132 }
133 };
134
135 auto process_tensor_field =
136 [](const std::string label,
137 const boost::shared_ptr<MatrixDouble> tensorFieldPtr) {
138 if (tensorFieldPtr->size1()) {
139 auto t_tensor_holder =
140 getFTensor2FromMat<DIM, DIM>(*tensorFieldPtr);
141
142 std::string tensor_holder_string = "";
143 for (
int i = 0;
i < DIM;
i++) {
144 for (
int j = 0;
j < DIM;
j++) {
145 tensor_holder_string +=
146 ", entry " + boost::lexical_cast<std::string>(
i) +
147 boost::lexical_cast<std::string>(
j) +
" = ";
148 tensor_holder_string +=
149 boost::lexical_cast<std::string>(t_tensor_holder(
i,
j));
150 }
151 }
152
154 << "For " << label << " field" << tensor_holder_string;
155 }
156 };
157
160 const std::string &label = pair.first;
161 const boost::shared_ptr<VectorDouble> &ptr = pair.second;
162
163 if (ptr) {
164 process_scalar_field(label, ptr);
165 }
166 }
167 }
168
171 const std::string &label = pair.first;
172 const boost::shared_ptr<MatrixDouble> &ptr = pair.second;
173
174 if (ptr) {
175 process_vector_field(label, ptr);
176 }
177 }
178 }
179
182 const std::string &label = pair.first;
183 const boost::shared_ptr<MatrixDouble> &ptr = pair.second;
184
185 if (ptr) {
186 process_sym_tensor_field(label, ptr);
187 }
188 }
189 }
190
193 const std::string &label = pair.first;
194 const boost::shared_ptr<MatrixDouble> &ptr = pair.second;
195
196 if (ptr) {
197 process_tensor_field(label, ptr);
198 }
199 }
200 }
201 }
202
204
205 auto make_vtk = [&]() {
210 "out_plastic_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
211 }
214 getCacheWeakPtr());
216 "out_skin_plastic_" + boost::lexical_cast<std::string>(ts_step) +
217 ".h5m");
218 }
220 };
221
222 auto calculate_reaction = [&]() {
228
229#ifndef NDEBUG
230 auto post_proc_residual = [&](auto dm, auto f_res, auto out_name) {
232 auto post_proc_fe =
233 boost::make_shared<PostProcBrokenMeshInMoab<DomainEle>>(*m_field_ptr);
234 using OpPPMap = OpPostProcMapInMoab<DIM, DIM>;
235 auto u_vec = boost::make_shared<MatrixDouble>();
236 post_proc_fe->getOpPtrVector().push_back(
237 new OpCalculateVectorFieldValues<DIM>("U", u_vec, f_res));
238 post_proc_fe->getOpPtrVector().push_back(
239
241
242 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
243
244 {},
245
246 {{"RES", u_vec}},
247
248 {}, {})
249
250 );
251
253 post_proc_fe->writeFile("res.h5m");
255 };
256
257 CHKERR post_proc_residual(
dM, r,
"reaction");
258#endif
259
261 };
262
263 auto print_max_min = [&](auto &tuple, const std::string msg) {
265 CHKERR VecScatterBegin(std::get<1>(tuple), ts_u, std::get<0>(tuple),
266 INSERT_VALUES, SCATTER_FORWARD);
267 CHKERR VecScatterEnd(std::get<1>(tuple), ts_u, std::get<0>(tuple),
268 INSERT_VALUES, SCATTER_FORWARD);
269 double max, min;
270 CHKERR VecMax(std::get<0>(tuple), PETSC_NULLPTR, &max);
271 CHKERR VecMin(std::get<0>(tuple), PETSC_NULLPTR, &min);
272 MOFEM_LOG_C(
"PLASTICITY", Sev::inform,
"%s time %3.4e min %3.4e max %3.4e",
273 msg.c_str(), ts_t, min, max);
275 };
276
277 int se = 1;
279 if (!(ts_step % se)) {
281 }
283 CHKERR calculate_reaction();
286 if (DIM == 3)
288
290}
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
#define MOFEM_LOG_C(channel, severity, format,...)
void simple(double P1[], double P2[], double P3[], double c[], const int N)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
auto createDMVector(DM dm, RowColData rc=RowColData::COL)
Get smart vector from DM.
PetscErrorCode DMoFEMGetInterfacePtr(DM dm, MoFEM::Interface **m_field_ptr)
Get pointer to MoFEM::Interface.
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
Deprecated interface functions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
PetscBool do_eval_field
Evaluate field.