56int main(
int argc,
char *argv[])
61 const char *mesh_file =
"../../data/star.mesh";
62 const char *device_config =
"cpu";
69 args.
AddOption(&device_config,
"-d",
"--device",
70 "Device configuration string, see Device::Configure().");
71 args.
AddOption(&mesh_file,
"-m",
"--mesh",
"Mesh file to use.");
72 args.
AddOption(&ser_ref,
"-rs",
"--serial-refine",
73 "Number of times to refine the mesh in serial.");
74 args.
AddOption(&par_ref,
"-rp",
"--parallel-refine",
75 "Number of times to refine the mesh in parallel.");
76 args.
AddOption(&order,
"-o",
"--order",
"Polynomial degree.");
77 args.
AddOption(&
alpha,
"-a",
"--alpha",
"Value of alpha coefficient.");
80 Device device(device_config);
85 MFEM_VERIFY(
dim == 2 ||
dim == 3,
"Spatial dimension must be 2 or 3.");
99 cout <<
"\nRT DOFs: " << ndofs_rt <<
"\nL2 DOFs: " << ndofs_l2 << endl;
120 if (
Mpi::Root()) { cout <<
"\nSaddle point solver... " << flush; }
142 const auto solver_mode = HdivSaddlePointSolver::Mode::DARCY;
144 mesh, fes_rt, fes_l2, alpha_coeff, one, ess_rt_dofs, solver_mode);
154 saddle_point_solver.
Mult(B_block, X_block);
155 X_block.SyncToBlocks();
159 cout <<
"Done.\nIterations: "
167 if (
Mpi::Root()) { cout <<
"L2 error: " << error << endl; }
176 ParMesh mesh(MPI_COMM_WORLD, serial_mesh);
@ GaussLobatto
Closed type.
@ GaussLegendre
Open type.
A class to handle Vectors in a block fashion.
void SyncFromBlocks() const
Synchronize the memory location flags (i.e. the memory validity flags) of the big/monolithic block-ve...
Vector & GetBlock(int i)
Get the i-th vector in the block.
A coefficient that is constant across space and time.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
Class for domain integration .
A general function coefficient.
Solve the H(div) saddle-point system using MINRES with matrix-free block-diagonal preconditioning.
const Array< int > & GetOffsets() const
Return the offsets of the block system.
void Mult(const Vector &b, Vector &x) const override
Solve the linear system for L2 (scalar) and RT (flux) unknowns.
int GetNumIterations() const
Get the number of MINRES iterations.
static void Init()
Initialize hypre by calling HYPRE_Init() and set default options. After calling Hypre::Init(),...
Arbitrary order "L2-conforming" discontinuous finite elements.
void Clear()
Clear the contents of the Mesh.
int Dimension() const
Dimension of the reference space used within the elements.
static Mesh LoadFromFile(const std::string &filename, int generate_edges=0, int refine=1, bool fix_orientation=true)
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
static bool Root()
Return true if the rank in MPI_COMM_WORLD is zero.
static void Init(int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
Singleton creation with Mpi::Init(argc, argv).
void ParseCheck(std::ostream &out=mfem::out)
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...
Abstract parallel finite element space.
HYPRE_BigInt GlobalTrueVSize() const
Class for parallel grid function.
real_t ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const override
void SetFromTrueDofs(const Vector &tv) override
Set the GridFunction from the given true-dof vector.
Class for parallel meshes.
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
double RealTime()
Return the number of real seconds elapsed since the stopwatch was started.
void Start()
Start the stopwatch. The elapsed time is not cleared.
void Clear()
Clear the elapsed time on the stopwatch and restart it if it's running.
ParMesh LoadParMesh(const char *mesh_file, int ser_ref=0, int par_ref=0)
real_t u(const Vector &xvec)
std::function< real_t(const Vector &)> f(real_t mass_coeff)