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

Go to the source code of this file.

Classes

struct  CommonData
 
struct  SkeletonFE
 
struct  SkeletonFE::OpFaceSide
 

Typedefs

using FaceEleOnSide = MoFEM::FaceElementForcesAndSourcesCoreOnSide
 
using EdgeEle = MoFEM::EdgeElementForcesAndSourcesCore
 
using FaceEleOnSideOp = FaceEleOnSide::UserDataOperator
 
using EdgeEleOp = EdgeEle::UserDataOperator
 

Functions

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

Variables

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

Typedef Documentation

◆ EdgeEle

◆ EdgeEleOp

◆ FaceEleOnSide

◆ FaceEleOnSideOp

Function Documentation

◆ main()

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

Definition at line 151 of file continuity_check_on_skeleton_with_simple_2d_for_h1.cpp.

151  {
152 
153  // initialize petsc
154  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
155 
156  try {
157 
158  // Create MoAB database
159  moab::Core moab_core;
160  moab::Interface &moab = moab_core;
161 
162  // Create MoFEM database and link it to MoAB
163  MoFEM::Core mofem_core(moab);
164  MoFEM::Interface &m_field = mofem_core;
165 
166  auto core_log = logging::core::get();
167  core_log->add_sink(
168  LogManager::createSink(LogManager::getStrmSelf(), "ATOM"));
169  LogManager::setLog("ATOM");
170 
171  // Register DM Manager
172  DMType dm_name = "DMMOFEM";
173  CHKERR DMRegister_MoFEM(dm_name);
174 
175  // Simple interface
176  Simple *simple_interface;
177  CHKERR m_field.getInterface(simple_interface);
178  {
179  // get options from command line
180  CHKERR simple_interface->getOptions();
181  // Add ghost cells needed for evaluation on skeleton
182  simple_interface->getAddSkeletonFE() = true;
183 
184  // load mesh file
185  CHKERR simple_interface->loadFile("");
186 
187  auto get_base = []() -> FieldApproximationBase {
188  enum bases { AINSWORTH, DEMKOWICZ, LASTBASEOP };
189  const char *list_bases[] = {"ainsworth", "demkowicz"};
190  PetscBool flg;
191  PetscInt choice_base_value = AINSWORTH;
192  CHKERR PetscOptionsGetEList(PETSC_NULL, NULL, "-base", list_bases,
193  LASTBASEOP, &choice_base_value, &flg);
194  if (flg == PETSC_TRUE) {
196  if (choice_base_value == AINSWORTH)
198  else if (choice_base_value == DEMKOWICZ)
199  base = DEMKOWICZ_JACOBI_BASE;
200  return base;
201  }
202  return LASTBASE;
203  };
204 
205  // add fields
206  auto base = get_base();
207  CHKERR simple_interface->addDomainField("FIELD", H1, base, 1);
208  // CHKERR simple_interface->addDomainField("TEST_FIELD", L2,
209  // AINSWORTH_LEGENDRE_BASE, 1);
210  CHKERR simple_interface->addSkeletonField("FIELD", H1, base, 1);
211  // set fields order
212  CHKERR simple_interface->setFieldOrder("FIELD", 2);
213  // CHKERR simple_interface->setFieldOrder("TEST_FIELD", 1);
214  // setup problem
215  CHKERR simple_interface->setUp();
216  // get dm
217  auto dm = simple_interface->getDM();
218 
219  // create elements
220  CommonData elem_data;
221  boost::shared_ptr<EdgeEle> skeleton_fe =
222  boost::shared_ptr<EdgeEle>(new EdgeEle(m_field));
223  skeleton_fe->getOpPtrVector().push_back(
224  new SkeletonFE(m_field, elem_data));
225 
226  // iterate skeleton finite elements
227  CHKERR DMoFEMLoopFiniteElements(dm, simple_interface->getSkeletonFEName(),
228  skeleton_fe);
229  }
230  }
231  CATCH_ERRORS;
232 
233  // finish work cleaning memory, getting statistics, etc.
235 
236  return 0;
237 }

Variable Documentation

◆ help

char help[] = "...\n\n"
static
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
LASTBASE
@ LASTBASE
Definition: definitions.h:69
MoFEM::Simple::getSkeletonFEName
const std::string getSkeletonFEName() const
Get the Skeleton FE Name.
Definition: Simple.hpp:382
MoFEM::Simple::loadFile
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
Definition: Simple.cpp:194
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
SkeletonFE
Definition: continuity_check_on_skeleton_with_simple_2d_for_h1.cpp:28
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::Simple::addSkeletonField
MoFEMErrorCode addSkeletonField(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add field on skeleton.
Definition: Simple.cpp:318
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2002
MoFEM::Simple::getOptions
MoFEMErrorCode getOptions()
get options
Definition: Simple.cpp:180
MoFEM::Simple::getAddSkeletonFE
bool & getAddSkeletonFE()
Get the addSkeletonFE.
Definition: Simple.hpp:452
MoFEM::Simple::getDM
MoFEMErrorCode getDM(DM *dm)
Get DM.
Definition: Simple.cpp:693
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
EdgeEle
MoFEM::EdgeElementForcesAndSourcesCore EdgeEle
Definition: continuity_check_on_skeleton_with_simple_2d_for_h1.cpp:18
MoFEM::Simple::addDomainField
MoFEMErrorCode addDomainField(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add field on domain.
Definition: Simple.cpp:264
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:43
help
static char help[]
Definition: continuity_check_on_skeleton_with_simple_2d_for_h1.cpp:15
MoFEM::Simple::setFieldOrder
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Definition: Simple.cpp:491
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
DEMKOWICZ_JACOBI_BASE
@ DEMKOWICZ_JACOBI_BASE
Definition: definitions.h:66
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1140
CommonData
Definition: continuity_check_on_skeleton_with_simple_2d_for_h1.cpp:22
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MoFEM::PetscOptionsGetEList
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
Definition: DeprecatedPetsc.hpp:203
FieldApproximationBase
FieldApproximationBase
approximation base
Definition: definitions.h:58
MoFEM::Simple::setUp
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
Definition: Simple.cpp:629
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