|
| v0.14.0
|
Go to the documentation of this file.
40 std::tuple<SmartPetscObj<Vec>, SmartPetscObj<VecScatter>>
vScatter[3];
59 printMaxMin(std::tuple<SmartPetscObj<Vec>, SmartPetscObj<VecScatter>> &tuple,
60 const std::string msg,
Vec &ts_u,
double time);
103 enum bases { AINSWORTH, DEMKOWICZ, BERNSTEIN, LASBASETOPT };
104 const char *list_bases[] = {
"ainsworth",
"demkowicz",
"bernstein"};
105 PetscInt choice_base_value = AINSWORTH;
107 LASBASETOPT, &choice_base_value, PETSC_NULL);
110 switch (choice_base_value) {
114 <<
"Set AINSWORTH_LEGENDRE_BASE for displacements";
119 <<
"Set DEMKOWICZ_JACOBI_BASE for displacements";
124 <<
"Set AINSWORTH_BERNSTEIN_BEZIER_BASE for displacements";
164 DMType dm_name =
"DMMOFEM";
172 simple->getBitRefLevel());
188 auto set_time_monitor = [&](
auto solver) {
190 boost::shared_ptr<ForcesAndSourcesCore>
null;
196 auto set_section_monitor = [&](
auto solver) {
199 CHKERR TSGetSNES(solver, &snes);
200 PetscViewerAndFormat *vf;
201 CHKERR PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD,
202 PETSC_VIEWER_DEFAULT, &vf);
205 (
MoFEMErrorCode(*)(SNES, PetscInt, PetscReal,
void *))SNESMonitorFields,
211 auto set_dm_section = [&](
auto dm) {
214 simple->getProblemName());
215 CHKERR DMSetSection(dm, section);
219 auto scatter_create = [&](
auto coeff,
auto D) {
220 SmartPetscObj<IS> is;
221 CHKERR is_manager->isCreateProblemFieldAndRank(
simple->getProblemName(),
222 ROW,
"U", coeff, coeff, is);
224 CHKERR ISGetLocalSize(is, &loc_size);
228 CHKERR VecScatterCreate(
D, is,
v, PETSC_NULL, &scatter);
229 return std::make_tuple(SmartPetscObj<Vec>(
v),
230 SmartPetscObj<VecScatter>(scatter));
251 CHKERR TSSetExactFinalTime(
tSolver, TS_EXACTFINALTIME_MATCHSTEP);
254 for (
int i = 0;
i != 3; ++
i)
275 std::tuple<SmartPetscObj<Vec>, SmartPetscObj<VecScatter>> &tuple,
276 const std::string msg,
Vec &ts_u,
double time) {
278 double min_disp, max_disp;
280 CHKERR VecScatterBegin(std::get<1>(tuple), ts_u, std::get<0>(tuple),
281 INSERT_VALUES, SCATTER_FORWARD);
282 CHKERR VecScatterEnd(std::get<1>(tuple), ts_u, std::get<0>(tuple),
283 INSERT_VALUES, SCATTER_FORWARD);
284 CHKERR VecMax(std::get<0>(tuple), PETSC_NULL, &max_disp);
285 CHKERR VecMin(std::get<0>(tuple), PETSC_NULL, &min_disp);
286 MOFEM_LOG_C(
"WORLD", Sev::inform,
"%s time %3.4e min %3.4e max %3.4e\n",
287 msg.c_str(), time, min_disp, max_disp);
292 <<
"Atom test min displacement X:" << min_disp;
293 if (abs(min_disp + 0.2220) > 1e-4)
295 "atom test diverged!");
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
MFManager(MoFEM::Interface &m_field)
auto createTS(MPI_Comm comm)
virtual MPI_Comm & get_comm() const =0
MoFEMErrorCode printMaxMin(std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter >> &tuple, const std::string msg, Vec &ts_u, double time)
DEPRECATED auto createSmartDM(MPI_Comm comm, const std::string dm_type_name)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
MoFEM::Interface & mField
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.
MoFEMErrorCode defineDM()
MoFEMErrorCode setMainField()
#define CHKERR
Inline error check.
boost::shared_ptr< FEMethod > monitorPtr
#define MOFEM_LOG_C(channel, severity, format,...)
void simple(double P1[], double P2[], double P3[], double c[], const int N)
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
DEPRECATED SmartPetscObj< Vec > smartVectorDuplicate(Vec vec)
DEPRECATED auto smartCreateDMVector(DM dm)
PetscErrorCode DMMoFEMCreateMoFEM(DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
Must be called by user to set MoFEM data structures.
FTensor::Index< 'i', SPACE_DIM > i
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > vScatter[3]
const double v
phase velocity of light in medium (cm/ns)
SmartPetscObj< TS > tSolver
#define MOFEM_LOG(channel, severity)
Log.
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.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
FieldApproximationBase
approximation base
const double D
diffusivity
MoFEMErrorCode getParams()
@ MOFEM_ATOM_TEST_INVALID
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
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.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
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.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)