8static char help[] =
"...\n\n";
30 return 200 * sin(x * 10.) * cos(y * 10.);
37 return sin(x * 10.) * cos(y * 10.);
82 : domainField(
"U"), mField(m_field), mpiComm(mField.get_comm()),
83 mpiRank(mField.get_comm_rank()) {
144 auto domain_rule_lhs = [](int, int,
int p) ->
int {
return 2 * (
p + 1); };
145 auto domain_rule_rhs = [](int, int,
int p) ->
int {
return 2 * (
p + 1); };
149 auto boundary_rule_lhs = [](int, int,
int p) ->
int {
return 2 *
p + 1; };
150 auto boundary_rule_rhs = [](int, int,
int p) ->
int {
return 2 *
p + 1; };
161 auto get_ents_on_mesh_skin = [&]() {
162 Range boundary_entities;
164 std::string entity_name = it->getName();
165 if (entity_name.compare(0, 18,
"BOUNDARY_CONDITION") == 0) {
167 boundary_entities,
true);
171 Range boundary_vertices;
173 boundary_vertices,
true);
174 boundary_entities.merge(boundary_vertices);
179 return boundary_entities;
182 auto mark_boundary_dofs = [&](
Range &&skin_edges) {
184 auto marker_ptr = boost::make_shared<std::vector<unsigned char>>();
186 skin_edges, *marker_ptr);
201 auto det_ptr = boost::make_shared<VectorDouble>();
202 auto jac_ptr = boost::make_shared<MatrixDouble>();
203 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
284 boost::shared_ptr<FaceEle> null_face;
293 boost::shared_ptr<EdgeEle> null_edge;
322 CHKERR KSPGetPC(ksp_solver, &pc);
324 PetscBool is_pcfs = PETSC_FALSE;
325 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
328 if (is_pcfs == PETSC_TRUE) {
337 CHKERR PCFieldSplitSetIS(pc, NULL, is_boundary);
339 CHKERR ISDestroy(&is_boundary);
362 auto u_ptr = boost::make_shared<VectorDouble>();
363 postProc->getOpPtrVector().push_back(
368 postProc->getOpPtrVector().push_back(
381 dM, simpleInterface->getDomainFEName(),
382 boost::dynamic_pointer_cast<FEMethod>(postProc));
384 CHKERR postProc->writeFile(
"out_result.h5m");
389int main(
int argc,
char *argv[]) {
398 DMType dm_name =
"DMMOFEM";
402 moab::Core mb_instance;
403 moab::Interface &moab = mb_instance;
MoFEM::FaceElementForcesAndSourcesCore FaceEle
MoFEM::EdgeElementForcesAndSourcesCore EdgeEle
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
#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 DMMoFEMSNESSetFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES residual evaluation function
PetscErrorCode DMMoFEMGetProblemPtr(DM dm, const MoFEM::Problem **problem_ptr)
Get pointer to problem data structure.
PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES Jacobian evaluation function
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, Vec *g)
DMShellSetCreateGlobalVector.
PetscErrorCode DMoFEMMeshToGlobalVector(DM dm, Vec g, InsertMode mode, ScatterMode scatter_mode)
set ghosted vector values on all existing mesh entities
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
auto createSNES(MPI_Comm comm)
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
Section manager is used to create indexes and sections.
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
Get value at integration points for scalar field.
Post post-proc data at points from hash maps.
Set inverse jacobian to base functions.
Modify integration weights on face to take in account higher-order geometry.
keeps basic data about problem
Problem manager is used to build and partition problems.
MoFEMErrorCode markDofs(const std::string problem_name, RowColData rc, const enum MarkOP op, const Range ents, std::vector< unsigned char > &marker) const
Create vector with marked indices.
Simple interface for fast problem set-up.
const std::string getBoundaryFEName() const
Get the Boundary FE Name.
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
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.
MoFEMErrorCode getOptions()
get options
MoFEMErrorCode getDM(DM *dm)
Get DM.
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
MoFEMErrorCode addBoundaryField(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 boundary.
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
const std::string getProblemName() const
Get the Problem Name.
const std::string getDomainFEName() const
Get the Domain FE Name.
intrusive_ptr for managing petsc objects
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
MoFEMErrorCode outputResults()
MoFEMErrorCode boundaryCondition()
static double boundaryFunction(const double x, const double y, const double z)
MoFEMErrorCode solveSystem()
SmartPetscObj< SNES > snesSolver
static double sourceTermFunction(const double x, const double y, const double z)
MoFEMErrorCode readMesh()
MoFEM::Interface & mField
MoFEMErrorCode assembleSystem()
NonlinearPoisson(MoFEM::Interface &m_field)
boost::shared_ptr< EdgeEle > boundaryTangentMatrixPipeline
boost::shared_ptr< VectorDouble > fieldValuePtr
MoFEMErrorCode setIntegrationRules()
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
boost::shared_ptr< MatrixDouble > fieldGradPtr
boost::shared_ptr< PostProcEle > postProc
MoFEMErrorCode runProgram()
boost::shared_ptr< EdgeEle > boundaryResidualVectorPipeline
boost::shared_ptr< FaceEle > domainResidualVectorPipeline
MoFEMErrorCode setupProblem()
Range boundaryEntitiesForFieldsplit
boost::shared_ptr< DataAtGaussPoints > previousUpdate
boost::shared_ptr< FaceEle > domainTangentMatrixPipeline