48 int main(
int argc,
char *argv[])
52 MPI_Init(&argc, &argv);
53 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
54 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
57 const char *mesh_file =
"../data/beam-tri.mesh";
61 bool visualization = 1;
65 args.
AddOption(&mesh_file,
"-m",
"--mesh",
68 "Finite element order (polynomial degree).");
70 "Number of desired eigenmodes.");
72 "Random seed used to initialize LOBPCG.");
73 args.
AddOption(&amg_elast,
"-elast",
"--amg-for-elasticity",
"-sys",
75 "Use the special AMG elasticity solver (GM/LN approaches), "
76 "or standard AMG for systems (unknown approach).");
77 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
79 "Enable or disable GLVis visualization.");
98 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
104 cerr <<
"\nInput mesh should have at least two materials!"
105 <<
" (See schematic in ex12p.cpp)\n"
124 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
125 for (
int l = 0; l < ref_levels; l++)
137 int par_ref_levels = 1;
138 for (
int l = 0; l < par_ref_levels; l++)
152 const bool use_nodal_fespace = pmesh->
NURBSext && !amg_elast;
153 if (use_nodal_fespace)
166 cout <<
"Number of unknowns: " << size << endl
167 <<
"Assembling: " << flush;
181 lambda(0) = lambda(1)*50;
196 cout <<
"matrix ... " << flush;
210 cout <<
"done." << endl;
259 if (!use_nodal_fespace)
267 ostringstream mesh_name, mode_name;
268 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
270 ofstream mesh_ofs(mesh_name.str().c_str());
271 mesh_ofs.precision(8);
272 pmesh->
Print(mesh_ofs);
274 for (
int i=0; i<nev; i++)
279 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"."
280 << setfill(
'0') << setw(6) << myid;
282 ofstream mode_ofs(mode_name.str().c_str());
283 mode_ofs.precision(8);
293 char vishost[] =
"localhost";
297 for (
int i=0; i<nev; i++)
301 cout <<
"Eigenmode " << i+1 <<
'/' << nev
302 <<
", Lambda = " << eigenvalues[i] << endl;
308 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n"
309 <<
"solution\n" << *pmesh << x << flush
310 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
311 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
316 cout <<
"press (q)uit or (c)ontinue --> " << flush;
319 MPI_Bcast(&c, 1, MPI_CHAR, 0, MPI_COMM_WORLD);
HypreParVector & GetEigenvector(unsigned int i)
Extract a single eigenvector.
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.
HYPRE_Int GlobalTrueVSize() const
virtual void Print(std::ostream &out=mfem::out) const
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)
void SetRandomSeed(int s)
NURBSExtension * NURBSext
Optional NURBS mesh extension.
class for piecewise constant coefficient
void DegreeElevate(int rel_degree, int degree=16)
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.