v0.14.0
Loading...
Searching...
No Matches
poisson_2d_dis_galerkin.cpp File Reference

Go to the source code of this file.

Classes

struct  Poisson2DiscontGalerkin
 

Typedefs

using DomainEle = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>::DomainEle
 
using BoundaryEle
 
using FaceSideEle
 
using FaceSideOp = FaceSideEle::UserDataOperator
 
using PostProcEle = PostProcBrokenMeshInMoab<DomainEle>
 
using OpDomainGradGrad
 
using OpDomainSource
 

Functions

int main (int argc, char *argv[])
 [Run program]
 

Variables

constexpr int BASE_DIM = 1
 
constexpr int FIELD_DIM = 1
 
constexpr int SPACE_DIM = 2
 
static double penalty = 1e6
 
static double phi
 
static double nitsche = 1
 
PetscBool is_test = PETSC_FALSE
 
auto u_exact
 
auto u_grad_exact
 
auto source
 
static char help [] = "...\n\n"
 

Typedef Documentation

◆ BoundaryEle

◆ DomainEle

◆ FaceSideEle

◆ FaceSideOp

◆ OpDomainGradGrad

◆ OpDomainSource

◆ PostProcEle

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

[Run program]

[Main]

Definition at line 538 of file poisson_2d_dis_galerkin.cpp.

538 {
539
540 // Initialisation of MoFEM/PETSc and MOAB data structures
541 const char param_file[] = "param_file.petsc";
542 MoFEM::Core::Initialize(&argc, &argv, param_file, help);
543
544 // Error handling
545 try {
546 // Register MoFEM discrete manager in PETSc
547 DMType dm_name = "DMMOFEM";
548 CHKERR DMRegister_MoFEM(dm_name);
549
550 // Create MOAB instance
551 moab::Core mb_instance; // mesh database
552 moab::Interface &moab = mb_instance; // mesh database interface
553
554 // Create MoFEM instance
555 MoFEM::Core core(moab); // finite element database
556 MoFEM::Interface &m_field = core; // finite element interface
557
558 // Run the main analysis
559 Poisson2DiscontGalerkin poisson_problem(m_field);
560 CHKERR poisson_problem.runProgram();
561 }
563
564 // Finish work: cleaning memory, getting statistics, etc.
566
567 return 0;
568}
#define CATCH_ERRORS
Catch errors.
#define CHKERR
Inline error check.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:43
static char help[]
Core (interface) class.
Definition Core.hpp:82
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:72
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:112
Deprecated interface functions.

Variable Documentation

◆ BASE_DIM

int BASE_DIM = 1
constexpr

Definition at line 11 of file poisson_2d_dis_galerkin.cpp.

◆ FIELD_DIM

int FIELD_DIM = 1
constexpr

Definition at line 12 of file poisson_2d_dis_galerkin.cpp.

◆ help

char help[] = "...\n\n"
static

Definition at line 72 of file poisson_2d_dis_galerkin.cpp.

◆ is_test

PetscBool is_test = PETSC_FALSE
Examples
poisson_2d_dis_galerkin.cpp.

Definition at line 41 of file poisson_2d_dis_galerkin.cpp.

◆ nitsche

double nitsche = 1
static

◆ penalty

◆ phi

◆ source

auto source
Initial value:
= [](const double x, const double y, const double) {
if (is_test)
return -(2 * x * x + 2 * y * y);
else
return 8 * M_PI * M_PI * cos(2 * x * M_PI) * cos(2 * y * M_PI);
}
PetscBool is_test
Examples
mixed_poisson.cpp, plate.cpp, poisson_2d_dis_galerkin.cpp, and test_broken_space.cpp.

Definition at line 62 of file poisson_2d_dis_galerkin.cpp.

62 {
63 if (is_test)
64 return -(2 * x * x + 2 * y * y);
65 else
66 return 8 * M_PI * M_PI * cos(2 * x * M_PI) * cos(2 * y * M_PI);
67};

◆ SPACE_DIM

int SPACE_DIM = 2
constexpr

Definition at line 13 of file poisson_2d_dis_galerkin.cpp.

◆ u_exact

auto u_exact
Initial value:
= [](const double x, const double y, const double) {
if (is_test)
return x * x * y * y;
else
return cos(2 * x * M_PI) * cos(2 * y * M_PI);
}
Examples
poisson_2d_dis_galerkin.cpp.

Definition at line 43 of file poisson_2d_dis_galerkin.cpp.

43 {
44 if (is_test)
45 return x * x * y * y;
46 else
47 return cos(2 * x * M_PI) * cos(2 * y * M_PI);
48};

◆ u_grad_exact

auto u_grad_exact
Initial value:
= [](const double x, const double y, const double) {
if (is_test)
return FTensor::Tensor1<double, 2>{2 * x * y * y, 2 * x * x * y};
else
-2 * M_PI * cos(2 * M_PI * y) * sin(2 * M_PI * x),
-2 * M_PI * cos(2 * M_PI * x) * sin(2 * M_PI * y)
};
}
Examples
poisson_2d_dis_galerkin.cpp.

Definition at line 50 of file poisson_2d_dis_galerkin.cpp.

50 {
51 if (is_test)
52 return FTensor::Tensor1<double, 2>{2 * x * y * y, 2 * x * x * y};
53 else
55
56 -2 * M_PI * cos(2 * M_PI * y) * sin(2 * M_PI * x),
57 -2 * M_PI * cos(2 * M_PI * x) * sin(2 * M_PI * y)
58
59 };
60};