43 int main(
int argc,
char *argv[])
47 MPI_Init(&argc, &argv);
48 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
49 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
52 const char *mesh_file =
"../data/beam-tet.mesh";
53 int ser_ref_levels = 2;
54 int par_ref_levels = 1;
57 bool visualization = 1;
58 const char *device_config =
"cpu";
61 args.
AddOption(&mesh_file,
"-m",
"--mesh",
63 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
64 "Number of times to refine the mesh uniformly in serial.");
65 args.
AddOption(&par_ref_levels,
"-rp",
"--refine-parallel",
66 "Number of times to refine the mesh uniformly in parallel.");
68 "Finite element order (polynomial degree) or -1 for"
69 " isoparametric space.");
71 "Number of desired eigenmodes.");
72 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
74 "Enable or disable GLVis visualization.");
75 args.
AddOption(&device_config,
"-d",
"--device",
76 "Device configuration string, see Device::Configure().");
94 Device device(device_config);
95 if (myid == 0) { device.
Print(); }
100 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
106 for (
int lev = 0; lev < ser_ref_levels; lev++)
117 for (
int lev = 0; lev < par_ref_levels; lev++)
130 cout <<
"Number of unknowns: " << size << endl;
202 ostringstream mesh_name, mode_name;
203 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
205 ofstream mesh_ofs(mesh_name.str().c_str());
206 mesh_ofs.precision(8);
207 pmesh->
Print(mesh_ofs);
209 for (
int i=0; i<nev; i++)
214 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"."
215 << setfill(
'0') << setw(6) << myid;
217 ofstream mode_ofs(mode_name.str().c_str());
218 mode_ofs.precision(8);
230 mode_sock.precision(8);
232 for (
int i=0; i<nev; i++)
236 cout <<
"Eigenmode " << i+1 <<
'/' << nev
237 <<
", Lambda = " << eigenvalues[i] << endl;
243 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n"
244 <<
"solution\n" << *pmesh << x << flush
245 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
246 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
251 cout <<
"press (q)uit or (c)ontinue --> " << flush;
254 MPI_Bcast(&c, 1, MPI_CHAR, 0, MPI_COMM_WORLD);
int Size() const
Return the logical size of the array.
The Auxiliary-space Maxwell Solver in hypre.
A coefficient that is constant across space and time.
void SetMassMatrix(const HypreParMatrix &M)
virtual void ReorientTetMesh()
See the remarks for the serial version in mesh.hpp.
Integrator for (curl u, curl v) for Nedelec elements.
HYPRE_BigInt GlobalTrueVSize() const
void SetPreconditioner(HypreSolver &precond)
virtual void Save(std::ostream &out) const
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
Abstract parallel finite element space.
int close()
Close the socketstream.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
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.
virtual void Print(std::ostream &out=mfem::out) const
void PrintUsage(std::ostream &out) const
Print the usage message.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
void SetPrintLevel(int print_lvl)
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...
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
void Solve()
Solve the eigenproblem.
void SetNumModes(int num_eigs)
const HypreParVector & GetEigenvector(unsigned int i) const
Extract a single eigenvector.
void SetMaxIter(int max_iter)
void PrintOptions(std::ostream &out) const
Print the options.
void GetEigenvalues(Array< double > &eigenvalues) const
Collect the converged eigenvalues.
void SetPrintLevel(int logging)
Arbitrary order H(curl)-conforming Nedelec finite elements.
void SetOperator(const HypreParMatrix &A)
Class for parallel grid function.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
Wrapper for hypre's ParCSR matrix class.
Class for parallel meshes.
void SetSingularProblem()
Set this option when solving a curl-curl problem with zero mass term.
bool Good() const
Return true if the command line options were parsed successfully.