static char help[] =
"...\n\n";
PETSC>::LinearForm<GAUSS>::OpSource<1, 1>;
private:
boost::shared_ptr<std::vector<unsigned char>> boundaryMarker;
};
}
CHKERR mField.getInterface(simpleInterface);
CHKERR simpleInterface->getOptions();
CHKERR simpleInterface->loadFile();
}
CHKERR simpleInterface->addDomainField(
"P_REAL",
H1,
CHKERR simpleInterface->addDomainField(
"P_IMAG",
H1,
CHKERR simpleInterface->addBoundaryField(
"P_REAL",
H1,
CHKERR simpleInterface->addBoundaryField(
"P_IMAG",
H1,
CHKERR simpleInterface->setFieldOrder(
"P_REAL",
order);
CHKERR simpleInterface->setFieldOrder(
"P_IMAG",
order);
CHKERR simpleInterface->setUp();
}
auto get_ents_on_mesh_skin = [&]() {
std::string entity_name = it->getName();
if (entity_name.compare(0, 2, "BC") == 0) {
CHKERR it->getMeshsetIdEntitiesByDimension(mField.get_moab(), 1,
boundary_entities, true);
}
}
CHKERR mField.get_moab().get_connectivity(boundary_entities,
boundary_vertices, true);
boundary_entities.merge(boundary_vertices);
return boundary_entities;
};
auto mark_boundary_dofs = [&](
Range &&skin_edges) {
auto marker_ptr = boost::make_shared<std::vector<unsigned char>>();
problem_manager->
markDofs(simpleInterface->getProblemName(),
ROW,
skin_edges, *marker_ptr);
return marker_ptr;
};
auto remove_dofs_from_problem = [&](
Range &&skin_edges) {
CHKERR problem_manager->removeDofsOnEntities(
simpleInterface->getProblemName(), "P_IMAG", skin_edges, 0, 1);
};
boundaryMarker = mark_boundary_dofs(get_ents_on_mesh_skin());
CHKERR remove_dofs_from_problem(get_ents_on_mesh_skin());
}
auto set_domain = [&]() {
new OpSetBc(
"P_REAL",
true, boundaryMarker));
};
auto set_boundary = [&]() {
new OpSetBc(
"P_REAL",
true, boundaryMarker));
new OpSetBc(
"P_REAL",
false, boundaryMarker));
new OpSetBc(
"P_REAL",
false, boundaryMarker));
};
}
CHKERR KSPSetFromOptions(solver);
auto dm = simpleInterface->getDM();
CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
}
auto post_proc_fe = boost::make_shared<PostProcEle>(mField);
auto p_real_ptr = boost::make_shared<VectorDouble>();
auto p_imag_ptr = boost::make_shared<VectorDouble>();
post_proc_fe->getOpPtrVector().push_back(
post_proc_fe->getOpPtrVector().push_back(
post_proc_fe->getOpPtrVector().push_back(
post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
{{"P_REAL", p_real_ptr}, {"P_IMAG", p_imag_ptr}},
{}, {}, {}
)
);
CHKERR post_proc_fe->writeFile(
"out_helmholtz.h5m");
}
double nrm2;
<< std::setprecision(9) << "Solution norm " << nrm2;
PetscBool test_flg = PETSC_FALSE;
if (test_flg) {
constexpr double regression_test = 97.261672;
constexpr
double eps = 1e-6;
if (std::abs(nrm2 - regression_test) / regression_test >
eps)
"Not converged solution");
}
}
int main(
int argc,
char *argv[]) {
const char param_file[] = "param_file.petsc";
try {
DMType dm_name = "DMMOFEM";
}
}