86 CHKERR PetscOptionsGetBool(PETSC_NULLPTR,
"",
"-ref_geom", &
refGeom,
94 "Adaptive order and geometry refinement cannot be used together");
97 simple->getAddSkeletonFE() =
true;
103 auto update_ghost_ents = [&]() {
107 std::regex((boost::format(
"%s(.*)") %
"MAT_ELASTIC").str()))
120 CHKERR update_ghost_ents();
130 Range domainEntities;
136 CHKERR PetscOptionsGetInt(PETSC_NULLPTR,
"",
"-order", &
oRder, PETSC_NULLPTR);
137 for (
auto ent : domainEntities) {
160 pip->getDomainLhsFE().reset();
161 pip->getDomainRhsFE().reset();
162 pip->getBoundaryRhsFE().reset();
163 pip->getBoundaryLhsFE().reset();
164 pip->getSkeletonLhsFE().reset();
165 pip->getSkeletonRhsFE().reset();
180 CHKERR KSPGetDM(solver, &dm);
181 auto D = createDMVector(dm);
182 auto F = vectorDuplicate(
D);
185 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
186 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
187 CHKERR DMoFEMMeshToLocalVector(dm,
D, INSERT_VALUES, SCATTER_REVERSE);
189 BOOST_LOG_SCOPED_THREAD_ATTR(
"Timeline", attrs::timer());
190 MOFEM_LOG(
"TIMER", Sev::inform) <<
"KSPSetUp";
192 MOFEM_LOG(
"TIMER", Sev::inform) <<
"KSPSetUp <= Done";
193 MOFEM_LOG(
"TIMER", Sev::inform) <<
"KSPSolve";
195 MOFEM_LOG(
"TIMER", Sev::inform) <<
"KSPSolve <= Done";
197 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
198 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
199 CHKERR DMoFEMMeshToLocalVector(dm,
D, INSERT_VALUES, SCATTER_REVERSE);
205inline auto sqr = [](
double v) {
return v *
v; };
212 double r = std::sqrt(x * x + y * y);
225 std::vector<double> v_u;
227 double u_r = (1. + nu) /
E * ((1. - 2. * nu) *
A * r +
B / r);
230 v_u = {u_r / r * x, u_r / r * y};
232 v_u = {u_r / r * x, u_r / r * y, 0.0};
247 std::ostringstream strm;
248 strm <<
"out_elastic";
250 strm <<
"_" << ref_iter;
257 {
"GEOMETRY_ERROR",
"SOLUTION_ERROR",
"ORDER"}, Sev::verbose);
274 pip->getOpDomainRhsPipeline(), {H1},
"GEOMETRY");
276 auto u_ptr = boost::make_shared<MatrixDouble>();
277 pip->getOpDomainRhsPipeline().push_back(
278 new OpCalculateVectorFieldValues<SPACE_DIM>(
"U", u_ptr));
280 auto analytical_disp_ptr = boost::make_shared<MatrixDouble>();
282 pip->getOpDomainRhsPipeline().push_back(
283 new OpGetTensor1fromFunc<SPACE_DIM, SPACE_DIM>(analytical_disp_ptr,
289 pip->getOpDomainRhsPipeline().push_back(
new OpCalcNormL2Tensor1<SPACE_DIM>(
290 u_ptr, normsVec, 0, analytical_disp_ptr));
292 CHKERR VecZeroEntries(normsVec);
293 CHKERR pip->loopFiniteElements();
294 CHKERR VecAssemblyBegin(normsVec);
295 CHKERR VecAssemblyEnd(normsVec);
299 CHKERR VecGetArrayRead(normsVec, &norms);
301 <<
"Displacement error L2 norm: " << std::scientific
302 << std::sqrt(norms[0]);
304 if (
atomTest == 3 && std::sqrt(norms[0]) > 2.195e-06) {
306 "atom test failed: displacement error L2 norm is too high: "
308 std::sqrt(norms[0]));
311 if (
atomTest == 4 && std::sqrt(norms[0]) > 1.995e-07) {
313 "atom test failed: displacement error L2 norm is too high: "
315 std::sqrt(norms[0]));
318 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
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.
FTensor::Index< 'i', SPACE_DIM > i
const double v
phase velocity of light in medium (cm/ns)
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
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
[Reset pipelines]
MoFEMErrorCode refineOrder(int ref_level)
MoFEMErrorCode computeErrorIndicators()
MoFEMErrorCode resetPipelines()
[Set up problem]
MoFEMErrorCode refineGeometry()
MoFEMErrorCode runProblem()
[Run problem]
MoFEMErrorCode readMesh()
[Run problem]
MoFEMErrorCode setupAdaptivity()
[Read mesh]
MoFEMErrorCode solveSystem()
[Solve]
MoFEMErrorCode outputResults()
[Solve]
MoFEMErrorCode assembleSystem()
[Boundary condition]
MoFEMErrorCode setupProblem()
[Read mesh]
MoFEM::Interface & mField
MoFEMErrorCode boundaryCondition()
[Set up problem]
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