|
| v0.14.0
|
Definition at line 15 of file nonlinear_poisson_2d.cpp.
◆ PostProcEle
◆ EX_NORMS
◆ NORMS
◆ NonlinearPoisson()
◆ assembleSystem()
Definition at line 219 of file nonlinear_poisson_2d.cpp.
226 auto add_domain_lhs_ops = [&](
auto &pipeline) {
228 auto data_u_at_gauss_pts = boost::make_shared<VectorDouble>();
229 auto grad_u_at_gauss_pts = boost::make_shared<MatrixDouble>();
239 auto add_domain_rhs_ops = [&](
auto &pipeline) {
241 auto data_u_at_gauss_pts = boost::make_shared<VectorDouble>();
242 auto grad_u_at_gauss_pts = boost::make_shared<MatrixDouble>();
249 grad_u_at_gauss_pts));
253 auto add_boundary_lhs_ops = [&](
auto &pipeline) {
257 [](
const double,
const double,
const double) {
return 1; }));
261 auto add_boundary_rhs_ops = [&](
auto &pipeline) {
263 auto u_at_gauss_pts = boost::make_shared<VectorDouble>();
268 [](
const double,
const double,
const double) {
return 1; }));
273 add_domain_lhs_ops(pipeline_mng->getOpDomainLhsPipeline());
274 add_domain_rhs_ops(pipeline_mng->getOpDomainRhsPipeline());
276 add_boundary_lhs_ops(pipeline_mng->getOpBoundaryLhsPipeline());
277 add_boundary_rhs_ops(pipeline_mng->getOpBoundaryRhsPipeline());
◆ boundaryCondition()
Definition at line 178 of file nonlinear_poisson_2d.cpp.
182 auto get_ents_on_mesh_skin = [&]() {
183 Range boundary_entities;
185 std::string entity_name = it->getName();
186 if (entity_name.compare(0, 18,
"BOUNDARY_CONDITION") == 0) {
188 boundary_entities,
true);
192 Range boundary_vertices;
194 boundary_vertices,
true);
195 boundary_entities.merge(boundary_vertices);
200 return boundary_entities;
203 auto mark_boundary_dofs = [&](
Range &&skin_edges) {
205 auto marker_ptr = boost::make_shared<std::vector<unsigned char>>();
207 ProblemsManager::OR, skin_edges, *marker_ptr);
◆ boundaryFunction()
◆ checkResults()
[Check]
Definition at line 369 of file nonlinear_poisson_2d.cpp.
371 auto check_result_fe_ptr = boost::make_shared<DomainEle>(
mField);
379 check_result_fe_ptr->getOpPtrVector(), {H1})),
381 check_result_fe_ptr->getRuleHook = [](
int,
int,
int p) {
return p; };
382 auto analyticalFunction = [&](
double x,
double y,
double z) {
383 return cos(M_PI * x) * cos(M_PI * y);
385 auto u_ptr = boost::make_shared<VectorDouble>();
386 check_result_fe_ptr->getOpPtrVector().push_back(
388 auto mValFuncPtr = boost::make_shared<VectorDouble>();
389 check_result_fe_ptr->getOpPtrVector().push_back(
391 check_result_fe_ptr->getOpPtrVector().push_back(
393 check_result_fe_ptr->getOpPtrVector().push_back(
399 check_result_fe_ptr);
407 const double *L2_norms;
408 const double *Ex_norms;
412 <<
"L2_NORM: " << std::sqrt(L2_norms[
NORM]);
414 <<
"NORMALISED_ERROR: "
415 << (std::sqrt(L2_norms[
NORM]) / std::sqrt(Ex_norms[
EX_NORM]));
421 const double *L2_norms;
422 const double *Ex_norms;
425 double ref_percentage = 4.4e-04;
426 double normalised_error;
429 normalised_error = std::sqrt(L2_norms[0]) / std::sqrt(Ex_norms[0]);
433 "atom test %d does not exist",
atomTest);
435 if (normalised_error > ref_percentage) {
437 "atom test %d failed! Calculated Norm %3.16e is greater than "
438 "reference Norm %3.16e",
439 atomTest, normalised_error, ref_percentage);
◆ outputResults()
Definition at line 336 of file nonlinear_poisson_2d.cpp.
339 auto post_proc = boost::make_shared<PostProcEle>(
mField);
341 auto u_ptr = boost::make_shared<VectorDouble>();
342 post_proc->getOpPtrVector().push_back(
347 post_proc->getOpPtrVector().push_back(
349 new OpPPMap(post_proc->getPostProcMesh(), post_proc->getMapGaussPts(),
351 {{domainField, u_ptr}},
360 auto dm =
simple->getDM();
363 CHKERR post_proc->writeFile(
"out_result.h5m");
◆ readMesh()
◆ runProgram()
◆ setIntegrationRules()
Definition at line 160 of file nonlinear_poisson_2d.cpp.
163 auto domain_rule_lhs = [](
int,
int,
int p) ->
int {
return 2 * p - 1; };
164 auto domain_rule_rhs = [](
int,
int,
int p) ->
int {
return 2 * p - 1; };
166 auto boundary_rule_lhs = [](
int,
int,
int p) ->
int {
return 2 * p; };
167 auto boundary_rule_rhs = [](
int,
int,
int p) ->
int {
return 2 * p; };
170 CHKERR pipeline_mng->setDomainRhsIntegrationRule(domain_rule_lhs);
171 CHKERR pipeline_mng->setDomainLhsIntegrationRule(domain_rule_rhs);
172 CHKERR pipeline_mng->setBoundaryLhsIntegrationRule(boundary_rule_lhs);
173 CHKERR pipeline_mng->setBoundaryRhsIntegrationRule(boundary_rule_rhs);
◆ setupProblem()
Definition at line 106 of file nonlinear_poisson_2d.cpp.
112 auto get_ents_by_dim = [&](
const auto dim) {
125 auto get_base = [&]() {
126 auto domain_ents = get_ents_by_dim(
SPACE_DIM);
127 if (domain_ents.empty())
144 auto base = get_base();
◆ solveSystem()
Definition at line 282 of file nonlinear_poisson_2d.cpp.
287 auto set_fieldsplit_preconditioner = [&](
auto snes) {
290 CHKERR SNESGetKSP(snes, &ksp);
292 CHKERR KSPGetPC(ksp, &pc);
293 PetscBool is_pcfs = PETSC_FALSE;
294 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
297 if (is_pcfs == PETSC_TRUE) {
298 auto name_prb =
simple->getProblemName();
304 CHKERR ISGetSize(is_all_bc, &is_all_bc_size);
306 <<
"Field split block size " << is_all_bc_size;
307 CHKERR PCFieldSplitSetIS(pc, PETSC_NULL,
314 auto dm =
simple->getDM();
322 CHKERR SNESSetFromOptions(solver);
323 CHKERR set_fieldsplit_preconditioner(solver);
327 CHKERR SNESSolve(solver, global_rhs, global_solution);
◆ sourceTermFunction()
Definition at line 34 of file nonlinear_poisson_2d.cpp.
37 return 2 * M_PI * M_PI *
38 (cos(M_PI * x) * cos(M_PI * y) +
39 cube(cos(M_PI * x)) *
cube(cos(M_PI * y)) -
40 cos(M_PI * x) * cos(M_PI * y) *
41 (
sqr(sin(M_PI * x)) *
sqr(cos(M_PI * y)) +
42 sqr(sin(M_PI * y)) *
sqr(cos(M_PI * x))));
◆ atomTest
int NonlinearPoisson::atomTest = 0 |
|
private |
◆ boundaryEntitiesForFieldsplit
Range NonlinearPoisson::boundaryEntitiesForFieldsplit |
|
private |
◆ boundaryMarker
boost::shared_ptr<std::vector<unsigned char> > NonlinearPoisson::boundaryMarker |
|
private |
◆ domainField
std::string NonlinearPoisson::domainField = "POTENTIAL" |
|
private |
◆ errorVec
◆ exactVec
◆ mField
◆ order
int NonlinearPoisson::order |
|
private |
◆ postProc
boost::shared_ptr<PostProcEle> NonlinearPoisson::postProc |
|
private |
◆ simpleInterface
Simple* NonlinearPoisson::simpleInterface |
|
private |
The documentation for this struct was generated from the following file:
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
MoFEMErrorCode outputResults()
SmartPetscObj< SNES > createSNES(SmartPetscObj< DM > dm=nullptr)
Create SNES (nonlinear) solver.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Problem manager is used to build and partition problems.
static double boundaryFunction(const double x, const double y, const double z)
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesScalar< 1 > OpBoundaryRhs
virtual MPI_Comm & get_comm() const =0
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
MoFEMErrorCode boundaryCondition()
static double sourceTermFunction(const double x, const double y, const double z)
virtual int get_comm_rank() const =0
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
PipelineManager interface.
Simple interface for fast problem set-up.
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, Vec *g)
DMShellSetCreateGlobalVector.
MoFEMErrorCode getOptions()
get options
MoFEMErrorCode setIntegrationRules()
MoFEMErrorCode getDM(DM *dm)
Get DM.
#define CHKERR
Inline error check.
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
virtual moab::Interface & get_moab()=0
MoFEMErrorCode assembleSystem()
Section manager is used to create indexes and sections.
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 1 > OpBoundaryRhsSource
MoFEMErrorCode solveSystem()
void simple(double P1[], double P2[], double P3[], double c[], const int N)
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
MoFEMErrorCode checkResults()
[Check]
PetscErrorCode DMoFEMMeshToGlobalVector(DM dm, Vec g, InsertMode mode, ScatterMode scatter_mode)
set ghosted vector values on all existing mesh entities
Get value at integration points for scalar field.
MoFEMErrorCode addDomainField(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add field on domain.
const std::string getDomainFEName() const
Get the Domain FE Name.
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, 1 > OpBoundaryLhs
MoFEMErrorCode markDofs(const std::string problem_name, RowColData rc, const enum MarkOP op, const Range ents, std::vector< unsigned char > &marker) const
Create vector with marked indices.
auto type_from_handle(const EntityHandle h)
get type from entity handle
Get values from scalar function at integration points and save them to VectorDouble for Tensor0.
MoFEM::Interface & mField
double sqr(const double x)
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Add operators pushing bases from local to physical configuration.
SmartPetscObj< Vec > exactVec
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define MOFEM_LOG(channel, severity)
Log.
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
SmartPetscObj< Vec > errorVec
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Set indices on entities on finite element.
Get norm of input VectorDouble for Tensor0.
auto createVectorMPI(MPI_Comm comm, PetscInt n, PetscInt N)
Create MPI Vector.
MoFEMErrorCode addBoundaryField(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add field on boundary.
MoFEMErrorCode setupProblem()
@ MOFEM_ATOM_TEST_INVALID
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
const std::string getProblemName() const
Get the Problem Name.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
double cube(const double x)
MoFEMErrorCode readMesh()
Range boundaryEntitiesForFieldsplit
Post post-proc data at points from hash maps.