324 DMType dm_name =
"DMMOFEM";
345 boost::shared_ptr<CommonData> data(
new CommonData());
347 auto val_ptr = boost::shared_ptr<VectorDouble>(data, &data->val);
348 auto dot_val_ptr = boost::shared_ptr<VectorDouble>(data, &data->dot_val);
349 auto grad_ptr = boost::shared_ptr<MatrixDouble>(data, &data->grad);
353 boost::shared_ptr<Ele> vol_ele_slow_rhs(
new Ele(m_field));
354 boost::shared_ptr<Ele> vol_ele_stiff_rhs(
new Ele(m_field));
355 boost::shared_ptr<Ele> vol_ele_stiff_lhs(
new Ele(m_field));
358 vol_ele_slow_rhs->getOpPtrVector().push_back(
365 auto solve_for_g = [&]() {
367 if (vol_ele_slow_rhs->vecAssembleSwitch) {
368 CHKERR VecGhostUpdateBegin(vol_ele_slow_rhs->ts_F, ADD_VALUES,
370 CHKERR VecGhostUpdateEnd(vol_ele_slow_rhs->ts_F, ADD_VALUES,
372 CHKERR VecAssemblyBegin(vol_ele_slow_rhs->ts_F);
373 CHKERR VecAssemblyEnd(vol_ele_slow_rhs->ts_F);
374 *vol_ele_slow_rhs->vecAssembleSwitch =
false;
376 CHKERR KSPSolve(data->ksp, vol_ele_slow_rhs->ts_F,
377 vol_ele_slow_rhs->ts_F);
381 vol_ele_slow_rhs->postProcessHook = solve_for_g;
383 auto det_ptr = boost::make_shared<VectorDouble>();
384 auto jac_ptr = boost::make_shared<MatrixDouble>();
385 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
387 vol_ele_stiff_rhs->getOpPtrVector().push_back(
389 vol_ele_stiff_rhs->getOpPtrVector().push_back(
391 vol_ele_stiff_rhs->getOpPtrVector().push_back(
393 vol_ele_stiff_rhs->getOpPtrVector().push_back(
395 vol_ele_stiff_rhs->getOpPtrVector().push_back(
397 vol_ele_stiff_rhs->getOpPtrVector().push_back(
401 vol_ele_stiff_lhs->getOpPtrVector().push_back(
403 vol_ele_stiff_lhs->getOpPtrVector().push_back(
405 vol_ele_stiff_lhs->getOpPtrVector().push_back(
407 vol_ele_stiff_lhs->getOpPtrVector().push_back(
411 auto vol_rule = [](
int,
int,
int p) ->
int {
return 2 *
p; };
412 vol_ele_slow_rhs->getRuleHook = vol_rule;
413 vol_ele_stiff_rhs->getRuleHook = vol_rule;
414 vol_ele_stiff_lhs->getRuleHook = vol_rule;
417 boost::shared_ptr<PostProcFaceOnRefinedMesh> post_proc =
418 boost::shared_ptr<PostProcFaceOnRefinedMesh>(
420 boost::shared_ptr<ForcesAndSourcesCore>
null;
422 post_proc->generateReferenceElementMesh();
424 post_proc->addFieldValuesPostProc(
"u");
427 auto dm = simple_interface->
getDM();
435 1,
BLOCKSET, 2, inner_surface,
true);
436 if (!inner_surface.empty()) {
437 Range inner_surface_verts;
438 CHKERR moab.get_connectivity(inner_surface, inner_surface_verts,
false);
440 u0, MBVERTEX, inner_surface_verts,
"u");
447 CHKERR moab.get_entities_by_dimension(0, 2, surface,
false);
450 CHKERR skin.find_skin(0, surface,
false, edges);
452 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
453 CHKERR pcomm->filter_pstatus(edges, PSTATUS_SHARED | PSTATUS_MULTISHARED,
454 PSTATUS_NOT, -1, &edges_part);
456 CHKERR moab.get_connectivity(edges_part, edges_verts,
false);
461 unite(edges_verts, edges_part));
465 CHKERR MatZeroEntries(data->M);
466 boost::shared_ptr<Ele> vol_mass_ele(
new Ele(m_field));
467 vol_mass_ele->getOpPtrVector().push_back(
new OpAssembleMass(data));
470 CHKERR MatAssemblyBegin(data->M, MAT_FINAL_ASSEMBLY);
471 CHKERR MatAssemblyEnd(data->M, MAT_FINAL_ASSEMBLY);
476 CHKERR KSPSetOperators(data->ksp, data->M, data->M);
477 CHKERR KSPSetFromOptions(data->ksp);
478 CHKERR KSPSetUp(data->ksp);
483 CHKERR TSSetType(ts, TSARKIMEX);
484 CHKERR TSARKIMEXSetType(ts, TSARKIMEXA2);
488 vol_ele_stiff_lhs,
null,
null);
491 vol_ele_stiff_rhs,
null,
null);
494 vol_ele_slow_rhs,
null,
null);
497 boost::shared_ptr<Monitor> monitor_ptr(
new Monitor(dm, post_proc));
499 monitor_ptr,
null,
null);
509 CHKERR TSSetDuration(ts, PETSC_DEFAULT, ftime);
510 CHKERR TSSetSolution(ts, X);
511 CHKERR TSSetFromOptions(ts);
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define MYPCOMM_INDEX
default communicator number PCOMM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
PetscErrorCode DMMoFEMTSSetIFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set TS implicit function evaluation function
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
PetscErrorCode DMMoFEMTSSetIJacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS Jacobian evaluation function
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, Vec *g)
DMShellSetCreateGlobalVector.
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
PetscErrorCode DMMoFEMTSSetMonitor(DM dm, TS ts, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
Set Monitor To TS solver.
PetscErrorCode DMMoFEMTSSetRHSFunction(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS the right hand side function
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
OpCalculateHOJacForFaceImpl< 2 > OpCalculateHOJacForFace
OpCalculateScalarFieldValuesFromPetscVecImpl< PetscData::CTX_SET_X_T > OpCalculateScalarFieldValuesDot
DeprecatedCoreInterface Interface
const double u0
inital vale on blocksets
FaceElementForcesAndSourcesCore Ele
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
Interface for managing meshsets containing materials and boundary conditions.
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
Get value at integration points for scalar field.
Problem manager is used to build and partition problems.
Simple interface for fast problem set-up.
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.
MoFEMErrorCode getOptions()
get options
MoFEMErrorCode getDM(DM *dm)
Get DM.
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name)
Load mesh file.
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
const std::string getProblemName() const
Get the Problem Name.
const std::string getDomainFEName() const
Get the Domain FE Name.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Assemble stiff part tangent.