8static char help[] =
"...\n\n";
24 post_proc = boost::shared_ptr<PostProcFaceOnRefinedMesh>(
32 boost::shared_ptr<MatrixDouble>(
data1, &
data1->flux_values);
37 boost::shared_ptr<VectorDouble>(
data1, &
data1->mass_values);
42 boost::shared_ptr<MatrixDouble>(
data2, &
data2->flux_values);
46 boost::shared_ptr<VectorDouble>(
data2, &
data2->mass_values);
50 boost::shared_ptr<MatrixDouble>(
data3, &
data3->flux_values);
54 boost::shared_ptr<VectorDouble>(
data3, &
data3->mass_values);
71 boost::shared_ptr<VectorDouble> &mass_ptr);
73 boost::shared_ptr<PreviousData> &
data);
75 boost::shared_ptr<PreviousData> &
data);
78 boost::shared_ptr<VectorDouble> &mass_ptr,
79 boost::shared_ptr<MatrixDouble> &flux_ptr,
80 boost::shared_ptr<VectorDouble> &mass_dot_ptr,
81 boost::shared_ptr<VectorDouble> &flux_div_ptr);
83 boost::shared_ptr<PreviousData> &
data,
84 std::map<int, BlockData> &block_map);
86 std::string flux_field,
87 boost::shared_ptr<VectorDouble> &mass_ptr,
88 boost::shared_ptr<MatrixDouble> &flux_ptr);
90 boost::shared_ptr<PreviousData> &
data,
91 std::map<int, BlockData> &block_map);
95 boost::shared_ptr<FaceEle> &initial_ele);
99 std::string flux_field);
130 boost::shared_ptr<PostProcFaceOnRefinedMesh>
post_proc;
133 boost::shared_ptr<PreviousData>
data1;
134 boost::shared_ptr<PreviousData>
data2;
135 boost::shared_ptr<PreviousData>
data3;
153 boost::shared_ptr<ForcesAndSourcesCore>
null;
158const double T = M_PI / 2.0;
176 double operator()(
const double x,
const double y,
const double t)
const {
177 double g = cos(
T * x) * cos(
T * y);
188 const double t)
const {
190 double mx = -
T * sin(
T * x) * cos(
T * y);
191 double my = -
T * cos(
T * x) * sin(
T * y);
207 double operator()(
const double x,
const double y,
const double t)
const {
208 double glap = -2.0 * pow(
T, 2) * cos(
T * x) * cos(
T * y);
218 double operator()(
const double x,
const double y,
const double t)
const {
219 double gdot = cos(
T * x) * cos(
T * y);
237 std::string flux_field) {
259 string name = it->getName();
260 const int id = it->getMeshsetId();
261 if (name.compare(0, 14,
"REGION1") == 0) {
263 id,
BLOCKSET, 2, block_map[
id].block_ents,
true);
264 block_map[id].B0 = 1e-4;
266 }
else if (name.compare(0, 14,
"REGION2") == 0) {
268 id,
BLOCKSET, 2, block_map[
id].block_ents,
true);
271 }
else if (name.compare(0, 14,
"REGION3") == 0) {
273 id,
BLOCKSET, 2, block_map[
id].block_ents,
true);
276 }
else if (name.compare(0, 14,
"REGION4") == 0) {
278 id,
BLOCKSET, 2, block_map[
id].block_ents,
true);
281 }
else if (name.compare(0, 14,
"REGION5") == 0) {
283 id,
BLOCKSET, 2, block_map[
id].block_ents,
true);
293 std::string internal) {
296 string name = it->getName();
297 if (name.compare(0, 14, natural) == 0) {
301 }
else if (name.compare(0, 14, essential) == 0) {
304 }
else if (name.compare(0, 14, internal) == 0) {
323 boost::shared_ptr<VectorDouble> &mass_ptr) {
331 std::string flux_field,
332 boost::shared_ptr<PreviousData> &data) {
353 boost::shared_ptr<PreviousData> &data) {
355 auto det_ptr = boost::make_shared<VectorDouble>();
356 auto jac_ptr = boost::make_shared<MatrixDouble>();
357 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
359 vol_ele->getOpPtrVector().push_back(
362 vol_ele->getOpPtrVector().push_back(
369 boost::shared_ptr<VectorDouble> &mass_ptr,
370 boost::shared_ptr<MatrixDouble> &flux_ptr,
371 boost::shared_ptr<VectorDouble> &mass_dot_ptr,
372 boost::shared_ptr<VectorDouble> &flux_div_ptr) {
391 std::string flux_field,
392 boost::shared_ptr<PreviousData> &data,
393 std::map<int, BlockData> &block_map) {
406 boost::shared_ptr<VectorDouble> &mass_ptr,
407 boost::shared_ptr<MatrixDouble> &flux_ptr) {
418 std::string flux_field,
419 boost::shared_ptr<PreviousData> &data,
420 std::map<int, BlockData> &block_map) {
438 auto vol_rule = [](int, int,
int p) ->
int {
return 2 *
p; };
449 boost::shared_ptr<FaceEle> &initial_ele) {
451 initial_ele->getOpPtrVector().push_back(
500 CHKERR TSARKIMEXSetType(
ts, TSARKIMEXA2);
519 std::string flux_field) {
521 post_proc->addFieldValuesPostProc(mass_field);
522 post_proc->addFieldValuesPostProc(flux_field);
541 CHKERR TSSetDuration(
ts, PETSC_DEFAULT, ftime);
549 CHKERR SNESGetKSP(snes, &ksp);
551 CHKERR KSPGetPC(ksp, &pc);
552 PetscBool is_pcfs = PETSC_FALSE;
553 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
556 if (is_pcfs == PETSC_TRUE) {
561 problem_ptr->
getName(),
ROW,
"MASS1", 0, 1, &is_mass);
563 problem_ptr->
getName(),
ROW,
"FLUX1", 0, 1, &is_flux);
567 CHKERR PCFieldSplitSetIS(pc, NULL, is_flux);
568 CHKERR PCFieldSplitSetIS(pc, NULL, is_mass);
571 CHKERR ISDestroy(&is_flux);
572 CHKERR ISDestroy(&is_mass);
680 boost::shared_ptr<FaceEle> initial_mass_ele(
new FaceEle(
m_field));
706 post_proc->generateReferenceElementMesh();
712 post_proc->addFieldValuesPostProc(
"ERROR");
776int main(
int argc,
char *argv[]) {
780 moab::Core mb_instance;
781 moab::Interface &moab = mb_instance;
783 DMType dm_name =
"DMMOFEM";
MoFEM::FaceElementForcesAndSourcesCore FaceEle
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ L2
field with C-1 continuity
@ HCURL
field with continuous tangents
#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 DMMoFEMGetProblemPtr(DM dm, const MoFEM::Problem **problem_ptr)
Get pointer to problem data structure.
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
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
OpSetInvJacHcurlFaceImpl< 2 > OpSetInvJacHcurlFace
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
OpCalculateScalarFieldValuesDot OpCalculateScalarValuesDot
auto createTS(MPI_Comm comm)
OpSetContravariantPiolaTransformOnEdge2D OpSetContrariantPiolaTransformOnEdge
OpSetContravariantPiolaTransformOnFace2DImpl< 2 > OpSetContravariantPiolaTransformOnFace2D
constexpr double t
plate stiffness
double operator()(const double x) const
double operator()(const double x, const double y, const double t) const
FTensor::Tensor1< double, 3 > operator()(const double x, const double y, const double t) const
double operator()(const double x, const double y, const double t) const
double operator()(const double x, const double y, const double t) const
double operator()(const double x) const
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.
Section manager is used to create indexes and sections.
Interface for managing meshsets containing materials and boundary conditions.
Get vector field for H-div approximation.
Calculate divergence of vector field.
Get value at integration points for scalar field.
Make Hdiv space from Hcurl space in 2d.
keeps basic data about problem
Problem manager is used to build and partition problems.
Simple interface for fast problem set-up.
const std::string getBoundaryFEName() const
Get the Boundary FE Name.
MoFEMErrorCode addDataField(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 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 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 setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
const std::string getDomainFEName() const
Get the Domain FE Name.
intrusive_ptr for managing petsc objects
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
MoFEMErrorCode update_slow_rhs(std::string mass_fiedl, boost::shared_ptr< VectorDouble > &mass_ptr)
boost::shared_ptr< MatrixDouble > flux_values_ptr2
boost::shared_ptr< FaceEle > vol_ele_stiff_lhs
boost::shared_ptr< VectorDouble > flux_divs_ptr3
std::map< int, BlockData > material_blocks
MoFEMErrorCode update_stiff_rhs()
MoFEMErrorCode apply_BC(std::string flux_field)
boost::shared_ptr< Monitor > monitor_ptr
MoFEMErrorCode push_slow_rhs()
boost::shared_ptr< PreviousData > data1
boost::shared_ptr< VectorDouble > mass_values_ptr3
MoFEMErrorCode update_vol_fe(boost::shared_ptr< FaceEle > &vol_ele, boost::shared_ptr< PreviousData > &data)
Range essential_bdry_ents
MoFEMErrorCode post_proc_fields()
boost::shared_ptr< ForcesAndSourcesCore > null
boost::shared_ptr< VectorDouble > flux_divs_ptr2
MoFEM::Interface & m_field
Simple * simple_interface
MoFEMErrorCode run_analysis()
boost::shared_ptr< MatrixDouble > flux_values_ptr3
boost::shared_ptr< VectorDouble > flux_divs_ptr1
MoFEMErrorCode extract_bd_ents(std::string ESSENTIAL, std::string NATURAL)
boost::shared_ptr< BoundaryEle > natural_bdry_ele_slow_rhs
MoFEMErrorCode set_blockData(std::map< int, BlockData > &block_data_map)
RDProblem(MoFEM::Core &core, const int order)
MoFEMErrorCode push_stiff_lhs()
MoFEMErrorCode push_stiff_rhs()
MoFEMErrorCode extract_initial_ents(int block_id, Range &surface)
boost::shared_ptr< VectorDouble > mass_dots_ptr3
boost::shared_ptr< VectorDouble > mass_values_ptr2
MoFEMErrorCode apply_IC(std::string mass_field, Range &surface, boost::shared_ptr< FaceEle > &initial_ele, double &init_val)
boost::shared_ptr< VectorDouble > mass_dots_ptr1
boost::shared_ptr< VectorDouble > mass_values_ptr1
MoFEMErrorCode update_stiff_lhs(std::string mass_fiedl, std::string flux_field, boost::shared_ptr< VectorDouble > &mass_ptr, boost::shared_ptr< MatrixDouble > &flux_ptr)
boost::shared_ptr< VectorDouble > mass_dots_ptr2
boost::shared_ptr< PreviousData > data2
MoFEMErrorCode setup_system()
MoFEMErrorCode output_result()
std::vector< boost::shared_ptr< PreviousData > > data
boost::shared_ptr< FaceEle > vol_ele_slow_rhs
MoFEMErrorCode update_stiff_lhs()
boost::shared_ptr< PreviousData > data3
MoFEMErrorCode update_stiff_rhs(std::string mass_field, std::string flux_field, boost::shared_ptr< VectorDouble > &mass_ptr, boost::shared_ptr< MatrixDouble > &flux_ptr, boost::shared_ptr< VectorDouble > &mass_dot_ptr, boost::shared_ptr< VectorDouble > &flux_div_ptr)
MoFEMErrorCode set_integration_rule()
boost::shared_ptr< PostProcFaceOnRefinedMesh > post_proc
boost::shared_ptr< MatrixDouble > flux_values_ptr1
boost::shared_ptr< FaceEle > vol_ele_stiff_rhs