242 DMType dm_name =
"DMMOFEM";
258 enum bases { AINSWORTH, DEMKOWICZ, LASBASETOP };
259 const char *list_bases[] = {
"ainsworth",
"demkowicz"};
261 PetscInt choice_base_value = AINSWORTH;
263 LASBASETOP, &choice_base_value, &flg);
265 if (flg != PETSC_TRUE)
268 if (choice_base_value == AINSWORTH)
270 else if (choice_base_value == DEMKOWICZ)
274 constexpr
int order = 5;
277 auto dm = simple_interface->
getDM();
281 auto assemble_matrices_and_vectors = [&]() {
283 auto jac_ptr = boost::make_shared<MatrixDouble>();
284 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
285 auto det_ptr = boost::make_shared<VectorDouble>();
287 pipeline_mng->getOpDomainRhsPipeline().push_back(
289 pipeline_mng->getOpDomainRhsPipeline().push_back(
291 pipeline_mng->getOpDomainRhsPipeline().push_back(
293 pipeline_mng->getOpDomainRhsPipeline().push_back(
295 pipeline_mng->getOpDomainRhsPipeline().push_back(
298 pipeline_mng->getOpDomainLhsPipeline().push_back(
300 pipeline_mng->getOpDomainLhsPipeline().push_back(
302 pipeline_mng->getOpDomainLhsPipeline().push_back(
304 pipeline_mng->getOpDomainLhsPipeline().push_back(
306 pipeline_mng->getOpDomainLhsPipeline().push_back(
309 [](
double,
double,
double) {
return 1; })
320 auto solve_problem = [&] {
322 auto solver = pipeline_mng->createKSP();
323 CHKERR KSPSetFromOptions(solver);
330 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
331 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
336 auto check_solution = [&] {
339 pipeline_mng->getOpDomainLhsPipeline().clear();
340 pipeline_mng->getOpDomainRhsPipeline().clear();
342 auto ptr_values = boost::make_shared<MatrixDouble>();
343 auto ptr_divergence = boost::make_shared<VectorDouble>();
344 auto ptr_grad = boost::make_shared<MatrixDouble>();
345 auto ptr_hessian = boost::make_shared<MatrixDouble>();
347 auto jac_ptr = boost::make_shared<MatrixDouble>();
348 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
349 auto det_ptr = boost::make_shared<VectorDouble>();
352 pipeline_mng->getOpDomainRhsPipeline().push_back(
354 pipeline_mng->getOpDomainRhsPipeline().push_back(
356 pipeline_mng->getOpDomainRhsPipeline().push_back(
358 pipeline_mng->getOpDomainRhsPipeline().push_back(
360 pipeline_mng->getOpDomainRhsPipeline().push_back(
364 auto base_mass = boost::make_shared<MatrixDouble>();
365 auto data_l2 = boost::make_shared<EntitiesFieldData>(MBENTITYSET);
367 pipeline_mng->getOpDomainRhsPipeline().push_back(
369 pipeline_mng->getOpDomainRhsPipeline().push_back(
372 pipeline_mng->getOpDomainRhsPipeline().push_back(
374 base_mass, data_l2, base,
HCURL));
377 pipeline_mng->getOpDomainRhsPipeline().push_back(
380 pipeline_mng->getOpDomainRhsPipeline().push_back(
384 pipeline_mng->getOpDomainRhsPipeline().push_back(
386 "FIELD1", ptr_divergence));
387 pipeline_mng->getOpDomainRhsPipeline().push_back(
392 ptr_values, ptr_divergence, ptr_grad, ptr_hessian));
394 CHKERR pipeline_mng->loopFiniteElements();
399 CHKERR assemble_matrices_and_vectors();