46 int main(
int argc,
char *argv[])
50 MPI_Init(&argc, &argv);
51 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
52 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
55 const char *mesh_file =
"../data/beam-tri.mesh";
58 bool visualization = 1;
62 args.
AddOption(&mesh_file,
"-m",
"--mesh",
65 "Finite element order (polynomial degree).");
67 "Number of desired eigenmodes.");
68 args.
AddOption(&amg_elast,
"-elast",
"--amg-for-elasticity",
"-sys",
70 "Use the special AMG elasticity solver (GM/LN approaches), "
71 "or standard AMG for systems (unknown approach).");
72 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
74 "Enable or disable GLVis visualization.");
94 ifstream imesh(mesh_file);
99 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
104 mesh =
new Mesh(imesh, 1, 1);
111 cerr <<
"\nInput mesh should have at least two materials!"
112 <<
" (See schematic in ex12p.cpp)\n"
131 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
132 for (
int l = 0; l < ref_levels; l++)
144 int par_ref_levels = 1;
145 for (
int l = 0; l < par_ref_levels; l++)
159 const bool use_nodal_fespace = pmesh->
NURBSext && !amg_elast;
160 if (use_nodal_fespace)
173 cout <<
"Number of unknowns: " << size << endl
174 <<
"Assembling: " << flush;
188 lambda(0) = lambda(1)*50;
203 cout <<
"matrix ... " << flush;
217 cout <<
"done." << endl;
265 if (!use_nodal_fespace)
273 ostringstream mesh_name, mode_name;
274 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
276 ofstream mesh_ofs(mesh_name.str().c_str());
277 mesh_ofs.precision(8);
278 pmesh->
Print(mesh_ofs);
280 for (
int i=0; i<nev; i++)
285 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"."
286 << setfill(
'0') << setw(6) << myid;
288 ofstream mode_ofs(mode_name.str().c_str());
289 mode_ofs.precision(8);
299 char vishost[] =
"localhost";
303 for (
int i=0; i<nev; i++)
307 cout <<
"Eigenmode " << i+1 <<
'/' << nev
308 <<
", Lambda = " << eigenvalues[i] << endl;
314 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n"
315 <<
"solution\n" << *pmesh << x << flush
316 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
317 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
322 cout <<
"press (q)uit or (c)ontinue --> " << flush;
325 MPI_Bcast(&c, 1, MPI_CHAR, 0, MPI_COMM_WORLD);
HypreParVector & GetEigenvector(unsigned int i)
Extract a single eigenvector.
void DegreeElevate(int t)
HYPRE_Int GlobalTrueVSize()
int GetNE() const
Returns number of elements.
virtual void Save(std::ostream &out) const
void SetPreconditioner(Solver &precond)
void SetMassMatrix(Operator &M)
Abstract parallel finite element space.
void SetPrintLevel(int logging)
void SetSystemsOptions(int dim)
The BoomerAMG solver in hypre.
void SetMaxIter(int max_iter)
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetPrintLevel(int print_level)
void SetElasticityOptions(ParFiniteElementSpace *fespace)
void SetNodalFESpace(FiniteElementSpace *nfes)
void PrintUsage(std::ostream &out) const
Array< int > bdr_attributes
int main(int argc, char *argv[])
void GetEigenvalues(Array< double > &eigenvalues)
Collect the converged eigenvalues.
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)
NURBSExtension * NURBSext
class for piecewise constant coefficient
void SetOperator(Operator &A)
void PrintOptions(std::ostream &out) const
void GetNodes(Vector &node_coord) const
void SetPrecondUsageMode(int pcg_mode)
Arbitrary order H1-conforming (continuous) finite elements.
Class for parallel grid function.
Wrapper for hypre's ParCSR matrix class.
void SetNumModes(int num_eigs)
Class for parallel meshes.
void Solve()
Solve the eigenproblem.
virtual void Print(std::ostream &out=std::cout) const