53 int main(
int argc,
char *argv[])
57 MPI_Init(&argc, &argv);
58 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
59 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
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.");
115 Device device(device_config);
116 if (myid == 0) { device.
Print(); }
124 Mesh mesh(mesh_file, 1, 1);
146 switch (reorder_mesh)
150 default: MFEM_ABORT(
"Unknown mesh reodering type " << reorder_mesh);
164 pmesh =
new ParMesh(MPI_COMM_WORLD, mesh);
172 MFEM_VERIFY(ifs.good(),
"Checkpoint file " << fname <<
" not found.");
173 pmesh =
new ParMesh(MPI_COMM_WORLD, ifs);
180 "Boundary attributes required in the mesh.");
218 sout.
open(vishost, visport);
223 cout <<
"Unable to connect to GLVis server at "
224 << vishost <<
':' << visport << endl;
225 cout <<
"GLVis visualization disabled.\n";
227 visualization =
false;
241 if (smooth_rt && dim > 1)
264 for (
int it = 0; ; it++)
269 cout <<
"\nAMR iteration " << it << endl;
270 cout <<
"Number of unknowns: " << global_dofs << endl;
290 const int copy_interior = 1;
324 sout <<
"parallel " << num_procs <<
" " << myid <<
"\n";
325 sout <<
"solution\n" << *pmesh << x << flush;
328 if (global_dofs >= max_dofs)
332 cout <<
"Reached the maximum number of dofs. Stop." << endl;
341 refiner.
Apply(*pmesh);
346 cout <<
"Stopping criterion satisfied. Stop." << endl;
380 if ((it + 1) % 5 == 0)
388 cout <<
"\nCheckpoint saved." << endl;
393 delete smooth_flux_fes;
394 delete smooth_flux_fec;
double GetGeckoElementOrdering(Array< int > &ordering, int iterations=4, int window=4, int period=2, int seed=0, bool verbose=false, double time_limit=0)
int Size() const
Return the logical size of the array.
Class for domain integration L(v) := (f, v)
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
Conjugate gradient method.
A coefficient that is constant across space and time.
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
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...
virtual void Update(bool want_transform=true)
Pointer to an Operator of a specified type.
HYPRE_BigInt GlobalTrueVSize() const
bool Stop() const
Check if STOP action is requested, e.g. stopping criterion is satisfied.
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
Abstract parallel finite element space.
The L2ZienkiewiczZhuEstimator class implements the Zienkiewicz-Zhu error estimation procedure where t...
The BoomerAMG solver in hypre.
bool Apply(Mesh &mesh)
Perform the mesh operation.
bool Nonconforming() const
void SetPrintLevel(int print_lvl)
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void EnsureNCMesh(bool simplices_nonconforming=false)
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
Jacobi smoothing for a given bilinear form (no matrix necessary).
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetPrintLevel(int print_level)
Mesh refinement operator using an error threshold.
void SetMaxIter(int max_it)
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void GetHilbertElementOrdering(Array< int > &ordering)
void PrintUsage(std::ostream &out) const
Print the usage message.
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.
void SetRelTol(double rtol)
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.
void ReorderElements(const Array< int > &ordering, bool reorder_vertices=true)
void PrintOptions(std::ostream &out) const
Print the options.
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Arbitrary order H1-conforming (continuous) finite elements.
Class for parallel grid function.
void SetTotalErrorFraction(double fraction)
Set the total fraction used in the computation of the threshold. The default value is 1/2...
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
void ParPrint(std::ostream &out) const
Save the mesh in a parallel mesh format.
Class for parallel meshes.
Arbitrary order "L2-conforming" discontinuous finite elements.
bool Good() const
Return true if the command line options were parsed successfully.