|
| v0.14.0
|
◆ AtomTest() [1/4]
◆ AtomTest() [2/4]
◆ AtomTest() [3/4]
◆ AtomTest() [4/4]
◆ assembleSystem() [1/4]
◆ assembleSystem() [2/4]
[Push operators to pipeline]
[Set up problem]
[Push operators to pipeline]
- Examples
- child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, and higher_derivatives.cpp.
Definition at line 290 of file child_and_parent.cpp.
294 auto rule = [](
int,
int,
int p) ->
int {
return 2 * p; };
299 auto test_bit_parent = [](
FEMethod *fe_ptr) {
300 const auto &
bit = fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel();
322 parent_op_lhs->doWorkRhsHook = [&](
DataOperator *op_ptr,
int side,
325 auto domain_op =
static_cast<DomainEleOp *
>(op_ptr);
328 MOFEM_LOG(
"SELF", Sev::noisy) <<
"LHS Pipeline FE";
334 domain_op->getFEMethod()->numeredEntFiniteElementPtr->getBitRefLevel();
336 CHKERR domain_op->loopChildren(domain_op->getFEName(),
346 parent_op_rhs->doWorkRhsHook = [&](
DataOperator *op_ptr,
int side,
349 auto domain_op =
static_cast<DomainEleOp *
>(op_ptr);
352 MOFEM_LOG(
"SELF", Sev::noisy) <<
"RHS Pipeline FE";
358 domain_op->getFEMethod()->numeredEntFiniteElementPtr->getBitRefLevel();
360 CHKERR domain_op->loopChildren(domain_op->getFEName(),
◆ assembleSystem() [3/4]
◆ assembleSystem() [4/4]
◆ checkResults() [1/4]
[Check results]
- Examples
- child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, and higher_derivatives.cpp.
Definition at line 213 of file dg_projection.cpp.
217 pipeline_mng->getDomainLhsFE().reset();
218 pipeline_mng->getDomainRhsFE().reset();
219 pipeline_mng->getOpDomainRhsPipeline().clear();
221 auto rule = [](
int,
int,
int p) ->
int {
return 2 * p + 1; };
222 CHKERR pipeline_mng->setDomainRhsIntegrationRule(
225 auto entity_data_l2 = boost::make_shared<EntitiesFieldData>(
229 auto mass_ptr = boost::make_shared<MatrixDouble>();
232 boost::make_shared<MatrixDouble>();
235 boost::make_shared<MatrixDouble>();
242 pipeline_mng->getOpDomainRhsPipeline().push_back(op_this);
246 pipeline_mng->getOpDomainRhsPipeline().push_back(
249 auto fe_physics_ptr = op_this->getThisFEPtr();
250 fe_physics_ptr->getRuleHook = [](
int,
int,
int p) {
return 2 * p; };
254 fe_physics_ptr->getOpPtrVector().push_back(
257 fe_physics_ptr->getOpPtrVector().push_back(
262 CHKERR pipeline_mng->loopFiniteElements();
◆ checkResults() [2/4]
◆ checkResults() [3/4]
◆ checkResults() [4/4]
[Postprocess results]
[Check results]
Definition at line 523 of file child_and_parent.cpp.
531 auto rule = [](
int,
int,
int p) ->
int {
return 2 * p + 1; };
535 auto common_data_ptr = boost::make_shared<CommonData>();
539 common_data_ptr->approxVals = boost::make_shared<VectorDouble>();
543 common_data_ptr->approxVals));
547 CHKERR VecZeroEntries(common_data_ptr->L2Vec);
548 CHKERR VecZeroEntries(common_data_ptr->resVec);
552 CHKERR VecAssemblyBegin(common_data_ptr->L2Vec);
553 CHKERR VecAssemblyEnd(common_data_ptr->L2Vec);
554 CHKERR VecAssemblyBegin(common_data_ptr->resVec);
555 CHKERR VecAssemblyEnd(common_data_ptr->resVec);
557 CHKERR VecNorm(common_data_ptr->resVec, NORM_2, &nrm2);
559 CHKERR VecGetArrayRead(common_data_ptr->L2Vec, &array);
560 MOFEM_LOG_C(
"WORLD", Sev::inform,
"Error %6.4e Vec norm %6.4e\n",
561 std::sqrt(array[0]), nrm2);
562 CHKERR VecRestoreArrayRead(common_data_ptr->L2Vec, &array);
564 constexpr
double eps = 1e-8;
567 "Not converged solution err = %6.4e", nrm2);
◆ printResults()
[Check results]
- Examples
- hanging_node_approx.cpp.
Definition at line 655 of file hanging_node_approx.cpp.
661 auto rule = [](
int,
int,
int p) ->
int {
return -1; };
684 auto approx_vals = boost::make_shared<VectorDouble>();
688 double def_val[] = {0};
689 CHKERR moab.tag_get_handle(
"FIELD", 1, MB_TYPE_DOUBLE,
th,
690 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
692 field_op_row->doWorkRhsHook = [&](
DataOperator *base_op_ptr,
int side,
696 if (
type == MBVERTEX) {
701 auto nb_gauss_pts = op_ptr->getGaussPts().size2();
702 if (nb_gauss_pts != 3)
704 "Should be three guass pts.");
705 auto conn = op_ptr->getConn();
706 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
707 const double v = t_field;
708 CHKERR moab.tag_set_data(
th, &conn[gg], 1, &
v);
716 DomainEleOp::OPSPACE,
VERBOSE, Sev::noisy);
718 DomainEleOp::OPROW,
VERBOSE, Sev::noisy);
◆ readMesh() [1/4]
◆ readMesh() [2/4]
[Run programme]
[Read mesh]
- Examples
- child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, and higher_derivatives.cpp.
Definition at line 208 of file child_and_parent.cpp.
221 auto refine_mesh = [&](
auto bit_level1) {
228 bit_level0,
BitRefLevel().set(), *meshset_level0_ptr);
232 Range edges_to_refine;
233 CHKERR moab.get_entities_by_type(*meshset_level0_ptr, MBEDGE,
236 for (Range::iterator eit = edges_to_refine.begin();
237 eit != edges_to_refine.end(); eit++, ii++) {
240 CHKERR moab.add_entities(*meshset_ref_edges_ptr, &*eit, 1);
243 CHKERR refine->addVerticesInTheMiddleOfEdges(*meshset_ref_edges_ptr,
246 CHKERR refine->refineTets(*meshset_level0_ptr, bit_level1,
VERBOSE);
248 CHKERR refine->refineTris(*meshset_level0_ptr, bit_level1,
VERBOSE);
251 "Dimension not handled by test");
259 CHKERR refine_mesh(bit_level1);
◆ readMesh() [3/4]
◆ readMesh() [4/4]
red mesh and randomly refine three times
- Returns
- MoFEMErrorCode
◆ refineResults()
[Solve]
- Examples
- child_and_parent.cpp.
Definition at line 399 of file child_and_parent.cpp.
408 auto refine_mesh = [&]() {
416 *meshset_level1_ptr);
420 Range edges_to_refine;
422 bit_level1,
BitRefLevel().set(), MBEDGE, edges_to_refine);
424 CHKERR refine->addVerticesInTheMiddleOfEdges(edges_to_refine, bit_level2,
427 CHKERR refine->refineTets(*meshset_level1_ptr, bit_level2,
VERBOSE);
429 CHKERR refine->refineTris(*meshset_level1_ptr, bit_level2,
VERBOSE);
432 "Dimension not handled by test");
436 CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshsets,
true);
437 for (
auto m : meshsets) {
439 ->updateMeshsetByEntitiesChildren(
m, bit_level2,
m, MBMAXTYPE,
false);
454 bit_level0 | bit_level1);
456 auto project_data = [&]() {
465 auto rule = [](
int,
int,
int p) ->
int {
return 2 * p; };
471 auto test_bit_ref = [](
FEMethod *fe_ptr) {
472 const auto &
bit = fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel();
473 MOFEM_LOG(
"SELF", Sev::noisy) <<
"ref : " <<
bit <<
" " <<
bit.test(2);
482 auto field_vals_ptr = boost::make_shared<VectorDouble>();
484 auto domainParentRhs = boost::make_shared<DomainParentEle>(
mField);
485 domainParentRhs->getOpPtrVector().push_back(
491 new OpRunParent(domainParentRhs, bit_level2, bit_level2,
492 domainParentRhs, bit_level2,
BitRefLevel().set()));
495 PETSC>::LinearForm<GAUSS>::OpBaseTimesScalar<1>;
◆ runProblem() [1/4]
◆ runProblem() [2/4]
◆ runProblem() [3/4]
◆ runProblem() [4/4]
◆ setupProblem() [1/4]
◆ setupProblem() [2/4]
◆ setupProblem() [3/4]
◆ setupProblem() [4/4]
add field, and set up problem
- Returns
- MoFEMErrorCode
◆ solveSystem() [1/4]
◆ solveSystem() [2/4]
◆ solveSystem() [3/4]
◆ solveSystem() [4/4]
◆ approxFunction
◆ divApproxFunction
◆ mField
◆ simpleInterface
Simple * AtomTest::simpleInterface |
|
private |
The documentation for this struct was generated from the following files:
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Data on single entity (This is passed as argument to DataOperator::doWork)
boost::shared_ptr< FEMethod > & getDomainRhsFE()
base operator to do operations at Gauss Pt. level
Execute "this" element in the operator.
Problem manager is used to build and partition problems.
structure for User Loop Methods on finite elements
Operator to execute finite element instance on parent element. This operator is typically used to pro...
virtual MPI_Comm & get_comm() const =0
constexpr char FIELD_NAME[]
MoFEM::Interface & mField
@ L2
field with C-1 continuity
MoFEMErrorCode loopFiniteElements(SmartPetscObj< DM > dm=nullptr)
Iterate finite elements.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Get values at integration pts for tensor filed rank 1, i.e. vector field.
boost::ptr_deque< UserDataOperator > & getOpDomainRhsPipeline()
Get the Op Domain Rhs Pipeline object.
virtual int get_comm_rank() const =0
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
PipelineManager interface.
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
boost::shared_ptr< FEMethod > & getBoundaryRhsFE()
MoFEMErrorCode assembleSystem()
[Push operators to pipeline]
constexpr int nb_ref_levels
Three levels of refinement.
BitRefLevel & getBitRefLevelMask()
Get the BitRefLevel.
auto test_bit_child
lambda function used to select elements on which finite element pipelines are executed.
Simple interface for fast problem set-up.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, FIELD_DIM > OpDomainMass
MoFEMErrorCode getOptions()
get options
MoFEMErrorCode getDM(DM *dm)
Get DM.
#define CHKERR
Inline error check.
auto createDMVector(DM dm)
Get smart vector from DM.
boost::shared_ptr< DomainEle > domainChildLhs
[Set up problem]
virtual moab::Interface & get_moab()=0
DomainEle::UserDataOperator DomainEleOp
Finire element operator type.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesScalar< 1 > OpDomainTimesScalarField
default operator for TRI element
Mesh refinement interface.
#define MOFEM_LOG_C(channel, severity, format,...)
auto get_temp_meshset_ptr(moab::Interface &moab)
Create smart pointer to temporary meshset.
void simple(double P1[], double P2[], double P3[], double c[], const int N)
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Get value at integration points for scalar field.
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.
SmartPetscObj< KSP > createKSP(SmartPetscObj< DM > dm=nullptr)
Create KSP (linear) solver.
MoFEMErrorCode setDomainRhsIntegrationRule(RuleHookFun rule)
MoFEMErrorCode refineResults()
[Solve]
static ApproxFieldFunction< FIELD_DIM > approxFunction
boost::ptr_deque< UserDataOperator > & getOpDomainLhsPipeline()
Get the Op Domain Lhs Pipeline object.
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
MoFEMErrorCode solveSystem()
[Push operators to pipeline]
MoFEMErrorCode setDomainLhsIntegrationRule(RuleHookFun rule)
structure to get information form mofem into EntitiesFieldData
const double v
phase velocity of light in medium (cm/ns)
boost::shared_ptr< FEMethod > & getDomainLhsFE()
#define MOFEM_LOG(channel, severity)
Log.
constexpr char FIELD_NAME[]
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
ForcesAndSourcesCore::UserDataOperator UserDataOperator
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ MOFEM_DATA_INCONSISTENCY
MatrixDouble gaussPts
Matrix of integration points.
MoFEMErrorCode checkResults()
[Check results]
BitRefLevel & getBitRefLevel()
Get the BitRefLevel.
auto createVectorMPI(MPI_Comm comm, PetscInt n, PetscInt N)
Create MPI Vector.
int getDim() const
Get the problem dimension.
boost::ptr_deque< UserDataOperator > & getOpBoundaryRhsPipeline()
Get the Op Boundary Rhs Pipeline object.
MoFEMErrorCode readMesh()
[Run programme]
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.
MoFEMErrorCode reSetUp(bool only_dm=false)
Rebuild internal MoFEM data structures.
const double D
diffusivity
boost::shared_ptr< DomainEle > domainChildRhs
MoFEMErrorCode setBoundaryRhsIntegrationRule(RuleHookFun rule)
FTensor::Index< 'm', 3 > m
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
@ MOFEM_ATOM_TEST_INVALID
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, FIELD_DIM > OpDomainSource
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
const std::string getProblemName() const
Get the Problem Name.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode setupProblem()
[Read mesh]
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
constexpr char FIELD_NAME[]