v0.16.0
Loading...
Searching...
No Matches
plot_base.cpp
Go to the documentation of this file.
1/**
2 * \file plot_base.cpp
3 * \example mofem/tutorials/fun-2_plot_base/plot_base.cpp
4 *
5 * Utility for plotting base functions for different spaces, polynomial bases
6 */
7
8#include <MoFEM.hpp>
9
10using namespace MoFEM;
11
12static char help[] = "...\n\n";
13
14
15
16template <int DIM> struct ElementsAndOps {};
17
18template <> struct ElementsAndOps<2> {
20};
21
22template <> struct ElementsAndOps<3> {
24};
25
26constexpr int SPACE_DIM =
27 EXECUTABLE_DIMENSION; //< Space dimension of problem, mesh
28
31using DomainEleOp = DomainEle::UserDataOperator;
33
34struct MyPostProc : public PostProcEle {
35 using PostProcEle::PostProcEle;
36
39
42
43protected:
44 ublas::matrix<int> refEleMap;
46};
47
48struct Example {
49
50 Example(MoFEM::Interface &m_field) : mField(m_field) {}
51
53
54private:
57
67
70};
71
72//! [Run programme]
85}
86//! [Run programme]
87
88//! [Read mesh]
91
92 PetscBool load_file = PETSC_FALSE;
93 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-load_file", &load_file,
94 PETSC_NULLPTR);
95
96 if (load_file == PETSC_FALSE) {
97
98 auto &moab = mField.get_moab();
99
100 if (SPACE_DIM == 3) {
101
102 // create one tet
103 double tet_coords[] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1};
104 EntityHandle nodes[4];
105 for (int nn = 0; nn < 4; nn++) {
106 CHKERR moab.create_vertex(&tet_coords[3 * nn], nodes[nn]);
107 }
108 EntityHandle tet;
109 CHKERR moab.create_element(MBTET, nodes, 4, tet);
110 Range adj;
111 for (auto d : {1, 2})
112 CHKERR moab.get_adjacencies(&tet, 1, d, true, adj);
113 }
114
115 if (SPACE_DIM == 2) {
116
117 // create one triangle
118 double tri_coords[] = {0, 0, 0, 1, 0, 0, 0, 1, 0};
119 EntityHandle nodes[3];
120 for (int nn = 0; nn < 3; nn++) {
121 CHKERR moab.create_vertex(&tri_coords[3 * nn], nodes[nn]);
122 }
123 EntityHandle tri;
124 CHKERR moab.create_element(MBTRI, nodes, 3, tri);
125 Range adj;
126 CHKERR moab.get_adjacencies(&tri, 1, 1, true, adj);
127 }
128
132
133 // Add all elements to database
134 CHKERR mField.getInterface<BitRefManager>()->setBitRefLevelByDim(
136
137 } else {
138
142 }
143
145}
146//! [Read mesh]
147
148//! [Set up problem]
151 // Add field
152
153 // Declare elements
154 enum bases { AINSWORTH, AINSWORTH_LOBATTO, DEMKOWICZ, BERNSTEIN, LASBASETOP };
155 const char *list_bases[] = {"ainsworth", "ainsworth_lobatto", "demkowicz",
156 "bernstein"};
157
158 PetscBool flg;
159 PetscInt choice_base_value = AINSWORTH;
160 CHKERR PetscOptionsGetEList(PETSC_NULLPTR, NULL, "-base", list_bases, LASBASETOP,
161 &choice_base_value, &flg);
162 if (flg != PETSC_TRUE)
163 SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "base not set");
165 if (choice_base_value == AINSWORTH)
167 if (choice_base_value == AINSWORTH_LOBATTO)
169 else if (choice_base_value == DEMKOWICZ)
171 else if (choice_base_value == BERNSTEIN)
173
174 const char *list_continuity[] = {"continuous", "discontinuous"};
175 PetscInt choice_continuity_value = CONTINUOUS;
176 CHKERR PetscOptionsGetEList(PETSC_NULLPTR, NULL, "-continuity", list_continuity,
177 LASTCONTINUITY, &choice_continuity_value, &flg);
178
179 FieldContinuity continuity;
180 if (choice_continuity_value == CONTINUOUS)
181 continuity = CONTINUOUS;
182 else if (choice_continuity_value == DISCONTINUOUS)
183 continuity = DISCONTINUOUS;
184 else
185 SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "continuity not set");
186
187 enum spaces { H1SPACE, L2SPACE, HCURLSPACE, HDIVSPACE, LASBASETSPACE };
188 const char *list_spaces[] = {"h1", "l2", "hcurl", "hdiv"};
189 PetscInt choice_space_value = H1SPACE;
190 CHKERR PetscOptionsGetEList(PETSC_NULLPTR, NULL, "-space", list_spaces,
191 LASBASETSPACE, &choice_space_value, &flg);
192 if (flg != PETSC_TRUE)
193 SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "space not set");
194 space = H1;
195 if (choice_space_value == H1SPACE)
196 space = H1;
197 else if (choice_space_value == L2SPACE)
198 space = L2;
199 else if (choice_space_value == HCURLSPACE)
200 space = HCURL;
201 else if (choice_space_value == HDIVSPACE)
202 space = HDIV;
203
204 AinsworthOrderHooks::broken_nbfacetri_edge_hdiv = [](int p) { return p; };
205 AinsworthOrderHooks::broken_nbfacetri_face_hdiv = [](int p) { return p; };
209
210 if(continuity == CONTINUOUS)
212 else
214
215 int order = 3;
216 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-order", &order, PETSC_NULLPTR);
219
220 auto bc_mng = mField.getInterface<BcManager>();
221 CHKERR bc_mng->removeSideDOFs(simpleInterface->getProblemName(), "ZERO_FLUX",
222 "U", SPACE_DIM, 0, 1, true);
223
225}
226//! [Set up problem]
227
228//! [Set integration rule]
233//! [Set integration rule]
234
235//! [Create common data]
237//! [Create common data]
238
239//! [Boundary condition]
241//! [Boundary condition]
242
243//! [Push operators to pipeline]
245//! [Push operators to pipeline]
246
247//! [Solve]
249
250//! [Solve]
253
255
256 auto post_proc_fe = boost::make_shared<MyPostProc>(mField);
257 post_proc_fe->generateReferenceElementMesh();
258 pipeline_mng->getDomainPostProcFE() = post_proc_fe;
259
260 if (SPACE_DIM == 2) {
261 if (space == HCURL) {
262 auto jac_ptr = boost::make_shared<MatrixDouble>();
263 post_proc_fe->getOpPtrVector().push_back(
264 new OpCalculateHOJacForFace(jac_ptr));
265 post_proc_fe->getOpPtrVector().push_back(new OpMakeHdivFromHcurl());
266 post_proc_fe->getOpPtrVector().push_back(
268 }
269 }
270
271 switch (space) {
272 case H1:
273 case L2:
274
275 {
276
278
279 auto u_ptr = boost::make_shared<VectorDouble>();
280 post_proc_fe->getOpPtrVector().push_back(
281 new OpCalculateScalarFieldValues("U", u_ptr));
282 post_proc_fe->getOpPtrVector().push_back(
283
284 new OpPPMap(
285
286 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
287
288 {{"U", u_ptr}},
289
290 {},
291
292 {},
293
294 {}
295
296 )
297
298 );
299 } break;
300 case HCURL:
301 case HDIV:
302
303 {
305
307 post_proc_fe->getOpPtrVector(), {space});
308 auto u_ptr = boost::make_shared<MatrixDouble>();
309 post_proc_fe->getOpPtrVector().push_back(
310 new OpCalculateHVecVectorField<3>("U", u_ptr));
311
312 post_proc_fe->getOpPtrVector().push_back(
313
314 new OpPPMap(
315
316 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
317
318 {},
319
320 {{"U", u_ptr}},
321
322 {},
323
324 {}
325
326 )
327
328 );
329 } break;
330 default:
331 break;
332 }
333
334 auto scale_tag_val = [&]() {
336 auto &post_proc_mesh = post_proc_fe->getPostProcMesh();
337 Range nodes;
338 CHKERR post_proc_mesh.get_entities_by_type(0, MBVERTEX, nodes);
339 Tag th;
340 CHKERR post_proc_mesh.tag_get_handle("U", th);
341 int length;
342 CHKERR post_proc_mesh.tag_get_length(th, length);
343 std::vector<double> data(nodes.size() * length);
344 CHKERR post_proc_mesh.tag_get_data(th, nodes, &*data.begin());
345 double max_v = 0;
346 for (int i = 0; i != nodes.size(); ++i) {
347 double v = 0;
348 for (int d = 0; d != length; ++d)
349 v += pow(data[length * i + d], 2);
350 v = std::sqrt(v);
351 max_v = std::max(max_v, v);
352 }
353 for (auto &v : data)
354 v /= max_v;
355 CHKERR post_proc_mesh.tag_set_data(th, nodes, &*data.begin());
357 };
358
359 auto prb_ptr = mField.get_problem(simpleInterface->getProblemName());
360
361 size_t nb = 0;
362 auto dofs_ptr = prb_ptr->getNumeredRowDofsPtr();
363
364 for (auto dof_ptr : (*dofs_ptr)) {
365 MOFEM_LOG("PLOTBASE", Sev::verbose) << *dof_ptr;
366 auto &val = const_cast<double &>(dof_ptr->getFieldData());
367 val = 1;
368 CHKERR pipeline_mng->loopFiniteElementsPostProc();
369 CHKERR scale_tag_val();
370 CHKERR post_proc_fe->writeFile(
371 "out_base_dof_" + boost::lexical_cast<std::string>(nb) + ".h5m");
372 CHKERR post_proc_fe->getPostProcMesh().delete_mesh();
373 val = 0;
374 ++nb;
375 };
376
378}
379//! [Postprocess results]
380
381//! [Check results]
383//! [Check results]
384
385int main(int argc, char *argv[]) {
386
387 // Initialisation of MoFEM/PETSc and MOAB data structures
388 MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
389
390 try {
391
392 //! [Register MoFEM discrete manager in PETSc]
393 DMType dm_name = "DMMOFEM";
394 CHKERR DMRegister_MoFEM(dm_name);
395 //! [Register MoFEM discrete manager in PETSc
396
397 // Add logging channel for example
398 auto core_log = logging::core::get();
399 core_log->add_sink(
401 LogManager::setLog("PLOTBASE");
402 MOFEM_LOG_TAG("PLOTBASE", "plotbase");
403
404 //! [Create MoAB]
405 moab::Core mb_instance; ///< mesh database
406 moab::Interface &moab = mb_instance; ///< mesh database interface
407 //! [Create MoAB]
408
409 //! [Create MoFEM]
410 MoFEM::Core core(moab); ///< finite element database
411 MoFEM::Interface &m_field = core; ///< finite element database insterface
412 //! [Create MoFEM]
413
414 //! [Example]
415 Example ex(m_field);
416 CHKERR ex.runProblem();
417 //! [Example]
418 }
420
422
423 return 0;
424}
425
428 moab::Core core_ref;
429 moab::Interface &moab_ref = core_ref;
430
431 char ref_mesh_file_name[255];
432
433 if (SPACE_DIM == 2)
434 strcpy(ref_mesh_file_name, "ref_mesh2d.h5m");
435 else if (SPACE_DIM == 3)
436 strcpy(ref_mesh_file_name, "ref_mesh3d.h5m");
437 else
438 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
439 "Dimension not implemented");
440
441 CHKERR PetscOptionsGetString(PETSC_NULLPTR, "", "-ref_file", ref_mesh_file_name,
442 255, PETSC_NULLPTR);
443 CHKERR moab_ref.load_file(ref_mesh_file_name, 0, "");
444
445 // Get elements
446 Range elems;
447 CHKERR moab_ref.get_entities_by_dimension(0, SPACE_DIM, elems);
448
449 // Add mid-nodes on edges
450 EntityHandle meshset;
451 CHKERR moab_ref.create_meshset(MESHSET_SET, meshset);
452 CHKERR moab_ref.add_entities(meshset, elems);
453 CHKERR moab_ref.convert_entities(meshset, true, false, false);
454 CHKERR moab_ref.delete_entities(&meshset, 1);
455
456 // Get nodes on the mesh
457 Range elem_nodes;
458 CHKERR moab_ref.get_connectivity(elems, elem_nodes, false);
459
460 // Map node entity and Gauss pint number
461 std::map<EntityHandle, int> nodes_pts_map;
462
463 // Set gauss points coordinates from the reference mesh
464 gaussPts.resize(SPACE_DIM + 1, elem_nodes.size(), false);
465 gaussPts.clear();
466 Range::iterator nit = elem_nodes.begin();
467 for (int gg = 0; nit != elem_nodes.end(); nit++, gg++) {
468 double coords[3];
469 CHKERR moab_ref.get_coords(&*nit, 1, coords);
470 for (auto d : {0, 1, 2})
471 gaussPts(d, gg) = coords[d];
472 nodes_pts_map[*nit] = gg;
473 }
474
475 if (SPACE_DIM == 2) {
476 // Set size of adjacency matrix (note ho order nodes 3 nodes and 3 nodes on
477 // edges)
478 refEleMap.resize(elems.size(), 3 + 3);
479 } else if (SPACE_DIM == 3) {
480 refEleMap.resize(elems.size(), 4 + 6);
481 }
482
483 // Set adjacency matrix
484 Range::iterator tit = elems.begin();
485 for (int tt = 0; tit != elems.end(); ++tit, ++tt) {
486 const EntityHandle *conn;
487 int num_nodes;
488 CHKERR moab_ref.get_connectivity(*tit, conn, num_nodes, false);
489 for (int nn = 0; nn != num_nodes; ++nn) {
490 refEleMap(tt, nn) = nodes_pts_map[conn[nn]];
491 }
492 }
493
495}
496
499
500 const int num_nodes = gaussPts.size2();
501
502 // Calculate shape functions
503
504 switch (numeredEntFiniteElementPtr->getEntType()) {
505 case MBTRI:
506 shapeFunctions.resize(num_nodes, 3);
508 &gaussPts(0, 0), &gaussPts(1, 0), num_nodes);
509 break;
510 case MBQUAD: {
511 shapeFunctions.resize(num_nodes, 4);
512 for (int gg = 0; gg != num_nodes; gg++) {
513 double ksi = gaussPts(0, gg);
514 double eta = gaussPts(1, gg);
515 shapeFunctions(gg, 0) = N_MBQUAD0(ksi, eta);
516 shapeFunctions(gg, 1) = N_MBQUAD1(ksi, eta);
517 shapeFunctions(gg, 2) = N_MBQUAD2(ksi, eta);
518 shapeFunctions(gg, 3) = N_MBQUAD3(ksi, eta);
519 }
520 } break;
521 case MBTET: {
522 shapeFunctions.resize(num_nodes, 8);
524 &gaussPts(0, 0), &gaussPts(1, 0),
525 &gaussPts(2, 0), num_nodes);
526 } break;
527 case MBHEX: {
528 shapeFunctions.resize(num_nodes, 8);
529 for (int gg = 0; gg != num_nodes; gg++) {
530 double ksi = gaussPts(0, gg);
531 double eta = gaussPts(1, gg);
532 double zeta = gaussPts(2, gg);
533 shapeFunctions(gg, 0) = N_MBHEX0(ksi, eta, zeta);
534 shapeFunctions(gg, 1) = N_MBHEX1(ksi, eta, zeta);
535 shapeFunctions(gg, 2) = N_MBHEX2(ksi, eta, zeta);
536 shapeFunctions(gg, 3) = N_MBHEX3(ksi, eta, zeta);
537 shapeFunctions(gg, 4) = N_MBHEX4(ksi, eta, zeta);
538 shapeFunctions(gg, 5) = N_MBHEX5(ksi, eta, zeta);
539 shapeFunctions(gg, 6) = N_MBHEX6(ksi, eta, zeta);
540 shapeFunctions(gg, 7) = N_MBHEX7(ksi, eta, zeta);
541 }
542 } break;
543 default:
544 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
545 "Not implemented element type");
546 }
547
548 // Create physical nodes
549
550 // MoAB interface allowing for creating nodes and elements in the bulk
551 ReadUtilIface *iface;
552 CHKERR getPostProcMesh().query_interface(iface);
553
554 std::vector<double *> arrays; /// pointers to memory allocated by MoAB for
555 /// storing X, Y, and Z coordinates
556 EntityHandle startv; // Starting handle for vertex
557 // Allocate memory for num_nodes, and return starting handle, and access to
558 // memort.
559 CHKERR iface->get_node_coords(3, num_nodes, 0, startv, arrays);
560
561 mapGaussPts.resize(gaussPts.size2());
562 for (int gg = 0; gg != num_nodes; ++gg)
563 mapGaussPts[gg] = startv + gg;
564
565 Tag th;
566 int def_in_the_loop = -1;
567 CHKERR getPostProcMesh().tag_get_handle("NB_IN_THE_LOOP", 1, MB_TYPE_INTEGER,
568 th, MB_TAG_CREAT | MB_TAG_SPARSE,
569 &def_in_the_loop);
570
571 // Create physical elements
572
573 const int num_el = refEleMap.size1();
574 const int num_nodes_on_ele = refEleMap.size2();
575
576 EntityHandle starte; // Starting handle to first created element
577 EntityHandle *conn; // Access to MOAB memory with connectivity of elements
578
579 // Create tris/tets in the bulk in MoAB database
580 if (SPACE_DIM == 2)
581 CHKERR iface->get_element_connect(num_el, num_nodes_on_ele, MBTRI, 0,
582 starte, conn);
583 else if (SPACE_DIM == 3)
584 CHKERR iface->get_element_connect(num_el, num_nodes_on_ele, MBTET, 0,
585 starte, conn);
586 else
587 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
588 "Dimension not implemented");
589
590 // At this point elements (memory for elements) is allocated, at code bellow
591 // actual connectivity of elements is set.
592 for (unsigned int tt = 0; tt != refEleMap.size1(); ++tt) {
593 for (int nn = 0; nn != num_nodes_on_ele; ++nn)
594 conn[num_nodes_on_ele * tt + nn] = mapGaussPts[refEleMap(tt, nn)];
595 }
596
597 // Finalise elements creation. At that point MOAB updates adjacency tables,
598 // and elements are ready to use.
599 CHKERR iface->update_adjacencies(starte, num_el, num_nodes_on_ele, conn);
600
601 auto physical_elements = Range(starte, starte + num_el - 1);
602 CHKERR getPostProcMesh().tag_clear_data(th, physical_elements, &(nInTheLoop));
603
604 EntityHandle fe_ent = numeredEntFiniteElementPtr->getEnt();
605 int fe_num_nodes;
606 {
607 const EntityHandle *conn;
608 mField.get_moab().get_connectivity(fe_ent, conn, fe_num_nodes, true);
609 coords.resize(3 * fe_num_nodes, false);
610 CHKERR mField.get_moab().get_coords(conn, fe_num_nodes, &coords[0]);
611 }
612
613 // Set physical coordinates to physical nodes
614 FTensor::Index<'i', 3> i;
616 &*shapeFunctions.data().begin());
617
619 arrays[0], arrays[1], arrays[2]);
620 const double *t_coords_ele_x = &coords[0];
621 const double *t_coords_ele_y = &coords[1];
622 const double *t_coords_ele_z = &coords[2];
623 for (int gg = 0; gg != num_nodes; ++gg) {
625 t_coords_ele_x, t_coords_ele_y, t_coords_ele_z);
626 t_coords(i) = 0;
627 for (int nn = 0; nn != fe_num_nodes; ++nn) {
628 t_coords(i) += t_n * t_ele_coords(i);
629 for (auto ii : {0, 1, 2})
630 if (std::abs(t_coords(ii)) < std::numeric_limits<float>::epsilon())
631 t_coords(ii) = 0;
632 ++t_ele_coords;
633 ++t_n;
634 }
635 ++t_coords;
636 }
637
639}
640
643 ParallelComm *pcomm_post_proc_mesh =
644 ParallelComm::get_pcomm(coreMeshPtr.get(), MYPCOMM_INDEX);
645 if (pcomm_post_proc_mesh != NULL)
646 delete pcomm_post_proc_mesh;
648};
649
652
653 auto resolve_shared_ents = [&]() {
655
656 ParallelComm *pcomm_post_proc_mesh =
657 ParallelComm::get_pcomm(&(getPostProcMesh()), MYPCOMM_INDEX);
658 if (pcomm_post_proc_mesh == NULL) {
659 // wrapRefMeshComm =
660 // boost::make_shared<WrapMPIComm>(T::mField.get_comm(), false);
661 pcomm_post_proc_mesh = new ParallelComm(
662 &(getPostProcMesh()),
663 PETSC_COMM_WORLD /*(T::wrapRefMeshComm)->get_comm()*/);
664 }
665
666 CHKERR pcomm_post_proc_mesh->resolve_shared_ents(0);
667
669 };
670
671 CHKERR resolve_shared_ents();
672
674}
int main()
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
#define CATCH_ERRORS
Catch errors.
FieldApproximationBase
approximation base
Definition definitions.h:58
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
@ AINSWORTH_LOBATTO_BASE
Definition definitions.h:62
@ DEMKOWICZ_JACOBI_BASE
Definition definitions.h:66
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
Definition definitions.h:64
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FieldSpace
approximation spaces
Definition definitions.h:82
@ L2
field with C-1 continuity
Definition definitions.h:88
@ H1
continuous field
Definition definitions.h:85
@ HCURL
field with continuous tangents
Definition definitions.h:86
@ HDIV
field with continuous normal traction
Definition definitions.h:87
#define MYPCOMM_INDEX
default communicator number PCOMM
FieldContinuity
Field continuity.
Definition definitions.h:99
@ LASTCONTINUITY
@ CONTINUOUS
Regular field.
@ DISCONTINUOUS
Broken continuity (No effect on L2 space)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_IMPOSSIBLE_CASE
Definition definitions.h:35
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
constexpr int order
#define N_MBQUAD3(x, y)
quad shape function
Definition fem_tools.h:60
#define N_MBHEX7(x, y, z)
Definition fem_tools.h:78
#define N_MBHEX3(x, y, z)
Definition fem_tools.h:74
#define N_MBHEX5(x, y, z)
Definition fem_tools.h:76
#define N_MBHEX4(x, y, z)
Definition fem_tools.h:75
#define N_MBHEX0(x, y, z)
Definition fem_tools.h:71
#define N_MBHEX6(x, y, z)
Definition fem_tools.h:77
#define N_MBHEX2(x, y, z)
Definition fem_tools.h:73
#define N_MBQUAD0(x, y)
quad shape function
Definition fem_tools.h:57
#define N_MBHEX1(x, y, z)
Definition fem_tools.h:72
#define N_MBQUAD2(x, y)
quad shape function
Definition fem_tools.h:59
#define N_MBQUAD1(x, y)
quad shape function
Definition fem_tools.h:58
double eta
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:43
MoFEMErrorCode loopFiniteElementsPostProc(SmartPetscObj< DM > dm=nullptr)
Iterate postprocessing finite elements.
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
MoFEMErrorCode removeSideDOFs(const std::string problem_name, const std::string block_name, const std::string field_name, int bridge_dim, int lo, int hi, bool is_distributed_mesh=true)
Remove DOFs on side entities from problem.
FTensor::Index< 'i', SPACE_DIM > i
const double v
phase velocity of light in medium (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
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)
OpCalculateHOJacForFaceImpl< 2 > OpCalculateHOJacForFace
OpSetContravariantPiolaTransformOnFace2DImpl< 2 > OpSetContravariantPiolaTransformOnFace2D
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
static char help[]
Definition plot_base.cpp:12
constexpr int SPACE_DIM
Definition plot_base.cpp:26
[Operators_definition]
[Example]
Definition plastic.cpp:217
MoFEMErrorCode boundaryCondition()
MoFEMErrorCode assembleSystem()
MoFEMErrorCode readMesh()
MoFEMErrorCode setIntegrationRules()
[Set up problem]
FieldApproximationBase base
Choice of finite element basis functions.
Definition plot_base.cpp:68
MoFEMErrorCode checkResults()
MoFEMErrorCode solveSystem()
MoFEMErrorCode createCommonData()
Example(MoFEM::Interface &m_field)
Definition plot_base.cpp:50
MoFEMErrorCode runProblem()
FieldSpace space
Definition plot_base.cpp:69
MoFEM::Interface & mField
Reference to MoFEM interface.
Definition plastic.cpp:227
MoFEMErrorCode setupProblem()
MoFEMErrorCode outputResults()
Add operators pushing bases from local to physical configuration.
static boost::function< int(int)> broken_nbvolumetet_edge_hdiv
Definition Hdiv.hpp:27
static boost::function< int(int)> broken_nbvolumetet_face_hdiv
Definition Hdiv.hpp:28
static boost::function< int(int)> broken_nbfacetri_face_hdiv
Definition Hdiv.hpp:26
static boost::function< int(int)> broken_nbvolumetet_volume_hdiv
Definition Hdiv.hpp:29
static boost::function< int(int)> broken_nbfacetri_edge_hdiv
Definition Hdiv.hpp:25
Boundary condition manager for finite element problem setup.
Managing BitRefLevels.
virtual moab::Interface & get_moab()=0
virtual MoFEMErrorCode rebuild_database(int verb=DEFAULT_VERBOSITY)=0
Clear database and initialize it once again.
Core (interface) class.
Definition Core.hpp:83
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:68
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:123
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Get vector field for H-div approximation.
Specialization for double precision scalar field values calculation.
Make Hdiv space from Hcurl space in 2d.
Post post-proc data at points from hash maps.
PipelineManager interface.
boost::shared_ptr< FEMethod > & getDomainPostProcFE()
Get domain postprocessing finite element.
Simple interface for fast problem set-up.
Definition Simple.hpp:27
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.
Definition Simple.cpp:261
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
Definition Simple.cpp:191
void setDim(int dim)
Set the problem dimension.
Definition Simple.hpp:380
MoFEMErrorCode getOptions()
get options
Definition Simple.cpp:180
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Definition Simple.cpp:575
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
Definition Simple.cpp:735
const std::string getProblemName() const
Get the Problem Name.
Definition Simple.hpp:450
BitRefLevel & getBitRefLevel()
Get the BitRefLevel.
Definition Simple.hpp:415
MoFEMErrorCode addDomainBrokenField(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 broken field on domain.
Definition Simple.cpp:282
static MoFEMErrorCode shapeFunMBTET(double *shape, const double *ksi, const double *eta, const double *zeta, const double nb)
Calculate shape functions on tetrahedron.
Definition Tools.hpp:767
static MoFEMErrorCode shapeFunMBTRI(double *shape, const double *ksi, const double *eta, const int nb)
Calculate shape functions on triangle.
Definition Tools.hpp:730
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
MoFEMErrorCode postProcess()
MoFEMErrorCode generateReferenceElementMesh()
ublas::matrix< int > refEleMap
Definition plot_base.cpp:44
MoFEMErrorCode setGaussPts(int order)
MoFEMErrorCode preProcess()
MatrixDouble shapeFunctions
Definition plot_base.cpp:45
#define EXECUTABLE_DIMENSION
Definition plastic.cpp:13
double zeta
Viscous hardening.
Definition plastic.cpp:131
constexpr int SPACE_DIM