6namespace bio = boost::iostreams;
10static char help[] =
"...\n\n";
12int main(
int argc,
char *argv[]) {
18 moab::Core mb_instance;
19 moab::Interface &moab = mb_instance;
21 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
23 PetscBool flg = PETSC_TRUE;
27 if (flg != PETSC_TRUE) {
28 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
43 rval = moab.create_meshset(MESHSET_SET, meshset_level0);
117 ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(
"TEST_PROBLEM", &A);
122 CHKERR TSCreate(PETSC_COMM_WORLD, &ts);
123 CHKERR TSSetType(ts, TSBEULER);
148 CHKERR TSSetDuration(ts, PETSC_DEFAULT, ftime);
149 CHKERR TSSetSolution(ts, T);
150 CHKERR TSSetFromOptions(ts);
157#if PETSC_VERSION_GE(3, 7, 0)
158 CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_STEPOVER);
161 CHKERR TSGetTime(ts, &ftime);
165 PetscInt steps, snesfails, rejects, nonlinits, linits;
166 CHKERR TSGetTimeStepNumber(ts, &steps);
167 CHKERR TSGetSNESFailures(ts, &snesfails);
168 CHKERR TSGetStepRejections(ts, &rejects);
169 CHKERR TSGetSNESIterations(ts, &nonlinits);
170 CHKERR TSGetKSPIterations(ts, &linits);
171 PetscPrintf(PETSC_COMM_WORLD,
172 "steps %D (%D rejected, %D SNES fails), ftime %g, nonlinits "
174 steps, rejects, snesfails, ftime, nonlinits, linits);
186 sit->get_step_number());
188 "TEST_PROBLEM",
ROW, T, INSERT_VALUES, SCATTER_FORWARD);
192 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"sum0 = %9.8e\n", sum0);
194 CHKERR VecNorm(T, NORM_2, &fnorm0);
195 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"fnorm0 = %9.8e\n", fnorm0);
203 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"sum = %9.8e\n", sum);
204 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"fnorm = %9.8e\n", fnorm);
205 if (fabs(sum + 1.32314077e+01) > 1e-7) {
208 if (fabs(fnorm - 4.59664623e+00) > 1e-6) {
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base nme:nme847.
@ MOFEM_ATOM_TEST_INVALID
#define CHKERR
Inline error check.
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
MoFEMErrorCode partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
MoFEMErrorCode partitionSimpleProblem(const std::string name, int verb=VERBOSE)
partition problem dofs
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
MoFEMErrorCode partitionFiniteElements(const std::string name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=VERBOSE)
partition finite elements
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
virtual MoFEMErrorCode modify_problem_add_finite_element(const std::string name_problem, const std::string &fe_name)=0
add finite element to problem, this add entities assigned to finite element to a particular problem
virtual MoFEMErrorCode load_series_data(const std::string &serie_name, const int step_number)
virtual MoFEMErrorCode finalize_series_recorder(const std::string &serie_name)
virtual MoFEMErrorCode initialize_series_recorder(const std::string &serie_name)
#define _IT_SERIES_STEPS_BY_NAME_FOR_LOOP_(RECORDER, NAME, IT)
loop over recorded series step
virtual MoFEMErrorCode add_series_recorder(const std::string &series_name)
MoFEMErrorCode addThermalElements(const std::string field_name, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS")
add thermal element on tets
MoFEMErrorCode addThermalFluxElement(const std::string field_name, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS")
add heat flux element
MoFEMErrorCode setTimeSteppingProblem(string field_name, string rate_name, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS")
set up operators for unsteady heat flux; convection; radiation problem
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
PetscErrorCode TsSetIJacobian(TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a, Mat A, Mat B, void *ctx)
Set function evaluating jacobian in TS solver.
PetscErrorCode TsMonitorSet(TS ts, PetscInt step, PetscReal t, Vec u, void *ctx)
Set monitor for TS solver.
PetscErrorCode TsSetIFunction(TS ts, PetscReal t, Vec u, Vec u_t, Vec F, void *ctx)
Set IFunction for TS solver.
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
virtual MoFEMErrorCode add_field(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_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
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.
Matrix manager is used to build and partition problems.
Problem manager is used to build and partition problems.
Interface for Time Stepping (TS) solver.
BasicMethodsSequence & getPostProcessIJacobian()
Get the postProcess to do IJacobian object.
BasicMethodsSequence & getPostProcessIFunction()
Get the postProcess to do IFunction object.
BasicMethodsSequence & getPreProcessIFunction()
Get the preProcess to do IFunction object.
BasicMethodsSequence & getPostProcessMonitor()
Get the postProcess to do Monitor object.
BasicMethodsSequence & getPreProcessIJacobian()
Get the preProcess to do IJacobian object.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Vector manager is used to create vectors \mofem_vectors.
TS monitore it records temperature at time steps.
this calass is to control time stepping
structure grouping operators and data used for thermal problems