19static char help[] =
"...\n\n";
48 : domainField(
"U"), mField(m_field) {}
101 pipeline_mng->getOpDomainLhsPipeline().push_back(
107 constexpr int space_dim = 3;
109 auto set_values_to_bc_dofs = [&](
auto &fe) {
110 auto get_bc_hook = [&]() {
114 fe->preProcessHook = get_bc_hook();
117 auto calculate_residual_from_set_values_on_bc = [&](
auto &pipeline) {
124 auto grad_u_vals_ptr = boost::make_shared<MatrixDouble>();
125 pipeline_mng->getOpDomainRhsPipeline().push_back(
128 pipeline_mng->getOpDomainRhsPipeline().push_back(
130 [](
double,
double,
double)
constexpr {
return -1; }));
134 pipeline_mng->getOpDomainRhsPipeline(), {H1});
135 set_values_to_bc_dofs(pipeline_mng->getDomainRhsFE());
136 calculate_residual_from_set_values_on_bc(
137 pipeline_mng->getOpDomainRhsPipeline());
138 pipeline_mng->getOpDomainRhsPipeline().push_back(
148 auto rule_lhs = [](int, int,
int p) ->
int {
return 2 * (
p - 1); };
149 auto rule_rhs = [](int, int,
int p) ->
int {
return p; };
152 CHKERR pipeline_mng->setDomainLhsIntegrationRule(rule_lhs);
153 CHKERR pipeline_mng->setDomainRhsIntegrationRule(rule_rhs);
163 auto ksp_solver = pipeline_mng->
createKSP();
164 CHKERR KSPSetFromOptions(ksp_solver);
165 CHKERR KSPSetUp(ksp_solver);
173 CHKERR KSPSolve(ksp_solver, F,
D);
176 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
177 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
189 auto post_proc_fe = boost::make_shared<PostProcVolEle>(
mField);
191 auto u_ptr = boost::make_shared<VectorDouble>();
192 post_proc_fe->getOpPtrVector().push_back(
197 post_proc_fe->getOpPtrVector().push_back(
201 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
203 {{domainField, u_ptr}},
213 pipeline_mng->getDomainRhsFE() = post_proc_fe;
214 CHKERR pipeline_mng->loopFiniteElements();
215 CHKERR post_proc_fe->writeFile(
"out_result.h5m");
234int main(
int argc,
char *argv[]) {
243 DMType dm_name =
"DMMOFEM";
247 moab::Core mb_instance;
248 moab::Interface &moab = mb_instance;
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. 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 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.
SmartPetscObj< KSP > createKSP(SmartPetscObj< DM > dm=nullptr)
Create KSP (linear) solver.
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)
SmartPetscObj< Vec > smartVectorDuplicate(SmartPetscObj< Vec > &vec)
Create duplicate vector of smart vector.
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
Add operators pushing bases from local to physical configuration.
Simple interface for fast problem set-up.
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.
Class (Function) to enforce essential constrains.
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.
PipelineManager interface.
boost::shared_ptr< FEMethod > & getDomainLhsFE()
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 setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
const std::string getProblemName() const
Get the Problem Name.
Definition of the temperature bc data structure.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
MoFEMErrorCode setupProblem()
MoFEMErrorCode runProgram()
MoFEM::Interface & mField
MoFEMErrorCode readMesh()
MoFEMErrorCode assembleSystem()
MoFEMErrorCode outputResults()
MoFEMErrorCode setIntegrationRules()
MoFEMErrorCode solveSystem()
Poisson3DHomogeneous(MoFEM::Interface &m_field)
MoFEMErrorCode boundaryCondition()