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.");
93 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
99 cerr <<
"\nInput mesh should have at least two materials!"
100 <<
" (See schematic in ex12p.cpp)\n"
119 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
120 for (
int l = 0; l < ref_levels; l++)
132 int par_ref_levels = 1;
133 for (
int l = 0; l < par_ref_levels; l++)
147 const bool use_nodal_fespace = pmesh->
NURBSext && !amg_elast;
148 if (use_nodal_fespace)
161 cout <<
"Number of unknowns: " << size << endl
162 <<
"Assembling: " << flush;
176 lambda(0) = lambda(1)*50;
191 cout <<
"matrix ... " << flush;
205 cout <<
"done." << endl;
253 if (!use_nodal_fespace)
261 ostringstream mesh_name, mode_name;
262 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
264 ofstream mesh_ofs(mesh_name.str().c_str());
265 mesh_ofs.precision(8);
266 pmesh->
Print(mesh_ofs);
268 for (
int i=0; i<nev; i++)
273 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"."
274 << setfill(
'0') << setw(6) << myid;
276 ofstream mode_ofs(mode_name.str().c_str());
277 mode_ofs.precision(8);
287 char vishost[] =
"localhost";
291 for (
int i=0; i<nev; i++)
295 cout <<
"Eigenmode " << i+1 <<
'/' << nev
296 <<
", Lambda = " << eigenvalues[i] << endl;
302 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n"
303 <<
"solution\n" << *pmesh << x << flush
304 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
305 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
310 cout <<
"press (q)uit or (c)ontinue --> " << flush;
313 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)
int main(int argc, char *argv[])
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)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void SetElasticityOptions(ParFiniteElementSpace *fespace)
void SetNodalFESpace(FiniteElementSpace *nfes)
void PrintUsage(std::ostream &out) const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
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
Optional NURBS mesh extension.
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.
Array< int > attributes
A list of all unique element attributes used by the Mesh.
virtual void Print(std::ostream &out=std::cout) const