50 int main(
int argc,
char *argv[])
53 const char *mesh_file =
"../data/star.mesh";
56 bool static_cond =
false;
57 bool hybridization =
false;
58 bool visualization = 1;
61 args.
AddOption(&mesh_file,
"-m",
"--mesh",
64 "Finite element order (polynomial degree).");
65 args.
AddOption(&set_bc,
"-bc",
"--impose-bc",
"-no-bc",
"--dont-impose-bc",
66 "Impose or not essential boundary conditions.");
67 args.
AddOption(&
freq,
"-f",
"--frequency",
"Set the frequency for the exact"
69 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
70 "--no-static-condensation",
"Enable static condensation.");
71 args.
AddOption(&hybridization,
"-hb",
"--hybridization",
"-no-hb",
72 "--no-hybridization",
"Enable hybridization.");
73 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
75 "Enable or disable GLVis visualization.");
88 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
98 (int)floor(log(25000./mesh->
GetNE())/log(2.)/
dim);
99 for (
int l = 0; l < ref_levels; l++)
109 cout <<
"Number of finite element unknowns: "
120 ess_bdr = set_bc ? 1 : 0;
161 else if (hybridization)
174 cout <<
"Size of linear system: " << A.
Height() << endl;
176 #ifndef MFEM_USE_SUITESPARSE
180 PCG(A, M, B, X, 1, 10000, 1e-20, 0.0);
184 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
186 umf_solver.
Mult(B, X);
193 cout <<
"\n|| F_h - F ||_{L^2} = " << x.
ComputeL2Error(F) <<
'\n' << endl;
198 ofstream mesh_ofs(
"refined.mesh");
199 mesh_ofs.precision(8);
200 mesh->
Print(mesh_ofs);
201 ofstream sol_ofs(
"sol.gf");
202 sol_ofs.precision(8);
209 char vishost[] =
"localhost";
212 sol_sock.precision(8);
213 sol_sock <<
"solution\n" << *mesh << x << flush;
259 f(0) = temp*cos(kappa*x)*sin(kappa*y);
260 f(1) = temp*cos(kappa*y)*sin(kappa*x);
int Size() const
Logical size of the array.
virtual void Print(std::ostream &out=mfem::out) const
Class for grid function - Vector with associated FE space.
Subclass constant coefficient.
virtual double ComputeL2Error(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
int Size() const
Returns the size of the vector.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
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.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
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)
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
void PrintUsage(std::ostream &out) const
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
int SpaceDimension() const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
double Control[UMFPACK_CONTROL]
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
virtual 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: y=A(x).
virtual void SetOperator(const Operator &op)
Factorize the given Operator op which must be a SparseMatrix.