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";
59 bool visualization = 1;
63 args.
AddOption(&mesh_file,
"-m",
"--mesh",
66 "Finite element order (polynomial degree).");
68 "Number of desired eigenmodes.");
70 "Random seed used to initialize LOBPCG.");
71 args.
AddOption(&amg_elast,
"-elast",
"--amg-for-elasticity",
"-sys",
73 "Use the special AMG elasticity solver (GM/LN approaches), "
74 "or standard AMG for systems (unknown approach).");
75 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
77 "Enable or disable GLVis visualization.");
96 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
102 cerr <<
"\nInput mesh should have at least two materials!"
103 <<
" (See schematic in ex12p.cpp)\n"
122 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
123 for (
int l = 0; l < ref_levels; l++)
135 int par_ref_levels = 1;
136 for (
int l = 0; l < par_ref_levels; l++)
150 const bool use_nodal_fespace = pmesh->
NURBSext && !amg_elast;
151 if (use_nodal_fespace)
164 cout <<
"Number of unknowns: " << size << endl
165 <<
"Assembling: " << flush;
179 lambda(0) = lambda(1)*50;
194 cout <<
"matrix ... " << flush;
208 cout <<
"done." << endl;
257 if (!use_nodal_fespace)
265 ostringstream mesh_name, mode_name;
266 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
268 ofstream mesh_ofs(mesh_name.str().c_str());
269 mesh_ofs.precision(8);
270 pmesh->
Print(mesh_ofs);
272 for (
int i=0; i<nev; i++)
277 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"."
278 << setfill(
'0') << setw(6) << myid;
280 ofstream mode_ofs(mode_name.str().c_str());
281 mode_ofs.precision(8);
291 char vishost[] =
"localhost";
295 for (
int i=0; i<nev; i++)
299 cout <<
"Eigenmode " << i+1 <<
'/' << nev
300 <<
", Lambda = " << eigenvalues[i] << endl;
306 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n"
307 <<
"solution\n" << *pmesh << x << flush
308 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
309 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
314 cout <<
"press (q)uit or (c)ontinue --> " << flush;
317 MPI_Bcast(&c, 1, MPI_CHAR, 0, MPI_COMM_WORLD);
HypreParVector & GetEigenvector(unsigned int i)
Extract a single eigenvector.
void DegreeElevate(int t)
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)
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 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.