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;
60 args.
AddOption(&mesh_file,
"-m",
"--mesh",
62 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
63 "Number of times to refine the mesh uniformly in serial.");
64 args.
AddOption(&par_ref_levels,
"-rp",
"--refine-parallel",
65 "Number of times to refine the mesh uniformly in parallel.");
67 "Finite element order (polynomial degree) or -1 for"
68 " isoparametric space.");
70 "Number of desired eigenmodes.");
71 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
73 "Enable or disable GLVis visualization.");
92 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
98 for (
int lev = 0; lev < ser_ref_levels; lev++)
109 for (
int lev = 0; lev < par_ref_levels; lev++)
122 cout <<
"Number of unknowns: " << size << endl;
194 ostringstream mesh_name, mode_name;
195 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
197 ofstream mesh_ofs(mesh_name.str().c_str());
198 mesh_ofs.precision(8);
199 pmesh->
Print(mesh_ofs);
201 for (
int i=0; i<nev; i++)
206 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"."
207 << setfill(
'0') << setw(6) << myid;
209 ofstream mode_ofs(mode_name.str().c_str());
210 mode_ofs.precision(8);
219 char vishost[] =
"localhost";
222 mode_sock.precision(8);
224 for (
int i=0; i<nev; i++)
228 cout <<
"Eigenmode " << i+1 <<
'/' << nev
229 <<
", Lambda = " << eigenvalues[i] << endl;
235 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n"
236 <<
"solution\n" << *pmesh << x << flush
237 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
238 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
243 cout <<
"press (q)uit or (c)ontinue --> " << flush;
246 MPI_Bcast(&c, 1, MPI_CHAR, 0, MPI_COMM_WORLD);
int Size() const
Logical size of the array.
The Auxiliary-space Maxwell Solver in hypre.
Subclass constant coefficient.
virtual void ReorientTetMesh()
See the remarks for the serial version in mesh.hpp.
Integrator for (curl u, curl v) for Nedelec elements.
void GetEigenvalues(Array< double > &eigenvalues)
Collect the converged eigenvalues.
void SetPreconditioner(HypreSolver &precond)
virtual void Save(std::ostream &out) const
Abstract parallel finite element space.
void SetOperator(HypreParMatrix &A)
int main(int argc, char *argv[])
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.
HYPRE_Int GlobalTrueVSize() const
virtual void Print(std::ostream &out=mfem::out) const
void PrintUsage(std::ostream &out) const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
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)
void SetSize(int nsize)
Change logical size of the array, keep existing entries.
void Solve()
Solve the eigenproblem.
void SetNumModes(int num_eigs)
void SetMaxIter(int max_iter)
void SetMassMatrix(HypreParMatrix &M)
void PrintOptions(std::ostream &out) const
void SetPrintLevel(int logging)
Arbitrary order H(curl)-conforming Nedelec finite elements.
HypreParVector & GetEigenvector(unsigned int i)
Extract a single eigenvector.
Class for parallel grid function.
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.
Integrator for (Q u, v) for VectorFiniteElements.