v0.13.0
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Cornea Struct Reference
Collaboration diagram for Cornea:
[legend]

Classes

struct  CommonData
 
struct  OpError
 

Public Member Functions

 Cornea (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 [Run programme] More...
 

Private Member Functions

MoFEMErrorCode getOptions ()
 [Run programme] More...
 
MoFEMErrorCode readMesh ()
 [Read mesh] More...
 
MoFEMErrorCode setupProblem ()
 [Read mesh] More...
 
MoFEMErrorCode setIntegrationRules ()
 [Set up problem] More...
 
MoFEMErrorCode createCommonData ()
 [Set integration rule] More...
 
MoFEMErrorCode boundaryCondition ()
 [Create common data] More...
 
MoFEMErrorCode setOPs ()
 [Boundary condition] More...
 
MoFEMErrorCode solveSystem ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode outputResults ()
 [Solve] More...
 
MoFEMErrorCode checkResults ()
 [Postprocess results] More...
 
MoFEMErrorCode setHOGeometry ()
 [Check results] More...
 

Private Attributes

MoFEM::InterfacemField
 
Range entsTop
 
Range entsBottom
 
Range entsGap
 
Range entsGraft
 
Range prismsGap
 
Range prismsGraft
 
boost::shared_ptr< CommonDatacommonDataPtr
 
char meshFileName [255]
 mesh file name More...
 
SmartPetscObj< DM > dM
 Discrete manager (interface to PETSc/MoFEM functions) More...
 
boost::shared_ptr< DomainElefeZRhsTopPtr
 FE instance. More...
 
boost::shared_ptr< DomainElefeZRhsBottomPtr
 FE instance. More...
 
boost::shared_ptr< DomainElefeZRhsGapPtr
 FE instance. More...
 
boost::shared_ptr< DomainElefeZRhsGraftPtr
 FE instance. More...
 
boost::shared_ptr< DomainElefeZLhsPtr
 FE instance. More...
 

Detailed Description

Definition at line 100 of file cornea_z_approx.cpp.

Constructor & Destructor Documentation

◆ Cornea()

Cornea::Cornea ( MoFEM::Interface m_field)

Definition at line 102 of file cornea_z_approx.cpp.

102 : mField(m_field) {}
MoFEM::Interface & mField

Member Function Documentation

◆ boundaryCondition()

MoFEMErrorCode Cornea::boundaryCondition ( )
private

[Create common data]

[Boundary condition]

Definition at line 391 of file cornea_z_approx.cpp.

391 { return 0; }

◆ checkResults()

MoFEMErrorCode Cornea::checkResults ( )
private

[Postprocess results]

[Check results]

Definition at line 470 of file cornea_z_approx.cpp.

470  {
472 
473  auto create_check_fe = [&](auto approx_fun) {
474  auto fe = boost::make_shared<DomainEle>(mField);
475  fe->getOpPtrVector().push_back(
476  new OpCalculateScalarFieldValues("Z", commonDataPtr->approxVals));
477  fe->getOpPtrVector().push_back(new OpError(commonDataPtr, approx_fun));
478  return fe;
479  };
480 
482  create_check_fe(ApproxFieldFunctionGeneric(
483  [](double, double) { return 0; })));
485  dM, "Z_BOTTOM",
486  create_check_fe(ApproxFieldFunctionGeneric(thickness_bottom)));
487 
488  CHKERR VecAssemblyBegin(commonDataPtr->L2Vec);
489  CHKERR VecAssemblyEnd(commonDataPtr->L2Vec);
490  CHKERR VecAssemblyBegin(commonDataPtr->resVec);
491  CHKERR VecAssemblyEnd(commonDataPtr->resVec);
492  double nrm2;
493  CHKERR VecNorm(commonDataPtr->resVec, NORM_2, &nrm2);
494  const double *array;
495  CHKERR VecGetArrayRead(commonDataPtr->L2Vec, &array);
496  if (mField.get_comm_rank() == 0)
497  PetscPrintf(PETSC_COMM_SELF, "Error %6.4e Vec norm %6.4e\n", sqrt(array[0]),
498  nrm2);
499  CHKERR VecRestoreArrayRead(commonDataPtr->L2Vec, &array);
500 
502 }
auto thickness_bottom
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition: DMMMoFEM.cpp:544
SmartPetscObj< DM > dM
Discrete manager (interface to PETSc/MoFEM functions)
boost::shared_ptr< CommonData > commonDataPtr
virtual int get_comm_rank() const =0
Get value at integration points for scalar field.

◆ createCommonData()

MoFEMErrorCode Cornea::createCommonData ( )
private

[Set integration rule]

[Create common data]

Definition at line 379 of file cornea_z_approx.cpp.

379  {
381  commonDataPtr = boost::make_shared<CommonData>();
384  mField.get_comm(), (!mField.get_comm_rank()) ? 1 : 0, 1);
385  commonDataPtr->approxVals = boost::make_shared<VectorDouble>();
387 }
auto smartCreateDMVector
Get smart vector from DM.
Definition: DMMoFEM.hpp:956
auto createSmartVectorMPI
Create MPI Vector.
virtual MPI_Comm & get_comm() const =0

◆ getOptions()

MoFEMErrorCode Cornea::getOptions ( )
private

[Run programme]

Definition at line 216 of file cornea_z_approx.cpp.

216  {
217  PetscBool flg = PETSC_TRUE;
219  ierr = PetscOptionsBegin(PETSC_COMM_WORLD, "", "Cornea", "none");
220  CHKERRG(ierr);
221  ierr = PetscOptionsString("-file_name", "file name", "", "mesh.h5m",
222  meshFileName, 255, &flg);
223  CHKERRG(ierr);
224  ierr = PetscOptionsEnd();
225  CHKERRG(ierr);
227 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:496
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
char meshFileName[255]
mesh file name

◆ outputResults()

MoFEMErrorCode Cornea::outputResults ( )
private

[Solve]

Definition at line 444 of file cornea_z_approx.cpp.

444  {
446  auto post_proc_fe = boost::make_shared<PostProcFaceOnRefinedMesh>(mField);
447  post_proc_fe->generateReferenceElementMesh();
448  post_proc_fe->addFieldValuesPostProc("Z");
449  post_proc_fe->addFieldValuesPostProc("HO_GEOMETRY");
450  CHKERR DMoFEMLoopFiniteElements(dM, "Z_TOP", post_proc_fe);
451  CHKERR DMoFEMLoopFiniteElements(dM, "Z_BOTTOM", post_proc_fe);
452  CHKERR DMoFEMLoopFiniteElements(dM, "Z_GAP", post_proc_fe);
453  CHKERR DMoFEMLoopFiniteElements(dM, "Z_GRAFT", post_proc_fe);
454  CHKERR post_proc_fe->writeFile("out_approx.h5m");
455 
456  dM.reset();
458  CHKERR mField.delete_finite_element("Z_BOTTOM");
462 
463  CHKERR mField.get_moab().write_file("out_ho_mesh.h5m");
464 
466 }
virtual MoFEMErrorCode delete_finite_element(const std::string name, int verb=DEFAULT_VERBOSITY)=0
delete finite element from mofem database
virtual MoFEMErrorCode delete_field(const std::string name, int verb=DEFAULT_VERBOSITY)=0
Delete field.
virtual moab::Interface & get_moab()=0

◆ readMesh()

MoFEMErrorCode Cornea::readMesh ( )
private

[Read mesh]

Definition at line 230 of file cornea_z_approx.cpp.

230  {
232 
233  // This is a case of distributed mesh and algebra. In that case each processor
234  // keep only part of the problem.
235  CHKERR mField.get_moab().load_file(meshFileName, 0, "");
237 
238  auto getBlokset = [&](auto block_name) {
239  const CubitMeshSets *blockset_ptr;
240  CHKERR mField.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
241  block_name, &blockset_ptr);
242  return blockset_ptr;
243  };
244 
245  auto getEnts = [&](auto block_name) {
246  auto blockset_ptr = getBlokset(block_name);
247  Range faces;
248  CHKERR blockset_ptr->getMeshsetIdEntitiesByDimension(mField.get_moab(), 2,
249  faces, true);
250  return faces;
251  };
252 
253  entsTop = getEnts("TOP");
254  entsBottom = getEnts("BOTTOM");
255 
256  auto add_two_layers_of_prisms = [&]() {
258  auto interface_ptr = mField.getInterface<PrismsFromSurfaceInterface>();
259  CHKERR interface_ptr->createPrisms(entsBottom, prismsGap);
260  std::array<double, 3> d3{0, 0, 0};
261  std::array<double, 3> d4{0, 0, -1};
262  CHKERR interface_ptr->setThickness(prismsGap, d3.data(), d4.data());
263 
264  interface_ptr->createdVertices.clear();
265  CHKERR interface_ptr->createPrismsFromPrisms(prismsGap, false, prismsGraft);
266  CHKERR interface_ptr->setThickness(prismsGraft, d3.data(), d4.data());
267 
268  auto meshset_mng = mField.getInterface<MeshsetsManager>();
269 
270  CHKERR meshset_mng->addMeshset(BLOCKSET, 101, "GAP");
271  CHKERR meshset_mng->addMeshset(BLOCKSET, 102, "GRAFT");
272  CHKERR meshset_mng->addEntitiesToMeshset(BLOCKSET, 101, prismsGap);
273  CHKERR meshset_mng->addEntitiesToMeshset(BLOCKSET, 102, prismsGraft);
274 
275  Skinner skin(&mField.get_moab());
276  CHKERR skin.find_skin(0, prismsGap, false, entsGap);
277  entsGap = subtract(entsGap, entsBottom).subset_by_type(MBTRI);
278  CHKERR skin.find_skin(0, prismsGraft, false, entsGraft);
279  entsGraft = subtract(entsGraft, entsGap).subset_by_type(MBTRI);
280 
281  CHKERR meshset_mng->addMeshset(BLOCKSET, 103, "SKIN_GAP");
282  CHKERR meshset_mng->addMeshset(BLOCKSET, 104, "SKIN_GRAFT");
283  CHKERR meshset_mng->addEntitiesToMeshset(BLOCKSET, 103, entsGap);
284  CHKERR meshset_mng->addEntitiesToMeshset(BLOCKSET, 104, entsGraft);
285 
287  };
288 
289  CHKERR add_two_layers_of_prisms();
290 
291  Range ents;
292  CHKERR mField.get_moab().get_entities_by_dimension(0, 3, ents, true);
293  CHKERR mField.getInterface<BitRefManager>()->setBitRefLevel(
294  ents, BitRefLevel().set(0), false);
296 }
@ BLOCKSET
Definition: definitions.h:161
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
static constexpr std::array< double, 3 > d4
static constexpr std::array< double, 3 > d3
Range entsGraft
Range entsBottom
Range prismsGap
Range prismsGraft
Managing BitRefLevels.
virtual MoFEMErrorCode rebuild_database(int verb=DEFAULT_VERBOSITY)=0
Clear database and initialize it once again.
this struct keeps basic methods for moab meshset about material and boundary conditions
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.

◆ runProblem()

MoFEMErrorCode Cornea::runProblem ( )

[Run programme]

Definition at line 199 of file cornea_z_approx.cpp.

199  {
201  CHKERR getOptions();
202  CHKERR readMesh();
207  CHKERR setOPs();
213 }
MoFEMErrorCode setIntegrationRules()
[Set up problem]
MoFEMErrorCode readMesh()
[Read mesh]
MoFEMErrorCode setHOGeometry()
[Check results]
MoFEMErrorCode setOPs()
[Boundary condition]
MoFEMErrorCode createCommonData()
[Set integration rule]
MoFEMErrorCode setupProblem()
[Read mesh]
MoFEMErrorCode outputResults()
[Solve]
MoFEMErrorCode boundaryCondition()
[Create common data]
MoFEMErrorCode getOptions()
[Run programme]
MoFEMErrorCode checkResults()
[Postprocess results]
MoFEMErrorCode solveSystem()
[Push operators to pipeline]

◆ setHOGeometry()

MoFEMErrorCode Cornea::setHOGeometry ( )
private

[Check results]

Definition at line 505 of file cornea_z_approx.cpp.

505  {
507 
508  EntityMethod set_coords_method;
509  set_coords_method.preProcessHook = []() { return 0; };
510  set_coords_method.operatorHook = [&]() {
512  VectorDouble3 coords(3);
513  EntityHandle v = set_coords_method.entPtr->getEnt();
514  CHKERR mField.get_moab().get_coords(&v, 1, &coords[0]);
515  for (size_t i = 0; i != 3; ++i)
516  set_coords_method.entPtr->getEntFieldData()[i] = coords[i];
518  };
519  set_coords_method.postProcessHook = []() { return 0; };
520 
521  Range verts;
522  CHKERR mField.get_moab().get_entities_by_type(0, MBVERTEX, verts);
523  CHKERR mField.loop_entities("HO_GEOMETRY", set_coords_method, &verts);
524 
525  Range ents_top_and_bottom = unite(entsTop, entsBottom);
526  ents_top_and_bottom.merge(entsGap);
527  ents_top_and_bottom.merge(entsGraft);
528  Range sub_ents_top_and_bottom;
529  for (size_t d = 0; d != 2; ++d)
530  CHKERR mField.get_moab().get_adjacencies(ents_top_and_bottom, d, false,
531  sub_ents_top_and_bottom,
532  moab::Interface::UNION);
533  ents_top_and_bottom.merge(sub_ents_top_and_bottom);
534 
535  map<EntityHandle, VectorDouble> z_vec_map;
536  EntityMethod get_z_vec;
537  get_z_vec.preProcessHook = []() { return 0; };
538  get_z_vec.operatorHook = [&]() {
540  EntityHandle v = get_z_vec.entPtr->getEnt();
541  z_vec_map[v] = get_z_vec.entPtr->getEntFieldData();
543  };
544  get_z_vec.postProcessHook = []() { return 0; };
545  CHKERR mField.loop_entities("Z", get_z_vec, &ents_top_and_bottom);
546 
547  EntityMethod set_z_vec;
548  set_z_vec.preProcessHook = []() { return 0; };
549  set_z_vec.operatorHook = [&]() {
551  EntityHandle v = set_z_vec.entPtr->getEnt();
552  int i = 2;
553  for (auto z_dof : z_vec_map.at(v)) {
554  set_z_vec.entPtr->getEntFieldData()[i] = z_dof;
555  i += 3;
556  }
558  };
559  set_z_vec.postProcessHook = []() { return 0; };
560  CHKERR mField.loop_entities("HO_GEOMETRY", set_z_vec, &ents_top_and_bottom);
562 }
virtual MoFEMErrorCode loop_entities(const std::string field_name, EntityMethod &method, Range const *const ents=nullptr, int verb=DEFAULT_VERBOSITY)=0
Loop over field entities.
FTensor::Index< 'i', SPACE_DIM > i
double v
phase velocity of light in medium (cm/ns)
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: dTensor0.hpp:27
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:103
boost::function< MoFEMErrorCode()> preProcessHook
Hook function for pre-processing.
boost::function< MoFEMErrorCode()> operatorHook
Hook function for operator.
boost::function< MoFEMErrorCode()> postProcessHook
Hook function for post-processing.
Data structure to exchange data between mofem and User Loop Methods on entities.
boost::shared_ptr< FieldEntity > entPtr

◆ setIntegrationRules()

MoFEMErrorCode Cornea::setIntegrationRules ( )
private

[Set up problem]

[Set integration rule]

Definition at line 363 of file cornea_z_approx.cpp.

363  {
365  auto make_fe_ptr = [&](auto &fe_ptr) {
366  fe_ptr = boost::make_shared<DomainEle>(mField);
367  fe_ptr->getRuleHook = [](int, int, int p) -> int { return 2 * p; };
368  };
369  make_fe_ptr(feZRhsTopPtr);
370  make_fe_ptr(feZRhsBottomPtr);
371  make_fe_ptr(feZRhsGapPtr);
372  make_fe_ptr(feZRhsGraftPtr);
373  make_fe_ptr(feZLhsPtr);
375 }
static Index< 'p', 3 > p
boost::shared_ptr< DomainEle > feZRhsGapPtr
FE instance.
boost::shared_ptr< DomainEle > feZRhsTopPtr
FE instance.
boost::shared_ptr< DomainEle > feZRhsBottomPtr
FE instance.
boost::shared_ptr< DomainEle > feZLhsPtr
FE instance.
boost::shared_ptr< DomainEle > feZRhsGraftPtr
FE instance.

◆ setOPs()

MoFEMErrorCode Cornea::setOPs ( )
private

[Boundary condition]

[Push operators to pipeline]

Definition at line 395 of file cornea_z_approx.cpp.

395  {
398  auto beta = [](const double, const double, const double) { return 1; };
399  feZLhsPtr->getOpPtrVector().push_back(new OpDomainMass("Z", "Z", beta));
400  feZRhsTopPtr->getOpPtrVector().push_back(new OpDomainSource(
401  "Z", ApproxFieldFunctionGeneric([](double, double) { return 0; })));
402  feZRhsBottomPtr->getOpPtrVector().push_back(
404  feZRhsGapPtr->getOpPtrVector().push_back(
406  feZRhsGraftPtr->getOpPtrVector().push_back(
409 }
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, FIELD_DIM > OpDomainSource
auto thickness_gap
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, FIELD_DIM > OpDomainMass
auto thickness_graft
PipelineManager interface.

◆ setupProblem()

MoFEMErrorCode Cornea::setupProblem ( )
private

[Read mesh]

[Set up problem]

Definition at line 300 of file cornea_z_approx.cpp.

300  {
302 
303  // Declare fields
305  CHKERR mField.add_field("HO_GEOMETRY", H1, AINSWORTH_LEGENDRE_BASE, 3);
306 
307  // Set order and add entities to field
308  constexpr int order = 4;
309  Range z_ents = unite(entsTop, entsBottom);
310  z_ents.merge(entsGap);
311  z_ents.merge(entsGraft);
312  CHKERR mField.add_ents_to_field_by_dim(z_ents, 2, "Z");
313  CHKERR mField.set_field_order(0, MBVERTEX, "Z", 1);
314  CHKERR mField.set_field_order(0, MBEDGE, "Z", order);
315  CHKERR mField.set_field_order(0, MBTRI, "Z", order);
316 
317  CHKERR mField.add_ents_to_field_by_type(0, MBTRI, "HO_GEOMETRY");
318  CHKERR mField.set_field_order(0, MBVERTEX, "HO_GEOMETRY", 1);
319  CHKERR mField.set_field_order(0, MBEDGE, "HO_GEOMETRY", order);
320  CHKERR mField.set_field_order(0, MBTRI, "HO_GEOMETRY", order);
321 
322  auto add_ele = [&](auto name, auto ents) {
325  // Declare finite ele,elements
330  // Add entities to finite element
333  };
334 
335  CHKERR add_ele("Z_TOP", entsTop);
336  CHKERR add_ele("Z_BOTTOM", entsBottom);
337  CHKERR add_ele("Z_GAP", entsGap);
338  CHKERR add_ele("Z_GRAFT", entsGraft);
339 
340  // Build fields and finite elements
343  CHKERR mField.build_finite_elements("Z_BOTTOM");
347 
348  dM = createSmartDM(PETSC_COMM_WORLD, "DMMOFEM");
349  CHKERR DMMoFEMCreateMoFEM(dM, &mField, "Z", BitRefLevel().set(0));
350  CHKERR DMSetFromOptions(dM);
351  CHKERR DMMoFEMAddElement(dM, "Z_TOP");
352  CHKERR DMMoFEMAddElement(dM, "Z_BOTTOM");
353  CHKERR DMMoFEMAddElement(dM, "Z_GAP");
354  CHKERR DMMoFEMAddElement(dM, "Z_GRAFT");
355  CHKERR DMMoFEMSetDestroyProblem(dM, PETSC_TRUE);
357 
359 }
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:73
@ H1
continuous field
Definition: definitions.h:98
PetscErrorCode DMMoFEMCreateMoFEM(DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
Must be called by user to set MoFEM data structures.
Definition: DMMMoFEM.cpp:130
PetscErrorCode DMMoFEMAddElement(DM dm, const char fe_name[])
add element to dm
Definition: DMMMoFEM.cpp:461
PetscErrorCode DMSetUp_MoFEM(DM dm)
Definition: DMMMoFEM.cpp:1203
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 add_ents_to_finite_element_by_dim(const EntityHandle entities, const int dim, const std::string &name, const bool recursive=true)=0
add entities to 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
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string &name_filed)=0
set finite element field data
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 build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode add_ents_to_field_by_dim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
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.
PetscErrorCode DMMoFEMSetDestroyProblem(DM dm, PetscBool destroy_problem)
Definition: DMMMoFEM.cpp:396
auto createSmartDM
Creates smart DM object.
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
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.

◆ solveSystem()

MoFEMErrorCode Cornea::solveSystem ( )
private

[Push operators to pipeline]

[Solve]

Definition at line 413 of file cornea_z_approx.cpp.

413  {
415 
416  auto solver = MoFEM::createKSP(mField.get_comm());
417  CHKERR KSPSetDM(solver, dM);
418 
419  boost::shared_ptr<FEMethod> null;
420  auto add_fe_instance = [&](auto fe_name, auto fe_lhs, auto fe_rhs) {
422  CHKERR DMMoFEMKSPSetComputeOperators(dM, fe_name, fe_lhs, null, null);
423  CHKERR DMMoFEMKSPSetComputeRHS(dM, fe_name, fe_rhs, null, null);
425  };
426  CHKERR add_fe_instance("Z_TOP", feZLhsPtr, feZRhsTopPtr);
427  CHKERR add_fe_instance("Z_BOTTOM", feZLhsPtr, feZRhsBottomPtr);
428  CHKERR add_fe_instance("Z_GAP", feZLhsPtr, feZRhsGapPtr);
429  CHKERR add_fe_instance("Z_GRAFT", feZLhsPtr, feZRhsGraftPtr);
430  CHKERR KSPSetFromOptions(solver);
431  CHKERR KSPSetUp(solver);
432 
433  auto D = smartCreateDMVector(dM);
434  auto F = smartVectorDuplicate(D);
435 
436  CHKERR KSPSolve(solver, F, D);
437  CHKERR VecGhostUpdateBegin(D, INSERT_VALUES, SCATTER_FORWARD);
438  CHKERR VecGhostUpdateEnd(D, INSERT_VALUES, SCATTER_FORWARD);
439  CHKERR DMoFEMMeshToLocalVector(dM, D, INSERT_VALUES, SCATTER_REVERSE);
441 }
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition: DMMMoFEM.cpp:481
PetscErrorCode DMMoFEMKSPSetComputeRHS(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set KSP right hand side evaluation function
Definition: DMMMoFEM.cpp:595
PetscErrorCode DMMoFEMKSPSetComputeOperators(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
Set KSP operators and push mofem finite element methods.
Definition: DMMMoFEM.cpp:636
auto createKSP
SmartPetscObj< Vec > smartVectorDuplicate(SmartPetscObj< Vec > &vec)
Create duplicate vector of smart vector.
const double D
diffusivity

Member Data Documentation

◆ commonDataPtr

boost::shared_ptr<CommonData> Cornea::commonDataPtr
private

Definition at line 133 of file cornea_z_approx.cpp.

◆ dM

SmartPetscObj<DM> Cornea::dM
private

Discrete manager (interface to PETSc/MoFEM functions)

Definition at line 137 of file cornea_z_approx.cpp.

◆ entsBottom

Range Cornea::entsBottom
private

Definition at line 110 of file cornea_z_approx.cpp.

◆ entsGap

Range Cornea::entsGap
private

Definition at line 111 of file cornea_z_approx.cpp.

◆ entsGraft

Range Cornea::entsGraft
private

Definition at line 112 of file cornea_z_approx.cpp.

◆ entsTop

Range Cornea::entsTop
private

Definition at line 109 of file cornea_z_approx.cpp.

◆ feZLhsPtr

boost::shared_ptr<DomainEle> Cornea::feZLhsPtr
private

FE instance.

Definition at line 142 of file cornea_z_approx.cpp.

◆ feZRhsBottomPtr

boost::shared_ptr<DomainEle> Cornea::feZRhsBottomPtr
private

FE instance.

Definition at line 139 of file cornea_z_approx.cpp.

◆ feZRhsGapPtr

boost::shared_ptr<DomainEle> Cornea::feZRhsGapPtr
private

FE instance.

Definition at line 140 of file cornea_z_approx.cpp.

◆ feZRhsGraftPtr

boost::shared_ptr<DomainEle> Cornea::feZRhsGraftPtr
private

FE instance.

Definition at line 141 of file cornea_z_approx.cpp.

◆ feZRhsTopPtr

boost::shared_ptr<DomainEle> Cornea::feZRhsTopPtr
private

FE instance.

Definition at line 138 of file cornea_z_approx.cpp.

◆ meshFileName

char Cornea::meshFileName[255]
private

mesh file name

Definition at line 135 of file cornea_z_approx.cpp.

◆ mField

MoFEM::Interface& Cornea::mField
private

Definition at line 107 of file cornea_z_approx.cpp.

◆ prismsGap

Range Cornea::prismsGap
private

Definition at line 113 of file cornea_z_approx.cpp.

◆ prismsGraft

Range Cornea::prismsGraft
private

Definition at line 114 of file cornea_z_approx.cpp.


The documentation for this struct was generated from the following file: