53 int main(
int argc,
char *argv[])
56 Mpi::Init(argc, argv);
57 int num_procs = Mpi::WorldSize();
58 int myid = Mpi::WorldRank();
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);
195 a.SetDiagonalPolicy(Operator::DIAG_ONE);
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);
318 a.RecoverFEMSolution(X,
b, x);
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;
double GetGeckoElementOrdering(Array< int > &ordering, int iterations=4, int window=4, int period=2, int seed=0, bool verbose=false, double time_limit=0)
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.
void PrintOptions(std::ostream &out) const
Print the options.
int Dimension() const
Dimension of the reference space used within the elements.
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...
void PrintUsage(std::ostream &out) const
Print the usage message.
virtual void Update(bool want_transform=true)
Pointer to an Operator of a specified type.
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
bool Nonconforming() const
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
bool Good() const
Return true if the command line options were parsed successfully.
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.
void ParPrint(std::ostream &out) const
Save the mesh in a parallel mesh format.
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
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)
Set the curvature of the mesh nodes using the given polynomial degree.
void GetHilbertElementOrdering(Array< int > &ordering)
HYPRE_BigInt GlobalTrueVSize() const
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
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...
int SpaceDimension() const
Dimension of the physical space containing the mesh.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
void ReorderElements(const Array< int > &ordering, bool reorder_vertices=true)
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
int Size() const
Return the logical size of the array.
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 ...
bool Stop() const
Check if STOP action is requested, e.g. stopping criterion is satisfied.
Class for parallel meshes.
Arbitrary order "L2-conforming" discontinuous finite elements.
int main(int argc, char *argv[])