13 std::pair<boost::shared_ptr<PostProcEle>,
14 boost::shared_ptr<SkinPostProcEle>>
16 boost::shared_ptr<DomainEle> reaction_fe,
17 std::tuple<SmartPetscObj<Vec>, SmartPetscObj<VecScatter>> ux_scatter,
18 std::tuple<SmartPetscObj<Vec>, SmartPetscObj<VecScatter>> uy_scatter,
19 std::tuple<SmartPetscObj<Vec>, SmartPetscObj<VecScatter>> uz_scatter,
20 std::array<double, DIM> pass_field_eval_coords,
21 boost::shared_ptr<SetPtsData> pass_field_eval_data,
22 boost::shared_ptr<std::map<std::string, boost::shared_ptr<VectorDouble>>>
24 boost::shared_ptr<std::map<std::string, boost::shared_ptr<MatrixDouble>>>
26 boost::shared_ptr<std::map<std::string, boost::shared_ptr<MatrixDouble>>>
27 sym_tensor_field_ptrs,
28 boost::shared_ptr<std::map<std::string, boost::shared_ptr<MatrixDouble>>>
48 std::tuple<SmartPetscObj<Vec>, SmartPetscObj<VecScatter>>
uXScatter;
49 std::tuple<SmartPetscObj<Vec>, SmartPetscObj<VecScatter>>
uYScatter;
50 std::tuple<SmartPetscObj<Vec>, SmartPetscObj<VecScatter>>
uZScatter;
53 boost::shared_ptr<std::map<std::string, boost::shared_ptr<VectorDouble>>>
55 boost::shared_ptr<std::map<std::string, boost::shared_ptr<MatrixDouble>>>
57 boost::shared_ptr<std::map<std::string, boost::shared_ptr<MatrixDouble>>>
59 boost::shared_ptr<std::map<std::string, boost::shared_ptr<MatrixDouble>>>
76 ->evalFEAtThePoint<DIM>(
77 fieldEvalCoords.data(), 1e-12,
simple->getProblemName(),
78 simple->getDomainFEName(), fieldEvalData,
82 auto process_scalar_field =
83 [](
const std::string label,
84 const boost::shared_ptr<VectorDouble> scalarFieldPtr) {
85 if (scalarFieldPtr->size()) {
89 <<
"For " << label <<
" field, " << t_scalar_holder;
93 auto process_vector_field =
94 [](
const std::string label,
95 const boost::shared_ptr<MatrixDouble> vecFieldPtr) {
96 if (vecFieldPtr->size1()) {
97 auto t_vec_holder = getFTensor1FromMat<DIM>(*vecFieldPtr);
99 std::string vec_holder_string =
"";
100 for (
int i = 0;
i < DIM;
i++) {
102 " " + boost::lexical_cast<std::string>(t_vec_holder(
i));
106 <<
"For " << label <<
" field," << vec_holder_string;
110 auto process_sym_tensor_field =
111 [](
const std::string label,
112 const boost::shared_ptr<MatrixDouble> symTensorFieldPtr) {
113 if (symTensorFieldPtr->size1()) {
114 auto t_sym_tensor_holder =
115 getFTensor2SymmetricFromMat<DIM>(*symTensorFieldPtr);
117 std::string sym_tensor_holder_string =
"";
118 for (
int i = 0;
i < DIM;
i++) {
119 for (
int j =
i;
j < DIM;
j++) {
120 sym_tensor_holder_string +=
121 ", entry " + boost::lexical_cast<std::string>(
i) +
122 boost::lexical_cast<std::string>(
j) +
" = ";
123 sym_tensor_holder_string +=
124 boost::lexical_cast<std::string>(t_sym_tensor_holder(
i,
j));
129 <<
"For " << label <<
" field" << sym_tensor_holder_string;
133 auto process_tensor_field =
134 [](
const std::string label,
135 const boost::shared_ptr<MatrixDouble> tensorFieldPtr) {
136 if (tensorFieldPtr->size1()) {
137 auto t_tensor_holder =
138 getFTensor2FromMat<DIM, DIM>(*tensorFieldPtr);
140 std::string tensor_holder_string =
"";
141 for (
int i = 0;
i < DIM;
i++) {
142 for (
int j = 0;
j < DIM;
j++) {
143 tensor_holder_string +=
144 ", entry " + boost::lexical_cast<std::string>(
i) +
145 boost::lexical_cast<std::string>(
j) +
" = ";
146 tensor_holder_string +=
147 boost::lexical_cast<std::string>(t_tensor_holder(
i,
j));
152 <<
"For " << label <<
" field" << tensor_holder_string;
156 auto process_fields = [](
auto &fieldPtr,
auto process_field) {
157 for (
const auto &pair : fieldPtr) {
158 const std::string &label = pair.first;
159 const boost::shared_ptr<MatrixDouble> &ptr = pair.second;
162 process_field(label, ptr);
167 if (scalarFieldPtrs) {
168 for (
const auto &pair : *scalarFieldPtrs) {
169 const std::string &label = pair.first;
170 const boost::shared_ptr<VectorDouble> &ptr = pair.second;
173 process_scalar_field(label, ptr);
179 for (
const auto &pair : *vecFieldPtrs) {
180 const std::string &label = pair.first;
181 const boost::shared_ptr<MatrixDouble> &ptr = pair.second;
184 process_vector_field(label, ptr);
189 if (symTensorFieldPtrs) {
190 for (
const auto &pair : *symTensorFieldPtrs) {
191 const std::string &label = pair.first;
192 const boost::shared_ptr<MatrixDouble> &ptr = pair.second;
195 process_sym_tensor_field(label, ptr);
200 if (tensorFieldPtrs) {
201 for (
const auto &pair : *tensorFieldPtrs) {
202 const std::string &label = pair.first;
203 const boost::shared_ptr<MatrixDouble> &ptr = pair.second;
206 process_tensor_field(label, ptr);
214 auto make_vtk = [&]() {
218 CHKERR postProcFe->writeFile(
219 "out_plastic_" + boost::lexical_cast<std::string>(ts_step) +
".h5m");
221 if (skinPostProcFe) {
224 CHKERR skinPostProcFe->writeFile(
225 "out_skin_plastic_" + boost::lexical_cast<std::string>(ts_step) +
231 auto calculate_reaction = [&]() {
239 auto post_proc_residual = [&](
auto dm,
auto f_res,
auto out_name) {
242 boost::make_shared<PostProcBrokenMeshInMoab<DomainEle>>(*m_field_ptr);
243 using OpPPMap = OpPostProcMapInMoab<DIM, DIM>;
244 auto u_vec = boost::make_shared<MatrixDouble>();
245 post_proc_fe->getOpPtrVector().push_back(
246 new OpCalculateVectorFieldValues<DIM>(
"U", u_vec, f_res));
247 post_proc_fe->getOpPtrVector().push_back(
251 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
262 post_proc_fe->writeFile(
"res.h5m");
266 CHKERR post_proc_residual(dM,
r,
"reaction");
272 auto print_max_min = [&](
auto &tuple,
const std::string msg) {
274 CHKERR VecScatterBegin(std::get<1>(tuple), ts_u, std::get<0>(tuple),
275 INSERT_VALUES, SCATTER_FORWARD);
276 CHKERR VecScatterEnd(std::get<1>(tuple), ts_u, std::get<0>(tuple),
277 INSERT_VALUES, SCATTER_FORWARD);
279 CHKERR VecMax(std::get<0>(tuple), PETSC_NULL, &max);
280 CHKERR VecMin(std::get<0>(tuple), PETSC_NULL, &min);
281 MOFEM_LOG_C(
"PLASTICITY", Sev::inform,
"%s time %3.4e min %3.4e max %3.4e",
282 msg.c_str(), ts_t, min, max);
288 if (!(ts_step % se)) {
292 CHKERR calculate_reaction();
293 CHKERR print_max_min(uXScatter,
"Ux");
294 CHKERR print_max_min(uYScatter,
"Uy");
296 CHKERR print_max_min(uZScatter,
"Uz");