26 #include <BasicFiniteElements.hpp>
28 #include <PoissonOperators.hpp>
32 static char help[] =
"...\n\n";
47 double operator()(
const double x,
const double y,
const double z)
const {
48 return 1 + x + y + pow(z, 3);
57 const double z)
const {
71 double operator()(
const double x,
const double y,
const double z)
const {
72 return 0.4e1 + (double)(4 * x) + (double)(4 * y) + 0.4e1 * pow(z, 0.3e1) +
74 (0.6e1 * z * z + 0.6e1 * (double)x * z * z +
75 0.6e1 * (
double)y * z * z + 0.6e1 * pow(z, 0.5e1)) *
78 (0.2e1 + (
double)(2 * x) + (
double)(2 * y) +
79 0.2e1 * pow(z, 0.3e1) + (double)(x * x) + (double)(2 * x * y) +
80 0.2e1 * (double)x * pow(z, 0.3e1) + (double)(y * y) +
81 0.2e1 * (double)y * pow(z, 0.3e1) + pow(z, 0.6e1)) *
98 int main(
int argc,
char *argv[]) {
110 PetscBool flg_test = PETSC_FALSE;
111 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Poisson's problem options",
117 CHKERR PetscOptionsBool(
"-test",
"if true is ctest",
"", flg_test,
118 &flg_test, PETSC_NULL);
119 ierr = PetscOptionsEnd();
139 boost::shared_ptr<ForcesAndSourcesCore>
141 boost::shared_ptr<ForcesAndSourcesCore>
143 boost::shared_ptr<ForcesAndSourcesCore>
145 boost::shared_ptr<ForcesAndSourcesCore>
147 boost::shared_ptr<ForcesAndSourcesCore>
149 boost::shared_ptr<ForcesAndSourcesCore>
151 boost::shared_ptr<ForcesAndSourcesCore>
null;
158 domain_lhs_fe, boundary_lhs_fe, domain_rhs_fe, boundary_rhs_fe,
164 global_error, domain_error);
172 Simple *simple_interface;
180 CHKERR simple_interface->getOptions();
182 CHKERR simple_interface->loadFile();
201 CHKERR simple_interface->addBoundaryField(
"L",
H1,
207 CHKERR simple_interface->addDataField(
"ERROR",
L2,
211 CHKERR simple_interface->setFieldOrder(
"U",
213 CHKERR simple_interface->setFieldOrder(
"L",
215 CHKERR simple_interface->setFieldOrder(
221 CHKERR simple_interface->setUp();
234 CHKERR simple_interface->getDM(&dm);
245 domain_lhs_fe,
null,
null);
247 boundary_lhs_fe,
null,
null);
250 domain_rhs_fe,
null,
null);
252 boundary_rhs_fe,
null,
null);
260 CHKERR DMCreateGlobalVector(dm, &F);
267 CHKERR SNESCreate(PETSC_COMM_WORLD, &solver);
268 CHKERR SNESSetFromOptions(solver);
269 CHKERR SNESSetDM(solver, dm);
275 CHKERR SNESSolve(solver, F,
D);
282 CHKERR SNESDestroy(&solver);
296 if (flg_test == PETSC_TRUE) {
307 CHKERR boost::static_pointer_cast<PostProcVolumeOnRefinedMesh>(
309 ->writeFile(
"out_vol.h5m");
316 CHKERR VecDestroy(&global_error);
int main(int argc, char *argv[])
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ L2
field with C-1 continuity
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
#define CHKERR
Inline error check.
PetscErrorCode DMMoFEMSNESSetFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES residual evaluation function
PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES Jacobian evaluation function
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
PetscErrorCode DMoFEMMeshToGlobalVector(DM dm, Vec g, InsertMode mode, ScatterMode scatter_mode)
set ghosted vector values on all existing mesh entities
const FTensor::Tensor2< T, Dim, Dim > Vec
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
DeprecatedCoreInterface Interface
const double D
diffusivity
double operator()(const double u)
FTensor::Tensor1< double, 3 > operator()(const double x, const double y, const double z) const
double operator()(const double x, const double y, const double z) const
double operator()(const double x, const double y, const double z) const
double operator()(const double u)
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
MoFEMErrorCode createGhostVec(Vec *ghost_vec) const
MoFEMErrorCode testError(Vec ghost_vec)
Test error.
MoFEMErrorCode assembleGhostVector(Vec ghost_vec) const
Assemble error vector.
MoFEMErrorCode printError(Vec ghost_vec)
Print error.
Create finite elements instances.
MoFEMErrorCode creatFEToPostProcessResults(boost::shared_ptr< ForcesAndSourcesCore > &post_proc_volume) const
Create finite element to post-process results.
MoFEMErrorCode createFEToAssembleMatrixAndVectorForNonlinearProblem(boost::function< double(const double, const double, const double)> f_u, boost::function< double(const double, const double, const double)> f_source, boost::function< double(const double)> a, boost::function< double(const double)> diff_a, boost::shared_ptr< ForcesAndSourcesCore > &domain_lhs_fe, boost::shared_ptr< ForcesAndSourcesCore > &boundary_lhs_fe, boost::shared_ptr< ForcesAndSourcesCore > &domain_rhs_fe, boost::shared_ptr< ForcesAndSourcesCore > &boundary_rhs_fe, ForcesAndSourcesCore::RuleHookFun vol_rule, ForcesAndSourcesCore::RuleHookFun face_rule=FaceRule(), bool trans=true) const
Create finite element to calculate matrix and vectors.
MoFEMErrorCode createFEToEvaluateError(boost::function< double(const double, const double, const double)> f_u, boost::function< FTensor::Tensor1< double, 3 >(const double, const double, const double)> g_u, Vec global_error, boost::shared_ptr< ForcesAndSourcesCore > &domain_error) const
Create finite element to calculate error.
int operator()(int, int, int p) const