Solution of poisson equation. Direct implementation of User Data Operators for teaching proposes.
static char help[] =
"...\n\n";
public:
private:
int oRder;
static double sourceTermFunction(const double x, const double y,
const double z) {
return 2. * M_PI * M_PI * sin(M_PI * x) * sin(M_PI * y);
}
enum NORMS { NORM = 0, LAST_NORM };
};
: mField(m_field) {}
}
true);
auto get_ents_by_dim = [&](const auto dim) {
return domain_ents;
} else {
if (dim == 0)
else
return ents;
}
};
auto get_base = [&]() {
auto domain_ents = get_ents_by_dim(
SPACE_DIM);
if (domain_ents.empty())
case MBQUAD:
case MBHEX:
case MBTRI:
case MBTET:
default:
}
};
auto base = get_base();
PETSC_NULL);
}
}
{
pipeline_mng->getOpDomainLhsPipeline(), {H1});
pipeline_mng->getOpDomainLhsPipeline().push_back(
}
{
auto set_values_to_bc_dofs = [&](auto &fe) {
auto get_bc_hook = [&]() {
return hook;
};
fe->preProcessHook = get_bc_hook();
};
auto calculate_residual_from_set_values_on_bc = [&](auto &pipeline) {
auto grad_u_vals_ptr = boost::make_shared<MatrixDouble>();
pipeline_mng->getOpDomainRhsPipeline().push_back(
grad_u_vals_ptr));
pipeline_mng->getOpDomainRhsPipeline().push_back(
[](double, double, double) constexpr { return -1; }));
};
pipeline_mng->getOpDomainRhsPipeline(), {H1});
set_values_to_bc_dofs(pipeline_mng->getDomainRhsFE());
calculate_residual_from_set_values_on_bc(
pipeline_mng->getOpDomainRhsPipeline());
pipeline_mng->getOpDomainRhsPipeline().push_back(
}
}
auto rule_lhs = [](
int,
int,
int p) ->
int {
return 2 * (p - 1); };
auto rule_rhs = [](
int,
int,
int p) ->
int {
return p; };
CHKERR pipeline_mng->setDomainLhsIntegrationRule(rule_lhs);
CHKERR pipeline_mng->setDomainRhsIntegrationRule(rule_rhs);
}
CHKERR KSPSetFromOptions(ksp_solver);
CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
}
auto post_proc_fe = boost::make_shared<PostProcFaceEle>(
mField);
post_proc_fe->getOpPtrVector(), {H1});
auto u_ptr = boost::make_shared<VectorDouble>();
auto grad_u_ptr = boost::make_shared<MatrixDouble>();
post_proc_fe->getOpPtrVector().push_back(
post_proc_fe->getOpPtrVector().push_back(
post_proc_fe->getOpPtrVector().push_back(
new OpPPMap(post_proc_fe->getPostProcMesh(),
post_proc_fe->getMapGaussPts(),
)
);
pipeline_mng->getDomainRhsFE() = post_proc_fe;
CHKERR pipeline_mng->loopFiniteElements();
CHKERR post_proc_fe->writeFile(
"out_result.h5m");
}
auto check_result_fe_ptr = boost::make_shared<DomainEle>(
mField);
check_result_fe_ptr->getOpPtrVector(), {H1})),
"Apply transform");
check_result_fe_ptr->getRuleHook = [](
int,
int,
int p) {
return p; };
auto analyticalFunction = [&](double x, double y, double z) {
return sin(M_PI * x) * sin(M_PI * y);
};
auto u_ptr = boost::make_shared<VectorDouble>();
check_result_fe_ptr->getOpPtrVector().push_back(
auto mValFuncPtr = boost::make_shared<VectorDouble>();
check_result_fe_ptr->getOpPtrVector().push_back(
check_result_fe_ptr->getOpPtrVector().push_back(
check_result_fe_ptr);
const double *norms;
<<
"NORM: " << std::sqrt(norms[
NORM]);
}
const double *t_ptr;
double ref_norm = 2.2e-04;
double cal_norm;
case 1:
cal_norm = sqrt(t_ptr[0]);
break;
default:
}
if (cal_norm > ref_norm) {
"atom test %d failed! Calculated Norm %3.16e is greater than "
"reference Norm %3.16e",
}
}
}
}
int main(
int argc,
char *argv[]) {
const char param_file[] = "param_file.petsc";
try {
DMType dm_name = "DMMOFEM";
CHKERR poisson_problem.runProgram();
}
return 0;
}