v0.8.23
Classes | Public Member Functions | Public Attributes | List of all members
PostProcFaceOnRefinedMesh Struct Reference

Postprocess on face. More...

#include <users_modules/basic_finite_elements/src/PostProcOnRefMesh.hpp>

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

Classes

struct  CommonData
 
struct  OpGetFieldGradientValuesOnSkin
 

Public Member Functions

 PostProcFaceOnRefinedMesh (MoFEM::Interface &m_field, bool six_node_post_proc_tris=true)
 
virtual ~PostProcFaceOnRefinedMesh ()
 
int getRule (int order)
 
MoFEMErrorCode generateReferenceElementMesh ()
 
MoFEMErrorCode setGaussPts (int order)
 
MoFEMErrorCode preProcess ()
 
MoFEMErrorCode postProcess ()
 
virtual PostProcCommonOnRefMesh::CommonDatagetCommonData ()
 
MoFEMErrorCode addFieldValuesGradientPostProcOnSkin (const std::string field_name, const std::string vol_fe_name, boost::shared_ptr< MatrixDouble > grad_mat_ptr=nullptr, bool save_on_tag=true)
 
- Public Member Functions inherited from PostProcTemplateOnRefineMesh< MoFEM::FaceElementForcesAndSourcesCore >
 PostProcTemplateOnRefineMesh (MoFEM::Interface &m_field)
 
MoFEMErrorCode addFieldValuesPostProc (const std::string field_name, Vec v=PETSC_NULL)
 Add operator to post-process L2, H1, Hdiv, Hcurl field value. More...
 
MoFEMErrorCode addFieldValuesPostProc (const std::string field_name, const std::string tag_name, Vec v=PETSC_NULL)
 Add operator to post-process L2 or H1 field value. More...
 
MoFEMErrorCode addFieldValuesGradientPostProc (const std::string field_name, Vec v=PETSC_NULL)
 Add operator to post-process L2 or H1 field gradient. More...
 
MoFEMErrorCode addFieldValuesGradientPostProc (const std::string field_name, const std::string tag_name, Vec v=PETSC_NULL)
 Add operator to post-process L2 or H1 field gradient. More...
 
MoFEMErrorCode writeFile (const std::string file_name)
 wrote results in (MOAB) format, use "file_name.h5m" More...
 

Public Attributes

bool sixNodePostProcTris
 
std::map< EntityHandle, EntityHandleelementsMap
 
CommonData commonData
 
- Public Attributes inherited from PostProcTemplateOnRefineMesh< MoFEM::FaceElementForcesAndSourcesCore >
moab::Core coreMesh
 
moab::Interface & postProcMesh
 
std::vector< EntityHandlemapGaussPts
 

Detailed Description

Postprocess on face.

Examples
cell_forces.cpp, minimal_surface_area.cpp, and reaction_diffusion_equation.cpp.

Definition at line 736 of file PostProcOnRefMesh.hpp.

Constructor & Destructor Documentation

◆ PostProcFaceOnRefinedMesh()

PostProcFaceOnRefinedMesh::PostProcFaceOnRefinedMesh ( MoFEM::Interface m_field,
bool  six_node_post_proc_tris = true 
)

◆ ~PostProcFaceOnRefinedMesh()

virtual PostProcFaceOnRefinedMesh::~PostProcFaceOnRefinedMesh ( )
virtual

Definition at line 747 of file PostProcOnRefMesh.hpp.

747  {
748  ParallelComm *pcomm_post_proc_mesh =
749  ParallelComm::get_pcomm(&postProcMesh, MYPCOMM_INDEX);
750  if (pcomm_post_proc_mesh != NULL) {
751  delete pcomm_post_proc_mesh;
752  }
753  }
moab::Interface & postProcMesh
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:285

Member Function Documentation

◆ addFieldValuesGradientPostProcOnSkin()

MoFEMErrorCode PostProcFaceOnRefinedMesh::addFieldValuesGradientPostProcOnSkin ( const std::string  field_name,
const std::string  vol_fe_name,
boost::shared_ptr< MatrixDouble >  grad_mat_ptr = nullptr,
bool  save_on_tag = true 
)

Definition at line 802 of file PostProcOnRefMesh.hpp.

805  {
807 
808  if (!grad_mat_ptr)
809  grad_mat_ptr = boost::make_shared<MatrixDouble>();
810 
811  boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnSide> my_side_fe =
812  boost::make_shared<VolumeElementForcesAndSourcesCoreOnSide>(mField);
813 
814  // check number of coefficients
815  auto field_ptr = mField.get_field_structure(field_name);
816  const int nb_coefficients = field_ptr->getNbOfCoeffs();
817 
818  switch (nb_coefficients) {
819  case 1:
820  my_side_fe->getOpPtrVector().push_back(
821  new OpCalculateScalarFieldGradient<3>(field_name, grad_mat_ptr));
822  break;
823  case 3:
824  my_side_fe->getOpPtrVector().push_back(
825  new OpCalculateVectorFieldGradient<3, 3>(field_name, grad_mat_ptr));
826  break;
827  default:
828  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
829  "field with that number of coefficients is not implemented");
830  }
831 
832  FaceElementForcesAndSourcesCore::getOpPtrVector().push_back(
833  new OpGetFieldGradientValuesOnSkin(
834  postProcMesh, mapGaussPts, field_name, field_name + "_GRAD",
835  my_side_fe, vol_fe_name, grad_mat_ptr, save_on_tag));
836 
838  }
moab::Interface & postProcMesh
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
std::vector< EntityHandle > mapGaussPts
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ generateReferenceElementMesh()

MoFEMErrorCode PostProcFaceOnRefinedMesh::generateReferenceElementMesh ( )
Examples
minimal_surface_area.cpp.

Definition at line 532 of file PostProcOnRefMesh.cpp.

532  {
534 
535  gaussPts.resize(3, 3, false);
536  gaussPts.clear();
537  gaussPts(0, 0) = 0;
538  gaussPts(1, 0) = 0;
539  gaussPts(0, 1) = 1;
540  gaussPts(1, 1) = 0;
541  gaussPts(0, 2) = 0;
542  gaussPts(1, 2) = 1;
543  mapGaussPts.resize(gaussPts.size2());
544 
545  moab::Core core_ref;
546  moab::Interface &moab_ref = core_ref;
547  const EntityHandle *conn;
548  int num_nodes;
549  EntityHandle tri_conn[3];
550  MatrixDouble coords(6, 3);
551  for (int gg = 0; gg != 3; gg++) {
552  coords(gg, 0) = gaussPts(0, gg);
553  coords(gg, 1) = gaussPts(1, gg);
554  coords(gg, 2) = 0;
555  CHKERR moab_ref.create_vertex(&coords(gg, 0), tri_conn[gg]);
556  }
557 
558  EntityHandle tri;
559  CHKERR moab_ref.create_element(MBTRI, tri_conn, 3, tri);
560  Range edges;
561  CHKERR moab_ref.get_adjacencies(&tri, 1, 1, true, edges);
562  EntityHandle meshset;
563  CHKERR moab_ref.create_meshset(MESHSET_SET, meshset);
564  CHKERR moab_ref.add_entities(meshset, &tri, 1);
565  CHKERR moab_ref.add_entities(meshset, edges);
566  if (sixNodePostProcTris) {
567  CHKERR moab_ref.convert_entities(meshset, true, false, false);
568  }
569  CHKERR moab_ref.get_connectivity(tri, conn, num_nodes, false);
570  CHKERR moab_ref.get_coords(conn, num_nodes, &coords(0, 0));
571 
572  gaussPts.resize(3, num_nodes, false);
573  gaussPts.clear();
574  for (int nn = 0; nn < 3; nn++) {
575  gaussPts(0, nn) = coords(nn, 0);
576  gaussPts(1, nn) = coords(nn, 1);
577  gaussPts(0, 3 + nn) = coords(3 + nn, 0);
578  gaussPts(1, 3 + nn) = coords(3 + nn, 1);
579  }
580 
582 }
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:74
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
bool sixNodePostProcTris
#define CHKERR
Inline error check.
Definition: definitions.h:596
std::vector< EntityHandle > mapGaussPts
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ getCommonData()

virtual PostProcCommonOnRefMesh::CommonData& PostProcFaceOnRefinedMesh::getCommonData ( )
virtual

Reimplemented from PostProcTemplateOnRefineMesh< MoFEM::FaceElementForcesAndSourcesCore >.

Definition at line 769 of file PostProcOnRefMesh.hpp.

769  {
770  return commonData;
771  }
CommonData commonData

◆ getRule()

int PostProcFaceOnRefinedMesh::getRule ( int  order)

Definition at line 756 of file PostProcOnRefMesh.hpp.

756 { return -1; };

◆ postProcess()

MoFEMErrorCode PostProcFaceOnRefinedMesh::postProcess ( )

Definition at line 659 of file PostProcOnRefMesh.cpp.

659  {
661  ParallelComm *pcomm =
662  ParallelComm::get_pcomm(&mField.get_moab(), MYPCOMM_INDEX);
663  ParallelComm *pcomm_post_proc_mesh =
664  ParallelComm::get_pcomm(&postProcMesh, MYPCOMM_INDEX);
665  if (pcomm_post_proc_mesh == NULL) {
666  pcomm_post_proc_mesh = new ParallelComm(&postProcMesh, mField.get_comm());
667  }
668  Range tris;
669  CHKERR postProcMesh.get_entities_by_type(0, MBTRI, tris, false);
670  int rank = pcomm->rank();
671  Range::iterator pit = tris.begin();
672  for (; pit != tris.end(); pit++) {
673  CHKERR postProcMesh.tag_set_data(pcomm_post_proc_mesh->part_tag(), &*pit, 1,
674  &rank);
675  }
676  CHKERR pcomm_post_proc_mesh->resolve_shared_ents(0);
678 }
moab::Interface & postProcMesh
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:285
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ preProcess()

MoFEMErrorCode PostProcFaceOnRefinedMesh::preProcess ( )

Definition at line 649 of file PostProcOnRefMesh.cpp.

649  {
651  ParallelComm *pcomm_post_proc_mesh =
652  ParallelComm::get_pcomm(&postProcMesh, MYPCOMM_INDEX);
653  if (pcomm_post_proc_mesh != NULL) {
654  delete pcomm_post_proc_mesh;
655  }
657 }
moab::Interface & postProcMesh
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:285

◆ setGaussPts()

MoFEMErrorCode PostProcFaceOnRefinedMesh::setGaussPts ( int  order)

Definition at line 584 of file PostProcOnRefMesh.cpp.

584  {
586  if (gaussPts.size1() == 0) {
587  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
588  "post-process mesh not generated");
589  }
590 
591  const EntityHandle *conn;
592  int num_nodes;
593  EntityHandle tri;
594 
595  if (elementsMap.find(numeredEntFiniteElementPtr->getEnt()) !=
596  elementsMap.end()) {
597  tri = elementsMap[numeredEntFiniteElementPtr->getEnt()];
598  } else {
599  ublas::vector<EntityHandle> tri_conn(3);
600  MatrixDouble coords_tri(3, 3);
601  VectorDouble coords(3);
602  CHKERR mField.get_moab().get_connectivity(
603  numeredEntFiniteElementPtr->getEnt(), conn, num_nodes, true);
604  CHKERR mField.get_moab().get_coords(conn, num_nodes, &coords_tri(0, 0));
605  for (int gg = 0; gg != 3; gg++) {
606  double ksi = gaussPts(0, gg);
607  double eta = gaussPts(1, gg);
608  double n0 = N_MBTRI0(ksi, eta);
609  double n1 = N_MBTRI1(ksi, eta);
610  double n2 = N_MBTRI2(ksi, eta);
611  double x =
612  n0 * coords_tri(0, 0) + n1 * coords_tri(1, 0) + n2 * coords_tri(2, 0);
613  double y =
614  n0 * coords_tri(0, 1) + n1 * coords_tri(1, 1) + n2 * coords_tri(2, 1);
615  double z =
616  n0 * coords_tri(0, 2) + n1 * coords_tri(1, 2) + n2 * coords_tri(2, 2);
617  coords[0] = x;
618  coords[1] = y;
619  coords[2] = z;
620  CHKERR postProcMesh.create_vertex(&coords[0], tri_conn[gg]);
621  }
622  CHKERR postProcMesh.create_element(MBTRI, &tri_conn[0], 3, tri);
623  elementsMap[numeredEntFiniteElementPtr->getEnt()] = tri;
624  Range edges;
625  CHKERR postProcMesh.get_adjacencies(&tri, 1, 1, true, edges);
626  EntityHandle meshset;
627  CHKERR postProcMesh.create_meshset(MESHSET_SET, meshset);
628  CHKERR postProcMesh.add_entities(meshset, &tri, 1);
629  CHKERR postProcMesh.add_entities(meshset, edges);
630  if (sixNodePostProcTris) {
631  CHKERR postProcMesh.convert_entities(meshset, true, false, false);
632  }
633  CHKERR postProcMesh.delete_entities(&meshset, 1);
634  CHKERR postProcMesh.delete_entities(edges);
635  }
636 
637  // Set values which map nodes with integration points on the prism
638  {
639  CHKERR postProcMesh.get_connectivity(tri, conn, num_nodes, false);
640  mapGaussPts.resize(num_nodes);
641  for (int nn = 0; nn < num_nodes; nn++) {
642  mapGaussPts[nn] = conn[nn];
643  }
644  }
645 
647 }
moab::Interface & postProcMesh
std::map< EntityHandle, EntityHandle > elementsMap
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:74
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
bool sixNodePostProcTris
#define CHKERR
Inline error check.
Definition: definitions.h:596
std::vector< EntityHandle > mapGaussPts
#define N_MBTRI2(x, y)
triangle shape function
Definition: fem_tools.h:56
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
ublas::vector< double, DoubleAllocator > VectorDouble
Definition: Types.hpp:72
#define N_MBTRI1(x, y)
triangle shape function
Definition: fem_tools.h:55
#define N_MBTRI0(x, y)
triangle shape function
Definition: fem_tools.h:54

Member Data Documentation

◆ commonData

CommonData PostProcFaceOnRefinedMesh::commonData

Definition at line 767 of file PostProcOnRefMesh.hpp.

◆ elementsMap

std::map<EntityHandle, EntityHandle> PostProcFaceOnRefinedMesh::elementsMap

Definition at line 761 of file PostProcOnRefMesh.hpp.

◆ sixNodePostProcTris

bool PostProcFaceOnRefinedMesh::sixNodePostProcTris

Definition at line 739 of file PostProcOnRefMesh.hpp.


The documentation for this struct was generated from the following files: