129 {
130
132
133 try {
134
135 DMType dm_name = "DMMOFEM";
137
138 moab::Core mb_instance;
139 moab::Interface &moab = mb_instance;
140
141
144
149
150
151 enum bases { AINSWORTH, DEMKOWICZ, LASBASETOP };
152 const char *list_bases[] = {"ainsworth", "demkowicz"};
153 PetscBool flg;
154 PetscInt choice_base_value = AINSWORTH;
156 LASBASETOP, &choice_base_value, &flg);
157
158 if (flg != PETSC_TRUE)
161 if (choice_base_value == AINSWORTH)
163 else if (choice_base_value == DEMKOWICZ)
165
171 return p;
172 };
173
175 constexpr int order = 4;
178 auto dm =
simple->getDM();
179
181
182 auto assemble_matrices_and_vectors = [&]() {
184
186 pipeline_mng->getOpDomainRhsPipeline(), {HDIV});
187 pipeline_mng->getOpDomainRhsPipeline().push_back(
189
191 pipeline_mng->getOpDomainLhsPipeline(), {HDIV});
192 pipeline_mng->getOpDomainLhsPipeline().push_back(
193
195 [](double x, double, double) { return 1; })
196
197 );
198
200 return 2 * p_data + 1;
201 };
204
206 };
207
208 auto solve_problem = [&] {
210 auto solver = pipeline_mng->createKSP();
211 CHKERR KSPSetFromOptions(solver);
213
216
218 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
219 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
222 };
223
224 auto check_solution = [&] {
226
227 pipeline_mng->getOpDomainLhsPipeline().clear();
228 pipeline_mng->getOpDomainRhsPipeline().clear();
229
230 auto ptr_values = boost::make_shared<MatrixDouble>();
231 auto ptr_grad = boost::make_shared<MatrixDouble>();
232
233
235 pipeline_mng->getOpDomainRhsPipeline(), {HDIV});
236
237
238 pipeline_mng->getOpDomainRhsPipeline().push_back(
240
241 pipeline_mng->getOpDomainRhsPipeline().push_back(
243 ptr_grad));
244 pipeline_mng->getOpDomainRhsPipeline().push_back(
246
247 CHKERR pipeline_mng->loopFiniteElements();
248
250 };
251
252 CHKERR assemble_matrices_and_vectors();
255 }
257
259}
void simple(double P1[], double P2[], double P3[], double c[], const int N)
#define CATCH_ERRORS
Catch errors.
FieldApproximationBase
approximation base
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base nme:nme847.
@ HDIV
field with continuous normal traction
#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 createDMVector(DM dm)
Get smart vector from DM.
FormsIntegrators< EleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< BASE_DIM, SPACE_DIM > OpDomainSource
Operator to integrate the right hand side matrix for the problem.
FormsIntegrators< EleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< BASE_DIM, SPACE_DIM > OpDomainMass
OPerator to integrate mass matrix for least square approximation.
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
Add operators pushing bases from local to physical configuration.
static boost::function< int(int)> broken_nbvolumetet_edge_hdiv
static boost::function< int(int)> broken_nbvolumetet_face_hdiv
static boost::function< int(int)> broken_nbfacetri_face_hdiv
static boost::function< int(int)> broken_nbvolumetet_volume_hdiv
static boost::function< int(int)> broken_nbfacetri_edge_hdiv
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.
Get vector field for H-div approximation.
Calculate gradient of vector field.
PipelineManager interface.
Simple interface for fast problem set-up.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.