49 int main(
int argc,
char *argv[])
52 Mpi::Init(argc, argv);
53 int num_procs = Mpi::WorldSize();
54 int myid = Mpi::WorldRank();
58 const char *mesh_file =
"../data/beam-tri.mesh";
62 bool visualization = 1;
67 args.
AddOption(&mesh_file,
"-m",
"--mesh",
70 "Finite element order (polynomial degree).");
72 "Number of desired eigenmodes.");
74 "Random seed used to initialize LOBPCG.");
75 args.
AddOption(&amg_elast,
"-elast",
"--amg-for-elasticity",
"-sys",
77 "Use the special AMG elasticity solver (GM/LN approaches), " 78 "or standard AMG for systems (unknown approach).");
79 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
81 "Enable or disable GLVis visualization.");
82 args.
AddOption(&adios2,
"-adios2",
"--adios2-streams",
"-no-adios2",
83 "--no-adios2-streams",
84 "Save data using adios2 streams.");
102 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
108 cerr <<
"\nInput mesh should have at least two materials!" 109 <<
" (See schematic in ex12p.cpp)\n" 127 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
128 for (
int l = 0; l < ref_levels; l++)
140 int par_ref_levels = 1;
141 for (
int l = 0; l < par_ref_levels; l++)
155 const bool use_nodal_fespace = pmesh->
NURBSext && !amg_elast;
156 if (use_nodal_fespace)
169 cout <<
"Number of unknowns: " << size << endl
170 <<
"Assembling: " << flush;
184 lambda(0) = lambda(1)*50;
199 cout <<
"matrix ... " << flush;
202 a->EliminateEssentialBCDiag(ess_bdr, 1.0);
213 cout <<
"done." << endl;
262 if (!use_nodal_fespace)
270 ostringstream mesh_name, mode_name;
271 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
273 ofstream mesh_ofs(mesh_name.str().c_str());
274 mesh_ofs.precision(8);
275 pmesh->
Print(mesh_ofs);
277 for (
int i=0; i<nev; i++)
282 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"." 283 << setfill(
'0') << setw(6) << myid;
285 ofstream mode_ofs(mode_name.str().c_str());
286 mode_ofs.precision(8);
294 #ifdef MFEM_USE_ADIOS2 297 std::string postfix(mesh_file);
298 postfix.erase(0, std::string(
"../data/").size() );
299 postfix +=
"_o" + std::to_string(order);
303 pmesh->
Print(adios2output);
304 for (
int i=0; i<nev; i++)
308 x.
Save(adios2output,
"mode_" + std::to_string(i));
321 for (
int i=0; i<nev; i++)
325 cout <<
"Eigenmode " << i+1 <<
'/' << nev
326 <<
", Lambda = " << eigenvalues[i] << endl;
332 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n" 333 <<
"solution\n" << *pmesh << x << flush
334 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
335 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
340 cout <<
"press (q)uit or (c)ontinue --> " << flush;
343 MPI_Bcast(&c, 1, MPI_CHAR, 0, MPI_COMM_WORLD);
void GetEigenvalues(Array< double > &eigenvalues) const
Collect the converged eigenvalues.
void PrintOptions(std::ostream &out) const
Print the options.
int Dimension() const
Dimension of the reference space used within the elements.
const HypreParVector & GetEigenvector(unsigned int i) const
Extract a single eigenvector.
void PrintUsage(std::ostream &out) const
Print the usage message.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void SetPreconditioner(Solver &precond)
void SetMassMatrix(Operator &M)
bool Good() const
Return true if the command line options were parsed successfully.
Abstract parallel finite element space.
void SetPrintLevel(int logging)
int close()
Close the socketstream.
The BoomerAMG solver in hypre.
void SetMaxIter(int max_iter)
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetPrintLevel(int print_level)
int main(int argc, char *argv[])
void SetElasticityOptions(ParFiniteElementSpace *fespace)
HYPRE_BigInt GlobalTrueVSize() const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
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)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
virtual void Save(std::ostream &out) const
void SetRandomSeed(int s)
int GetNE() const
Returns number of elements.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
A piecewise constant coefficient with the constants keyed off the element attribute numbers...
void DegreeElevate(int rel_degree, int degree=16)
void SetOperator(Operator &A)
void SetPrecondUsageMode(int pcg_mode)
void SetSystemsOptions(int dim, bool order_bynodes=false)
void SetNodalFESpace(FiniteElementSpace *nfes) override
Arbitrary order H1-conforming (continuous) finite elements.
void GetNodes(Vector &node_coord) const
void Print(std::ostream &out=mfem::out) const override
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.