40 int main(
int argc,
char *argv[])
43 const char *mesh_file =
"../data/star.mesh";
49 bool visualization = 1;
52 args.
AddOption(&mesh_file,
"-m",
"--mesh",
54 args.
AddOption(&ref_levels,
"-r",
"--refine",
55 "Number of times to refine the mesh uniformly, -1 for auto.");
57 "Finite element order (polynomial degree) >= 0.");
59 "One of the three DG penalty parameters, typically +1/-1."
60 " See the documentation of class DGDiffusionIntegrator.");
62 "One of the three DG penalty parameters, should be positive."
63 " Negative values are replaced with (order+1)^2.");
64 args.
AddOption(&eta,
"-e",
"--eta",
"BR2 penalty parameter.");
65 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
67 "Enable or disable GLVis visualization.");
76 kappa = (order+1)*(order+1);
83 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
93 ref_levels = (int)floor(log(50000./mesh->
GetNE())/log(2.)/
dim);
95 for (
int l = 0; l < ref_levels; l++)
109 cout <<
"Number of unknowns: " << fespace->
GetVSize() << endl;
145 #ifndef MFEM_USE_SUITESPARSE
152 PCG(A, M, *b, x, 1, 500, 1e-12, 0.0);
156 GMRES(A, M, *b, x, 1, 500, 10, 1e-12, 0.0);
161 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
163 umf_solver.
Mult(*b, x);
168 ofstream mesh_ofs(
"refined.mesh");
169 mesh_ofs.precision(8);
170 mesh->
Print(mesh_ofs);
171 ofstream sol_ofs(
"sol.gf");
172 sol_ofs.precision(8);
181 sol_sock.precision(8);
182 sol_sock <<
"solution\n" << *mesh << x << flush;
Class for domain integration L(v) := (f, v)
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
Class for grid function - Vector with associated FE space.
A coefficient that is constant across space and time.
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.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
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
Print the usage message.
L2_FECollection DG_FECollection
Declare an alternative name for L2_FECollection = DG_FECollection.
double Control[UMFPACK_CONTROL]
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
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)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
NURBSExtension * NURBSext
Optional NURBS mesh extension.
virtual void Print(std::ostream &os=mfem::out) const
void PrintOptions(std::ostream &out) const
Print the options.
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
int GMRES(const Operator &A, Vector &x, const Vector &b, Solver &M, int &max_iter, int m, double &tol, double atol, int printit)
GMRES method. (tolerances are squared)
virtual void SetOperator(const Operator &op)
Factorize the given Operator op which must be a SparseMatrix.
double sigma(const Vector &x)
bool Good() const
Return true if the command line options were parsed successfully.