22 {
24
25 auto make_vtk = [&]() {
29 "out_plastic_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
31 };
32
33 auto calculate_reaction = [&]() {
39 CHKERR VecGhostUpdateBegin(r, ADD_VALUES, SCATTER_REVERSE);
40 CHKERR VecGhostUpdateEnd(r, ADD_VALUES, SCATTER_REVERSE);
41 CHKERR VecAssemblyBegin(r);
43
44 double sum;
46 MOFEM_LOG_C(
"EXAMPLE", Sev::inform,
"reaction time %3.4e %3.4e", ts_t,
47 sum);
48
50 };
51
52 auto print_max_min = [&](auto &tuple, const std::string msg) {
54 CHKERR VecScatterBegin(std::get<1>(tuple), ts_u, std::get<0>(tuple),
55 INSERT_VALUES, SCATTER_FORWARD);
56 CHKERR VecScatterEnd(std::get<1>(tuple), ts_u, std::get<0>(tuple),
57 INSERT_VALUES, SCATTER_FORWARD);
58 double max, min;
59 CHKERR VecMax(std::get<0>(tuple), PETSC_NULL, &max);
60 CHKERR VecMin(std::get<0>(tuple), PETSC_NULL, &min);
61 MOFEM_LOG_C(
"EXAMPLE", Sev::inform,
"%s time %3.4e min %3.4e max %3.4e",
62 msg.c_str(), ts_t, min, max);
64 };
65
68 CHKERR calculate_reaction();
73
75 }
#define MOFEM_LOG_C(channel, severity, format,...)
#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)
Get smart vector from DM.