70 {
71
72
74
75 try {
76
77
78 moab::Core moab_core;
79 moab::Interface &moab = moab_core;
80
81
83 PetscBool flg_test = PETSC_FALSE;
84 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Poisson's problem options",
85 "none");
86
88 PETSC_NULL);
89
90 CHKERR PetscOptionsBool(
"-test",
"if true is ctest",
"", flg_test,
91 &flg_test, PETSC_NULL);
92 ierr = PetscOptionsEnd();
94
95
98
100
101
104
105
106
107
108
109
110
111
112 boost::shared_ptr<ForcesAndSourcesCore> domain_lhs_fe;
113 boost::shared_ptr<ForcesAndSourcesCore> boundary_lhs_fe;
114 boost::shared_ptr<ForcesAndSourcesCore> domain_rhs_fe;
115 boost::shared_ptr<ForcesAndSourcesCore> boundary_rhs_fe;
116 boost::shared_ptr<ForcesAndSourcesCore> domain_error;
117 boost::shared_ptr<PoissonExample::PostProcFE>
118 post_proc_volume;
119 boost::shared_ptr<ForcesAndSourcesCore> null;
120 {
121
125 boundary_lhs_fe, domain_rhs_fe, boundary_rhs_fe);
126
127
130 global_error, domain_error);
131
134 }
135
136
137
139
141
142
143 {
144
145
147
149
150
151
152
153
154
155
156
157
158
159
160
161
163
165
166
167
168
170
171
175
176
177
179
180 }
181
182
183
184
185
186
187
188 DM dm;
189
191
192
193
194
195
196
197
198 {
199
204 null);
205
207 domain_rhs_fe, null, null);
209 boundary_rhs_fe, null, null);
210 }
211
212
213 {
214
215
217 CHKERR DMCreateGlobalVector(dm,&
F);
218
219
221
222
223 KSP solver;
224 CHKERR KSPCreate(PETSC_COMM_WORLD,&solver);
225 CHKERR KSPSetFromOptions(solver);
226 CHKERR KSPSetDM(solver,dm);
227
229
230
231
233
234
236
237
238 CHKERR KSPDestroy(&solver);
241 }
242
243
244 {
245
247 domain_error);
249 global_error);
251 if (flg_test == PETSC_TRUE) {
253 }
254 }
255
256 {
257
258
260 post_proc_volume);
261
262 post_proc_volume->writeFile("out_vol.h5m");
263 }
264
265
267
268
269 CHKERR VecDestroy(&global_error);
270 }
272
273
275
276 return 0;
277
278}
#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 DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
PetscErrorCode DMMoFEMKSPSetComputeRHS(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set KSP right hand side evaluation function
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
PetscErrorCode DMMoFEMKSPSetComputeOperators(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
Set KSP operators and push mofem finite element methods.
const FTensor::Tensor2< T, Dim, Dim > Vec
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
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.
Simple interface for fast problem set-up.
const std::string getBoundaryFEName() const
Get the Boundary FE Name.
MoFEMErrorCode addDataField(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.
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.
MoFEMErrorCode getOptions()
get options
MoFEMErrorCode getDM(DM *dm)
Get DM.
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name)
Load mesh file.
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
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 setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
const std::string getDomainFEName() const
Get the Domain FE Name.
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< PostProcFE > &post_proc_volume) const
Create finite element to post-process results.
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.
MoFEMErrorCode createFEToAssembleMatrixAndVector(boost::function< double(const double, const double, const double)> f_u, boost::function< double(const double, const double, const double)> f_source, 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, bool trans=true) const
Create finite element to calculate matrix and vectors.