v0.14.0
forces_and_sources_h1_continuity_check.cpp
Go to the documentation of this file.
1 
2 
3 #include <MoFEM.hpp>
4 
5 namespace bio = boost::iostreams;
6 using bio::stream;
7 using bio::tee_device;
8 
9 using namespace MoFEM;
10 
11 static char help[] = "...\n\n";
12 
13 static const double face_coords[4][9] = {{0, 0, 0, 1, 0, 0, 0, 0, 1},
14  {1, 0, 0, 0, 1, 0, 0, 0, 1},
15  {0, 0, 0, 0, 1, 0, 0, 0, 1},
16  {0, 0, 0, 1, 0, 0, 0, 1, 0}};
17 
18 static const double edge_coords[6][6] = {
19  {0, 0, 0, 1, 0, 0}, {1, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0},
20  {0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 1}, {0, 1, 0, 0, 0, 1}};
21 
22 int main(int argc, char *argv[]) {
23 
24  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
25 
26  try {
27 
28  moab::Core mb_instance;
29  moab::Interface &moab = mb_instance;
30  int rank;
31  MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
32 
33  PetscBool flg = PETSC_TRUE;
34  char mesh_file_name[255];
35 #if PETSC_VERSION_GE(3, 6, 4)
36  ierr = PetscOptionsGetString(PETSC_NULL, "", "-my_file", mesh_file_name,
37  255, &flg);
38  CHKERRG(ierr);
39 #else
40  ierr = PetscOptionsGetString(PETSC_NULL, PETSC_NULL, "-my_file",
41  mesh_file_name, 255, &flg);
42  CHKERRG(ierr);
43 #endif
44  if (flg != PETSC_TRUE) {
45  SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
46  }
47  const char *option;
48  option = "";
49  CHKERR moab.load_file(mesh_file_name, 0, option);
50 
51  // Create MoFEM (Joseph) database
52  MoFEM::Core core(moab);
53  MoFEM::Interface &m_field = core;
54 
55  // set entitities bit level
56  BitRefLevel bit_level0;
57  bit_level0.set(0);
58  EntityHandle meshset_level0;
59  CHKERR moab.create_meshset(MESHSET_SET, meshset_level0);
60 
61  CHKERR m_field.getInterface<BitRefManager>()->setBitRefLevelByDim(
62  0, 3, bit_level0);
63 
64 
65  // Fields
66  CHKERR m_field.add_field("MESH_NODE_POSITIONS", H1, AINSWORTH_LEGENDRE_BASE,
67  3);
68 
69  CHKERR m_field.add_field("H1", H1, AINSWORTH_LEGENDRE_BASE, 1);
70 
71 
72  // FE
73  CHKERR m_field.add_finite_element("TET_FE");
74  CHKERR m_field.add_finite_element("TRI_FE");
75  CHKERR m_field.add_finite_element("SKIN_FE");
76  CHKERR m_field.add_finite_element("EDGE_FE");
77 
78 
79  // Define rows/cols and element data
80  CHKERR m_field.modify_finite_element_add_field_row("TET_FE", "H1");
81  CHKERR m_field.modify_finite_element_add_field_col("TET_FE", "H1");
82  CHKERR m_field.modify_finite_element_add_field_data("TET_FE", "H1");
84  "MESH_NODE_POSITIONS");
85 
86 
87  CHKERR m_field.modify_finite_element_add_field_row("SKIN_FE", "H1");
88  CHKERR m_field.modify_finite_element_add_field_col("SKIN_FE", "H1");
89  CHKERR m_field.modify_finite_element_add_field_data("SKIN_FE", "H1");
91  "MESH_NODE_POSITIONS");
92 
93 
94  CHKERR m_field.modify_finite_element_add_field_row("TRI_FE", "H1");
95  CHKERR m_field.modify_finite_element_add_field_col("TRI_FE", "H1");
96  CHKERR m_field.modify_finite_element_add_field_data("TRI_FE", "H1");
98  "MESH_NODE_POSITIONS");
99 
100 
101  CHKERR m_field.modify_finite_element_add_field_row("EDGE_FE", "H1");
102  CHKERR m_field.modify_finite_element_add_field_col("EDGE_FE", "H1");
103  CHKERR m_field.modify_finite_element_add_field_data("EDGE_FE", "H1");
105  "MESH_NODE_POSITIONS");
106 
107  // Problem
108  CHKERR m_field.add_problem("TEST_PROBLEM");
109 
110 
111  // set finite elements for problem
112  CHKERR m_field.modify_problem_add_finite_element("TEST_PROBLEM", "TET_FE");
113  CHKERR m_field.modify_problem_add_finite_element("TEST_PROBLEM", "SKIN_FE");
114  CHKERR m_field.modify_problem_add_finite_element("TEST_PROBLEM", "TRI_FE");
115  CHKERR m_field.modify_problem_add_finite_element("TEST_PROBLEM", "EDGE_FE");
116 
117  // set refinement level for problem
118  CHKERR m_field.modify_problem_ref_level_add_bit("TEST_PROBLEM", bit_level0);
119 
120 
121  // meshset consisting all entities in mesh
122  EntityHandle root_set = moab.get_root_set();
123  // add entities to field
124  CHKERR m_field.add_ents_to_field_by_type(root_set, MBTET, "H1");
125 
126 
127  // add entities to finite element
128  CHKERR
129  m_field.add_ents_to_finite_element_by_type(root_set, MBTET, "TET_FE");
130 
131 
132  Range tets;
133  CHKERR m_field.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
134  BitRefLevel().set(0), BitRefLevel().set(), MBTET, tets);
135 
136  Skinner skin(&moab);
137  Range skin_faces; // skin faces from 3d ents
138  CHKERR skin.find_skin(0, tets, false, skin_faces);
139  CHKERR m_field.add_ents_to_finite_element_by_type(skin_faces, MBTRI,
140  "SKIN_FE");
141 
142  Range faces;
143  CHKERR m_field.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
144  BitRefLevel().set(0), BitRefLevel().set(), MBTRI, faces);
145 
146  faces = subtract(faces, skin_faces);
147  CHKERR m_field.add_ents_to_finite_element_by_type(faces, MBTRI, "TRI_FE");
148 
149  Range edges;
150  CHKERR moab.get_adjacencies(faces, 1, false, edges, moab::Interface::UNION);
151  CHKERR m_field.add_ents_to_finite_element_by_type(edges, MBEDGE, "EDGE_FE");
152 
153  Range skin_edges;
154  CHKERR moab.get_adjacencies(skin_faces, 1, false, skin_edges,
155  moab::Interface::UNION);
156  CHKERR m_field.add_ents_to_finite_element_by_type(edges, MBEDGE, "EDGE_FE");
157 
158 
159  // set app. order
160  int order = 4;
161  CHKERR m_field.set_field_order(root_set, MBTET, "H1", order);
162  CHKERR m_field.set_field_order(root_set, MBTRI, "H1", order);
163  CHKERR m_field.set_field_order(root_set, MBEDGE, "H1", order);
164 
165  CHKERR m_field.add_ents_to_field_by_type(0, MBTET, "MESH_NODE_POSITIONS");
166  CHKERR m_field.set_field_order(0, MBVERTEX, "MESH_NODE_POSITIONS", 1);
167  CHKERR m_field.set_field_order(0, MBEDGE, "MESH_NODE_POSITIONS", 2);
168  CHKERR m_field.set_field_order(0, MBTRI, "MESH_NODE_POSITIONS", 2);
169  CHKERR m_field.set_field_order(0, MBTET, "MESH_NODE_POSITIONS", 2);
170 
171  /****/
172  // build database
173  // build field
174  CHKERR m_field.build_fields();
175 
176  // build finite elemnts
177  CHKERR m_field.build_finite_elements();
178 
179  // build adjacencies
180  CHKERR m_field.build_adjacencies(bit_level0);
181 
182 
183  ProblemsManager *prb_mng_ptr;
184  CHKERR m_field.getInterface(prb_mng_ptr);
185 
186  // build problem
187  CHKERR prb_mng_ptr->buildProblem("TEST_PROBLEM", true);
188 
189 
190  // project geometry form 10 node tets on higher order approx. functions
191  Projection10NodeCoordsOnField ent_method(m_field, "MESH_NODE_POSITIONS");
192  CHKERR m_field.loop_dofs("MESH_NODE_POSITIONS", ent_method);
193 
194  /****/
195  // mesh partitioning
196  // partition
197  CHKERR prb_mng_ptr->partitionSimpleProblem("TEST_PROBLEM");
198  CHKERR prb_mng_ptr->partitionFiniteElements("TEST_PROBLEM");
199 
200  // what are ghost nodes, see Petsc Manual
201  CHKERR prb_mng_ptr->partitionGhostDofs("TEST_PROBLEM");
202 
203 
204  Vec v;
205  CHKERR m_field.getInterface<VecManager>()->vecCreateGhost("TEST_PROBLEM",
206  ROW, &v);
207  CHKERR VecSetRandom(v, PETSC_NULL);
208 
209  CHKERR m_field.getInterface<VecManager>()->setLocalGhostVector(
210  "TEST_PROBLEM", ROW, v, INSERT_VALUES, SCATTER_REVERSE);
211 
212  CHKERR VecDestroy(&v);
213 
214 
215  typedef tee_device<std::ostream, std::ofstream> TeeDevice;
216  typedef stream<TeeDevice> TeeStream;
217  std::ofstream ofs("forces_and_sources_hdiv_continuity_check.txt");
218  TeeDevice my_tee(std::cout, ofs);
219  TeeStream my_split(my_tee);
220 
221  struct OpTetFluxes
223 
224  MoFEM::Interface &mField;
225  Tag tH;
226 
227  OpTetFluxes(MoFEM::Interface &m_field, Tag th)
230  mField(m_field), tH(th) {}
231 
232  MoFEMErrorCode doWork(int side, EntityType type,
235 
236  if (data.getFieldData().size() == 0)
238 
239  if (type == MBTRI) {
240 
241  boost::shared_ptr<const NumeredEntFiniteElement> mofem_fe =
242  getNumeredEntFiniteElementPtr();
243  SideNumber_multiIndex &side_table = mofem_fe->getSideNumberTable();
244  EntityHandle face = side_table.get<1>()
245  .find(boost::make_tuple(type, side))
246  ->get()
247  ->ent;
248  int sense = side_table.get<1>()
249  .find(boost::make_tuple(type, side))
250  ->get()
251  ->sense;
252 
253  double t = 0;
254  int nb_dofs = data.getN().size2();
255  for (int dd = 0; dd < nb_dofs; dd++) {
256  t += data.getN(side)(dd) * data.getFieldData()[dd];
257  }
258 
259  double *t_ptr;
260  CHKERR mField.get_moab().tag_get_by_ptr(tH, &face, 1,
261  (const void **)&t_ptr);
262 
263  *t_ptr += sense * t;
264  }
265 
266  if (type == MBEDGE) {
267 
268  boost::shared_ptr<const NumeredEntFiniteElement> mofem_fe =
269  getNumeredEntFiniteElementPtr();
270  SideNumber_multiIndex &side_table = mofem_fe->getSideNumberTable();
271  EntityHandle edge = side_table.get<1>()
272  .find(boost::make_tuple(type, side))
273  ->get()
274  ->ent;
275  Range adj_tets;
276  CHKERR mField.get_moab().get_adjacencies(&edge, 1, 3, false, adj_tets,
277  moab::Interface::UNION);
278  const int nb_adj_tets = adj_tets.size();
279 
280  double t = 0;
281  int nb_dofs = data.getN().size2();
282  for (int dd = 0; dd < nb_dofs; dd++) {
283  t += data.getN(4 + side)(dd) * data.getFieldData()[dd];
284  }
285 
286  double *t_ptr;
287  CHKERR mField.get_moab().tag_get_by_ptr(tH, &edge, 1,
288  (const void **)&t_ptr);
289 
290  *t_ptr += t / nb_adj_tets;
291  }
292 
294  }
295  };
296 
297  struct MyTetFE : public VolumeElementForcesAndSourcesCore {
298 
299  MyTetFE(MoFEM::Interface &m_field)
301  int getRule(int order) { return -1; };
302 
303  MatrixDouble N_tri;
304  MoFEMErrorCode setGaussPts(int order) {
305 
307 
308  try {
309 
310  N_tri.resize(1, 3);
311  CHKERR ShapeMBTRI(&N_tri(0, 0), G_TRI_X1, G_TRI_Y1, 1);
312 
313 
314  gaussPts.resize(4, 4 + 6);
315  int ff = 0;
316  for (; ff < 4; ff++) {
317  int dd = 0;
318  for (; dd < 3; dd++) {
319  gaussPts(dd, ff) =
320  cblas_ddot(3, &N_tri(0, 0), 1, &face_coords[ff][dd], 3);
321  }
322  gaussPts(3, ff) = G_TRI_W1[0];
323  }
324 
325  int ee = 0;
326  for (; ee < 6; ee++) {
327  int dd = 0;
328  for (; dd < 3; dd++) {
329  gaussPts(dd, 4 + ee) =
330  (edge_coords[ee][0 + dd] + edge_coords[ee][3 + dd]) * 0.5;
331  }
332  gaussPts(3, 4 + ee) = 1;
333  }
334 
335  // std::cerr << gaussPts << std::endl;
336 
337  } catch (std::exception &ex) {
338  std::ostringstream ss;
339  ss << "thorw in method: " << ex.what() << " at line " << __LINE__
340  << " in file " << __FILE__;
341  SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, ss.str().c_str());
342  }
343 
345  }
346  };
347 
348  struct OpFacesSkinFluxes
350 
351  MoFEM::Interface &mField;
352  Tag tH1, tH2;
353  TeeStream &mySplit;
354 
355  OpFacesSkinFluxes(MoFEM::Interface &m_field, Tag th1, Tag th2,
356  TeeStream &my_split)
359  mField(m_field), tH1(th1), tH2(th2), mySplit(my_split) {}
360 
361  MoFEMErrorCode doWork(int side, EntityType type,
364 
365  if (type != MBTRI)
367  EntityHandle face = getNumeredEntFiniteElementPtr()->getEnt();
368 
369  double *t_ptr;
370  CHKERR mField.get_moab().tag_get_by_ptr(tH1, &face, 1,
371  (const void **)&t_ptr);
372 
373  double *tn_ptr;
374  CHKERR mField.get_moab().tag_get_by_ptr(tH2, &face, 1,
375  (const void **)&tn_ptr);
376 
377 
378  *tn_ptr = *t_ptr;
379 
380  int dd = 0;
381  int nb_dofs = data.getN().size2();
382  for (; dd < nb_dofs; dd++) {
383  double val = data.getFieldData()[dd];
384  *tn_ptr += -data.getN()(0, dd) * val;
385  }
386 
387  const double eps = 1e-8;
388  if (fabs(*tn_ptr) > eps) {
389  SETERRQ1(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
390  "H1 continuity failed %6.4e", *tn_ptr);
391  }
392 
393  mySplit.precision(5);
394  mySplit << face << " " << /*std::fixed <<*/ fabs(*tn_ptr) << std::endl;
395 
397  }
398  };
399 
400  struct OpFacesFluxes
402 
403  MoFEM::Interface &mField;
404  Tag tH1, tH2;
405  TeeStream &mySplit;
406 
407  OpFacesFluxes(MoFEM::Interface &m_field, Tag _th1, Tag _th2,
408  TeeStream &my_split)
411  mField(m_field), tH1(_th1), tH2(_th2), mySplit(my_split) {}
412 
413  MoFEMErrorCode doWork(int side, EntityType type,
416 
417  if (type != MBTRI)
419 
420  EntityHandle face = getNumeredEntFiniteElementPtr()->getEnt();
421 
422  double *t_ptr;
423  CHKERR mField.get_moab().tag_get_by_ptr(tH1, &face, 1,
424  (const void **)&t_ptr);
425 
426  double *tn_ptr;
427  CHKERR mField.get_moab().tag_get_by_ptr(tH2, &face, 1,
428  (const void **)&tn_ptr);
429 
430 
431  *tn_ptr = *t_ptr;
432 
433  const double eps = 1e-8;
434  if (fabs(*tn_ptr) > eps) {
435  SETERRQ1(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
436  "H1 continuity failed %6.4e", *tn_ptr);
437  }
438 
439  mySplit.precision(5);
440 
441  mySplit << face << " " << /*std::fixed <<*/ fabs(*tn_ptr) << std::endl;
442 
444  }
445  };
446 
447  struct MyTriFE : public FaceElementForcesAndSourcesCore {
448 
449  MyTriFE(MoFEM::Interface &m_field)
450  : FaceElementForcesAndSourcesCore(m_field) {}
451  int getRule(int order) { return -1; };
452 
453  MoFEMErrorCode setGaussPts(int order) {
455 
456  gaussPts.resize(3, 1);
457  gaussPts(0, 0) = G_TRI_X1[0];
458  gaussPts(1, 0) = G_TRI_Y1[0];
459  gaussPts(2, 0) = G_TRI_W1[0];
460 
462  }
463  };
464 
465  struct OpEdgesFluxes
467 
468  MoFEM::Interface &mField;
469  Tag tH1, tH2;
470  TeeStream &mySplit;
471 
472  OpEdgesFluxes(MoFEM::Interface &m_field, Tag _th1, Tag _th2,
473  TeeStream &my_split)
476  mField(m_field), tH1(_th1), tH2(_th2), mySplit(my_split) {}
477 
478  MoFEMErrorCode doWork(int side, EntityType type,
481 
482  if (type != MBEDGE)
484 
485  EntityHandle edge = getNumeredEntFiniteElementPtr()->getEnt();
486 
487  double *t_ptr;
488  CHKERR mField.get_moab().tag_get_by_ptr(tH1, &edge, 1,
489  (const void **)&t_ptr);
490 
491  double *tn_ptr;
492  CHKERR mField.get_moab().tag_get_by_ptr(tH2, &edge, 1,
493  (const void **)&tn_ptr);
494 
495 
496  *tn_ptr = *t_ptr;
497 
498  double tn = 0;
499  int nb_dofs = data.getN().size2();
500  int dd = 0;
501  for (; dd < nb_dofs; dd++) {
502  double val = data.getFieldData()[dd];
503  tn += data.getN()(0, dd) * val;
504  }
505 
506  // mySplit << *tn_ptr << " " << tn << " " << getLength() << endl;
507  *tn_ptr -= tn;
508 
509  // mySplit << getTangentAtGaussPts() << " " << getDirection() << endl;
510 
511  // cerr << t_ptr[0] << " " << t_ptr[1] << " " << t_ptr[2] << endl;
512 
513  // const double eps = 1e-8;
514  // if(fabs(*tn_ptr)>eps) {
515  // SETERRQ1(
516  // PETSC_COMM_SELF,
517  // MOFEM_ATOM_TEST_INVALID,
518  // "H1 continuity failed %6.4e",
519  // *tn_ptr
520  // );
521  // }
522 
523  mySplit.precision(5);
524 
525  mySplit << edge << " " << /*std::fixed <<*/ fabs(*tn_ptr) << std::endl;
526 
528  }
529  };
530 
531  struct MyEdgeFE : public EdgeElementForcesAndSourcesCore {
532 
533  MyEdgeFE(MoFEM::Interface &m_field)
534  : EdgeElementForcesAndSourcesCore(m_field) {}
535  int getRule(int order) { return -1; };
536 
537  MoFEMErrorCode setGaussPts(int order) {
539 
540  gaussPts.resize(2, 1);
541  gaussPts(0, 0) = 0.5;
542  gaussPts(1, 0) = 1;
543 
545  }
546  };
547 
548  MyTetFE tet_fe(m_field);
549  MyTriFE tri_fe(m_field);
550  MyTriFE skin_fe(m_field);
551  MyEdgeFE edge_fe(m_field);
552 
553  Tag th1;
554  double def_val[] = {0, 0, 0};
555  CHKERR moab.tag_get_handle("T", 3, MB_TYPE_DOUBLE, th1,
556  MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
557 
558  tet_fe.getOpPtrVector().push_back(
559  new OpCalculateHOCoords("MESH_NODE_POSITIONS"));
560  tet_fe.getOpPtrVector().push_back(new OpTetFluxes(m_field, th1));
561 
562  Tag th2;
563  CHKERR moab.tag_get_handle("TN", 1, MB_TYPE_DOUBLE, th2,
564  MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
565 
566  tri_fe.getOpPtrVector().push_back(
567  new OpCalculateHOCoords("MESH_NODE_POSITIONS"));
568  tri_fe.getOpPtrVector().push_back(
569  new OpGetHONormalsOnFace("MESH_NODE_POSITIONS"));
570  tri_fe.getOpPtrVector().push_back(
571  new OpFacesFluxes(m_field, th1, th2, my_split));
572  skin_fe.getOpPtrVector().push_back(
573  new OpFacesSkinFluxes(m_field, th1, th2, my_split));
574 
575  edge_fe.getOpPtrVector().push_back(
576  new OpGetHOTangentsOnEdge("MESH_NODE_POSITIONS"));
577  edge_fe.getOpPtrVector().push_back(
578  new OpCalculateHOCoords("MESH_NODE_POSITIONS"));
579  edge_fe.getOpPtrVector().push_back(
580  new OpEdgesFluxes(m_field, th1, th2, my_split));
581 
582  for (Range::iterator fit = faces.begin(); fit != faces.end(); fit++) {
583  CHKERR moab.tag_set_data(th1, &*fit, 1, &def_val);
584 
585  CHKERR moab.tag_set_data(th2, &*fit, 1, &def_val);
586 
587  }
588 
589  CHKERR m_field.loop_finite_elements("TEST_PROBLEM", "TET_FE", tet_fe);
590  my_split << "internal\n";
591  CHKERR m_field.loop_finite_elements("TEST_PROBLEM", "TRI_FE", tri_fe);
592  my_split << "skin\n";
593  CHKERR m_field.loop_finite_elements("TEST_PROBLEM", "SKIN_FE", skin_fe);
594  my_split << "edges\n";
595  CHKERR m_field.loop_finite_elements("TEST_PROBLEM", "EDGE_FE", edge_fe);
596 
597 
598  EntityHandle meshset;
599  CHKERR moab.create_meshset(MESHSET_SET, meshset);
600  CHKERR m_field.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
601  BitRefLevel().set(0), BitRefLevel().set(), MBTRI, meshset);
602 
603  CHKERR moab.write_file("out.vtk", "VTK", "", &meshset, 1);
604 
605  }
606  CATCH_ERRORS;
607 
609 }
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::EdgeElementForcesAndSourcesCore
Edge finite element.
Definition: EdgeElementForcesAndSourcesCore.hpp:30
MoFEM::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:128
TeeStream
stream< TeeDevice > TeeStream
Definition: forces_and_sources_testing_contact_prism_element.cpp:10
G_TRI_X1
static const double G_TRI_X1[]
Definition: fem_tools.h:312
MoFEM::CoreInterface::loop_finite_elements
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
MoFEM::OpGetHOTangentsOnEdge
Calculate tangent vector on edge form HO geometry approximation.
Definition: HODataOperators.hpp:369
MoFEM::CoreInterface::loop_dofs
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
MoFEM::ProblemsManager::buildProblem
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
Definition: ProblemsManager.cpp:87
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
H1
@ H1
continuous field
Definition: definitions.h:85
MOFEM_STD_EXCEPTION_THROW
@ MOFEM_STD_EXCEPTION_THROW
Definition: definitions.h:39
EntityHandle
MoFEM::ProblemsManager
Problem manager is used to build and partition problems.
Definition: ProblemsManager.hpp:21
MoFEM::CoreInterface::modify_finite_element_add_field_row
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string name_row)=0
set field row which finite element use
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
main
int main(int argc, char *argv[])
Definition: forces_and_sources_h1_continuity_check.cpp:22
MoFEM::EntitiesFieldData::EntData::getFieldData
const VectorDouble & getFieldData() const
get dofs values
Definition: EntitiesFieldData.hpp:1254
OpFacesFluxes
Definition: hdiv_divergence_operator.cpp:31
MoFEM.hpp
MoFEM::Projection10NodeCoordsOnField
Projection of edge entities with one mid-node on hierarchical basis.
Definition: Projection10NodeCoordsOnField.hpp:24
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
MoFEM::OpCalculateHOCoords
Calculate HO coordinates at gauss points.
Definition: HODataOperators.hpp:41
MoFEM::CoreInterface::add_ents_to_field_by_type
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
order
constexpr int order
Definition: dg_projection.cpp:18
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
TeeDevice
tee_device< std::ostream, std::ofstream > TeeDevice
Definition: forces_and_sources_testing_contact_prism_element.cpp:9
ROW
@ ROW
Definition: definitions.h:136
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
MoFEM::CoreInterface::add_ents_to_finite_element_by_type
virtual MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string &name, const bool recursive=true)=0
add entities to finite element
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
friend class UserDataOperator
Definition: FaceElementForcesAndSourcesCore.hpp:86
MoFEM::CoreInterface::add_finite_element
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::CoreInterface::modify_finite_element_add_field_col
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string name_row)=0
set field col which finite element use
MoFEM::CoreInterface::build_finite_elements
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
default operator for TRI element
Definition: FaceElementForcesAndSourcesCore.hpp:94
convert.type
type
Definition: convert.py:64
SideNumber_multiIndex
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< ordered_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, signed char, &SideNumber::side_number > > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
Definition: RefEntsMultiIndices.hpp:101
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
friend class UserDataOperator
Definition: VolumeElementForcesAndSourcesCore.hpp:105
G_TRI_Y1
static const double G_TRI_Y1[]
Definition: fem_tools.h:313
MoFEM::FaceElementForcesAndSourcesCore
Face finite element.
Definition: FaceElementForcesAndSourcesCore.hpp:23
MoFEM::OpGetHONormalsOnFace
Calculate normals at Gauss points of triangle element.
Definition: HODataOperators.hpp:281
t
constexpr double t
plate stiffness
Definition: plate.cpp:58
MoFEM::ForcesAndSourcesCore::UserDataOperator
friend class UserDataOperator
Definition: ForcesAndSourcesCore.hpp:482
MoFEM::CoreInterface::modify_finite_element_add_field_data
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
MoFEM::VolumeElementForcesAndSourcesCore
Volume finite element base.
Definition: VolumeElementForcesAndSourcesCore.hpp:26
MoFEM::ProblemsManager::partitionFiniteElements
MoFEMErrorCode partitionFiniteElements(const std::string name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=VERBOSE)
partition finite elements
Definition: ProblemsManager.cpp:2167
MoFEM::CoreInterface::modify_problem_ref_level_add_bit
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
MoFEM::VecManager
Vector manager is used to create vectors \mofem_vectors.
Definition: VecManager.hpp:23
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
Definition: VolumeElementForcesAndSourcesCore.hpp:108
mesh_file_name
char mesh_file_name[255]
Definition: mesh_smoothing.cpp:22
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator
default operator for EDGE element
Definition: EdgeElementForcesAndSourcesCore.hpp:68
edge_coords
static const double edge_coords[6][6]
Definition: forces_and_sources_h1_continuity_check.cpp:18
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
Range
face_coords
static const double face_coords[4][9]
Definition: forces_and_sources_h1_continuity_check.cpp:13
MoFEM::CoreTmp< 0 >::Initialize
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:72
FTensor::dd
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
MoFEM::EntitiesFieldData::EntData::getN
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
Definition: EntitiesFieldData.hpp:1318
G_TRI_W1
static const double G_TRI_W1[]
Definition: fem_tools.h:314
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1148
MoFEM::ProblemsManager::partitionSimpleProblem
MoFEMErrorCode partitionSimpleProblem(const std::string name, int verb=VERBOSE)
partition problem dofs
Definition: ProblemsManager.cpp:1537
eps
static const double eps
Definition: check_base_functions_derivatives_on_tet.cpp:11
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
MoFEM::PetscOptionsGetString
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
Definition: DeprecatedPetsc.hpp:172
MoFEM::CoreInterface::build_fields
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
MoFEM::BitRefManager
Managing BitRefLevels.
Definition: BitRefManager.hpp:21
MoFEM::CoreInterface::modify_problem_add_finite_element
virtual MoFEMErrorCode modify_problem_add_finite_element(const std::string name_problem, const std::string &fe_name)=0
add finite element to problem, this add entities assigned to finite element to a particular problem
MoFEM::Types::BitRefLevel
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
MOFEM_ATOM_TEST_INVALID
@ MOFEM_ATOM_TEST_INVALID
Definition: definitions.h:40
MoFEM::CoreInterface::build_adjacencies
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
MoFEM::CoreInterface::set_field_order
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
help
static char help[]
Definition: forces_and_sources_h1_continuity_check.cpp:11
MoFEM::ProblemsManager::partitionGhostDofs
MoFEMErrorCode partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
Definition: ProblemsManager.cpp:2339
MoFEM::CoreInterface::add_problem
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
CHKERRG
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:496
MoFEM::CoreInterface::add_field
virtual MoFEMErrorCode add_field(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_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROW
@ OPROW
operator doWork function is executed on FE rows
Definition: ForcesAndSourcesCore.hpp:567
ShapeMBTRI
PetscErrorCode ShapeMBTRI(double *N, const double *X, const double *Y, const int G_DIM)
calculate shape functions on triangle
Definition: fem_tools.c:182