Note: Two sets are tested, when Sigma or u is variation.
\[ \int_\Gamma n_i \Sigma_{ij} u_j \textrm{d}\Gamma = \int_\Omega \left( \Sigma_{ij} u_j \right)_i \textrm{d}\Omega = \int_\Omega \Sigma_{ij,i} u_j \textrm{d}\Omega + \int_\Omega \Sigma_{ij} u_{j,i} \textrm{d}\Omega \]
static char help[] =
"...\n\n";
};
};
int main(
int argc,
char *argv[]) {
try {
enum bases { AINSWORTH, DEMKOWICZ, LASBASETOP };
const char *list_bases[] = {"ainsworth", "demkowicz"};
PetscBool flg;
PetscInt choice_base_value = AINSWORTH;
LASBASETOP, &choice_base_value, &flg);
if (flg != PETSC_TRUE)
if (choice_base_value == AINSWORTH)
else if (choice_base_value == DEMKOWICZ)
DMType dm_name = "DMMOFEM";
auto core_log = logging::core::get();
core_log->add_sink(
auto get_skin = [&]() {
body_ents);
CHKERR skin.find_skin(0, body_ents,
false, skin_ents);
return skin_ents;
};
auto filter_true_skin = [&](auto skin) {
ParallelComm *pcomm =
CHKERR pcomm->filter_pstatus(skin, PSTATUS_SHARED | PSTATUS_MULTISHARED,
PSTATUS_NOT, -1, &boundary_ents);
return boundary_ents;
};
auto boundary_ents = filter_true_skin(get_skin());
CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"SYM",
CHKERR bc_mng->removeBlockDOFsOnEntities(
auto project_ho_geometry = [&]() {
return m_field.
loop_dofs(
"GEOMETRY", ent_method);
};
pip_mng->getOpDomainLhsPipeline().clear();
pip_mng->getOpDomainRhsPipeline().clear();
auto rule = [&](
int,
int,
int p) {
return 2 * p + 2; };
CHKERR pip_mng->setDomainRhsIntegrationRule(rule);
CHKERR pip_mng->setDomainLhsIntegrationRule(rule);
CHKERR pip_mng->setBoundaryRhsIntegrationRule(rule);
{{"U", {-1, 1}}, {"SIGMA", {-1, 1}}});
SCATTER_REVERSE);
auto jacobian = [&](
double r) {
else
return 1.;
};
};
};
auto post_proc = [&](auto dm, auto f_res, auto out_name) {
auto post_proc_fe =
boost::make_shared<PostProcBrokenMeshInMoab<DomainEle>>(m_field);
auto sigma_ptr = boost::make_shared<MatrixDouble>();
post_proc_fe->getOpPtrVector().push_back(
sigma_ptr));
auto u_ptr = boost::make_shared<MatrixDouble>();
post_proc_fe->getOpPtrVector().push_back(
post_proc_fe->getOpPtrVector().push_back(
post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
{}, {{"U", u_ptr}}, {{"SIGMA", sigma_ptr}}, {})
);
SCATTER_REVERSE);
post_proc_fe);
post_proc_fe->writeFile(out_name);
};
auto test_consistency_of_domain_and_bdy_integrals = [&]() {
using OpMixDivURhs =
GAUSS>::OpMixDivTimesU<3, SPACE_DIM, SPACE_DIM, COORD_TYPE>;
auto ops_rhs_interior = [&](auto &pip) {
"GEOMETRY");
auto u_ptr = boost::make_shared<MatrixDouble>();
auto grad_u_ptr = boost::make_shared<MatrixDouble>();
"U", grad_u_ptr));
pip.push_back(new OpMixDivURhs("SIGMA", u_ptr, beta_domain));
pip.push_back(
new OpMixLambdaGradURhs("SIGMA", grad_u_ptr, beta_domain));
auto sigma_ptr = boost::make_shared<MatrixDouble>();
auto sigma_div_ptr = boost::make_shared<MatrixDouble>();
"SIGMA", sigma_div_ptr));
"SIGMA", sigma_ptr));
pip.push_back(
new OpMixUTimesDivLambdaRhs("U", sigma_div_ptr, beta_domain));
pip.push_back(new OpMixUTimesLambdaRhs("U", sigma_ptr, beta_domain));
};
auto ops_rhs_boundary = [&](auto &pip) {
"GEOMETRY");
auto u_ptr = boost::make_shared<MatrixDouble>();
auto traction_ptr = boost::make_shared<MatrixDouble>();
"SIGMA", traction_ptr));
pip.push_back(new OpMixNormalLambdaURhs("SIGMA", u_ptr, beta_bdy));
pip.push_back(new OpUTimeTractionRhs("U", traction_ptr, beta_bdy));
};
CHKERR ops_rhs_interior(pip_mng->getOpDomainRhsPipeline());
CHKERR ops_rhs_boundary(pip_mng->getOpBoundaryRhsPipeline());
pip_mng->getDomainRhsFE()->f =
f;
pip_mng->getBoundaryRhsFE()->f =
f;
pip_mng->getDomainRhsFE());
pip_mng->getBoundaryRhsFE());
double f_nrm2;
CHKERR VecNorm(
f, NORM_2, &f_nrm2);
MOFEM_LOG(
"ATOM", Sev::inform) <<
"f_norm2 = " << f_nrm2;
if (std::fabs(f_nrm2) > 1e-10) {
"tensor_divergence_operator_res_vec.h5m");
}
};
auto test_lhs_ops = [&]() {
auto op_lhs_domain = [&](auto &pip) {
"GEOMETRY");
auto unity = []() { return 1; };
pip.push_back(
new OpMixDivULhs("SIGMA", "U", unity, beta_domain, true, false));
pip.push_back(
new OpLambdaGraULhs("SIGMA", "U", unity, beta_domain, true, false));
};
CHKERR op_lhs_domain(pip_mng->getOpDomainLhsPipeline());
auto diff_x = opt->setRandomFields(
simple->getDM(),
{{"U", {-1, 1}}, {"SIGMA", {-1, 1}}});
constexpr
double eps = 1e-5;
auto diff_res = opt->checkCentralFiniteDifference(
simple->getDM(),
simple->getDomainFEName(), pip_mng->getDomainRhsFE(),
double fnorm_res;
CHKERR VecNorm(diff_res, NORM_2, &fnorm_res);
MOFEM_LOG_C(
"ATOM", Sev::inform,
"Test Lhs OPs %3.4e", fnorm_res);
if (std::fabs(fnorm_res) > 1e-8)
};
CHKERR test_consistency_of_domain_and_bdy_integrals();
}
}