53int main(
int argc,
char *argv[])
62 const char *mesh_file =
"../data/star.mesh";
65 const char *device_config =
"cpu";
66 bool nc_simplices =
true;
68 int max_dofs = 100000;
69 bool smooth_rt =
true;
71 bool visualization =
true;
74 args.
AddOption(&mesh_file,
"-m",
"--mesh",
77 "Finite element order (polynomial degree).");
78 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
79 "--no-partial-assembly",
"Enable Partial Assembly.");
80 args.
AddOption(&device_config,
"-d",
"--device",
81 "Device configuration string, see Device::Configure().");
82 args.
AddOption(&reorder_mesh,
"-rm",
"--reorder-mesh",
83 "Reorder elements of the coarse mesh to improve "
84 "dynamic partitioning: 0=none, 1=hilbert, 2=gecko.");
85 args.
AddOption(&nc_simplices,
"-ns",
"--nonconforming-simplices",
86 "-cs",
"--conforming-simplices",
87 "For simplicial meshes, enable/disable nonconforming"
89 args.
AddOption(&max_dofs,
"-md",
"--max-dofs",
90 "Stop after reaching this many degrees of freedom.");
91 args.
AddOption(&smooth_rt,
"-rt",
"--smooth-rt",
"-h1",
"--smooth-h1",
92 "Represent the smooth flux in RT or vector H1 space.");
93 args.
AddOption(&restart,
"-res",
"--restart",
"-no-res",
"--no-restart",
94 "Restart computation from the last checkpoint.");
95 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
97 "Enable or disable GLVis visualization.");
114 Device device(device_config);
115 if (myid == 0) { device.
Print(); }
123 Mesh mesh(mesh_file, 1, 1);
145 switch (reorder_mesh)
149 default: MFEM_ABORT(
"Unknown mesh reodering type " << reorder_mesh);
163 pmesh =
new ParMesh(MPI_COMM_WORLD, mesh);
171 MFEM_VERIFY(ifs.good(),
"Checkpoint file " << fname <<
" not found.");
172 pmesh =
new ParMesh(MPI_COMM_WORLD, ifs);
179 "Boundary attributes required in the mesh.");
194 a.SetAssemblyLevel(AssemblyLevel::PARTIAL);
202 a.AddDomainIntegrator(integ);
222 cout <<
"Unable to connect to GLVis server at "
224 cout <<
"GLVis visualization disabled.\n";
226 visualization =
false;
240 if (smooth_rt &&
dim > 1)
263 for (
int it = 0; ; it++)
268 cout <<
"\nAMR iteration " << it << endl;
269 cout <<
"Number of unknowns: " << global_dofs << endl;
289 const int copy_interior = 1;
290 a.FormLinearSystem(ess_tdof_list, x,
b, A, X, B, copy_interior);
323 sout <<
"parallel " << num_procs <<
" " << myid <<
"\n";
324 sout <<
"solution\n" << *pmesh << x << flush;
327 if (global_dofs >= max_dofs)
331 cout <<
"Reached the maximum number of dofs. Stop." << endl;
340 refiner.
Apply(*pmesh);
345 cout <<
"Stopping criterion satisfied. Stop." << endl;
379 if ((it + 1) % 5 == 0)
387 cout <<
"\nCheckpoint saved." << endl;
392 delete smooth_flux_fes;
393 delete smooth_flux_fec;
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
int Size() const
Return the logical size of the array.
Conjugate gradient method.
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
virtual void Mult(const Vector &b, Vector &x) const
Iterative solution of the linear system using the Conjugate Gradient method.
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 .
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
Arbitrary order H1-conforming (continuous) finite elements.
The BoomerAMG solver in hypre.
void SetPrintLevel(int print_level)
static void Init()
Initialize hypre by calling HYPRE_Init() and set default options. After calling Hypre::Init(),...
void SetRelTol(real_t rtol)
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
void SetMaxIter(int max_it)
The L2ZienkiewiczZhuEstimator class implements the Zienkiewicz-Zhu error estimation procedure where t...
Arbitrary order "L2-conforming" discontinuous finite elements.
bool Apply(Mesh &mesh)
Perform the mesh operation.
bool Stop() const
Check if STOP action is requested, e.g. stopping criterion is satisfied.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
bool Nonconforming() const
real_t GetGeckoElementOrdering(Array< int > &ordering, int iterations=4, int window=4, int period=2, int seed=0, bool verbose=false, real_t time_limit=0)
int Dimension() const
Dimension of the reference space used within the elements.
void ReorderElements(const Array< int > &ordering, bool reorder_vertices=true)
int SpaceDimension() const
Dimension of the physical space containing the mesh.
void GetHilbertElementOrdering(Array< int > &ordering)
void EnsureNCMesh(bool simplices_nonconforming=false)
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
Set the curvature of the mesh nodes using the given polynomial degree.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
static int WorldRank()
Return the MPI rank in MPI_COMM_WORLD.
static int WorldSize()
Return the size of MPI_COMM_WORLD.
static void Init(int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
Singleton creation with Mpi::Init(argc, argv).
Pointer to an Operator of a specified type.
Jacobi smoothing for a given bilinear form (no matrix necessary).
@ DIAG_ONE
Set the diagonal value to one.
virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x)
Reconstruct a solution vector x (e.g. a GridFunction) from the solution X of a constrained linear sys...
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
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...
bool Good() const
Return true if the command line options were parsed successfully.
Abstract parallel finite element space.
void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1) const override
HYPRE_BigInt GlobalTrueVSize() const
void Update(bool want_transform=true) override
Class for parallel grid function.
void Update() override
Transform by the Space UpdateMatrix (e.g., on Mesh change).
Class for parallel meshes.
void ParPrint(std::ostream &out, const std::string &comments="") const
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
Mesh refinement operator using an error threshold.
void SetTotalErrorFraction(real_t fraction)
Set the total fraction used in the computation of the threshold. The default value is 1/2.
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
std::string MakeParFilename(const std::string &prefix, const int myid, const std::string suffix, const int width)
Construct a string of the form "<prefix><myid><suffix>" where the integer myid is padded with leading...