|
| v0.14.0
|
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
|
static char | help [] = "...\n\n" |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 12 of file thermal_elem_unsteady.cpp.
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);
78 CHKERR thermal_elements.addThermalElements(
"TEMP");
79 CHKERR thermal_elements.addThermalFluxElement(
"TEMP");
117 ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(
"TEST_PROBLEM", &
A);
122 CHKERR TSCreate(PETSC_COMM_WORLD, &ts);
123 CHKERR TSSetType(ts, TSBEULER);
136 CHKERR thermal_elements.setTimeSteppingProblem(
ts_ctx,
"TEMP",
"TEMP_RATE");
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) {
◆ help
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
Problem manager is used to build and partition problems.
PetscErrorCode TsSetIFunction(TS ts, PetscReal t, Vec u, Vec u_t, Vec F, void *ctx)
Set IFunction for TS solver.
BasicMethodsSequence & getPostProcessMonitor()
Get the postProcess to do Monitor object.
BasicMethodsSequence & getPostProcessIJacobian()
Get the postProcess to do IJacobian object.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
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.
Deprecated interface functions.
DeprecatedCoreInterface Interface
PetscErrorCode TsMonitorSet(TS ts, PetscInt step, PetscReal t, Vec u, void *ctx)
Set monitor for TS solver.
virtual MoFEMErrorCode add_series_recorder(const std::string &series_name)
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
#define CHKERR
Inline error check.
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
BasicMethodsSequence & getPreProcessIJacobian()
Get the preProcess to do IJacobian object.
virtual MoFEMErrorCode finalize_series_recorder(const std::string &serie_name)
Interface for Time Stepping (TS) solver.
BasicMethodsSequence & getPostProcessIFunction()
Get the postProcess to do IFunction object.
virtual MoFEMErrorCode load_series_data(const std::string &serie_name, const int step_number)
#define _IT_SERIES_STEPS_BY_NAME_FOR_LOOP_(RECORDER, NAME, IT)
loop over recorded series step
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.
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
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 modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
TS monitore it records temperature at time steps.
Vector manager is used to create vectors \mofem_vectors.
BasicMethodsSequence & getPreProcessIFunction()
Get the preProcess to do IFunction object.
Matrix manager is used to build and partition problems.
this calass is to control time stepping
structure grouping operators and data used for thermal problems
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
#define CATCH_ERRORS
Catch errors.
MoFEMErrorCode partitionSimpleProblem(const std::string name, int verb=VERBOSE)
partition problem dofs
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
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
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
@ MOFEM_ATOM_TEST_INVALID
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
virtual MoFEMErrorCode initialize_series_recorder(const std::string &serie_name)
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.
MoFEMErrorCode partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
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.