45 int main(
int argc,
char *argv[])
48 const char *mesh_file =
"../data/beam-hex.mesh";
50 bool static_cond =
false;
52 const char *device_config =
"cpu";
53 bool visualization = 1;
56 args.
AddOption(&mesh_file,
"-m",
"--mesh",
59 "Finite element order (polynomial degree).");
60 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
61 "--no-static-condensation",
"Enable static condensation.");
62 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
63 "--no-partial-assembly",
"Enable Partial Assembly.");
64 args.
AddOption(&device_config,
"-d",
"--device",
65 "Device configuration string, see Device::Configure().");
66 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
68 "Enable or disable GLVis visualization.");
80 Device device(device_config);
86 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
95 int ref_levels = (int)floor(log(50000./mesh->
GetNE())/log(2.)/
dim);
96 for (
int l = 0; l < ref_levels; l++)
112 cout <<
"Number of Nedelec finite element unknowns: " << size << endl;
113 cout <<
"Number of H1 finite element unknowns: " << H1size << endl;
217 cout <<
"\n Solution of (E_h,v) = (grad p_h,v) for E_h and v in H(curl): "
218 "|| E_h - grad p ||_{L^2} = " << errSol <<
'\n' << endl;
219 cout <<
" Gradient interpolant E_h = grad p_h in H(curl): || E_h - grad p"
220 "||_{L^2} = " << errInterp <<
'\n' << endl;
221 cout <<
" Projection E_h of exact grad p in H(curl): || E_h - grad p "
222 "||_{L^2} = " << errProj <<
'\n' << endl;
227 ofstream mesh_ofs(
"refined.mesh");
228 mesh_ofs.precision(8);
229 mesh->
Print(mesh_ofs);
230 ofstream sol_ofs(
"sol.gf");
231 sol_ofs.precision(8);
237 char vishost[] =
"localhost";
240 sol_sock.precision(8);
241 sol_sock <<
"solution\n" << *mesh << x << flush;
262 return sin(x(0)) * sin(x(1)) * sin(x(2));
266 return sin(x(0)) * sin(x(1));
276 f(0) = cos(x(0)) * sin(x(1)) * sin(x(2));
277 f(1) = sin(x(0)) * cos(x(1)) * sin(x(2));
278 f(2) = sin(x(0)) * sin(x(1)) * cos(x(2));
282 f(0) = cos(x(0)) * sin(x(1));
283 f(1) = sin(x(0)) * cos(x(1));
284 if (x.
Size() == 3) { f(2) = 0.0; }
virtual void Print(std::ostream &out=mfem::out) const
Conjugate gradient method.
Class for grid function - Vector with associated FE space.
Data type for scaled Jacobi-type smoother of sparse matrix.
void SetFromTrueVector()
Shortcut for calling SetFromTrueDofs() with GetTrueVector() as argument.
Subclass constant coefficient.
virtual double ComputeL2Error(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
int Size() const
Returns the size of the vector.
int GetNE() const
Returns number of elements.
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
int main(int argc, char *argv[])
void AddDomainInterpolator(DiscreteInterpolator *di)
Adds a domain interpolator. Assumes ownership of di.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
void SetTrueVector()
Shortcut for calling GetTrueDofs() with GetTrueVector() as argument.
void SetPrintLevel(int print_lvl)
Jacobi smoothing for a given bilinear form (no matrix necessary).
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetMaxIter(int max_it)
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
virtual void ReorientTetMesh()
void PrintUsage(std::ostream &out) const
double p_exact(const Vector &x)
int SpaceDimension() const
void SetRelTol(double rtol)
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
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 PrintOptions(std::ostream &out) const
virtual void ProjectCoefficient(Coefficient &coeff)
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
class for C-function coefficient
Arbitrary order H(curl)-conforming Nedelec finite elements.
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Arbitrary order H1-conforming (continuous) finite elements.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
virtual void Assemble(int skip_zeros=1)
Construct the internal matrix representation of the discrete linear operator.
void gradp_exact(const Vector &, Vector &)
double sigma(const Vector &x)