84 CHKERR PetscOptionsGetBool(PETSC_NULLPTR,
"",
"-ref_geom", &
refGeom,
92 "Adaptive order and geometry refinement cannot be used together");
95 simple->getAddSkeletonFE() =
true;
101 auto update_ghost_ents = [&]() {
105 std::regex((boost::format(
"%s(.*)") %
"MAT_ELASTIC").str()))
118 CHKERR update_ghost_ents();
128 Range domainEntities;
134 CHKERR PetscOptionsGetInt(PETSC_NULLPTR,
"",
"-order", &
oRder, PETSC_NULLPTR);
135 for (
auto ent : domainEntities) {
162 CHKERR KSPGetDM(solver, &dm);
163 auto D = createDMVector(dm);
164 auto F = vectorDuplicate(
D);
167 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
168 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
169 CHKERR DMoFEMMeshToLocalVector(dm,
D, INSERT_VALUES, SCATTER_REVERSE);
171 BOOST_LOG_SCOPED_THREAD_ATTR(
"Timeline", attrs::timer());
172 MOFEM_LOG(
"TIMER", Sev::inform) <<
"KSPSetUp";
174 MOFEM_LOG(
"TIMER", Sev::inform) <<
"KSPSetUp <= Done";
175 MOFEM_LOG(
"TIMER", Sev::inform) <<
"KSPSolve";
177 MOFEM_LOG(
"TIMER", Sev::inform) <<
"KSPSolve <= Done";
179 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
180 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
181 CHKERR DMoFEMMeshToLocalVector(dm,
D, INSERT_VALUES, SCATTER_REVERSE);
191 [](
double x,
double y,
double z) {
200 std::ostringstream strm;
201 strm <<
"out_elastic";
203 strm <<
"_" << ref_iter;
210 {
"GEOMETRY_ERROR",
"SOLUTION_ERROR",
"ORDER"}, Sev::verbose);
222 auto evaluation_fe = boost::make_shared<DomainEle>(
mField);
225 auto &evaluation_pipeline = evaluation_fe->getOpPtrVector();
229 auto u_ptr = boost::make_shared<MatrixDouble>();
230 evaluation_pipeline.push_back(
231 new OpCalculateVectorFieldValues<SPACE_DIM>(
"U", u_ptr));
233 auto analytical_disp_ptr = boost::make_shared<MatrixDouble>();
235 evaluation_pipeline.push_back(
new OpGetTensor1fromFunc<SPACE_DIM, SPACE_DIM>(
241 evaluation_pipeline.push_back(
new OpCalcNormL2Tensor1<SPACE_DIM>(
242 u_ptr, normsVec, 0, analytical_disp_ptr));
244 CHKERR VecZeroEntries(normsVec);
247 CHKERR VecAssemblyBegin(normsVec);
248 CHKERR VecAssemblyEnd(normsVec);
252 CHKERR VecGetArrayRead(normsVec, &norms);
254 <<
"Displacement error L2 norm: " << std::scientific
255 << std::sqrt(norms[0]);
257 if (
atomTest == 3 && std::sqrt(norms[0]) > 2.195e-06) {
259 "atom test failed: displacement error L2 norm is too high: "
261 std::sqrt(norms[0]));
264 if (
atomTest == 4 && std::sqrt(norms[0]) > 1.995e-07) {
266 "atom test failed: displacement error L2 norm is too high: "
268 std::sqrt(norms[0]));
271 CHKERR VecRestoreArrayRead(normsVec, &norms);
Calculate error indicators.
static MoFEMErrorCode getTagHandle(MoFEM::Interface &m_field, const char *name, DataType type, Tag &tag_handle)
static MoFEMErrorCode copyTagOnSkin(MoFEM::Interface &m_field, const char *name, DataType type)
MoFEM::VectorFunc analyticalDisplacement
const AnalyticalSolutions::HollowCylinderUnderRadialPressure< SPACE_DIM > lame_solution(0.5, 1.0, 2.0, 1.0, 1e3, 0.3)
Implementation of elastic example class.
Higher Order Geometry refinement.
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
void simple(double P1[], double P2[], double P3[], double c[], const int N)
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
MoFEMErrorCode postProcessElasticResults(MoFEM::Interface &mField, SmartPetscObj< DM > dm, const std::string &domain_fe_name, const std::string &out_file_name, std::vector< std::pair< std::string, SmartPetscObj< Vec > > > extra_vectors={}, const std::vector< std::string > &tags_to_transfer={}, const Sev hooke_ops_sev=Sev::verbose)
boost::function< VectorDouble(const double, const double, const double)> VectorFunc
FTensor::Index< 'm', 3 > m
Lamé analytical solution for a hollow cylinder under radial pressure with a linear isotropic Hooke ma...
MoFEMErrorCode calculateGeometryError()
Calculate geometry error and save on a tag.
MoFEMErrorCode computeErrorNorms()
[Postprocess results]
ElasticAdaptiveExample(MoFEM::Interface &m_field)
std::array< double, 2 > meanError
MoFEMErrorCode kspSetUpAndSolve(SmartPetscObj< KSP > solver) override
[Set up problem]
MoFEMErrorCode refineOrder(int ref_level)
MoFEMErrorCode computeErrorIndicators()
MoFEMErrorCode refineGeometry()
MoFEMErrorCode runProblem()
[Run problem]
MoFEMErrorCode readMesh()
[Run problem]
MoFEMErrorCode setupAdaptivity()
[Read mesh]
virtual MoFEMErrorCode solveSystem()
[Solve]
virtual MoFEMErrorCode outputResults()
[Solve]
virtual MoFEMErrorCode assembleSystem()
virtual MoFEMErrorCode setupProblem()
[Read mesh]
MoFEM::Interface & mField
virtual MoFEMErrorCode boundaryCondition()
[Set up problem]
virtual MoFEMErrorCode checkResults()
[Postprocess results]
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
Deprecated interface functions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
ElementsAndOps< SPACE_DIM >::SideEle SideEle