v0.15.0
Loading...
Searching...
No Matches
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

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 PetscOptionsBegin(PETSC_COMM_WORLD, "", "Mesh cut options", "none");
36 CHKERR PetscOptionsString("-my_file", "mesh file name", "", "mesh.h5m",
38 CHKERR PetscOptionsInt("-edges_block_set", "edges side set", "",
39 edges_block_set, &edges_block_set, PETSC_NULLPTR);
40 CHKERR PetscOptionsInt("-vertex_block_set", "vertex side set", "",
41 vertex_block_set, &vertex_block_set, PETSC_NULLPTR);
42 CHKERR PetscOptionsBool("-output_vtk", "if true outout vtk file", "",
43 output_vtk, &output_vtk, PETSC_NULLPTR);
44 CHKERR PetscOptionsScalar("-quality_reduction_tol", "",
45 "Tolerance of quality reduction", tol, &tol,
46 PETSC_NULLPTR);
47 CHKERR PetscOptionsScalar("-gamma_factor", "",
48 "Gamma factor", gamma_factor, &gamma_factor,
49 PETSC_NULLPTR);
50 PetscOptionsEnd();
51
52 // Create MoAB database
53 moab::Core moab_core; // create database
54 moab::Interface &moab = moab_core; // create interface to database
55 // Create MoFEM database and link it to MoAB
56 MoFEM::Core mofem_core(moab); // create database
57 MoFEM::Interface &m_field = mofem_core; // create interface to database
58 // Register DM Manager
59 CHKERR DMRegister_MoFEM("DMMOFEM"); // register MoFEM DM in PETSc
60
61 // Get simple interface is simplified version enabling quick and
62 // easy construction of problem.
63 Simple *simple_interface;
64 // Query interface and get pointer to Simple interface
65 CHKERR m_field.getInterface(simple_interface);
66
67 // Build problem with simple interface
68 {
69 // Get options for simple interface from command line
70 CHKERR simple_interface->getOptions();
71 // Load mesh file to database
72 CHKERR simple_interface->loadFile();
73
74 // Add domain field "U" in space H1 and Legendre base, Ainsworth recipe is
75 // used to construct base functions.
76 CHKERR simple_interface->addDomainField("MESH_NODE_POSITIONS", H1,
78 // Add Lagrange multiplier field on body boundary
79 CHKERR simple_interface->addBoundaryField("LAMBDA_SURFACE", H1,
81
82 // Set fields order domain and boundary fields.
83 CHKERR simple_interface->setFieldOrder("MESH_NODE_POSITIONS",
84 1); // to approximate function
85 CHKERR simple_interface->setFieldOrder("LAMBDA_SURFACE",
86 1); // to Lagrange multipliers
87
88 simple_interface->getDomainFEName() = "SMOOTHING";
89 simple_interface->getBoundaryFEName() = "SURFACE_SLIDING";
90
91 // Other fields and finite elements added to database directly
92 {
95 // Declare approximation fields
96 CHKERR m_field.add_field("LAMBDA_EDGE", H1, AINSWORTH_LOBATTO_BASE, 2,
97 MB_TAG_SPARSE, MF_ZERO);
98 Range edges;
100 ->getEntitiesByDimension(edges_block_set, BLOCKSET, 1, edges,
101 true);
102 CHKERR m_field.add_ents_to_field_by_type(edges, MBEDGE,
103 "LAMBDA_EDGE");
105 ->synchroniseFieldEntities("LAMBDA_EDGE");
106 CHKERR m_field.set_field_order(0, MBVERTEX, "LAMBDA_EDGE", 1);
107
108 CHKERR m_field.add_finite_element("EDGE_SLIDING");
110 "EDGE_SLIDING", "MESH_NODE_POSITIONS");
112 "EDGE_SLIDING", "MESH_NODE_POSITIONS");
114 "EDGE_SLIDING", "MESH_NODE_POSITIONS");
115 CHKERR m_field.modify_finite_element_add_field_row("EDGE_SLIDING",
116 "LAMBDA_EDGE");
117 CHKERR m_field.modify_finite_element_add_field_col("EDGE_SLIDING",
118 "LAMBDA_EDGE");
119 CHKERR m_field.modify_finite_element_add_field_data("EDGE_SLIDING",
120 "LAMBDA_EDGE");
121 CHKERR m_field.add_ents_to_finite_element_by_type(edges, MBEDGE,
122 "EDGE_SLIDING");
123 simple_interface->getOtherFiniteElements().push_back("EDGE_SLIDING");
124 }
125 }
126
127 CHKERR simple_interface->defineFiniteElements();
128 CHKERR simple_interface->defineProblem();
129 CHKERR simple_interface->buildFields();
130 // Remove vertices form LAMBDA_SURFACE which are on the edges
133 Range edges;
134 CHKERR m_field.getInterface<MeshsetsManager>()->getEntitiesByDimension(
135 edges_block_set, BLOCKSET, 1, edges, true);
136 Range verts;
137 CHKERR m_field.get_moab().get_connectivity(edges, verts, true);
138 CHKERR m_field.remove_ents_from_field("LAMBDA_SURFACE", verts);
139 }
140 CHKERR simple_interface->buildFiniteElements();
141 CHKERR simple_interface->buildProblem();
142 }
143
144 struct ElementsAndOperators {
145
146 MoFEM::Interface &mField;
147 Vec minQualityVec;
148 double *minQualityPtr;
149
150 ElementsAndOperators(MoFEM::Interface &m_field) : mField(m_field) {
151 ierr = VecCreateMPI(PETSC_COMM_WORLD, 1, m_field.get_comm_size(),
152 &minQualityVec);
153 CHKERRABORT(PETSC_COMM_WORLD, ierr);
154 ierr = VecGetArray(minQualityVec, &minQualityPtr);
155 CHKERRABORT(PETSC_COMM_WORLD, ierr);
156 }
157
158 virtual ~ElementsAndOperators() {
159 ierr = VecRestoreArray(minQualityVec, &minQualityPtr);
160 CHKERRABORT(PETSC_COMM_WORLD, ierr);
161 ierr = VecDestroy(&minQualityVec);
162 CHKERRABORT(PETSC_COMM_WORLD, ierr);
163 }
164
165 double getMinQuality() const { return *minQualityPtr; }
166
167 enum Tags {
168 SMOOTHING_TAG = 1,
169 SURFACE_CONSTRAINS_TAG,
170 EDGE_CONSTRAINS_TAG
171 };
172
173 boost::shared_ptr<Smoother> smootherFe;
174 boost::shared_ptr<Smoother::MyVolumeFE>
175 feSmootherRhs; ///< Integrate smoothing operators
176 boost::shared_ptr<Smoother::MyVolumeFE>
177 feSmootherLhs; ///< Integrate smoothing operators
178 boost::shared_ptr<VolumeLengthQuality<double> > volumeLengthDouble;
179 boost::shared_ptr<VolumeLengthQuality<adouble> > volumeLengthAdouble;
180
181 boost::shared_ptr<SurfaceSlidingConstrains> surfaceConstrain;
182 boost::shared_ptr<SurfaceSlidingConstrains::DriverElementOrientation>
183 skinOrientation;
184 boost::shared_ptr<EdgeSlidingConstrains> edgeConstrain;
185
186 boost::shared_ptr<DirichletFixFieldAtEntitiesBc> fixMaterialEnts;
187
188 boost::shared_ptr<MoFEM::VolumeElementForcesAndSourcesCore> minQualityFe;
189
191 double *minQualityPtr;
192 MinQualityOp(double *min_quality_ptr)
194 "MESH_NODE_POSITIONS", UserDataOperator::OPROW),
195 minQualityPtr(min_quality_ptr) {}
196 MoFEMErrorCode doWork(int side, EntityType type,
199 if (type != MBVERTEX)
201 double q = Tools::volumeLengthQuality(&*data.getFieldData().begin());
202 *minQualityPtr = fmin(*minQualityPtr, q);
204 }
205 };
206
207 MoFEMErrorCode createSmoothingFE() {
209 smootherFe = boost::shared_ptr<Smoother>(new Smoother(mField));
210 volumeLengthAdouble = boost::shared_ptr<VolumeLengthQuality<adouble> >(
212 volumeLengthDouble = boost::shared_ptr<VolumeLengthQuality<double> >(
214
215 Range tets;
216 CHKERR mField.get_moab().get_entities_by_type(0, MBTET, tets);
217 smootherFe->setOfBlocks[0].tEts.merge(tets);
218
219 smootherFe->setOfBlocks[0].materialDoublePtr = volumeLengthDouble;
220 smootherFe->setOfBlocks[0].materialAdoublePtr = volumeLengthAdouble;
221
222 // set element data
223 smootherFe->commonData.spatialPositions = "MESH_NODE_POSITIONS";
224 smootherFe->commonData.meshPositions = "NONE";
225
226 smootherFe->feRhs.meshPositionsFieldName = "NONE";
227 smootherFe->feLhs.meshPositionsFieldName = "NONE";
228 smootherFe->feRhs.addToRule = 0;
229 smootherFe->feLhs.addToRule = 0;
230
231 feSmootherRhs = smootherFe->feRhsPtr;
232 feSmootherLhs = smootherFe->feLhsPtr;
233
234 // Smoother right hand side
235 feSmootherRhs->getOpPtrVector().push_back(
237 "MESH_NODE_POSITIONS", smootherFe->commonData));
238 feSmootherRhs->getOpPtrVector().push_back(
240 "MESH_NODE_POSITIONS", smootherFe->setOfBlocks.at(0),
241 smootherFe->commonData, SMOOTHING_TAG, false));
242 feSmootherRhs->getOpPtrVector().push_back(new Smoother::OpRhsSmoother(
243 "MESH_NODE_POSITIONS", smootherFe->setOfBlocks[0],
244 smootherFe->commonData, smootherFe->smootherData));
245
246 // Smoother left hand side
247 feSmootherLhs->getOpPtrVector().push_back(
249 "MESH_NODE_POSITIONS", smootherFe->commonData));
250 feSmootherLhs->getOpPtrVector().push_back(
252 "MESH_NODE_POSITIONS", smootherFe->setOfBlocks.at(0),
253 smootherFe->commonData, SMOOTHING_TAG, true));
254 feSmootherLhs->getOpPtrVector().push_back(new Smoother::OpLhsSmoother(
255 "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
256 smootherFe->setOfBlocks.at(0), smootherFe->commonData,
257 smootherFe->smootherData, "LAMBDA_CRACKFRONT_AREA_TANGENT"));
258
259 minQualityFe =
260 boost::shared_ptr<MoFEM::VolumeElementForcesAndSourcesCore>(
262 minQualityFe->getOpPtrVector().push_back(
263 new MinQualityOp(minQualityPtr));
264
265 Range fixed_vertex;
268 CHKERR mField.getInterface<MeshsetsManager>()->getEntitiesByDimension(
269 vertex_block_set, BLOCKSET, 0, fixed_vertex, true);
270 }
271 fixMaterialEnts = boost::shared_ptr<DirichletFixFieldAtEntitiesBc>(
272 new DirichletFixFieldAtEntitiesBc(mField, "MESH_NODE_POSITIONS",
273 fixed_vertex));
274 fixMaterialEnts->fieldNames.push_back("LAMBDA_SURFACE");
275 fixMaterialEnts->fieldNames.push_back("LAMBDA_EDGE");
276
278 }
279
280 MoFEMErrorCode createConstrians() {
282 skinOrientation = boost::shared_ptr<
285 surfaceConstrain = boost::shared_ptr<SurfaceSlidingConstrains>(
286 skinOrientation,
287 new SurfaceSlidingConstrains(mField, *skinOrientation));
288 surfaceConstrain->setOperators(SURFACE_CONSTRAINS_TAG, "LAMBDA_SURFACE",
289 "MESH_NODE_POSITIONS");
290
293 Range edges;
295 ->getEntitiesByDimension(edges_block_set, BLOCKSET, 1, edges,
296 true);
297
298 Range tets;
299 CHKERR mField.get_moab().get_entities_by_type(0, MBTET, tets);
300 Skinner skin(&mField.get_moab());
301 Range skin_faces; // skin faces from 3d ents
302 CHKERR skin.find_skin(0, tets, false, skin_faces);
303
304 edgeConstrain = boost::shared_ptr<EdgeSlidingConstrains>(
305 new EdgeSlidingConstrains(mField));
306 CHKERR edgeConstrain->setOperators(EDGE_CONSTRAINS_TAG, edges,
307 skin_faces, "LAMBDA_EDGE",
308 "MESH_NODE_POSITIONS");
309
310 // CHKERR EdgeSlidingConstrains::CalculateEdgeBase::saveEdges(
311 // mField.get_moab(), "out_edges.vtk", edges);
312
313 }
315 }
316
317 MoFEMErrorCode addFEtoDM(DM dm) {
319 boost::shared_ptr<ForcesAndSourcesCore> null;
320
321 CHKERR DMMoFEMSNESSetFunction(dm, DM_NO_ELEMENT, null, fixMaterialEnts,
322 null);
323 CHKERR DMMoFEMSNESSetFunction(dm, "SMOOTHING", feSmootherRhs, null,
324 null);
325 CHKERR DMMoFEMSNESSetFunction(dm, "SURFACE_SLIDING",
326 surfaceConstrain->feRhsPtr, null, null);
327 CHKERR DMMoFEMSNESSetFunction(dm, "EDGE_SLIDING",
328 edgeConstrain->feRhsPtr, null, null);
330 fixMaterialEnts);
331
332 CHKERR DMMoFEMSNESSetJacobian(dm, DM_NO_ELEMENT, null, fixMaterialEnts,
333 null);
334 CHKERR DMMoFEMSNESSetJacobian(dm, "SMOOTHING", feSmootherLhs, null,
335 null);
336 CHKERR DMMoFEMSNESSetJacobian(dm, "SURFACE_SLIDING",
337 surfaceConstrain->feLhsPtr, null, null);
338 CHKERR DMMoFEMSNESSetJacobian(dm, "EDGE_SLIDING",
339 edgeConstrain->feLhsPtr, null, null);
341 fixMaterialEnts);
342
343 // MoFEM::SnesCtx *snes_ctx;
344 // DMMoFEMGetSnesCtx(dm,&snes_ctx);
345 // snes_ctx->vErify = true;
346
348 }
349
350 MoFEMErrorCode calcuteMinQuality(DM dm) {
352 *minQualityPtr = 1;
353 CHKERR DMoFEMLoopFiniteElements(dm, "SMOOTHING", minQualityFe.get());
354 CHKERR VecMin(minQualityVec, PETSC_NULLPTR, minQualityPtr);
356 }
357 };
358
359 ElementsAndOperators elements_and_operators(m_field);
360 CHKERR elements_and_operators.createSmoothingFE();
361 CHKERR elements_and_operators.createConstrians();
362
363 DM dm;
364 CHKERR simple_interface->getDM(&dm);
365 CHKERR elements_and_operators.addFEtoDM(dm);
366
367 struct Solve {
368
369 MoFEMErrorCode operator()(DM dm) const {
371
372 // Create the right hand side vector and vector of unknowns
373 Vec F, D;
374 CHKERR DMCreateGlobalVector(dm, &F);
375 // Create unknown vector by creating duplicate copy of F vector. only
376 // structure is duplicated no values.
377 CHKERR VecDuplicate(F, &D);
378
379 CHKERR zeroLambdaFields(dm);
380 CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_FORWARD);
381
382 // Create solver and link it to DM
383 SNES solver;
384 CHKERR SNESCreate(PETSC_COMM_WORLD, &solver);
385 CHKERR SNESSetFromOptions(solver);
386 CHKERR SNESSetDM(solver, dm);
387 // Set-up solver, is type of solver and pre-conditioners
388 CHKERR SNESSetUp(solver);
389 // At solution process, KSP solver using DM creates matrices, Calculate
390 // values of the left hand side and the right hand side vector. then
391 // solves system of equations. Results are stored in vector D.
392 CHKERR SNESSolve(solver, F, D);
393
394 // Scatter solution on the mesh. Stores unknown vector on field on the
395 // mesh.
396 CHKERR DMoFEMMeshToGlobalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
397 // Clean data. Solver and vector are not needed any more.
398 CHKERR SNESDestroy(&solver);
399 CHKERR VecDestroy(&D);
400 CHKERR VecDestroy(&F);
401
403 }
404
405 MoFEMErrorCode setCoordsFromField(DM dm) const {
407 MoFEM::Interface *m_field_ptr;
408 CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
409 for (_IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP_(*m_field_ptr,
410 "MESH_NODE_POSITIONS", it)) {
411 if (it->get()->getEntType() != MBVERTEX)
412 continue;
413 VectorDouble3 coords(3);
414 for(int dd = 0;dd!=3;++dd)
415 coords[dd] = it->get()->getEntFieldData()[dd];
416 EntityHandle ent = it->get()->getEnt();
417 CHKERR m_field_ptr->get_moab().set_coords(&ent, 1, &*coords.begin());
418 }
420 }
421
422 MoFEMErrorCode setFieldFromCoords(DM dm) const {
424 MoFEM::Interface *m_field_ptr;
425 CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
426 for (_IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP_(*m_field_ptr,
427 "MESH_NODE_POSITIONS", it)) {
428 if (it->get()->getEntType() != MBVERTEX)
429 continue;
430 EntityHandle ent = it->get()->getEnt();
431 VectorDouble3 coords(3);
432 CHKERR m_field_ptr->get_moab().get_coords(&ent, 1, &*coords.begin());
433 for(int dd = 0;dd!=3;++dd)
434 it->get()->getEntFieldData()[dd] = coords[dd];
435 }
437 }
438
439 private:
440 MoFEMErrorCode zeroLambdaFields(DM dm) const {
442 MoFEM::Interface *m_field_ptr;
443 CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
444 CHKERR m_field_ptr->getInterface<FieldBlas>()->setField(
445 0, MBVERTEX, "LAMBDA_SURFACE");
447 }
448
449 };
450
451 Solve solve;
452 CHKERR solve.setFieldFromCoords(dm);
453
454 CHKERR elements_and_operators.calcuteMinQuality(dm);
455 double min_quality = elements_and_operators.getMinQuality();
456 PetscPrintf(PETSC_COMM_WORLD, "Min quality = %4.3f\n", min_quality);
457
458 double gamma = min_quality > 0 ? gamma_factor * min_quality
459 : min_quality / gamma_factor;
460 elements_and_operators.volumeLengthDouble->gAmma = gamma;
461 elements_and_operators.volumeLengthAdouble->gAmma = gamma;
462
463 double min_quality_p, eps;
464 do {
465
466 min_quality_p = min_quality;
467
468 CHKERR solve(dm);
469
470 CHKERR solve.setCoordsFromField(dm);
471 CHKERR elements_and_operators.calcuteMinQuality(dm);
472 min_quality = elements_and_operators.getMinQuality();
473
474 eps = (min_quality - min_quality_p) / min_quality;
475 PetscPrintf(PETSC_COMM_WORLD, "Min quality = %4.3f eps = %4.3f\n",
476 min_quality, eps);
477
478 double gamma = min_quality > 0 ? gamma_factor * min_quality
479 : min_quality / gamma_factor;
480 elements_and_operators.volumeLengthDouble->gAmma = gamma;
481 elements_and_operators.volumeLengthAdouble->gAmma = gamma;
482
483 } while (eps > tol);
484
485 // if (m_field.getInterface<MeshsetsManager>()->checkMeshset(edges_block_set,
486 // BLOCKSET)) {
487 // Range edges;
488 // CHKERR m_field.getInterface<MeshsetsManager>()->getEntitiesByDimension(
489 // edges_block_set, BLOCKSET, 1, edges, true);
490
491 // Range tets;
492 // CHKERR moab.get_entities_by_type(0,MBTET,tets);
493 // Skinner skin(&moab);
494 // Range skin_faces; // skin faces from 3d ents
495 // CHKERR skin.find_skin(0, tets, false, skin_faces);
496
497 // CHKERR EdgeSlidingConstrains::CalculateEdgeBase::setTags(moab, edges,
498 // skin_faces);
499 // CHKERR EdgeSlidingConstrains::CalculateEdgeBase::saveEdges(
500 // moab, "out_edges.vtk", edges);
501 // }
502
503 if (output_vtk)
504 CHKERR m_field.getInterface<BitRefManager>()->writeBitLevelByType(
505 BitRefLevel().set(0), BitRefLevel().set(), MBTET, "out.vtk", "VTK",
506 "");
507 }
509
511}
#define DM_NO_ELEMENT
Definition DMMoFEM.hpp:10
ForcesAndSourcesCore::UserDataOperator UserDataOperator
static const double eps
#define CATCH_ERRORS
Catch errors.
@ MF_ZERO
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
@ AINSWORTH_LOBATTO_BASE
Definition definitions.h:62
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ H1
continuous field
Definition definitions.h:85
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ BLOCKSET
#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 ...
@ F
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:708
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:514
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:749
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:43
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:576
PetscErrorCode DMoFEMGetInterfacePtr(DM dm, MoFEM::Interface **m_field_ptr)
Get pointer to MoFEM::Interface.
Definition DMMoFEM.cpp:410
PetscErrorCode DMoFEMMeshToGlobalVector(DM dm, Vec g, InsertMode mode, ScatterMode scatter_mode)
set ghosted vector values on all existing mesh entities
Definition DMMoFEM.cpp:525
#define _IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP_(MFIELD, NAME, IT)
loop over all dofs from a moFEM field and particular field
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
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
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
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
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
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.
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.
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
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
double D
double tol
PetscBool output_vtk
static char help[]
PetscBool flg_myfile
double gamma_factor
int vertex_block_set
int edges_block_set
char mesh_file_name[255]
const FTensor::Tensor2< T, Dim, Dim > Vec
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
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
VectorBoundedArray< double, 3 > VectorDouble3
Definition Types.hpp:92
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
static PetscErrorCode solve(Mat mat, Vec x, Vec y)
Definition Schur.cpp:1296
Fix dofs on entities.
Managing BitRefLevels.
Managing BitRefLevels.
virtual int get_comm_size() const =0
virtual moab::Interface & get_moab()=0
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.
Core (interface) class.
Definition Core.hpp:82
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
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:112
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
const VectorDouble & getFieldData() const
get dofs values
Basic algebra on fields.
Definition FieldBlas.hpp:21
structure to get information form mofem into EntitiesFieldData
Interface for managing meshsets containing materials and boundary conditions.
Simple interface for fast problem set-up.
Definition Simple.hpp:27
MoFEMErrorCode buildProblem()
Build problem.
Definition Simple.cpp:753
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
const std::string getBoundaryFEName() const
Get the Boundary FE Name.
Definition Simple.hpp:394
MoFEMErrorCode defineFiniteElements()
Define finite elements.
Definition Simple.cpp:471
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
Definition Simple.cpp:191
MoFEMErrorCode buildFiniteElements()
Build finite elements.
Definition Simple.cpp:699
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:355
std::vector< std::string > & getOtherFiniteElements()
Get the Other Finite Elements.
Definition Simple.hpp:462
MoFEMErrorCode getOptions()
get options
Definition Simple.cpp:180
MoFEMErrorCode getDM(DM *dm)
Get DM.
Definition Simple.cpp:831
MoFEMErrorCode buildFields()
Build fields.
Definition Simple.cpp:610
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Definition Simple.cpp:601
MoFEMErrorCode defineProblem(const PetscBool is_partitioned=PETSC_TRUE)
define problem
Definition Simple.cpp:577
const std::string getDomainFEName() const
Get the Domain FE Name.
Definition Simple.hpp:387
static double volumeLengthQuality(const double *coords)
Calculate tetrahedron volume length quality.
Definition Tools.cpp:15
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Class implemented by user to detect face orientation.
Shape preserving constrains, i.e. nodes sliding on body surface.
Volume Length Quality.
@ BARRIER_AND_QUALITY

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

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.