43 int main(
int argc,
char *argv[])
46 const char *mesh_file =
"../data/star.mesh";
49 bool visualization = 1;
52 args.
AddOption(&mesh_file,
"-m",
"--mesh",
55 "Finite element order (polynomial degree).");
56 args.
AddOption(&set_bc,
"-bc",
"--impose-bc",
"-no-bc",
"--dont-impose-bc",
57 "Impose or not essential boundary conditions.");
58 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
60 "Enable or disable GLVis visualization.");
73 ifstream imesh(mesh_file);
76 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
79 mesh =
new Mesh(imesh, 1, 1);
89 (int)floor(log(25000./mesh->
GetNE())/log(2.)/dim);
90 for (
int l = 0; l < ref_levels; l++)
99 cout <<
"Number of unknowns: " << fespace->
GetVSize() << endl;
140 #ifndef MFEM_USE_SUITESPARSE
145 PCG(A, M, *b, x, 1, 10000, 1e-20, 0.0);
149 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
151 umf_solver.
Mult(*b, x);
155 cout <<
"\n|| F_h - F ||_{L^2} = " << x.
ComputeL2Error(F) <<
'\n' << endl;
160 ofstream mesh_ofs(
"refined.mesh");
161 mesh_ofs.precision(8);
162 mesh->
Print(mesh_ofs);
163 ofstream sol_ofs(
"sol.gf");
164 sol_ofs.precision(8);
171 char vishost[] =
"localhost";
174 sol_sock.precision(8);
175 sol_sock <<
"solution\n" << *mesh << x << flush;
200 F(0) = cos(M_PI*x)*sin(M_PI*y);
201 F(1) = cos(M_PI*y)*sin(M_PI*x);
215 double temp = 1 + 2*M_PI*M_PI;
217 f(0) = temp*cos(M_PI*x)*sin(M_PI*y);
218 f(1) = temp*cos(M_PI*y)*sin(M_PI*x);
int Size() const
Logical size of the array.
Class for grid function - Vector with associated FE space.
Subclass constant coefficient.
int Size() const
Returns the size of the vector.
int GetNE() const
Returns number of elements.
(Q div u, div v) for RT elements
Data type for Gauss-Seidel smoother of sparse matrix.
Direct sparse solver using UMFPACK.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
double ComputeL2Error(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void F_exact(const Vector &, Vector &)
void PCG(const Operator &A, Solver &B, const Vector &b, Vector &x, int print_iter, int max_num_iter, double RTOLERANCE, double ATOLERANCE)
Preconditioned conjugate gradient method. (tolerances are squared)
void PrintUsage(std::ostream &out) const
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
virtual void Print(std::ostream &out=std::cout) const
Print the mesh to the given stream using the default MFEM mesh format.
Array< int > bdr_attributes
int main(int argc, char *argv[])
double Control[UMFPACK_CONTROL]
Abstract finite element space.
Base class Coefficient that may optionally depend on time.
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
void f_exact(const Vector &, Vector &)
void PrintOptions(std::ostream &out) const
void ProjectCoefficient(Coefficient &coeff)
for VectorFiniteElements (Nedelec, Raviart-Thomas)
Integrator for (Q u, v) for VectorFiniteElements.
virtual void Mult(const Vector &b, Vector &x) const
Operator application.
virtual void SetOperator(const Operator &op)
Set/update the solver for the given operator.