32 GAUSS>::OpGradTensorGrad<1, SPACE_DIM, SPACE_DIM, 1>;
38 GAUSS>::OpSource<1, SPACE_DIM>;
43constexpr double rho = 1;
79 boost::shared_ptr<MatrixDouble>
matDPtr;
88 auto set_matrial_stiffness = [&]() {
99 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*
matDPtr);
106 matGradPtr = boost::make_shared<MatrixDouble>();
111 matDPtr = boost::make_shared<MatrixDouble>();
118 CHKERR set_matrial_stiffness();
172 simple->getProblemName(),
"U");
184 auto det_ptr = boost::make_shared<VectorDouble>();
185 auto jac_ptr = boost::make_shared<MatrixDouble>();
186 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
188 auto add_base_transform = [&](
auto &pipeline) {
196 add_base_transform(pipeline_mng->getOpDomainRhsPipeline());
197 add_base_transform(pipeline_mng->getOpDomainLhsPipeline());
202 auto &fe_domain_lhs = pipeline_mng->getDomainLhsFE();
203 return rho * fe_domain_lhs->ts_aa;
208 auto fe_domain_rhs = pipeline_mng->getDomainRhsFE();
214 const auto time = fe_domain_rhs->ts_t;
215 t_source(
i) *= sin(time *
omega * M_PI);
219 auto henky_common_data_ptr = boost::make_shared<HenckyOps::CommonData>();
220 henky_common_data_ptr->matGradPtr =
matGradPtr;
221 henky_common_data_ptr->matDPtr =
matDPtr;
223 pipeline_mng->getOpDomainLhsPipeline().push_back(
227 pipeline_mng->getOpDomainLhsPipeline().push_back(
229 pipeline_mng->getOpDomainLhsPipeline().push_back(
231 pipeline_mng->getOpDomainLhsPipeline().push_back(
233 pipeline_mng->getOpDomainLhsPipeline().push_back(
235 pipeline_mng->getOpDomainLhsPipeline().push_back(
237 pipeline_mng->getOpDomainLhsPipeline().push_back(
239 pipeline_mng->getOpDomainLhsPipeline().push_back(
240 new OpK(
"U",
"U", henky_common_data_ptr->getMatTangent()));
243 pipeline_mng->getOpDomainLhsPipeline().push_back(
244 new OpMass(
"U",
"U", get_rho));
246 pipeline_mng->getOpDomainRhsPipeline().push_back(
248 pipeline_mng->getOpDomainRhsPipeline().push_back(
252 pipeline_mng->getOpDomainRhsPipeline().push_back(
254 pipeline_mng->getOpDomainRhsPipeline().push_back(
256 pipeline_mng->getOpDomainRhsPipeline().push_back(
258 pipeline_mng->getOpDomainRhsPipeline().push_back(
260 pipeline_mng->getOpDomainRhsPipeline().push_back(
264 "U", henky_common_data_ptr->getMatFirstPiolaStress()));
266 pipeline_mng->getOpDomainRhsPipeline().push_back(
269 pipeline_mng->getOpDomainRhsPipeline().push_back(
271 pipeline_mng->getOpDomainRhsPipeline().push_back(
new OpInertiaForce(
272 "U",
matInertiaPtr, [](
double,
double,
double) {
return 1.; }));
281 auto get_bc_hook = [&]() {
283 mField, pipeline_mng->getDomainRhsFE(),
284 {boost::make_shared<TimeScale>()});
288 pipeline_mng->getDomainRhsFE()->preProcessHook = get_bc_hook();
309 "out_step_" + boost::lexical_cast<std::string>(
ts_step) +
".h5m");
316 boost::shared_ptr<PostProcEle>
postProc;
325 auto dm =
simple->getDM();
328 ts = pipeline_mng->createTSIM();
330 ts = pipeline_mng->createTSIM2();
333 auto post_proc_fe = boost::make_shared<PostProcEle>(
mField);
335 auto det_ptr = boost::make_shared<VectorDouble>();
336 auto jac_ptr = boost::make_shared<MatrixDouble>();
337 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
338 post_proc_fe->getOpPtrVector().push_back(
340 post_proc_fe->getOpPtrVector().push_back(
342 post_proc_fe->getOpPtrVector().push_back(
345 post_proc_fe->getOpPtrVector().push_back(
348 post_proc_fe->getOpPtrVector().push_back(
350 post_proc_fe->getOpPtrVector().push_back(
354 auto u_ptr = boost::make_shared<MatrixDouble>();
355 post_proc_fe->getOpPtrVector().push_back(
360 post_proc_fe->getOpPtrVector().push_back(
364 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
372 {{
"STRAIN", matStrainPtr}, {
"STRESS", matStressPtr}}
379 boost::shared_ptr<FEMethod> null_fe;
380 auto monitor_ptr = boost::make_shared<Monitor>(dm, post_proc_fe);
382 null_fe, monitor_ptr);
386 CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
392 CHKERR TSSetSolution(ts, T);
393 CHKERR TSSetFromOptions(ts);
396 CHKERR TS2SetSolution(ts, T, TT);
397 CHKERR TSSetFromOptions(ts);
401 CHKERR TSGetTime(ts, &ftime);
403 PetscInt steps, snesfails, rejects, nonlinits, linits;
404#if PETSC_VERSION_GE(3, 8, 0)
405 CHKERR TSGetStepNumber(ts, &steps);
407 CHKERR TSGetTimeStepNumber(ts, &steps);
409 CHKERR TSGetSNESFailures(ts, &snesfails);
410 CHKERR TSGetStepRejections(ts, &rejects);
411 CHKERR TSGetSNESIterations(ts, &nonlinits);
412 CHKERR TSGetKSPIterations(ts, &linits);
414 "steps %D (%D rejected, %D SNES fails), ftime %g, nonlinits "
416 steps, rejects, snesfails, ftime, nonlinits, linits);
425 PetscBool test_flg = PETSC_FALSE;
433 CHKERR VecNorm(T, NORM_2, &nrm2);
434 MOFEM_LOG(
"EXAMPLE", Sev::inform) <<
"Regression norm " << nrm2;
435 constexpr double regression_value = 1.09572;
436 if (fabs(nrm2 - regression_value) > 1e-2)
438 "Regression test faileed; wrong norm value.");
453int main(
int argc,
char *argv[]) {
460 auto core_log = logging::core::get();
469 DMType dm_name =
"DMMOFEM";
474 moab::Core mb_instance;
475 moab::Interface &moab = mb_instance;
#define MOFEM_LOG_C(channel, severity, format,...)
void simple(double P1[], double P2[], double P3[], double c[], const int N)
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
Kronecker Delta class symmetric.
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FormsIntegrators< DomainEleOp >::Assembly< A >::LinearForm< I >::OpGradTimesSymTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForce
constexpr double shear_modulus_G
constexpr double bulk_modulus_K
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM > OpMass
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 DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
auto smartCreateDMVector(DM dm)
Get smart vector from DM.
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
FTensor::Index< 'k', 3 > k
FormsIntegrators< DomainEleOp >::Assembly< USER_ASSEMBLE >::LinearForm< GAUSS >::OpBaseTimesVector< 1, 3, 1 > OpInertiaForce
FormsIntegrators< DomainEleOp >::Assembly< USER_ASSEMBLE >::LinearForm< GAUSS >::OpSource< 1, 3 > OpBodyForce
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)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
SmartPetscObj< Vec > smartVectorDuplicate(SmartPetscObj< Vec > &vec)
Create duplicate vector of smart vector.
static char help[]
[Check]
static double * ts_aa_ptr
constexpr double poisson_ratio
constexpr double shear_modulus_G
constexpr double bulk_modulus_K
static double * ts_time_ptr
constexpr bool is_quasi_static
constexpr double young_modulus
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
#define EXECUTABLE_DIMENSION
static constexpr int approx_order
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'i', 3 > i
MoFEMErrorCode boundaryCondition()
MoFEMErrorCode assembleSystem()
MoFEMErrorCode readMesh()
boost::shared_ptr< MatrixDouble > matAccelerationPtr
boost::shared_ptr< MatrixDouble > matInertiaPtr
boost::shared_ptr< MatrixDouble > matGradPtr
boost::shared_ptr< MatrixDouble > matStressPtr
boost::shared_ptr< MatrixDouble > matStrainPtr
MoFEMErrorCode checkResults()
MoFEMErrorCode solveSystem()
MoFEMErrorCode createCommonData()
Example(MoFEM::Interface &m_field)
boost::shared_ptr< MatrixDouble > matTangentPtr
MoFEMErrorCode runProblem()
MoFEM::Interface & mField
MoFEMErrorCode setupProblem()
MoFEMErrorCode outputResults()
boost::shared_ptr< MatrixDouble > matDPtr
Simple interface for fast problem set-up.
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.
Definition of the displacement bc data structure.
Data on single entity (This is passed as argument to DataOperator::doWork)
Class (Function) to enforce essential constrains.
structure for User Loop Methods on finite elements
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
Approximate field values for given petsc vector.
Get values at integration pts for tensor filed rank 1, i.e. vector field.
Post post-proc data at points from hash maps.
Set inverse jacobian to base functions.
Set inverse jacobian to base functions.
PipelineManager interface.
Simple interface for fast problem set-up.
intrusive_ptr for managing petsc objects
PetscInt ts_step
time step number
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Volume finite element base.
Monitor(SmartPetscObj< DM > dm, boost::shared_ptr< PostProcEle > post_proc)
MoFEMErrorCode postProcess()
function is run at the end of loop
boost::shared_ptr< PostProcEle > postProc