34constexpr auto MESH_TRI = MFEM_SOURCE_DIR
"/miniapps/mtop/sq_2D_9_tri.mesh";
35constexpr auto MESH_QUAD = MFEM_SOURCE_DIR
"/miniapps/mtop/sq_2D_9_quad.mesh";
37int main(
int argc,
char *argv[])
45 const char *device_config =
"cpu";
49 bool mesh_tri =
false;
50 bool mesh_quad =
false;
51 int par_ref_levels = 1;
52 bool paraview =
false;
53 bool visualization =
true;
56 args.
AddOption(&mesh_file,
"-m",
"--mesh",
"Mesh file to use.");
57 args.
AddOption(&device_config,
"-d",
"--device",
58 "Device configuration string, see Device::Configure().");
60 "Finite element order (polynomial degree) or -1 for"
61 " isoparametric space.");
62 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
63 "--no-partial-assembly",
"Enable Partial Assembly.");
64 args.
AddOption(&dfem,
"-dfem",
"--dFEM",
"-no-dfem",
"--no-dFEM",
65 "Enable or not dFEM.");
66 args.
AddOption(&mesh_tri,
"-tri",
"--triangular",
"-no-tri",
67 "--no-triangular",
"Enable or not triangular mesh.");
68 args.
AddOption(&mesh_quad,
"-quad",
"--quadrilateral",
"-no-quad",
69 "--no-quadrilateral",
"Enable or not quadrilateral mesh.");
70 args.
AddOption(&par_ref_levels,
"-prl",
"--par-ref-levels",
71 "Number of times to refine the mesh uniformly in parallel.");
72 args.
AddOption(¶view,
"-pv",
"--paraview",
"-no-pv",
"--no-paraview",
73 "Enable or not Paraview visualization");
74 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
76 "Enable or disable GLVis visualization.");
78 MFEM_VERIFY(!(pa && dfem),
"pa and dfem cannot be both set");
82 Device device(device_config);
96 const int ref_levels =
97 (int)floor(log(1000. / mesh.
GetNE()) / log(2.) /
dim);
102 std::cout <<
"Number of elements: " << mesh.
GetNE() << std::endl;
108 ParMesh pmesh(MPI_COMM_WORLD, mesh);
116 std::cout <<
"Number of unknowns: "
157 (glvis.open(
"localhost", 19916), glvis.is_open()))
160 glvis <<
"solution\n" << pmesh << sol << std::flush;
The IsoLinElasticSolver class provides a solver for linear isotropic elasticity. The solver provides ...
void AddDispBC(int id, int dir, real_t val)
Adds displacement BC in direction 0(x), 1(y), 2(z), or -1(all).
void FSolve()
Solves the forward problem.
void SetMaterial(mfem::Coefficient &E_, mfem::Coefficient &nu_)
Set material.
mfem::ParGridFunction & GetDisplacements()
Returns the displacements.
void SetLinearSolver(real_t rtol=1e-8, real_t atol=1e-12, int miter=200)
void AddSurfLoad(int id, real_t fx, real_t fy, real_t fz=0.0)
Add surface load.
mfem::Vector & GetSolutionVector()
Returns the solution vector.
A coefficient that is constant across space and time.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
void SetTime(real_t t)
Set physical time (for time-dependent simulations)
void SetPrefixPath(const std::string &prefix)
Set the path where the DataCollection will be saved.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
void Print(std::ostream &os=mfem::out)
Print the configuration of the MFEM virtual device object.
static void Init()
Initialize hypre by calling HYPRE_Init() and set default options. After calling Hypre::Init(),...
void Clear()
Clear the contents of the Mesh.
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
static bool Root()
Return true if the rank in MPI_COMM_WORLD is zero.
static int WorldRank()
Return the MPI rank in MPI_COMM_WORLD.
static int WorldSize()
Return the size of MPI_COMM_WORLD.
static void Init(int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
Singleton creation with Mpi::Init(argc, argv).
void ParseCheck(std::ostream &out=mfem::out)
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...
Class for parallel grid function.
Class for parallel meshes.
void SetLevelsOfDetail(int levels_of_detail_)
Set the refinement level.
void SetHighOrderOutput(bool high_order_output_)
Sets whether or not to output the data as high-order elements (false by default).
void SetDataFormat(VTKFormat fmt)
Set the data format for the ParaView output files.
Writer for ParaView visualization (PVD and VTU format)
int Size() const
Returns the size of the vector.