38 int main(
int argc,
char *argv[])
41 const char *mesh_file =
"../data/beam-tet.mesh";
43 bool visualization = 1;
46 args.
AddOption(&mesh_file,
"-m",
"--mesh",
49 "Finite element order (polynomial degree).");
50 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
52 "Enable or disable GLVis visualization.");
65 ifstream imesh(mesh_file);
68 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
71 mesh =
new Mesh(imesh, 1, 1);
76 cerr <<
"\nThis example requires a 3D mesh\n" << endl;
86 (int)floor(log(50000./mesh->
GetNE())/log(2.)/dim);
87 for (
int l = 0; l < ref_levels; l++)
97 cout <<
"Number of unknowns: " << fespace->
GetVSize() << endl;
135 #ifndef MFEM_USE_SUITESPARSE
140 PCG(A, M, *b, x, 1, 500, 1e-12, 0.0);
144 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
146 umf_solver.
Mult(*b, x);
150 cout <<
"\n|| E_h - E ||_{L^2} = " << x.
ComputeL2Error(E) <<
'\n' << endl;
155 ofstream mesh_ofs(
"refined.mesh");
156 mesh_ofs.precision(8);
157 mesh->
Print(mesh_ofs);
158 ofstream sol_ofs(
"sol.gf");
159 sol_ofs.precision(8);
166 char vishost[] =
"localhost";
169 sol_sock.precision(8);
170 sol_sock <<
"solution\n" << *mesh << x << flush;
190 E(0) = sin(
kappa * x(1));
191 E(1) = sin(
kappa * x(2));
192 E(2) = sin(
kappa * x(0));
Class for grid function - Vector with associated FE space.
Subclass constant coefficient.
Integrator for (curl u, curl v) for Nedelec elements.
int GetNE() const
Returns number of 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 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)
virtual void ReorientTetMesh()
void PrintUsage(std::ostream &out) const
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)
void E_exact(const Vector &, Vector &)
for VectorFiniteElements (Nedelec, Raviart-Thomas)
Arbitrary order H(curl)-conforming Nedelec finite elements.
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.