v0.14.0
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
Monitor Struct Reference

[Push operators to pipeline] More...

Inheritance diagram for Monitor:
[legend]
Collaboration diagram for Monitor:
[legend]

Public Member Functions

 Monitor (SmartPetscObj< DM > dm, std::pair< boost::shared_ptr< PostProcEleDomain >, boost::shared_ptr< PostProcEleBdy >> pair_post_proc_fe, boost::shared_ptr< DomainEle > reaction_fe, std::vector< boost::shared_ptr< ScalingMethod >> smv)
 
MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
 Monitor (SmartPetscObj< DM > dm, MoFEM::Interface &m_field, boost::shared_ptr< PostProcEle > post_proc, boost::shared_ptr< PostProcFaceEle > post_proc_bdry, boost::shared_ptr< MatrixDouble > velocity_field_ptr, boost::shared_ptr< MatrixDouble > x2_field_ptr, boost::shared_ptr< MatrixDouble > geometry_field_ptr, std::array< double, 3 > pass_field_eval_coords, boost::shared_ptr< SetPtsData > pass_field_eval_data)
 
MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
 Monitor (SmartPetscObj< DM > dm, boost::shared_ptr< PostProcEle > post_proc)
 
MoFEMErrorCode preProcess ()
 function is run at the beginning of loop More...
 
MoFEMErrorCode operator() ()
 function is run for every finite element More...
 
MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
 Monitor (SmartPetscObj< DM > dm, boost::shared_ptr< PostProcEle > post_proc)
 
MoFEMErrorCode preProcess ()
 function is run at the beginning of loop More...
 
MoFEMErrorCode operator() ()
 function is run for every finite element More...
 
MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
 Monitor (SmartPetscObj< DM > dm, boost::shared_ptr< PostProcEleBdy > post_proc)
 
MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
 Monitor (SmartPetscObj< DM > dm, boost::shared_ptr< PostProcEle > post_proc)
 
MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
 Monitor (SmartPetscObj< DM > dm, boost::shared_ptr< PostProcEle > post_proc)
 
MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
 Monitor (SmartPetscObj< DM > dm, boost::shared_ptr< moab::Core > post_proc_mesh, boost::shared_ptr< PostProcEleDomainCont > post_proc, boost::shared_ptr< PostProcEleBdyCont > post_proc_edge, std::pair< boost::shared_ptr< BoundaryEle >, boost::shared_ptr< VectorDouble >> p)
 
MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
- Public Member Functions inherited from MoFEM::FEMethod
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 
 FEMethod ()=default
 
auto getFEName () const
 get finite element name More...
 
auto getDataDofsPtr () const
 
auto getDataVectorDofsPtr () const
 
const FieldEntity_vector_viewgetDataFieldEnts () const
 
boost::shared_ptr< FieldEntity_vector_view > & getDataFieldEntsPtr () const
 
auto & getRowFieldEnts () const
 
auto & getRowFieldEntsPtr () const
 
auto & getColFieldEnts () const
 
auto & getColFieldEntsPtr () const
 
auto getRowDofsPtr () const
 
auto getColDofsPtr () const
 
auto getNumberOfNodes () const
 
EntityHandle getFEEntityHandle () const
 
MoFEMErrorCode getNodeData (const std::string field_name, VectorDouble &data, const bool reset_dofs=true)
 
- Public Member Functions inherited from MoFEM::BasicMethod
 BasicMethod ()
 
virtual ~BasicMethod ()=default
 
int getNinTheLoop () const
 get number of evaluated element in the loop More...
 
int getLoopSize () const
 get loop size More...
 
auto getLoHiFERank () const
 Get lo and hi processor rank of iterated entities. More...
 
auto getLoFERank () const
 Get upper rank in loop for iterating elements. More...
 
auto getHiFERank () const
 Get upper rank in loop for iterating elements. More...
 
unsigned int getFieldBitNumber (std::string field_name) const
 
MoFEMErrorCode copyBasicMethod (const BasicMethod &basic)
 Copy data from other base method to this base method. More...
 
boost::weak_ptr< CacheTuplegetCacheWeakPtr () const
 Get the cache weak ptr object. More...
 
- Public Member Functions inherited from MoFEM::KspMethod
 KspMethod ()
 
virtual ~KspMethod ()=default
 
MoFEMErrorCode copyKsp (const KspMethod &ksp)
 copy data form another method More...
 
- Public Member Functions inherited from MoFEM::PetscData
 PetscData ()
 
virtual ~PetscData ()=default
 
MoFEMErrorCode copyPetscData (const PetscData &petsc_data)
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 
- Public Member Functions inherited from MoFEM::SnesMethod
 SnesMethod ()
 
virtual ~SnesMethod ()=default
 
MoFEMErrorCode copySnes (const SnesMethod &snes)
 Copy snes data. More...
 
- Public Member Functions inherited from MoFEM::TSMethod
 TSMethod ()
 
virtual ~TSMethod ()=default
 
MoFEMErrorCode copyTs (const TSMethod &ts)
 Copy TS solver data. More...
 

Public Attributes

MoFEM::InterfacemField
 
- Public Attributes inherited from MoFEM::FEMethod
std::string feName
 Name of finite element. More...
 
boost::shared_ptr< const NumeredEntFiniteElementnumeredEntFiniteElementPtr
 
boost::function< bool(FEMethod *fe_method_ptr)> exeTestHook
 Tet if element to skip element. More...
 
- Public Attributes inherited from MoFEM::BasicMethod
int nInTheLoop
 number currently of processed method More...
 
int loopSize
 local number oe methods to process More...
 
std::pair< int, int > loHiFERank
 Llo and hi processor rank of iterated entities. More...
 
int rAnk
 processor rank More...
 
int sIze
 number of processors in communicator More...
 
const RefEntity_multiIndexrefinedEntitiesPtr
 container of mofem dof entities More...
 
const RefElement_multiIndexrefinedFiniteElementsPtr
 container of mofem finite element entities More...
 
const ProblemproblemPtr
 raw pointer to problem More...
 
const Field_multiIndexfieldsPtr
 raw pointer to fields container More...
 
const FieldEntity_multiIndexentitiesPtr
 raw pointer to container of field entities More...
 
const DofEntity_multiIndexdofsPtr
 raw pointer container of dofs More...
 
const FiniteElement_multiIndexfiniteElementsPtr
 raw pointer to container finite elements More...
 
const EntFiniteElement_multiIndexfiniteElementsEntitiesPtr
 
const FieldEntityEntFiniteElementAdjacencyMap_multiIndexadjacenciesPtr
 
boost::function< MoFEMErrorCode()> preProcessHook
 Hook function for pre-processing. More...
 
boost::function< MoFEMErrorCode()> postProcessHook
 Hook function for post-processing. More...
 
boost::function< MoFEMErrorCode()> operatorHook
 Hook function for operator. More...
 
boost::movelib::unique_ptr< boolvecAssembleSwitch
 
boost::movelib::unique_ptr< boolmatAssembleSwitch
 
boost::weak_ptr< CacheTuplecacheWeakPtr
 
- Public Attributes inherited from MoFEM::KspMethod
KSPContext ksp_ctx
 Context. More...
 
KSP ksp
 KSP solver. More...
 
Vec & ksp_f
 
Mat & ksp_A
 
Mat & ksp_B
 
- Public Attributes inherited from MoFEM::PetscData
Switches data_ctx
 
Vec f
 
Mat A
 
Mat B
 
Vec x
 
Vec x_t
 
Vec x_tt
 
- Public Attributes inherited from MoFEM::SnesMethod
SNESContext snes_ctx
 
SNES snes
 snes solver More...
 
Vec & snes_x
 state vector More...
 
Vec & snes_f
 residual More...
 
Mat & snes_A
 jacobian matrix More...
 
Mat & snes_B
 preconditioner of jacobian matrix More...
 
- Public Attributes inherited from MoFEM::TSMethod
TS ts
 time solver More...
 
TSContext ts_ctx
 
PetscInt ts_step
 time step number More...
 
PetscReal ts_a
 shift for U_t (see PETSc Time Solver) More...
 
PetscReal ts_aa
 shift for U_tt shift for U_tt More...
 
PetscReal ts_t
 time More...
 
PetscReal ts_dt
 time step size More...
 
Vec & ts_u
 state vector More...
 
Vec & ts_u_t
 time derivative of state vector More...
 
Vec & ts_u_tt
 second time derivative of state vector More...
 
Vec & ts_F
 residual vector More...
 
Mat & ts_A
 
Mat & ts_B
 Preconditioner for ts_A. More...
 

Static Public Attributes

static constexpr int saveEveryNthStep = 1
 
- Static Public Attributes inherited from MoFEM::PetscData
static constexpr Switches CtxSetNone = PetscData::Switches(CTX_SET_NONE)
 
static constexpr Switches CtxSetF = PetscData::Switches(CTX_SET_F)
 
static constexpr Switches CtxSetA = PetscData::Switches(CTX_SET_A)
 
static constexpr Switches CtxSetB = PetscData::Switches(CTX_SET_B)
 
static constexpr Switches CtxSetX = PetscData::Switches(CTX_SET_X)
 
static constexpr Switches CtxSetX_T = PetscData::Switches(CTX_SET_X_T)
 
static constexpr Switches CtxSetX_TT = PetscData::Switches(CTX_SET_X_TT)
 
static constexpr Switches CtxSetTime = PetscData::Switches(CTX_SET_TIME)
 

Private Attributes

SmartPetscObj< DM > dM
 
boost::shared_ptr< PostProcEleDomaindomainPostProcFe
 
boost::shared_ptr< PostProcEleBdyskinPostProcFe
 
boost::shared_ptr< FEMethodreactionFE
 
SmartPetscObj< Vec > fRes
 
VecOfTimeScalingMethods vecOfTimeScalingMethods
 
boost::shared_ptr< PostProcElepostProc
 
boost::shared_ptr< PostProcFaceElepostProcBdy
 
boost::shared_ptr< MatrixDouble > velocityFieldPtr
 
boost::shared_ptr< MatrixDouble > x2FieldPtr
 
boost::shared_ptr< MatrixDouble > geometryFieldPtr
 
std::array< double, 3 > fieldEvalCoords
 
boost::shared_ptr< SetPtsDatafieldEvalData
 
boost::shared_ptr< PostProcEleBdypostProc
 
boost::shared_ptr< moab::Core > postProcMesh
 
boost::shared_ptr< PostProcEleDomainContpostProc
 
boost::shared_ptr< PostProcEleBdyContpostProcEdge
 
boost::shared_ptr< BoundaryEleliftFE
 
boost::shared_ptr< VectorDouble > liftVec
 

Additional Inherited Members

- Public Types inherited from MoFEM::KspMethod
enum  KSPContext { CTX_SETFUNCTION, CTX_OPERATORS, CTX_KSPNONE }
 pass information about context of KSP/DM for with finite element is computed More...
 
- Public Types inherited from MoFEM::PetscData
enum  DataContext {
  CTX_SET_NONE = 0, CTX_SET_F = 1 << 0, CTX_SET_A = 1 << 1, CTX_SET_B = 1 << 2,
  CTX_SET_X = 1 << 3, CTX_SET_X_T = 1 << 4, CTX_SET_X_TT = 1 << 6, CTX_SET_TIME = 1 << 7
}
 
using Switches = std::bitset< 8 >
 
- Public Types inherited from MoFEM::SnesMethod
enum  SNESContext { CTX_SNESSETFUNCTION, CTX_SNESSETJACOBIAN, CTX_SNESNONE }
 
- Public Types inherited from MoFEM::TSMethod
enum  TSContext {
  CTX_TSSETRHSFUNCTION, CTX_TSSETRHSJACOBIAN, CTX_TSSETIFUNCTION, CTX_TSSETIJACOBIAN,
  CTX_TSTSMONITORSET, CTX_TSNONE
}
 
- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 

Detailed Description

[Push operators to pipeline]

[Push operators to pip]

Monitor solution.

Monitor solution

This functions is called by TS solver at the end of each step. It is used to output results to the hard drive.

This functions is called by TS solver at the end of each step. It is used to output results to the hard drive.

Monitor solution

This functions is called by TS kso at the end of each step. It is used

Examples
adolc_plasticity.cpp, dynamic_first_order_con_law.cpp, free_surface.cpp, heat_equation.cpp, nonlinear_elastic.cpp, photon_diffusion.cpp, PlasticOpsMonitor.hpp, reaction_diffusion.cpp, shallow_wave.cpp, and wave_equation.cpp.

Definition at line 333 of file adolc_plasticity.cpp.

Constructor & Destructor Documentation

◆ Monitor() [1/8]

Monitor::Monitor ( SmartPetscObj< DM >  dm,
std::pair< boost::shared_ptr< PostProcEleDomain >, boost::shared_ptr< PostProcEleBdy >>  pair_post_proc_fe,
boost::shared_ptr< DomainEle reaction_fe,
std::vector< boost::shared_ptr< ScalingMethod >>  smv 
)
inline
Examples
free_surface.cpp.

Definition at line 334 of file adolc_plasticity.cpp.

340  : dM(dm), reactionFE(reaction_fe), vecOfTimeScalingMethods(smv) {
342  domainPostProcFe = pair_post_proc_fe.first;
343  skinPostProcFe = pair_post_proc_fe.second;
344  }

◆ Monitor() [2/8]

Monitor::Monitor ( SmartPetscObj< DM >  dm,
MoFEM::Interface m_field,
boost::shared_ptr< PostProcEle post_proc,
boost::shared_ptr< PostProcFaceEle post_proc_bdry,
boost::shared_ptr< MatrixDouble >  velocity_field_ptr,
boost::shared_ptr< MatrixDouble >  x2_field_ptr,
boost::shared_ptr< MatrixDouble >  geometry_field_ptr,
std::array< double, 3 >  pass_field_eval_coords,
boost::shared_ptr< SetPtsData pass_field_eval_data 
)
inline

Definition at line 785 of file dynamic_first_order_con_law.cpp.

793  : dM(dm), mField(m_field), postProc(post_proc),
794  postProcBdy(post_proc_bdry), velocityFieldPtr(velocity_field_ptr),
795  x2FieldPtr(x2_field_ptr), geometryFieldPtr(geometry_field_ptr),
796  fieldEvalCoords(pass_field_eval_coords),
797  fieldEvalData(pass_field_eval_data){};

◆ Monitor() [3/8]

Monitor::Monitor ( SmartPetscObj< DM >  dm,
boost::shared_ptr< PostProcEle post_proc 
)
inline

Definition at line 68 of file heat_equation.cpp.

69  : dM(dm), postProc(post_proc){};

◆ Monitor() [4/8]

Monitor::Monitor ( SmartPetscObj< DM >  dm,
boost::shared_ptr< PostProcEle post_proc 
)
inline

Definition at line 65 of file wave_equation.cpp.

66  : dM(dm), postProc(post_proc){};

◆ Monitor() [5/8]

Monitor::Monitor ( SmartPetscObj< DM >  dm,
boost::shared_ptr< PostProcEleBdy post_proc 
)
inline

Definition at line 222 of file nonlinear_elastic.cpp.

223  : dM(dm), postProc(post_proc){};

◆ Monitor() [6/8]

Monitor::Monitor ( SmartPetscObj< DM >  dm,
boost::shared_ptr< PostProcEle post_proc 
)
inline

Definition at line 313 of file nonlinear_dynamic_elastic.cpp.

314  : dM(dm), postProc(post_proc){};

◆ Monitor() [7/8]

Monitor::Monitor ( SmartPetscObj< DM >  dm,
boost::shared_ptr< PostProcEle post_proc 
)
inline

Definition at line 731 of file shallow_wave.cpp.

732  : dM(dm), postProc(post_proc){};

◆ Monitor() [8/8]

Monitor::Monitor ( SmartPetscObj< DM >  dm,
boost::shared_ptr< moab::Core >  post_proc_mesh,
boost::shared_ptr< PostProcEleDomainCont post_proc,
boost::shared_ptr< PostProcEleBdyCont post_proc_edge,
std::pair< boost::shared_ptr< BoundaryEle >, boost::shared_ptr< VectorDouble >>  p 
)
inline

Definition at line 1990 of file free_surface.cpp.

1996  : dM(dm), postProcMesh(post_proc_mesh), postProc(post_proc),
1997  postProcEdge(post_proc_edge), liftFE(p.first), liftVec(p.second) {}

Member Function Documentation

◆ operator()() [1/2]

MoFEMErrorCode Monitor::operator() ( )
inlinevirtual

function is run for every finite element

It is used to calculate element local matrices and assembly. It can be used for post-processing.

Reimplemented from MoFEM::BasicMethod.

Definition at line 69 of file wave_equation.cpp.

69 { return 0; }

◆ operator()() [2/2]

MoFEMErrorCode Monitor::operator() ( )
inlinevirtual

function is run for every finite element

It is used to calculate element local matrices and assembly. It can be used for post-processing.

Reimplemented from MoFEM::BasicMethod.

Definition at line 72 of file heat_equation.cpp.

72 { return 0; }

◆ postProcess() [1/8]

MoFEMErrorCode Monitor::postProcess ( )
inlinevirtual

function is run at the end of loop

It is used to assembly matrices and vectors, calculating global variables, f.e. total internal energy, ect.

Iterating over dofs: Example1 iterating over dofs in row by name of the field for(IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP(this,"DISPLACEMENT",it)) { ... }

Reimplemented from MoFEM::BasicMethod.

Definition at line 73 of file wave_equation.cpp.

73  {
75  if (ts_step % saveEveryNthStep == 0) {
77  CHKERR postProc->writeFile(
78  "out_level_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
79  }
81  }

◆ postProcess() [2/8]

MoFEMErrorCode Monitor::postProcess ( )
inlinevirtual

function is run at the end of loop

It is used to assembly matrices and vectors, calculating global variables, f.e. total internal energy, ect.

Iterating over dofs: Example1 iterating over dofs in row by name of the field for(IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP(this,"DISPLACEMENT",it)) { ... }

Reimplemented from MoFEM::BasicMethod.

Definition at line 76 of file heat_equation.cpp.

76  {
78  if (ts_step % saveEveryNthStep == 0) {
80  CHKERR postProc->writeFile(
81  "out_level_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
82  }
84  }

◆ postProcess() [3/8]

MoFEMErrorCode Monitor::postProcess ( )
inlinevirtual

function is run at the end of loop

It is used to assembly matrices and vectors, calculating global variables, f.e. total internal energy, ect.

Iterating over dofs: Example1 iterating over dofs in row by name of the field for(IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP(this,"DISPLACEMENT",it)) { ... }

Reimplemented from MoFEM::BasicMethod.

Definition at line 224 of file nonlinear_elastic.cpp.

224  {
226  constexpr int save_every_nth_step = 1;
227  if (ts_step % save_every_nth_step == 0) {
230  postProc->mField, postProc->getPostProcMesh(), {"U"});
231 
232  CHKERR postProc->writeFile(
233  "out_step_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
234  }
236  }

◆ postProcess() [4/8]

MoFEMErrorCode Monitor::postProcess ( )
inlinevirtual

function is run at the end of loop

It is used to assembly matrices and vectors, calculating global variables, f.e. total internal energy, ect.

Iterating over dofs: Example1 iterating over dofs in row by name of the field for(IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP(this,"DISPLACEMENT",it)) { ... }

Reimplemented from MoFEM::BasicMethod.

Definition at line 315 of file nonlinear_dynamic_elastic.cpp.

315  {
317  constexpr int save_every_nth_step = 1;
318  if (ts_step % save_every_nth_step == 0) {
320  CHKERR postProc->writeFile(
321  "out_step_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
322  }
324  }

◆ postProcess() [5/8]

MoFEMErrorCode Monitor::postProcess ( )
inlinevirtual

function is run at the end of loop

It is used to assembly matrices and vectors, calculating global variables, f.e. total internal energy, ect.

Iterating over dofs: Example1 iterating over dofs in row by name of the field for(IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP(this,"DISPLACEMENT",it)) { ... }

Reimplemented from MoFEM::BasicMethod.

Examples
free_surface.cpp.

Definition at line 345 of file adolc_plasticity.cpp.

345  {
347  int save_every_nth_step = 1;
348  CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-save_every_nth_step",
349  &save_every_nth_step, PETSC_NULL);
350  auto make_vtk = [&]() {
352  if (domainPostProcFe) {
354  getCacheWeakPtr());
355  CHKERR domainPostProcFe->writeFile(
356  "out_plastic_" + boost::lexical_cast<std::string>(ts_step) +
357  ".h5m");
358  }
359  if (skinPostProcFe) {
361  getCacheWeakPtr());
362  CHKERR skinPostProcFe->writeFile(
363  "out_skin_plastic_" + boost::lexical_cast<std::string>(ts_step) +
364  ".h5m");
365  }
367  };
368 
369  if (!(ts_step % save_every_nth_step)) {
370  CHKERR make_vtk();
371  }
372  if (reactionFE) {
373  CHKERR VecZeroEntries(fRes);
374  reactionFE->f = fRes;
376  CHKERR VecAssemblyBegin(fRes);
377  CHKERR VecAssemblyEnd(fRes);
378  CHKERR VecGhostUpdateBegin(fRes, ADD_VALUES, SCATTER_REVERSE);
379  CHKERR VecGhostUpdateEnd(fRes, ADD_VALUES, SCATTER_REVERSE);
380 
381  MoFEM::Interface *m_field_ptr;
382  CHKERR DMoFEMGetInterfacePtr(dM, &m_field_ptr);
384  *m_field_ptr, reactionFE, fRes)();
385 
386  double nrm;
387  CHKERR VecNorm(fRes, NORM_2, &nrm);
388  MOFEM_LOG("PlasticPrb", Sev::verbose)
389  << "Residual norm " << nrm << " at time step " << ts_step;
390  }
391 
392  auto get_min_max_displacement = [&]() {
394  MoFEM::Interface *m_field_ptr;
395  CHKERR DMoFEMGetInterfacePtr(dM, &m_field_ptr);
396 
397  std::array<double, 4> a_min = {DBL_MAX, DBL_MAX, DBL_MAX, 0};
398  std::array<double, 4> a_max = {-DBL_MAX, -DBL_MAX, -DBL_MAX, 0};
399 
400  auto get_min_max = [&](boost::shared_ptr<FieldEntity> field_entity_ptr) {
402  int d = 0;
403  for (auto v : field_entity_ptr->getEntFieldData()) {
404  a_min[d] = std::min(a_min[d], v);
405  a_max[d] = std::max(a_max[d], v);
406  ++d;
407  }
409  };
410 
411  a_min[SPACE_DIM] = 0;
412  a_max[SPACE_DIM] = 0;
413 
414  Range verts;
415  CHKERR m_field_ptr->get_field_entities_by_type("U", MBVERTEX, verts);
416  CHKERR m_field_ptr->getInterface<FieldBlas>()->fieldLambdaOnEntities(
417  get_min_max, "U", &verts);
418 
419  auto mpi_reduce = [&](auto &a, auto op) {
420  std::array<double, 3> a_mpi = {0, 0, 0};
421  MPI_Allreduce(a.data(), a_mpi.data(), 3, MPI_DOUBLE, op,
422  m_field_ptr->get_comm());
423  return a_mpi;
424  };
425 
426  auto a_min_mpi = mpi_reduce(a_min, MPI_MIN);
427  auto a_max_mpi = mpi_reduce(a_max, MPI_MAX);
428 
429  MOFEM_LOG("PlasticPrb", Sev::inform)
430  << "Min displacement " << a_min_mpi[0] << " " << a_min_mpi[1] << " "
431  << a_min_mpi[2];
432  MOFEM_LOG("PlasticPrb", Sev::inform)
433  << "Max displacement " << a_max_mpi[0] << " " << a_max_mpi[1] << " "
434  << a_max_mpi[2];
436  };
437 
438  CHKERR get_min_max_displacement();
439 
440  double scale = 1;
441  for (auto s : vecOfTimeScalingMethods) {
442  scale *= s->getScale(this->ts_t);
443  }
444 
445  MOFEM_LOG("PlasticPrb", Sev::inform)
446  << "Time: " << this->ts_t << " scale: " << scale;
447 
449  }

◆ postProcess() [6/8]

MoFEMErrorCode Monitor::postProcess ( )
inlinevirtual

function is run at the end of loop

It is used to assembly matrices and vectors, calculating global variables, f.e. total internal energy, ect.

Iterating over dofs: Example1 iterating over dofs in row by name of the field for(IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP(this,"DISPLACEMENT",it)) { ... }

Reimplemented from MoFEM::BasicMethod.

Definition at line 733 of file shallow_wave.cpp.

733  {
735  constexpr int save_every_nth_step = 50;
736  if (ts_step % save_every_nth_step == 0) {
738  CHKERR postProc->writeFile(
739  "out_step_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
740  MOFEM_LOG("SW", Sev::verbose)
741  << "writing vector in binary to vector.dat ...";
742  PetscViewer viewer;
743  PetscViewerBinaryOpen(PETSC_COMM_WORLD, "vector.dat", FILE_MODE_WRITE,
744  &viewer);
745  VecView(ts_u, viewer);
746  PetscViewerDestroy(&viewer);
747  }
749  }

◆ postProcess() [7/8]

MoFEMErrorCode Monitor::postProcess ( )
inlinevirtual

function is run at the end of loop

It is used to assembly matrices and vectors, calculating global variables, f.e. total internal energy, ect.

Iterating over dofs: Example1 iterating over dofs in row by name of the field for(IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP(this,"DISPLACEMENT",it)) { ... }

Reimplemented from MoFEM::BasicMethod.

Definition at line 798 of file dynamic_first_order_con_law.cpp.

798  {
800 
801  // cerr << "wagawaga\n";
802  auto *simple = mField.getInterface<Simple>();
803 
804  if (SPACE_DIM == 3) {
805  CHKERR mField.getInterface<FieldEvaluatorInterface>()->evalFEAtThePoint3D(
806  fieldEvalCoords.data(), 1e-12, simple->getProblemName(),
807  simple->getDomainFEName(), fieldEvalData, mField.get_comm_rank(),
809  } else {
810  CHKERR mField.getInterface<FieldEvaluatorInterface>()->evalFEAtThePoint2D(
811  fieldEvalCoords.data(), 1e-12, simple->getProblemName(),
812  simple->getDomainFEName(), fieldEvalData, mField.get_comm_rank(),
814  }
815 
816  if (velocityFieldPtr->size1()) {
817  auto t_vel = getFTensor1FromMat<SPACE_DIM>(*velocityFieldPtr);
818  auto t_x2_field = getFTensor1FromMat<SPACE_DIM>(*x2FieldPtr);
819  auto t_geom = getFTensor1FromMat<SPACE_DIM>(*geometryFieldPtr);
820 
821  double u_x = t_x2_field(0) - t_geom(0);
822  double u_y = t_x2_field(1) - t_geom(1);
823  double u_z = t_x2_field(2) - t_geom(2);
824 
825  MOFEM_LOG("SYNC", Sev::inform)
826  << "Velocities x: " << t_vel(0) << " y: " << t_vel(1)
827  << " z: " << t_vel(2) << "\n";
828  MOFEM_LOG("SYNC", Sev::inform) << "Displacement x: " << u_x
829  << " y: " << u_y << " z: " << u_z << "\n";
830  }
831 
833  std::regex((boost::format("%s(.*)") % "Data_Vertex").str()))) {
834  Range ents;
835  mField.get_moab().get_entities_by_dimension(m->getMeshset(), 0, ents,
836  true);
837  auto print_vets = [](boost::shared_ptr<FieldEntity> ent_ptr) {
839  if (!(ent_ptr->getPStatus() & PSTATUS_NOT_OWNED)) {
840  MOFEM_LOG("SYNC", Sev::inform)
841  << "Velocities: " << ent_ptr->getEntFieldData()[0] << " "
842  << ent_ptr->getEntFieldData()[1] << " "
843  << ent_ptr->getEntFieldData()[2] << "\n";
844  }
846  };
847  CHKERR mField.getInterface<FieldBlas>()->fieldLambdaOnEntities(
848  print_vets, "V", &ents);
849  }
850  MOFEM_LOG_SEVERITY_SYNC(mField.get_comm(), Sev::inform);
851 
852  PetscBool print_volume = PETSC_FALSE;
853  CHKERR PetscOptionsGetBool(PETSC_NULL, "", "-print_volume", &print_volume,
854  PETSC_NULL);
855 
856  PetscBool print_skin = PETSC_FALSE;
857  CHKERR PetscOptionsGetBool(PETSC_NULL, "", "-print_skin", &print_skin,
858  PETSC_NULL);
859 
860  int save_every_nth_step = 1;
861  CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-save_step",
862  &save_every_nth_step, PETSC_NULL);
863  if (ts_step % save_every_nth_step == 0) {
864 
865  if (print_volume) {
867  CHKERR postProc->writeFile(
868  "out_step_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
869  }
870 
871  if (print_skin) {
873  CHKERR postProcBdy->writeFile(
874  "out_boundary_" + boost::lexical_cast<std::string>(ts_step) +
875  ".h5m");
876  }
877  }
879  }

◆ postProcess() [8/8]

MoFEMErrorCode Monitor::postProcess ( )
inlinevirtual

function is run at the end of loop

It is used to assembly matrices and vectors, calculating global variables, f.e. total internal energy, ect.

Iterating over dofs: Example1 iterating over dofs in row by name of the field for(IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP(this,"DISPLACEMENT",it)) { ... }

Reimplemented from MoFEM::BasicMethod.

Definition at line 1998 of file free_surface.cpp.

1998  {
2000 
2001  MOFEM_LOG("FS", Sev::verbose) << "Monitor";
2002  constexpr int save_every_nth_step = 1;
2003  if (ts_step % save_every_nth_step == 0) {
2004  MOFEM_LOG("FS", Sev::verbose) << "Mesh pre proc";
2005  MoFEM::Interface *m_field_ptr;
2006  CHKERR DMoFEMGetInterfacePtr(dM, &m_field_ptr);
2007  auto post_proc_begin =
2008  boost::make_shared<PostProcBrokenMeshInMoabBaseBegin>(*m_field_ptr,
2009  postProcMesh);
2010  auto post_proc_end = boost::make_shared<PostProcBrokenMeshInMoabBaseEnd>(
2011  *m_field_ptr, postProcMesh);
2012  CHKERR DMoFEMPreProcessFiniteElements(dM, post_proc_begin->getFEMethod());
2014  this->getCacheWeakPtr());
2016  this->getCacheWeakPtr());
2017  CHKERR DMoFEMPostProcessFiniteElements(dM, post_proc_end->getFEMethod());
2018  CHKERR post_proc_end->writeFile(
2019  "out_step_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
2020  MOFEM_LOG("FS", Sev::verbose) << "Mesh pre proc done";
2021  }
2022 
2023  liftVec->resize(SPACE_DIM, false);
2024  liftVec->clear();
2026  MPI_Allreduce(MPI_IN_PLACE, &(*liftVec)[0], SPACE_DIM, MPI_DOUBLE, MPI_SUM,
2027  MPI_COMM_WORLD);
2028  MOFEM_LOG("FS", Sev::inform)
2029  << "Step " << ts_step << " time " << ts_t
2030  << " lift vec x: " << (*liftVec)[0] << " y: " << (*liftVec)[1];
2031 
2033  }

◆ preProcess() [1/2]

MoFEMErrorCode Monitor::preProcess ( )
inlinevirtual

function is run at the beginning of loop

It is used to zeroing matrices and vectors, calculation of shape functions on reference element, preprocessing boundary conditions, etc.

Reimplemented from MoFEM::BasicMethod.

Definition at line 68 of file wave_equation.cpp.

68 { return 0; }

◆ preProcess() [2/2]

MoFEMErrorCode Monitor::preProcess ( )
inlinevirtual

function is run at the beginning of loop

It is used to zeroing matrices and vectors, calculation of shape functions on reference element, preprocessing boundary conditions, etc.

Reimplemented from MoFEM::BasicMethod.

Definition at line 71 of file heat_equation.cpp.

71 { return 0; }

Member Data Documentation

◆ dM

SmartPetscObj< DM > Monitor::dM
private
Examples
free_surface.cpp.

Definition at line 452 of file adolc_plasticity.cpp.

◆ domainPostProcFe

boost::shared_ptr<PostProcEleDomain> Monitor::domainPostProcFe
private

Definition at line 453 of file adolc_plasticity.cpp.

◆ fieldEvalCoords

std::array<double, 3> Monitor::fieldEvalCoords
private

Definition at line 888 of file dynamic_first_order_con_law.cpp.

◆ fieldEvalData

boost::shared_ptr<SetPtsData> Monitor::fieldEvalData
private

Definition at line 889 of file dynamic_first_order_con_law.cpp.

◆ fRes

SmartPetscObj<Vec> Monitor::fRes
private

Definition at line 456 of file adolc_plasticity.cpp.

◆ geometryFieldPtr

boost::shared_ptr<MatrixDouble> Monitor::geometryFieldPtr
private

Definition at line 887 of file dynamic_first_order_con_law.cpp.

◆ liftFE

boost::shared_ptr<BoundaryEle> Monitor::liftFE
private
Examples
free_surface.cpp.

Definition at line 2040 of file free_surface.cpp.

◆ liftVec

boost::shared_ptr<VectorDouble> Monitor::liftVec
private
Examples
free_surface.cpp.

Definition at line 2041 of file free_surface.cpp.

◆ mField

MoFEM::Interface& Monitor::mField

Definition at line 784 of file dynamic_first_order_con_law.cpp.

◆ postProc [1/3]

boost::shared_ptr<PostProcEleBdy> Monitor::postProc
private

Definition at line 240 of file nonlinear_elastic.cpp.

◆ postProc [2/3]

boost::shared_ptr< PostProcEle > Monitor::postProc
private
Examples
free_surface.cpp.

Definition at line 883 of file dynamic_first_order_con_law.cpp.

◆ postProc [3/3]

boost::shared_ptr<PostProcEleDomainCont> Monitor::postProc
private

Definition at line 2038 of file free_surface.cpp.

◆ postProcBdy

boost::shared_ptr<PostProcFaceEle> Monitor::postProcBdy
private

Definition at line 884 of file dynamic_first_order_con_law.cpp.

◆ postProcEdge

boost::shared_ptr<PostProcEleBdyCont> Monitor::postProcEdge
private
Examples
free_surface.cpp.

Definition at line 2039 of file free_surface.cpp.

◆ postProcMesh

boost::shared_ptr<moab::Core> Monitor::postProcMesh
private
Examples
free_surface.cpp.

Definition at line 2037 of file free_surface.cpp.

◆ reactionFE

boost::shared_ptr<FEMethod> Monitor::reactionFE
private

Definition at line 455 of file adolc_plasticity.cpp.

◆ saveEveryNthStep

static constexpr int Monitor::saveEveryNthStep = 1
staticconstexpr

Definition at line 74 of file heat_equation.cpp.

◆ skinPostProcFe

boost::shared_ptr<PostProcEleBdy> Monitor::skinPostProcFe
private

Definition at line 454 of file adolc_plasticity.cpp.

◆ vecOfTimeScalingMethods

VecOfTimeScalingMethods Monitor::vecOfTimeScalingMethods
private

Definition at line 457 of file adolc_plasticity.cpp.

◆ velocityFieldPtr

boost::shared_ptr<MatrixDouble> Monitor::velocityFieldPtr
private

Definition at line 885 of file dynamic_first_order_con_law.cpp.

◆ x2FieldPtr

boost::shared_ptr<MatrixDouble> Monitor::x2FieldPtr
private

Definition at line 886 of file dynamic_first_order_con_law.cpp.


The documentation for this struct was generated from the following files:
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
SPACE_DIM
constexpr int SPACE_DIM
Definition: adolc_plasticity.cpp:15
Monitor::vecOfTimeScalingMethods
VecOfTimeScalingMethods vecOfTimeScalingMethods
Definition: adolc_plasticity.cpp:457
MoFEM::EssentialPreProcReaction< DisplacementCubitBcData >
Specialization for DisplacementCubitBcData.
Definition: EssentialDisplacementCubitBcData.hpp:157
MOFEM_LOG_SEVERITY_SYNC
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
Definition: LogManager.hpp:352
Monitor::liftFE
boost::shared_ptr< BoundaryEle > liftFE
Definition: free_surface.cpp:2040
Monitor::fieldEvalCoords
std::array< double, 3 > fieldEvalCoords
Definition: dynamic_first_order_con_law.cpp:888
MoFEM::CoreInterface::get_comm
virtual MPI_Comm & get_comm() const =0
SPACE_DIM
constexpr int SPACE_DIM
Definition: dynamic_first_order_con_law.cpp:24
MoFEM::CoreInterface::get_comm_rank
virtual int get_comm_rank() const =0
MoFEM::Simple
Simple interface for fast problem set-up.
Definition: Simple.hpp:27
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
Monitor::reactionFE
boost::shared_ptr< FEMethod > reactionFE
Definition: adolc_plasticity.cpp:455
save_every_nth_step
int save_every_nth_step
Definition: photon_diffusion.cpp:67
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
ContactOps::scale
double scale
Definition: EshelbianContact.hpp:22
MoFEM::createDMVector
auto createDMVector(DM dm)
Get smart vector from DM.
Definition: DMMoFEM.hpp:1067
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
Monitor::skinPostProcFe
boost::shared_ptr< PostProcEleBdy > skinPostProcFe
Definition: adolc_plasticity.cpp:454
Monitor::velocityFieldPtr
boost::shared_ptr< MatrixDouble > velocityFieldPtr
Definition: dynamic_first_order_con_law.cpp:885
Monitor::mField
MoFEM::Interface & mField
Definition: dynamic_first_order_con_law.cpp:784
Monitor::domainPostProcFe
boost::shared_ptr< PostProcEleDomain > domainPostProcFe
Definition: adolc_plasticity.cpp:453
a
constexpr double a
Definition: approx_sphere.cpp:30
MoFEM::FieldEvaluatorInterface
Field evaluator interface.
Definition: FieldEvaluator.hpp:21
simple
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
Monitor::fieldEvalData
boost::shared_ptr< SetPtsData > fieldEvalData
Definition: dynamic_first_order_con_law.cpp:889
SPACE_DIM
constexpr int SPACE_DIM
Definition: free_surface.cpp:78
Monitor::postProcMesh
boost::shared_ptr< moab::Core > postProcMesh
Definition: free_surface.cpp:2037
Monitor::dM
SmartPetscObj< DM > dM
Definition: adolc_plasticity.cpp:452
MoFEM::DMoFEMPreProcessFiniteElements
PetscErrorCode DMoFEMPreProcessFiniteElements(DM dm, MoFEM::FEMethod *method)
execute finite element method for each element in dm (problem)
Definition: DMMoFEM.cpp:546
Monitor::postProcBdy
boost::shared_ptr< PostProcFaceEle > postProcBdy
Definition: dynamic_first_order_con_law.cpp:884
MoFEM::DMoFEMPostProcessFiniteElements
PetscErrorCode DMoFEMPostProcessFiniteElements(DM dm, MoFEM::FEMethod *method)
execute finite element method for each element in dm (problem)
Definition: DMMoFEM.cpp:556
MoFEM::TSMethod::ts_step
PetscInt ts_step
time step number
Definition: LoopMethods.hpp:159
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
Range
Monitor::fRes
SmartPetscObj< Vec > fRes
Definition: adolc_plasticity.cpp:456
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
MoFEM::TSMethod::ts_t
PetscReal ts_t
time
Definition: LoopMethods.hpp:162
Monitor::x2FieldPtr
boost::shared_ptr< MatrixDouble > x2FieldPtr
Definition: dynamic_first_order_con_law.cpp:886
MoFEM::DMoFEMGetInterfacePtr
PetscErrorCode DMoFEMGetInterfacePtr(DM dm, MoFEM::Interface **m_field_ptr)
Get pointer to MoFEM::Interface.
Definition: DMMoFEM.cpp:414
MoFEM::TSMethod::ts_u
Vec & ts_u
state vector
Definition: LoopMethods.hpp:165
MoFEM::MeshsetsManager
Interface for managing meshsets containing materials and boundary conditions.
Definition: MeshsetsManager.hpp:104
Monitor::postProc
boost::shared_ptr< PostProcEle > postProc
Definition: dynamic_first_order_con_law.cpp:883
sdf_hertz_2d_axisymm_plane.d
float d
Definition: sdf_hertz_2d_axisymm_plane.py:4
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
QUIET
@ QUIET
Definition: definitions.h:208
Monitor::saveEveryNthStep
static constexpr int saveEveryNthStep
Definition: heat_equation.cpp:74
MoFEM::BasicMethod::getCacheWeakPtr
boost::weak_ptr< CacheTuple > getCacheWeakPtr() const
Get the cache weak ptr object.
Definition: LoopMethods.hpp:344
MoFEM::MeshsetsManager::getCubitMeshsetPtr
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
Definition: MeshsetsManager.cpp:575
MoFEM::EssentialPreProc
Class (Function) to enforce essential constrains.
Definition: Essential.hpp:25
Monitor::postProcEdge
boost::shared_ptr< PostProcEleBdyCont > postProcEdge
Definition: free_surface.cpp:2039
MoFEM::CoreInterface::get_field_entities_by_type
virtual MoFEMErrorCode get_field_entities_by_type(const std::string name, EntityType type, Range &ents) const =0
get entities in the field by type
Monitor::liftVec
boost::shared_ptr< VectorDouble > liftVec
Definition: free_surface.cpp:2041
MoFEM::DMoFEMLoopFiniteElements
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition: DMMoFEM.cpp:586
MF_EXIST
@ MF_EXIST
Definition: definitions.h:100
MoFEM::PetscOptionsGetInt
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
Definition: DeprecatedPetsc.hpp:142
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEM::FieldBlas
Basic algebra on fields.
Definition: FieldBlas.hpp:21
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
Monitor::geometryFieldPtr
boost::shared_ptr< MatrixDouble > geometryFieldPtr
Definition: dynamic_first_order_con_law.cpp:887
MoFEM::PetscOptionsGetBool
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:182