8static char help[] =
"...\n\n";
63 boost::shared_ptr<PreviousData> &
data);
66 boost::shared_ptr<MatrixDouble> &
grads_ptr,
67 boost::shared_ptr<VectorDouble> &
dots_ptr);
70 boost::shared_ptr<PreviousData> &
data,
75 boost::shared_ptr<MatrixDouble> &
grads_ptr);
77 boost::shared_ptr<PreviousData> &
data,
121 std::vector<boost::shared_ptr<PreviousData>>
data;
125 std::vector<boost::shared_ptr<VectorDouble>>
dots_ptr;
127 boost::shared_ptr<ForcesAndSourcesCore>
null;
132 CHKERR m_field.getInterface(simple_interface);
133 CHKERR simple_interface->getOptions();
134 CHKERR simple_interface->loadFile();
155 string name = it->getName();
156 const int id = it->getMeshsetId();
157 if (name.compare(0, 14,
"REGION1") == 0) {
176 }
else if (name.compare(0, 14,
"REGION2") == 0) {
181 }
else if (name.compare(0, 14,
"REGION3") == 0) {
186 }
else if (name.compare(0, 14,
"REGION4") == 0) {
191 }
else if (name.compare(0, 14,
"REGION5") == 0) {
215 init_val, MBVERTEX, surface_verts,
field_name);
225 boost::shared_ptr<PreviousData> &data) {
227 auto det_ptr = boost::make_shared<VectorDouble>();
228 auto jac_ptr = boost::make_shared<MatrixDouble>();
229 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
231 vol_ele->getOpPtrVector()
239 boost::shared_ptr<VectorDouble> &values_ptr,
240 boost::shared_ptr<MatrixDouble> &grads_ptr,
241 boost::shared_ptr<VectorDouble> &dots_ptr) {
245 vol_ele_stiff_rhs->getOpPtrVector().push_back(
247 vol_ele_stiff_rhs->getOpPtrVector().push_back(
249 vol_ele_stiff_rhs->getOpPtrVector().push_back(
255 boost::shared_ptr<PreviousData> &data,
259 vol_ele_stiff_rhs->getOpPtrVector().push_back(
268 boost::shared_ptr<VectorDouble> &values_ptr,
269 boost::shared_ptr<MatrixDouble> &grads_ptr) {
271 vol_ele_stiff_lhs->getOpPtrVector().push_back(
274 vol_ele_stiff_lhs->getOpPtrVector().push_back(
280 boost::shared_ptr<PreviousData> &data,
284 vol_ele_stiff_lhs->getOpPtrVector().push_back(
292 auto vol_rule = [](int, int,
int p) ->
int {
return 2 *
p; };
295 vol_ele_stiff_rhs->getRuleHook = vol_rule;
297 vol_ele_stiff_lhs->getRuleHook = vol_rule;
298 boundary_ele_rhs->getRuleHook = vol_rule;
306 CHKERR TSSetType(ts, TSARKIMEX);
307 CHKERR TSARKIMEXSetType(ts, TSARKIMEXA2);
310 vol_ele_stiff_lhs, null, null);
313 vol_ele_stiff_rhs, null, null);
316 boundary_ele_rhs, null, null);
323 post_proc->addFieldValuesPostProc(
field_name);
331 monitor_ptr, null, null);
344 CHKERR TSSetDuration(ts, PETSC_DEFAULT, ftime);
345 CHKERR TSSetSolution(ts, X);
346 CHKERR TSSetFromOptions(ts);
354 std::vector<std::string> mass_names(nb_species);
356 for(
int i = 0;
i < nb_species; ++
i){
357 mass_names[
i] =
"h" + boost::lexical_cast<std::string>(
i+1);
360 for (
int i = 0;
i < nb_species; ++
i) {
361 add_fe(mass_names[
i]);
366 CHKERR simple_interface->setUp();
369 string name = it->getName();
370 if (name.compare(0, 14,
"ESSENTIAL") == 0) {
371 CHKERR it->getMeshsetIdEntitiesByDimension(m_field.get_moab(),
dim-1,
372 natural_bdry_ents,
true);
380 CHKERR moab.get_connectivity(natural_bdry_ents, edges_verts,
false);
383 bdry_ents = unite(natural_bdry_ents, edges_verts);
392 "SimpleProblem", mass_names[0], bdry_ents);
394 CHKERR set_blockData(material_blocks);
396 cout <<
"Material Block Size: " << material_blocks.size() << endl;
398 material_blocks[1003].block_ents.print();
400 cout << material_blocks[1003].block_ents.size() << endl;
403 initVals.resize(3,
false);
410 for (
int i = 0;
i < nb_species; ++
i) {
411 CHKERR set_initial_values(mass_names[
i],
i + 2, inner_surface[
i], initVals[
i]);
415 if (!natural_bdry_ents.empty()) {
418 CHKERR moab.get_connectivity(natural_bdry_ents, surface_verts,
false);
420 0.0, MBVERTEX, surface_verts, mass_names[0]);
429 dm = simple_interface->getDM();
431 CHKERR update_vol_fe(vol_ele_stiff_rhs, data[0]);
433 for (
int i = 0;
i < nb_species; ++
i) {
434 CHKERR update_stiff_rhs(mass_names[
i], values_ptr[
i], grads_ptr[
i],
436 CHKERR push_stiff_rhs(mass_names[
i], data[
i], material_blocks);
440 CHKERR update_vol_fe(vol_ele_stiff_lhs, data[0]);
442 for (
int i = 0;
i < nb_species; ++
i) {
443 CHKERR update_stiff_lhs(mass_names[
i], values_ptr[
i], grads_ptr[
i]);
444 CHKERR push_stiff_lhs(mass_names[
i], data[
i],
449 CHKERR set_integration_rule();
455 post_proc->generateReferenceElementMesh();
457 for (
int i = 0;
i < nb_species; ++
i) {
458 CHKERR post_proc_fields(mass_names[
i]);
461 monitor_ptr = boost::shared_ptr<Monitor>(
462 new Monitor(cOmm, rAnk, dm, post_proc, global_error));
470int main(
int argc,
char *argv[]) {
474 moab::Core mb_instance;
475 moab::Interface &moab = mb_instance;
477 DMType dm_name =
"DMMOFEM";
MoFEM::FaceElementForcesAndSourcesCore FaceEle
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#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 DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
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
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 PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
OpCalculateHOJacForFaceImpl< 2 > OpCalculateHOJacForFace
OpCalculateScalarFieldValuesDot OpCalculateScalarValuesDot
auto createTS(MPI_Comm comm)
PostProcFaceOnRefinedMesh PostProc
constexpr auto field_name
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.
intrusive_ptr for managing petsc objects
MoFEMErrorCode push_stiff_lhs(std::string field_name, boost::shared_ptr< PreviousData > &data, std::map< int, BlockData > &block_map)
boost::shared_ptr< VolEle > vol_ele_stiff_rhs
boost::shared_ptr< VolEle > vol_mass_ele
MoFEMErrorCode update_stiff_lhs(std::string field_name, boost::shared_ptr< VectorDouble > &values_ptr, boost::shared_ptr< MatrixDouble > &grads_ptr)
MoFEM::Interface & m_field
Simple * simple_interface
std::vector< boost::shared_ptr< MatrixDouble > > grads_ptr
std::vector< boost::shared_ptr< PreviousData > > data
std::map< int, BlockData > material_blocks
MoFEMErrorCode set_initial_values(std::string field_name, int block_id, Range &surface, double &init_val)
MoFEMErrorCode run_analysis()
boost::shared_ptr< Monitor > monitor_ptr
MoFEMErrorCode update_vol_fe(boost::shared_ptr< VolEle > &vol_ele, boost::shared_ptr< PreviousData > &data)
MoFEMErrorCode push_mass_ele(std::string field_name)
MoFEMErrorCode set_fe_in_loop()
std::vector< Range > inner_surface
boost::shared_ptr< VolEle > vol_ele_stiff_lhs
MoFEMErrorCode update_stiff_rhs(std::string field_name, boost::shared_ptr< VectorDouble > &values_ptr, boost::shared_ptr< MatrixDouble > &grads_ptr, boost::shared_ptr< VectorDouble > &dots_ptr)
MoFEMErrorCode output_result()
MoFEMErrorCode set_integration_rule()
MoFEMErrorCode post_proc_fields(std::string field_name)
MoFEMErrorCode push_stiff_rhs(std::string field_name, boost::shared_ptr< PreviousData > &data, std::map< int, BlockData > &block_map)
MoFEMErrorCode setup_system()
MoFEMErrorCode set_blockData(std::map< int, BlockData > &block_data_map)
boost::shared_ptr< ForcesAndSourcesCore > null
std::vector< boost::shared_ptr< VectorDouble > > values_ptr
MoFEMErrorCode add_fe(std::string field_name)
boost::shared_ptr< PostProc > post_proc
std::vector< boost::shared_ptr< VectorDouble > > dots_ptr
UFProblem(moab::Core &mb_instance, MoFEM::Core &core, const int order, const int n_species)
boost::shared_ptr< FaceEle > boundary_ele_rhs
VolumeElementForcesAndSourcesCore VolEle