v0.14.0
Classes | Typedefs | Functions | Variables
boundary_marker.cpp File Reference
#include <MoFEM.hpp>

Go to the source code of this file.

Classes

struct  OpFace
 

Typedefs

using FaceEle = MoFEM::FaceElementForcesAndSourcesCore
 
using FaceEleOp = FaceEle::UserDataOperator
 

Functions

int main (int argc, char *argv[])
 

Variables

static char help [] = "...\n\n"
 

Typedef Documentation

◆ FaceEle

Examples
boundary_marker.cpp.

Definition at line 16 of file boundary_marker.cpp.

◆ FaceEleOp

Examples
boundary_marker.cpp.

Definition at line 17 of file boundary_marker.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
Examples
boundary_marker.cpp.

Definition at line 74 of file boundary_marker.cpp.

74  {
75 
76  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
77 
78  try {
79 
80  moab::Core mb_instance;
81  moab::Interface &moab = mb_instance;
82 
83  // Create MoFEM instance
84  MoFEM::Core core(moab);
85  MoFEM::Interface &m_field = core;
86 
87  int order = 4;
88  CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-order", &order, PETSC_NULL);
89 
90  DMType dm_name = "DMMOFEM";
91  CHKERR DMRegister_MoFEM(dm_name);
92 
93  auto *simple_interface = m_field.getInterface<Simple>();
94  CHKERR simple_interface->getOptions();
95  CHKERR simple_interface->loadFile("");
96  CHKERR simple_interface->addDomainField("FIELD1", H1,
98  CHKERR simple_interface->setFieldOrder("FIELD1", order);
99  CHKERR simple_interface->setUp();
100 
101  auto get_ents_on_mesh_skin = [&]() {
102  Range faces;
103  CHKERR m_field.get_moab().get_entities_by_type(0, MBTRI, faces);
104  Skinner skin(&m_field.get_moab());
105  Range skin_edges;
106  CHKERR skin.find_skin(0, faces, false, skin_edges);
107  Range skin_verts;
108  CHKERR moab.get_connectivity(skin_edges, skin_verts, true);
109  skin_edges.merge(skin_verts);
110  return skin_edges;
111  };
112 
113  auto mark_boundary_dofs = [&](Range &skin_edges) {
114  auto problem_manager = m_field.getInterface<ProblemsManager>();
115  std::vector<unsigned char> marker;
116  problem_manager->markDofs(simple_interface->getProblemName(), ROW,
117  ProblemsManager::OR, skin_edges, marker);
118  // Unset coefficient 1, e.g. u_y
119  problem_manager->modifyMarkDofs(simple_interface->getProblemName(), ROW,
120  "FIELD1", 1, 1, ProblemsManager::AND, 0,
121  marker);
122  return marker;
123  };
124 
125  auto skin_ents = get_ents_on_mesh_skin();
126 
127  // Get global local vector of marked DOFs. Is global, since is set for all
128  // DOFs on processor. Is local since only DOFs on processor are in the
129  // vector. To access DOFs use local indices.
130  auto marker = mark_boundary_dofs(skin_ents);
131 
132  boost::shared_ptr<FaceEle> fe(new FaceEle(m_field));
133  fe->getOpPtrVector().push_back(new OpFace(skin_ents, marker));
134 
135  auto dm = simple_interface->getDM();
136  CHKERR DMoFEMLoopFiniteElements(dm, simple_interface->getDomainFEName(),
137  fe);
138  }
139  CATCH_ERRORS;
140 
142 }

Variable Documentation

◆ help

char help[] = "...\n\n"
static
Examples
boundary_marker.cpp.

Definition at line 14 of file boundary_marker.cpp.

MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
H1
@ H1
continuous field
Definition: definitions.h:85
MoFEM::ProblemsManager
Problem manager is used to build and partition problems.
Definition: ProblemsManager.hpp:21
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
MoFEM::Simple
Simple interface for fast problem set-up.
Definition: Simple.hpp:27
order
constexpr int order
Definition: dg_projection.cpp:18
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
ROW
@ ROW
Definition: definitions.h:136
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
help
static char help[]
Definition: boundary_marker.cpp:14
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:43
OpFace
Definition: boundary_marker.cpp:19
FaceEle
MoFEM::FaceElementForcesAndSourcesCore FaceEle
Definition: boundary_marker.cpp:16
Range
MoFEM::CoreTmp< 0 >::Initialize
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:72
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1148
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
marker
auto marker
set bit to marker
Definition: hanging_node_approx.cpp:82
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
MoFEM::PetscOptionsGetInt
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
Definition: DeprecatedPetsc.hpp:142