8static char help[] =
"...\n\n";
41 post_proc = boost::shared_ptr<PostProcFaceOnRefinedMesh>(
54 boost::shared_ptr<VectorDouble>(
data[
i], &
data[
i]->values);
56 boost::shared_ptr<VectorDouble>(
data[
i], &
data[
i]->dot_values);
69 Range &surface,
double &init_val);
72 boost::shared_ptr<VectorDouble> &mass_ptr);
75 boost::shared_ptr<PreviousData> &
data);
82 boost::shared_ptr<PreviousData> &
data);
85 boost::shared_ptr<MatrixDouble> &
grads_ptr,
86 boost::shared_ptr<VectorDouble> &
dots_ptr);
89 boost::shared_ptr<PreviousData> &
data,
90 std::map<int, BlockData> &block_map);
94 boost::shared_ptr<MatrixDouble> &
grads_ptr);
96 boost::shared_ptr<PreviousData> &
data,
97 std::map<int, BlockData> &block_map);
138 boost::shared_ptr<PostProcFaceOnRefinedMesh>
post_proc;
141 std::vector<boost::shared_ptr<PreviousData>>
data;
145 std::vector<boost::shared_ptr<VectorDouble>>
dots_ptr;
147 boost::shared_ptr<ForcesAndSourcesCore>
null;
152const double T = 2.0 * M_PI;
155 double operator()(
const double x,
const double y,
const double t)
const {
156 double g = sin(
T * x) * sin(
T * y);
173 const double t)
const {
175 double mx = -
T * cos(
T * x) * sin(
T * y);
176 double my = -
T * sin(
T * x) * cos(
T * y);
198 double operator()(
const double x,
const double y,
const double t)
const {
199 double glap = -2.0 * pow(
T, 2) * sin(
T * x) * sin(
T * y);
215 double operator()(
const double x,
const double y,
const double t)
const {
216 double gdot = sin(
T * x) * sin(
T * y);
274 string name = it->getName();
275 const int id = it->getMeshsetId();
276 if (name.compare(0, 14,
"REGION1") == 0) {
278 id,
BLOCKSET, 2, block_map[
id].block_ents,
true);
279 block_map[id].B0 = 1e-3;
281 }
else if (name.compare(0, 14,
"REGION2") == 0) {
283 id,
BLOCKSET, 2, block_map[
id].block_ents,
true);
286 }
else if (name.compare(0, 14,
"REGION3") == 0) {
288 id,
BLOCKSET, 2, block_map[
id].block_ents,
true);
291 }
else if (name.compare(0, 14,
"REGION4") == 0) {
293 id,
BLOCKSET, 2, block_map[
id].block_ents,
true);
296 }
else if (name.compare(0, 14,
"REGION5") == 0) {
298 id,
BLOCKSET, 2, block_map[
id].block_ents,
true);
307 int block_id,
Range &surface,
313 block_id,
BLOCKSET, 2, surface,
true);
315 if (!surface.empty()) {
317 CHKERR moab.get_connectivity(surface, surface_verts,
false);
319 init_val, MBVERTEX, surface_verts,
field_name);
327 boost::shared_ptr<VectorDouble> &values_ptr) {
335 boost::shared_ptr<PreviousData> &data) {
345 boost::shared_ptr<PreviousData> &data) {
347 auto det_ptr = boost::make_shared<VectorDouble>();
348 auto jac_ptr = boost::make_shared<MatrixDouble>();
349 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
351 vol_ele->getOpPtrVector().
359 boost::shared_ptr<VectorDouble> &values_ptr,
360 boost::shared_ptr<MatrixDouble> &grads_ptr,
361 boost::shared_ptr<VectorDouble> &dots_ptr) {
374 boost::shared_ptr<PreviousData> &data,
375 std::map<int, BlockData> &block_map) {
386 boost::shared_ptr<VectorDouble> &values_ptr,
387 boost::shared_ptr<MatrixDouble> &grads_ptr) {
398 boost::shared_ptr<PreviousData> &data,
399 std::map<int, BlockData> &block_map) {
410 auto vol_rule = [](int, int,
int p) ->
int {
return 2 *
p; };
445 CHKERR TSARKIMEXSetType(
ts, TSARKIMEXA2);
480 CHKERR TSSetDuration(
ts, PETSC_DEFAULT, ftime);
490 std::vector<std::string> mass_names(
nb_species);
493 mass_names[
i] =
"MASS" + boost::lexical_cast<std::string>(
i + 1);
511 CHKERR moab.get_entities_by_type(0, MBTRI, surface,
false);
514 CHKERR skin.find_skin(0, surface,
false, edges);
517 CHKERR pcomm->filter_pstatus(edges, PSTATUS_SHARED | PSTATUS_MULTISHARED,
518 PSTATUS_NOT, -1, &edges_part);
520 CHKERR moab.get_connectivity(edges_part, edges_verts,
false);
525 initVals.resize(3,
false);
532 for (
int i = 0;
i < 1; ++
i) {
564 auto solve_for_g = [&]() {
579 bdry_ents = unite(edges_verts, edges_part);
620 post_proc->generateReferenceElementMesh();
625 post_proc->addFieldValuesPostProc(
"ERROR");
636int main(
int argc,
char *argv[]) {
640 moab::Core mb_instance;
641 moab::Interface &moab = mb_instance;
643 DMType dm_name =
"DMMOFEM";
649 RDProblem reac_diff_problem(mb_instance, core,
order, nb_species);
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ L2
field with C-1 continuity
#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
#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.
FTensor::Index< 'i', SPACE_DIM > i
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
auto createKSP(MPI_Comm comm)
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)
constexpr double t
plate stiffness
constexpr auto field_name
FaceElementForcesAndSourcesCore Ele
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
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.
Simple interface for fast problem set-up.
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 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.
std::vector< Range > inner_surface
MoFEMErrorCode update_slow_rhs(std::string mass_fiedl, boost::shared_ptr< VectorDouble > &mass_ptr)
boost::shared_ptr< FaceEle > vol_ele_stiff_lhs
std::map< int, BlockData > material_blocks
RDProblem(moab::Core &mb_instance, MoFEM::Core &core, const int order, const int n_species)
MoFEMErrorCode update_stiff_rhs()
boost::shared_ptr< Ele > vol_ele_stiff_lhs
boost::shared_ptr< Ele > vol_mass_ele
Range stimulation_surface
MoFEMErrorCode set_fe_in_loop()
boost::shared_ptr< Monitor > monitor_ptr
SmartPetscObj< Mat > mass_matrix
MoFEMErrorCode push_slow_rhs()
MoFEMErrorCode update_vol_fe(boost::shared_ptr< FaceEle > &vol_ele, boost::shared_ptr< PreviousData > &data)
boost::shared_ptr< Ele > vol_ele_slow_rhs
MoFEMErrorCode post_proc_fields()
boost::shared_ptr< ForcesAndSourcesCore > null
boost::shared_ptr< BoundaryEle > boundary_ele_rhs
MoFEM::Interface & m_field
Simple * simple_interface
MoFEMErrorCode run_analysis()
boost::shared_ptr< Ele > vol_ele_stiff_rhs
MoFEMErrorCode set_blockData(std::map< int, BlockData > &block_data_map)
SmartPetscObj< KSP > mass_Ksp
std::vector< boost::shared_ptr< VectorDouble > > values_ptr
MoFEMErrorCode resolve_slow_rhs()
MoFEMErrorCode push_stiff_lhs()
MoFEMErrorCode push_stiff_rhs()
std::vector< boost::shared_ptr< VectorDouble > > dots_ptr
MoFEMErrorCode set_initial_values(std::string field_name, int block_id, Range &surface, double &init_val)
MoFEMErrorCode push_mass_ele(std::string field_name)
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()
std::vector< boost::shared_ptr< MatrixDouble > > grads_ptr
MoFEMErrorCode set_integration_rule()
boost::shared_ptr< PostProcFaceOnRefinedMesh > post_proc
boost::shared_ptr< FaceEle > vol_ele_stiff_rhs