15static char help[] =
"...\n\n";
109 auto get_ents_on_mesh_skin = [&]() {
110 Range boundary_entities;
112 std::string entity_name = it->getName();
113 if (entity_name.compare(0, 2,
"BC") == 0) {
115 boundary_entities,
true);
119 Range boundary_vertices;
121 boundary_vertices,
true);
122 boundary_entities.merge(boundary_vertices);
124 return boundary_entities;
127 auto mark_boundary_dofs = [&](
Range &&skin_edges) {
129 auto marker_ptr = boost::make_shared<std::vector<unsigned char>>();
131 skin_edges, *marker_ptr);
135 auto remove_dofs_from_problem = [&](
Range &&skin_edges) {
138 CHKERR problem_manager->removeDofsOnEntities(
147 CHKERR remove_dofs_from_problem(get_ents_on_mesh_skin());
167 auto set_domain = [&]() {
169 auto det_ptr = boost::make_shared<VectorDouble>();
170 auto jac_ptr = boost::make_shared<MatrixDouble>();
171 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
200 auto set_boundary = [&]() {
239 CHKERR KSPSetFromOptions(solver);
247 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
248 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
265 auto post_proc_fe = boost::make_shared<PostProcEle>(
mField);
267 auto p_real_ptr = boost::make_shared<VectorDouble>();
268 auto p_imag_ptr = boost::make_shared<VectorDouble>();
270 post_proc_fe->getOpPtrVector().push_back(
272 post_proc_fe->getOpPtrVector().push_back(
277 post_proc_fe->getOpPtrVector().push_back(
281 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
283 {{
"P_REAL", p_real_ptr}, {
"P_IMAG", p_imag_ptr}},
291 pipeline_mng->getDomainRhsFE() = post_proc_fe;
292 CHKERR pipeline_mng->loopFiniteElements();
293 CHKERR post_proc_fe->writeFile(
"out_helmholtz.h5m");
307 CHKERR VecNorm(
D, NORM_2, &nrm2);
309 << std::setprecision(9) <<
"Solution norm " << nrm2;
311 PetscBool test_flg = PETSC_FALSE;
314 constexpr double regression_test = 97.261672;
315 constexpr double eps = 1e-6;
316 if (std::abs(nrm2 - regression_test) / regression_test >
eps)
318 "Not converged solution");
324int main(
int argc,
char *argv[]) {
333 DMType dm_name =
"DMMOFEM";
338 moab::Core mb_instance;
339 moab::Interface &moab = mb_instance;
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, FIELD_DIM > OpDomainMass
#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 ...
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
auto smartCreateDMVector(DM dm)
Get smart vector from DM.
boost::ptr_vector< UserDataOperator > & getOpDomainLhsPipeline()
Get the Op Domain Lhs Pipeline object.
boost::ptr_vector< UserDataOperator > & getOpBoundaryLhsPipeline()
Get the Op Boundary Lhs Pipeline object.
SmartPetscObj< KSP > createKSP(SmartPetscObj< DM > dm=nullptr)
Create KSP (linear) solver.
boost::ptr_vector< UserDataOperator > & getOpBoundaryRhsPipeline()
Get the Op Boundary Rhs Pipeline object.
#define MOFEM_LOG(channel, severity)
Log.
#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.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradGrad< 1, 1, SPACE_DIM > OpDomainGradGrad
FormsIntegrators< EdgeEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 1 > OpBoundarySource
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
SmartPetscObj< Vec > smartVectorDuplicate(SmartPetscObj< Vec > &vec)
Create duplicate vector of smart vector.
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::BiLinearForm< G >::OpMass< 1, SPACE_DIM > OpBoundaryMass
[Only used with Hencky/nonlinear material]
MoFEMErrorCode boundaryCondition()
[Set up problem]
MoFEMErrorCode assembleSystem()
[Applying essential BC]
MoFEMErrorCode readMesh()
[run problem]
MoFEMErrorCode checkResults()
MoFEMErrorCode solveSystem()
[Push operators to pipeline]
Example(MoFEM::Interface &m_field)
MoFEMErrorCode runProblem()
MoFEM::Interface & mField
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
MoFEMErrorCode setupProblem()
MoFEMErrorCode outputResults()
[Solve]
virtual moab::Interface & get_moab()=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.
default operator for EDGE element
Get value at integration points for scalar field.
Post post-proc data at points from hash maps.
Set indices on entities on finite element.
Set inverse jacobian to base functions.
Modify integration weights on face to take in account higher-order geometry.
PipelineManager interface.
boost::shared_ptr< FEMethod > & getDomainRhsFE()
boost::shared_ptr< FEMethod > & getDomainLhsFE()
boost::shared_ptr< FEMethod > & getBoundaryLhsFE()
MoFEMErrorCode setBoundaryLhsIntegrationRule(RuleHookFun rule)
MoFEMErrorCode setBoundaryRhsIntegrationRule(RuleHookFun rule)
boost::shared_ptr< FEMethod > & getBoundaryRhsFE()
MoFEMErrorCode setDomainLhsIntegrationRule(RuleHookFun rule)
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.
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 loadFile(const std::string options, const std::string mesh_file_name)
Load mesh file.
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.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.