v0.14.0
Functions | Variables
mesh_smoothing.cpp File Reference

Improve mesh quality using Volume-length quality measure with barrier. More...

#include <MoFEM.hpp>
#include <Smoother.hpp>
#include <SurfaceSlidingConstrains.hpp>
#include <VolumeLengthQuality.hpp>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Variables

static char help [] = "mesh smoothing\n\n"
 
PetscBool flg_myfile = PETSC_TRUE
 
char mesh_file_name [255]
 
int edges_block_set = 1
 
int vertex_block_set = 2
 
PetscBool output_vtk = PETSC_TRUE
 
double tol = 0.1
 
double gamma_factor = 0.8
 

Detailed Description

Improve mesh quality using Volume-length quality measure with barrier.

Definition in file mesh_smoothing.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

< Integrate smoothing operators

< Integrate smoothing operators

Examples
mesh_smoothing.cpp.

Definition at line 29 of file mesh_smoothing.cpp.

29  {
30 
31  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
32 
33  try {
34 
35  CHKERR PetscOptionsBegin(PETSC_COMM_WORLD, "", "Mesh cut options", "none");
36  CHKERR PetscOptionsString("-my_file", "mesh file name", "", "mesh.h5m",
37  mesh_file_name, 255, &flg_myfile);
38  CHKERR PetscOptionsInt("-edges_block_set", "edges side set", "",
39  edges_block_set, &edges_block_set, PETSC_NULL);
40  CHKERR PetscOptionsInt("-vertex_block_set", "vertex side set", "",
41  vertex_block_set, &vertex_block_set, PETSC_NULL);
42  CHKERR PetscOptionsBool("-output_vtk", "if true outout vtk file", "",
43  output_vtk, &output_vtk, PETSC_NULL);
44  CHKERR PetscOptionsScalar("-quality_reduction_tol", "",
45  "Tolerance of quality reduction", tol, &tol,
46  PETSC_NULL);
47  CHKERR PetscOptionsScalar("-gamma_factor", "",
48  "Gamma factor", gamma_factor, &gamma_factor,
49  PETSC_NULL);
50  ierr = PetscOptionsEnd();
51  CHKERRG(ierr);
52 
53  // Create MoAB database
54  moab::Core moab_core; // create database
55  moab::Interface &moab = moab_core; // create interface to database
56  // Create MoFEM database and link it to MoAB
57  MoFEM::Core mofem_core(moab); // create database
58  MoFEM::Interface &m_field = mofem_core; // create interface to database
59  // Register DM Manager
60  CHKERR DMRegister_MoFEM("DMMOFEM"); // register MoFEM DM in PETSc
61 
62  // Get simple interface is simplified version enabling quick and
63  // easy construction of problem.
64  Simple *simple_interface;
65  // Query interface and get pointer to Simple interface
66  CHKERR m_field.getInterface(simple_interface);
67 
68  // Build problem with simple interface
69  {
70  // Get options for simple interface from command line
71  CHKERR simple_interface->getOptions();
72  // Load mesh file to database
73  CHKERR simple_interface->loadFile();
74 
75  // Add domain filed "U" in space H1 and Legendre base, Ainsworth recipe is
76  // used to construct base functions.
77  CHKERR simple_interface->addDomainField("MESH_NODE_POSITIONS", H1,
79  // Add Lagrange multiplier field on body boundary
80  CHKERR simple_interface->addBoundaryField("LAMBDA_SURFACE", H1,
82 
83  // Set fields order domain and boundary fields.
84  CHKERR simple_interface->setFieldOrder("MESH_NODE_POSITIONS",
85  1); // to approximate function
86  CHKERR simple_interface->setFieldOrder("LAMBDA_SURFACE",
87  1); // to Lagrange multipliers
88 
89  simple_interface->getDomainFEName() = "SMOOTHING";
90  simple_interface->getBoundaryFEName() = "SURFACE_SLIDING";
91 
92  // Other fields and finite elements added to database directly
93  {
96  // Declare approximation fields
97  CHKERR m_field.add_field("LAMBDA_EDGE", H1, AINSWORTH_LOBATTO_BASE, 2,
98  MB_TAG_SPARSE, MF_ZERO);
99  Range edges;
101  ->getEntitiesByDimension(edges_block_set, BLOCKSET, 1, edges,
102  true);
103  CHKERR m_field.add_ents_to_field_by_type(edges, MBEDGE,
104  "LAMBDA_EDGE");
106  ->synchroniseFieldEntities("LAMBDA_EDGE");
107  CHKERR m_field.set_field_order(0, MBVERTEX, "LAMBDA_EDGE", 1);
108 
109  CHKERR m_field.add_finite_element("EDGE_SLIDING");
111  "EDGE_SLIDING", "MESH_NODE_POSITIONS");
113  "EDGE_SLIDING", "MESH_NODE_POSITIONS");
115  "EDGE_SLIDING", "MESH_NODE_POSITIONS");
116  CHKERR m_field.modify_finite_element_add_field_row("EDGE_SLIDING",
117  "LAMBDA_EDGE");
118  CHKERR m_field.modify_finite_element_add_field_col("EDGE_SLIDING",
119  "LAMBDA_EDGE");
120  CHKERR m_field.modify_finite_element_add_field_data("EDGE_SLIDING",
121  "LAMBDA_EDGE");
122  CHKERR m_field.add_ents_to_finite_element_by_type(edges, MBEDGE,
123  "EDGE_SLIDING");
124  simple_interface->getOtherFiniteElements().push_back("EDGE_SLIDING");
125  }
126  }
127 
128  CHKERR simple_interface->defineFiniteElements();
129  CHKERR simple_interface->defineProblem();
130  CHKERR simple_interface->buildFields();
131  // Remove vertices form LAMBDA_SURFACE which are on the edges
132  if (m_field.getInterface<MeshsetsManager>()->checkMeshset(
134  Range edges;
135  CHKERR m_field.getInterface<MeshsetsManager>()->getEntitiesByDimension(
136  edges_block_set, BLOCKSET, 1, edges, true);
137  Range verts;
138  CHKERR m_field.get_moab().get_connectivity(edges, verts, true);
139  CHKERR m_field.remove_ents_from_field("LAMBDA_SURFACE", verts);
140  }
141  CHKERR simple_interface->buildFiniteElements();
142  CHKERR simple_interface->buildProblem();
143  }
144 
145  struct ElementsAndOperators {
146 
147  MoFEM::Interface &mField;
148  Vec minQualityVec;
149  double *minQualityPtr;
150 
151  ElementsAndOperators(MoFEM::Interface &m_field) : mField(m_field) {
152  ierr = VecCreateMPI(PETSC_COMM_WORLD, 1, m_field.get_comm_size(),
153  &minQualityVec);
154  CHKERRABORT(PETSC_COMM_WORLD, ierr);
155  ierr = VecGetArray(minQualityVec, &minQualityPtr);
156  CHKERRABORT(PETSC_COMM_WORLD, ierr);
157  }
158 
159  virtual ~ElementsAndOperators() {
160  ierr = VecRestoreArray(minQualityVec, &minQualityPtr);
161  CHKERRABORT(PETSC_COMM_WORLD, ierr);
162  ierr = VecDestroy(&minQualityVec);
163  CHKERRABORT(PETSC_COMM_WORLD, ierr);
164  }
165 
166  double getMinQuality() const { return *minQualityPtr; }
167 
168  enum Tags {
169  SMOOTHING_TAG = 1,
170  SURFACE_CONSTRAINS_TAG,
171  EDGE_CONSTRAINS_TAG
172  };
173 
174  boost::shared_ptr<Smoother> smootherFe;
175  boost::shared_ptr<Smoother::MyVolumeFE>
176  feSmootherRhs; ///< Integrate smoothing operators
177  boost::shared_ptr<Smoother::MyVolumeFE>
178  feSmootherLhs; ///< Integrate smoothing operators
179  boost::shared_ptr<VolumeLengthQuality<double> > volumeLengthDouble;
180  boost::shared_ptr<VolumeLengthQuality<adouble> > volumeLengthAdouble;
181 
182  boost::shared_ptr<SurfaceSlidingConstrains> surfaceConstrain;
183  boost::shared_ptr<SurfaceSlidingConstrains::DriverElementOrientation>
184  skinOrientation;
185  boost::shared_ptr<EdgeSlidingConstrains> edgeConstrain;
186 
187  boost::shared_ptr<DirichletFixFieldAtEntitiesBc> fixMaterialEnts;
188 
189  boost::shared_ptr<MoFEM::VolumeElementForcesAndSourcesCore> minQualityFe;
190 
191  struct MinQualityOp : MoFEM::ForcesAndSourcesCore::UserDataOperator {
192  double *minQualityPtr;
193  MinQualityOp(double *min_quality_ptr)
195  "MESH_NODE_POSITIONS", UserDataOperator::OPROW),
196  minQualityPtr(min_quality_ptr) {}
197  MoFEMErrorCode doWork(int side, EntityType type,
200  if (type != MBVERTEX)
202  double q = Tools::volumeLengthQuality(&*data.getFieldData().begin());
203  *minQualityPtr = fmin(*minQualityPtr, q);
205  }
206  };
207 
208  MoFEMErrorCode createSmoothingFE() {
210  smootherFe = boost::shared_ptr<Smoother>(new Smoother(mField));
211  volumeLengthAdouble = boost::shared_ptr<VolumeLengthQuality<adouble> >(
213  volumeLengthDouble = boost::shared_ptr<VolumeLengthQuality<double> >(
215 
216  Range tets;
217  CHKERR mField.get_moab().get_entities_by_type(0, MBTET, tets);
218  smootherFe->setOfBlocks[0].tEts.merge(tets);
219 
220  smootherFe->setOfBlocks[0].materialDoublePtr = volumeLengthDouble;
221  smootherFe->setOfBlocks[0].materialAdoublePtr = volumeLengthAdouble;
222 
223  // set element data
224  smootherFe->commonData.spatialPositions = "MESH_NODE_POSITIONS";
225  smootherFe->commonData.meshPositions = "NONE";
226 
227  smootherFe->feRhs.meshPositionsFieldName = "NONE";
228  smootherFe->feLhs.meshPositionsFieldName = "NONE";
229  smootherFe->feRhs.addToRule = 0;
230  smootherFe->feLhs.addToRule = 0;
231 
232  feSmootherRhs = smootherFe->feRhsPtr;
233  feSmootherLhs = smootherFe->feLhsPtr;
234 
235  // Smoother right hand side
236  feSmootherRhs->getOpPtrVector().push_back(
238  "MESH_NODE_POSITIONS", smootherFe->commonData));
239  feSmootherRhs->getOpPtrVector().push_back(
241  "MESH_NODE_POSITIONS", smootherFe->setOfBlocks.at(0),
242  smootherFe->commonData, SMOOTHING_TAG, false));
243  feSmootherRhs->getOpPtrVector().push_back(new Smoother::OpRhsSmoother(
244  "MESH_NODE_POSITIONS", smootherFe->setOfBlocks[0],
245  smootherFe->commonData, smootherFe->smootherData));
246 
247  // Smoother left hand side
248  feSmootherLhs->getOpPtrVector().push_back(
250  "MESH_NODE_POSITIONS", smootherFe->commonData));
251  feSmootherLhs->getOpPtrVector().push_back(
253  "MESH_NODE_POSITIONS", smootherFe->setOfBlocks.at(0),
254  smootherFe->commonData, SMOOTHING_TAG, true));
255  feSmootherLhs->getOpPtrVector().push_back(new Smoother::OpLhsSmoother(
256  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
257  smootherFe->setOfBlocks.at(0), smootherFe->commonData,
258  smootherFe->smootherData, "LAMBDA_CRACKFRONT_AREA_TANGENT"));
259 
260  minQualityFe =
261  boost::shared_ptr<MoFEM::VolumeElementForcesAndSourcesCore>(
263  minQualityFe->getOpPtrVector().push_back(
264  new MinQualityOp(minQualityPtr));
265 
266  Range fixed_vertex;
269  CHKERR mField.getInterface<MeshsetsManager>()->getEntitiesByDimension(
270  vertex_block_set, BLOCKSET, 0, fixed_vertex, true);
271  }
272  fixMaterialEnts = boost::shared_ptr<DirichletFixFieldAtEntitiesBc>(
273  new DirichletFixFieldAtEntitiesBc(mField, "MESH_NODE_POSITIONS",
274  fixed_vertex));
275  fixMaterialEnts->fieldNames.push_back("LAMBDA_SURFACE");
276  fixMaterialEnts->fieldNames.push_back("LAMBDA_EDGE");
277 
279  }
280 
281  MoFEMErrorCode createConstrians() {
283  skinOrientation = boost::shared_ptr<
286  surfaceConstrain = boost::shared_ptr<SurfaceSlidingConstrains>(
287  skinOrientation,
288  new SurfaceSlidingConstrains(mField, *skinOrientation));
289  surfaceConstrain->setOperators(SURFACE_CONSTRAINS_TAG, "LAMBDA_SURFACE",
290  "MESH_NODE_POSITIONS");
291 
294  Range edges;
296  ->getEntitiesByDimension(edges_block_set, BLOCKSET, 1, edges,
297  true);
298 
299  Range tets;
300  CHKERR mField.get_moab().get_entities_by_type(0, MBTET, tets);
301  Skinner skin(&mField.get_moab());
302  Range skin_faces; // skin faces from 3d ents
303  CHKERR skin.find_skin(0, tets, false, skin_faces);
304 
305  edgeConstrain = boost::shared_ptr<EdgeSlidingConstrains>(
306  new EdgeSlidingConstrains(mField));
307  CHKERR edgeConstrain->setOperators(EDGE_CONSTRAINS_TAG, edges,
308  skin_faces, "LAMBDA_EDGE",
309  "MESH_NODE_POSITIONS");
310 
311  // CHKERR EdgeSlidingConstrains::CalculateEdgeBase::saveEdges(
312  // mField.get_moab(), "out_edges.vtk", edges);
313 
314  }
316  }
317 
318  MoFEMErrorCode addFEtoDM(DM dm) {
320  boost::shared_ptr<ForcesAndSourcesCore> null;
321 
322  CHKERR DMMoFEMSNESSetFunction(dm, DM_NO_ELEMENT, null, fixMaterialEnts,
323  null);
324  CHKERR DMMoFEMSNESSetFunction(dm, "SMOOTHING", feSmootherRhs, null,
325  null);
326  CHKERR DMMoFEMSNESSetFunction(dm, "SURFACE_SLIDING",
327  surfaceConstrain->feRhsPtr, null, null);
328  CHKERR DMMoFEMSNESSetFunction(dm, "EDGE_SLIDING",
329  edgeConstrain->feRhsPtr, null, null);
331  fixMaterialEnts);
332 
333  CHKERR DMMoFEMSNESSetJacobian(dm, DM_NO_ELEMENT, null, fixMaterialEnts,
334  null);
335  CHKERR DMMoFEMSNESSetJacobian(dm, "SMOOTHING", feSmootherLhs, null,
336  null);
337  CHKERR DMMoFEMSNESSetJacobian(dm, "SURFACE_SLIDING",
338  surfaceConstrain->feLhsPtr, null, null);
339  CHKERR DMMoFEMSNESSetJacobian(dm, "EDGE_SLIDING",
340  edgeConstrain->feLhsPtr, null, null);
342  fixMaterialEnts);
343 
344  // MoFEM::SnesCtx *snes_ctx;
345  // DMMoFEMGetSnesCtx(dm,&snes_ctx);
346  // snes_ctx->vErify = true;
347 
349  }
350 
351  MoFEMErrorCode calcuteMinQuality(DM dm) {
353  *minQualityPtr = 1;
354  CHKERR DMoFEMLoopFiniteElements(dm, "SMOOTHING", minQualityFe.get());
355  CHKERR VecMin(minQualityVec, PETSC_NULL, minQualityPtr);
357  }
358  };
359 
360  ElementsAndOperators elements_and_operators(m_field);
361  CHKERR elements_and_operators.createSmoothingFE();
362  CHKERR elements_and_operators.createConstrians();
363 
364  DM dm;
365  CHKERR simple_interface->getDM(&dm);
366  CHKERR elements_and_operators.addFEtoDM(dm);
367 
368  struct Solve {
369 
370  MoFEMErrorCode operator()(DM dm) const {
372 
373  // Create the right hand side vector and vector of unknowns
374  Vec F, D;
375  CHKERR DMCreateGlobalVector(dm, &F);
376  // Create unknown vector by creating duplicate copy of F vector. only
377  // structure is duplicated no values.
378  CHKERR VecDuplicate(F, &D);
379 
380  CHKERR zeroLambdaFields(dm);
381  CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_FORWARD);
382 
383  // Create solver and link it to DM
384  SNES solver;
385  CHKERR SNESCreate(PETSC_COMM_WORLD, &solver);
386  CHKERR SNESSetFromOptions(solver);
387  CHKERR SNESSetDM(solver, dm);
388  // Set-up solver, is type of solver and pre-conditioners
389  CHKERR SNESSetUp(solver);
390  // At solution process, KSP solver using DM creates matrices, Calculate
391  // values of the left hand side and the right hand side vector. then
392  // solves system of equations. Results are stored in vector D.
393  CHKERR SNESSolve(solver, F, D);
394 
395  // Scatter solution on the mesh. Stores unknown vector on field on the
396  // mesh.
397  CHKERR DMoFEMMeshToGlobalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
398  // Clean data. Solver and vector are not needed any more.
399  CHKERR SNESDestroy(&solver);
400  CHKERR VecDestroy(&D);
401  CHKERR VecDestroy(&F);
402 
404  }
405 
406  MoFEMErrorCode setCoordsFromField(DM dm) const {
408  MoFEM::Interface *m_field_ptr;
409  CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
410  for (_IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP_(*m_field_ptr,
411  "MESH_NODE_POSITIONS", it)) {
412  if (it->get()->getEntType() != MBVERTEX)
413  continue;
414  VectorDouble3 coords(3);
415  for(int dd = 0;dd!=3;++dd)
416  coords[dd] = it->get()->getEntFieldData()[dd];
417  EntityHandle ent = it->get()->getEnt();
418  CHKERR m_field_ptr->get_moab().set_coords(&ent, 1, &*coords.begin());
419  }
421  }
422 
423  MoFEMErrorCode setFieldFromCoords(DM dm) const {
425  MoFEM::Interface *m_field_ptr;
426  CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
427  for (_IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP_(*m_field_ptr,
428  "MESH_NODE_POSITIONS", it)) {
429  if (it->get()->getEntType() != MBVERTEX)
430  continue;
431  EntityHandle ent = it->get()->getEnt();
432  VectorDouble3 coords(3);
433  CHKERR m_field_ptr->get_moab().get_coords(&ent, 1, &*coords.begin());
434  for(int dd = 0;dd!=3;++dd)
435  it->get()->getEntFieldData()[dd] = coords[dd];
436  }
438  }
439 
440  private:
441  MoFEMErrorCode zeroLambdaFields(DM dm) const {
443  MoFEM::Interface *m_field_ptr;
444  CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
445  CHKERR m_field_ptr->getInterface<FieldBlas>()->setField(
446  0, MBVERTEX, "LAMBDA_SURFACE");
448  }
449 
450  };
451 
452  Solve solve;
453  CHKERR solve.setFieldFromCoords(dm);
454 
455  CHKERR elements_and_operators.calcuteMinQuality(dm);
456  double min_quality = elements_and_operators.getMinQuality();
457  PetscPrintf(PETSC_COMM_WORLD, "Min quality = %4.3f\n", min_quality);
458 
459  double gamma = min_quality > 0 ? gamma_factor * min_quality
460  : min_quality / gamma_factor;
461  elements_and_operators.volumeLengthDouble->gAmma = gamma;
462  elements_and_operators.volumeLengthAdouble->gAmma = gamma;
463 
464  double min_quality_p, eps;
465  do {
466 
467  min_quality_p = min_quality;
468 
469  CHKERR solve(dm);
470 
471  CHKERR solve.setCoordsFromField(dm);
472  CHKERR elements_and_operators.calcuteMinQuality(dm);
473  min_quality = elements_and_operators.getMinQuality();
474 
475  eps = (min_quality - min_quality_p) / min_quality;
476  PetscPrintf(PETSC_COMM_WORLD, "Min quality = %4.3f eps = %4.3f\n",
477  min_quality, eps);
478 
479  double gamma = min_quality > 0 ? gamma_factor * min_quality
480  : min_quality / gamma_factor;
481  elements_and_operators.volumeLengthDouble->gAmma = gamma;
482  elements_and_operators.volumeLengthAdouble->gAmma = gamma;
483 
484  } while (eps > tol);
485 
486  // if (m_field.getInterface<MeshsetsManager>()->checkMeshset(edges_block_set,
487  // BLOCKSET)) {
488  // Range edges;
489  // CHKERR m_field.getInterface<MeshsetsManager>()->getEntitiesByDimension(
490  // edges_block_set, BLOCKSET, 1, edges, true);
491 
492  // Range tets;
493  // CHKERR moab.get_entities_by_type(0,MBTET,tets);
494  // Skinner skin(&moab);
495  // Range skin_faces; // skin faces from 3d ents
496  // CHKERR skin.find_skin(0, tets, false, skin_faces);
497 
498  // CHKERR EdgeSlidingConstrains::CalculateEdgeBase::setTags(moab, edges,
499  // skin_faces);
500  // CHKERR EdgeSlidingConstrains::CalculateEdgeBase::saveEdges(
501  // moab, "out_edges.vtk", edges);
502  // }
503 
504  if (output_vtk)
505  CHKERR m_field.getInterface<BitRefManager>()->writeBitLevelByType(
506  BitRefLevel().set(0), BitRefLevel().set(), MBTET, "out.vtk", "VTK",
507  "");
508  }
509  CATCH_ERRORS;
510 
512 }

Variable Documentation

◆ edges_block_set

int edges_block_set = 1
Examples
mesh_cut.cpp, and mesh_smoothing.cpp.

Definition at line 23 of file mesh_smoothing.cpp.

◆ flg_myfile

PetscBool flg_myfile = PETSC_TRUE
Examples
mesh_cut.cpp, and mesh_smoothing.cpp.

Definition at line 21 of file mesh_smoothing.cpp.

◆ gamma_factor

double gamma_factor = 0.8
Examples
mesh_smoothing.cpp.

Definition at line 27 of file mesh_smoothing.cpp.

◆ help

char help[] = "mesh smoothing\n\n"
static
Examples
mesh_smoothing.cpp.

Definition at line 19 of file mesh_smoothing.cpp.

◆ mesh_file_name

char mesh_file_name[255]

◆ output_vtk

PetscBool output_vtk = PETSC_TRUE
Examples
mesh_cut.cpp, mesh_smoothing.cpp, and split_sideset.cpp.

Definition at line 25 of file mesh_smoothing.cpp.

◆ tol

double tol = 0.1

◆ vertex_block_set

int vertex_block_set = 2
Examples
mesh_cut.cpp, and mesh_smoothing.cpp.

Definition at line 24 of file mesh_smoothing.cpp.

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::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:128
Smoother::OpLhsSmoother
Definition: Smoother.hpp:213
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
H1
@ H1
continuous field
Definition: definitions.h:85
MoFEM::Types::VectorDouble3
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:92
EntityHandle
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::Simple::buildProblem
MoFEMErrorCode buildProblem()
Build problem.
Definition: Simple.cpp:669
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
FractureMechanics::SMOOTHING_TAG
@ SMOOTHING_TAG
Definition: CrackPropagation.hpp:45
MoFEM::CoreInterface::remove_ents_from_field
virtual MoFEMErrorCode remove_ents_from_field(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)=0
remove entities from field
MoFEM::EntitiesFieldData::EntData::getFieldData
const VectorDouble & getFieldData() const
get dofs values
Definition: EntitiesFieldData.hpp:1254
MoFEM::Simple::loadFile
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
Definition: Simple.cpp:194
flg_myfile
PetscBool flg_myfile
Definition: mesh_smoothing.cpp:21
MoFEM::DMoFEMMeshToLocalVector
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition: DMMoFEM.cpp:523
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
gamma_factor
double gamma_factor
Definition: mesh_smoothing.cpp:27
MoFEM::Simple
Simple interface for fast problem set-up.
Definition: Simple.hpp:27
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.
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
DirichletFixFieldAtEntitiesBc
Fix dofs on entities.
Definition: DirichletBC.hpp:258
MoFEM::Simple::getOptions
MoFEMErrorCode getOptions()
get options
Definition: Simple.cpp:180
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
MoFEM::Simple::getDM
MoFEMErrorCode getDM(DM *dm)
Get DM.
Definition: Simple.cpp:747
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
vertex_block_set
int vertex_block_set
Definition: mesh_smoothing.cpp:24
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
output_vtk
PetscBool output_vtk
Definition: mesh_smoothing.cpp:25
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::ForcesAndSourcesCore::UserDataOperator
Definition: ForcesAndSourcesCore.hpp:549
convert.type
type
Definition: convert.py:64
DM_NO_ELEMENT
#define DM_NO_ELEMENT
Definition: DMMoFEM.hpp:10
MoFEM::DMoFEMMeshToGlobalVector
PetscErrorCode DMoFEMMeshToGlobalVector(DM dm, Vec g, InsertMode mode, ScatterMode scatter_mode)
set ghosted vector values on all existing mesh entities
Definition: DMMoFEM.cpp:535
_IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP_
#define _IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP_(MFIELD, NAME, IT)
loop over all dofs from a moFEM field and particular field
Definition: Interface.hpp:1842
MoFEM::Simple::addDomainField
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:264
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:43
MoFEM::CoreInterface::get_comm_size
virtual int get_comm_size() const =0
MoFEM::Simple::getDomainFEName
const std::string getDomainFEName() const
Get the Domain FE Name.
Definition: Simple.hpp:368
MoFEM::solve
static PetscErrorCode solve(Mat mat, Vec x, Vec y)
Definition: Schur.cpp:1223
MoFEM::DMMoFEMSNESSetJacobian
PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES Jacobian evaluation function
Definition: DMMoFEM.cpp:759
AINSWORTH_LOBATTO_BASE
@ AINSWORTH_LOBATTO_BASE
Definition: definitions.h:62
VolumeLengthQuality
Volume Length Quality.
Definition: VolumeLengthQuality.hpp:32
SurfaceSlidingConstrains
Shape preserving constrains, i.e. nodes sliding on body surface.
Definition: SurfaceSlidingConstrains.hpp:323
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
help
static char help[]
Definition: mesh_smoothing.cpp:19
mesh_file_name
char mesh_file_name[255]
Definition: mesh_smoothing.cpp:22
MoFEM::Simple::setFieldOrder
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Definition: Simple.cpp:545
MoFEM::Simple::buildFiniteElements
MoFEMErrorCode buildFiniteElements()
Build finite elements.
Definition: Simple.cpp:643
MoFEM::ForcesAndSourcesCore
structure to get information form mofem into EntitiesFieldData
Definition: ForcesAndSourcesCore.hpp:22
Range
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
Smoother
Definition: Smoother.hpp:10
MF_ZERO
@ MF_ZERO
Definition: definitions.h:111
edges_block_set
int edges_block_set
Definition: mesh_smoothing.cpp:23
NonlinearElasticElement::OpGetCommonDataAtGaussPts
Definition: NonLinearElasticElement.hpp:362
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
MoFEM::CommInterface
Managing BitRefLevels.
Definition: CommInterface.hpp:21
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1148
MoFEM::DMoFEMGetInterfacePtr
PetscErrorCode DMoFEMGetInterfacePtr(DM dm, MoFEM::Interface **m_field_ptr)
Get pointer to MoFEM::Interface.
Definition: DMMoFEM.cpp:414
BLOCKSET
@ BLOCKSET
Definition: definitions.h:161
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
MoFEM::Simple::getBoundaryFEName
const std::string getBoundaryFEName() const
Get the Boundary FE Name.
Definition: Simple.hpp:375
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
MoFEM::MeshsetsManager
Interface for managing meshsets containing materials and boundary conditions.
Definition: MeshsetsManager.hpp:104
MoFEM::Simple::defineFiniteElements
MoFEMErrorCode defineFiniteElements()
Define finite elements.
Definition: Simple.cpp:452
MoFEM::Simple::buildFields
MoFEMErrorCode buildFields()
Build fields.
Definition: Simple.cpp:554
MoFEM::Simple::addBoundaryField
MoFEMErrorCode addBoundaryField(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 boundary.
Definition: Simple.cpp:354
ReactionDiffusionEquation::D
const double D
diffusivity
Definition: reaction_diffusion.cpp:20
Smoother::OpRhsSmoother
Definition: Smoother.hpp:159
MoFEM::BitRefManager
Managing BitRefLevels.
Definition: BitRefManager.hpp:21
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
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEM::Simple::defineProblem
MoFEMErrorCode defineProblem(const PetscBool is_partitioned=PETSC_TRUE)
define problem
Definition: Simple.cpp:524
BARRIER_AND_QUALITY
@ BARRIER_AND_QUALITY
Definition: VolumeLengthQuality.hpp:17
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.
MoFEM::MeshsetsManager::checkMeshset
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
Definition: MeshsetsManager.cpp:360
MoFEM::Simple::getOtherFiniteElements
std::vector< std::string > & getOtherFiniteElements()
Get the Other Finite Elements.
Definition: Simple.hpp:427
MoFEM::DMoFEMLoopFiniteElements
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition: DMMoFEM.cpp:586
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEM::FieldBlas
Basic algebra on fields.
Definition: FieldBlas.hpp:21
Smoother::OpJacobianSmoother
Definition: Smoother.hpp:131
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.
SurfaceSlidingConstrains::DriverElementOrientation
Class implemented by user to detect face orientation.
Definition: SurfaceSlidingConstrains.hpp:334
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
tol
double tol
Definition: mesh_smoothing.cpp:26
F
@ F
Definition: free_surface.cpp:394
EdgeSlidingConstrains
Definition: SurfaceSlidingConstrains.hpp:639
MoFEM::DMMoFEMSNESSetFunction
PetscErrorCode DMMoFEMSNESSetFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES residual evaluation function
Definition: DMMoFEM.cpp:718