8static char help[] =
"...\n\n";
22 double operator()(
const double x,
const double y,
const double z,
const double t)
const{
23 if(y<= -1.6000 &&
t<= 0.50000){
33 return c * u * (u -
alpha) * (1.0 - u) - u *
v;
45 double operator()(
const double u,
const double v,
const double dt)
const {
50 return v + 0.5 * (k1 + k4);
65 post_proc = boost::shared_ptr<PostProcVolumeOnRefinedMesh>(
74 boost::shared_ptr<MatrixDouble>(
data_u, &
data_u->flux_values);
79 boost::shared_ptr<VectorDouble>(
data_u, &
data_u->mass_values);
86 boost::shared_ptr<VectorDouble>(
data_v, &
data_v->mass_values);
91 boost::shared_ptr<VectorDouble>(
data_w, &
data_w->mass_values);
96 boost::shared_ptr<VectorDouble>(
data_s, &
data_s->mass_values);
99 boost::shared_ptr<VectorDouble>(
data_s, &
data_s->mass_dots);
113 boost::shared_ptr<VectorDouble> &mass_ptr);
123 boost::shared_ptr<VolEle> &initial_ele,
double &init);
152 boost::shared_ptr<PostProcVolumeOnRefinedMesh>
post_proc;
176 boost::shared_ptr<ForcesAndSourcesCore>
null;
205 std::string natural) {
208 string name = it->getName();
209 if (name.compare(0, 14, natural) == 0) {
213 }
else if (name.compare(0, 14, essential) == 0) {
232 boost::shared_ptr<VectorDouble> &mass_ptr) {
323 auto vol_rule = [](int, int,
int p) ->
int {
return 2 *
p; };
334 boost::shared_ptr<VolEle> &initial_ele,
double &init_val) {
336 initial_ele->getOpPtrVector().push_back(
351 CHKERR TSARKIMEXSetType(
ts, TSARKIMEXA2);
391 CHKERR TSSetDuration(
ts, PETSC_DEFAULT, ftime);
399 CHKERR SNESGetKSP(snes, &ksp);
401 CHKERR KSPGetPC(ksp, &pc);
402 PetscBool is_pcfs = PETSC_FALSE;
403 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
406 if (is_pcfs == PETSC_TRUE) {
411 problem_ptr->
getName(),
ROW,
"U", 0, 1, &is_mass);
413 problem_ptr->
getName(),
ROW,
"F", 0, 1, &is_flux);
418 CHKERR PCFieldSplitSetIS(pc, NULL, is_flux);
419 CHKERR PCFieldSplitSetIS(pc, NULL, is_mass);
421 CHKERR ISDestroy(&is_mass);
422 CHKERR ISDestroy(&is_flux);
470 boost::shared_ptr<VolEle> initial_mass_ele(
new VolEle(
m_field));
487 post_proc->generateReferenceElementMesh();
500int main(
int argc,
char *argv[]) {
504 moab::Core mb_instance;
505 moab::Interface &moab = mb_instance;
507 DMType dm_name =
"DMMOFEM";
MoFEM::FaceElementForcesAndSourcesCore FaceEle
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ L2
field with C-1 continuity
@ HDIV
field with continuous normal traction
#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.
const double v
phase velocity of light in medium (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
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)
OpCalculateScalarFieldValuesDot OpCalculateScalarValuesDot
auto createTS(MPI_Comm comm)
constexpr double t
plate stiffness
double operator()(const double x, const double y, const double z, const double t) 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.
keeps basic data about problem
Problem manager is used to build and partition problems.
Simple interface for fast problem set-up.
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
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 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.
boost::shared_ptr< VectorDouble > mass_values_ptr_v
boost::shared_ptr< VolEle > vol_ele_slow_rhs
MoFEMErrorCode update_slow_rhs(std::string mass_fiedl, boost::shared_ptr< VectorDouble > &mass_ptr)
boost::shared_ptr< FaceEle > vol_ele_stiff_lhs
boost::shared_ptr< PreviousData > data_s
MoFEMErrorCode update_stiff_rhs()
MoFEMErrorCode apply_BC(std::string flux_field)
boost::shared_ptr< VolEle > vol_ele_stiff_rhs
MoFEMErrorCode update_slow_rhs(std::string mass_field, boost::shared_ptr< VectorDouble > &mass_ptr)
boost::shared_ptr< Monitor > monitor_ptr
boost::shared_ptr< VectorDouble > mass_values_ptr_s
MoFEMErrorCode push_slow_rhs()
boost::shared_ptr< VectorDouble > mass_dots_ptr_u
boost::shared_ptr< VectorDouble > mass_values_ptr_u
boost::shared_ptr< VectorDouble > mass_dots_ptr_s
Range essential_bdry_ents
MoFEMErrorCode post_proc_fields()
boost::shared_ptr< ForcesAndSourcesCore > null
MoFEM::Interface & m_field
Simple * simple_interface
MoFEMErrorCode run_analysis()
MoFEMErrorCode extract_bd_ents(std::string ESSENTIAL, std::string NATURAL)
boost::shared_ptr< VolEle > vol_ele_stiff_lhs
boost::shared_ptr< VectorDouble > mass_dots_ptr_v
boost::shared_ptr< BoundaryEle > natural_bdry_ele_slow_rhs
RDProblem(MoFEM::Core &core, const int order)
MoFEMErrorCode push_stiff_lhs()
MoFEMErrorCode apply_IC(std::string mass_field, Range &surface, boost::shared_ptr< VolEle > &initial_ele, double &init)
MoFEMErrorCode push_stiff_rhs()
boost::shared_ptr< MatrixDouble > flux_values_ptr_u
MoFEMErrorCode extract_initial_ents(int block_id, Range &surface)
boost::shared_ptr< FaceEle > natural_bdry_ele_slow_rhs
MoFEMErrorCode apply_IC(std::string mass_field, Range &surface, boost::shared_ptr< FaceEle > &initial_ele, double &init_val)
boost::shared_ptr< PreviousData > data_u
boost::shared_ptr< VectorDouble > mass_dots_ptr_w
boost::shared_ptr< PreviousData > data_v
boost::shared_ptr< PostProcVolumeOnRefinedMesh > post_proc
boost::shared_ptr< VectorDouble > mass_values_ptr_w
MoFEMErrorCode setup_system()
MoFEMErrorCode output_result()
boost::shared_ptr< FaceEle > vol_ele_slow_rhs
MoFEMErrorCode update_stiff_lhs()
MoFEMErrorCode set_integration_rule()
boost::shared_ptr< VectorDouble > flux_divs_ptr_u
boost::shared_ptr< PostProcFaceOnRefinedMesh > post_proc
boost::shared_ptr< PreviousData > data_w
boost::shared_ptr< FaceEle > vol_ele_stiff_rhs
double operator()(const double u, const double v, const double dt) const
double operator()(const double u, const double v) const
double operator()(const double u, const double v) const
VolumeElementForcesAndSourcesCore VolEle