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++)
121 cout <<
"Number of unknowns: " << size << endl;
193 ostringstream mesh_name, mode_name;
194 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
196 ofstream mesh_ofs(mesh_name.str().c_str());
197 mesh_ofs.precision(8);
198 pmesh->
Print(mesh_ofs);
200 for (
int i=0; i<nev; i++)
205 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"."
206 << setfill(
'0') << setw(6) << myid;
208 ofstream mode_ofs(mode_name.str().c_str());
209 mode_ofs.precision(8);
218 char vishost[] =
"localhost";
221 mode_sock.precision(8);
223 for (
int i=0; i<nev; i++)
227 cout <<
"Eigenmode " << i+1 <<
'/' << nev
228 <<
", Lambda = " << eigenvalues[i] << endl;
234 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n"
235 <<
"solution\n" << *pmesh << x << flush
236 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
237 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
242 cout <<
"press (q)uit or (c)ontinue --> " << flush;
245 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.
Integrator for (curl u, curl v) for Nedelec elements.
void GetEigenvalues(Array< double > &eigenvalues)
Collect the converged eigenvalues.
HYPRE_Int GlobalTrueVSize()
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 *)
void PrintUsage(std::ostream &out) const
Array< int > bdr_attributes
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.
virtual void Print(std::ostream &out=std::cout) const