MFEM  v3.2
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
ex10.cpp
Go to the documentation of this file.
1 // MFEM Example 10
2 //
3 // Compile with: make ex10
4 //
5 // Sample runs:
6 // ex10 -m ../data/beam-quad.mesh -s 3 -r 2 -o 2 -dt 3
7 // ex10 -m ../data/beam-tri.mesh -s 3 -r 2 -o 2 -dt 3
8 // ex10 -m ../data/beam-hex.mesh -s 2 -r 1 -o 2 -dt 3
9 // ex10 -m ../data/beam-tet.mesh -s 2 -r 1 -o 2 -dt 3
10 // ex10 -m ../data/beam-quad.mesh -s 14 -r 2 -o 2 -dt 0.03 -vs 20
11 // ex10 -m ../data/beam-hex.mesh -s 14 -r 1 -o 2 -dt 0.05 -vs 20
12 //
13 // Description: This examples solves a time dependent nonlinear elasticity
14 // problem of the form dv/dt = H(x) + S v, dx/dt = v, where H is a
15 // hyperelastic model and S is a viscosity operator of Laplacian
16 // type. The geometry of the domain is assumed to be as follows:
17 //
18 // +---------------------+
19 // boundary --->| |
20 // attribute 1 | |
21 // (fixed) +---------------------+
22 //
23 // The example demonstrates the use of nonlinear operators (the
24 // class HyperelasticOperator defining H(x)), as well as their
25 // implicit time integration using a Newton method for solving an
26 // associated reduced backward-Euler type nonlinear equation
27 // (class BackwardEulerOperator). Each Newton step requires the
28 // inversion of a Jacobian matrix, which is done through a
29 // (preconditioned) inner solver. Note that implementing the
30 // method HyperelasticOperator::ImplicitSolve is the only
31 // requirement for high-order implicit (SDIRK) time integration.
32 //
33 // We recommend viewing examples 2 and 9 before viewing this
34 // example.
35 
36 
37 #include "mfem.hpp"
38 #include <memory>
39 #include <iostream>
40 #include <fstream>
41 
42 using namespace std;
43 using namespace mfem;
44 
45 class BackwardEulerOperator;
46 
57 class HyperelasticOperator : public TimeDependentOperator
58 {
59 protected:
60  FiniteElementSpace &fespace;
61 
62  BilinearForm M, S;
63  NonlinearForm H;
64  double viscosity;
65  HyperelasticModel *model;
66 
67  CGSolver M_solver; // Krylov solver for inverting the mass matrix M
68  DSmoother M_prec; // Preconditioner for the mass matrix M
69 
72  BackwardEulerOperator *backward_euler_oper;
74  NewtonSolver newton_solver;
76  Solver *J_solver;
78  Solver *J_prec;
79 
80  mutable Vector z; // auxiliary vector
81 
82 public:
83  HyperelasticOperator(FiniteElementSpace &f, Array<int> &ess_bdr,
84  double visc, double mu, double K);
85 
86  virtual void Mult(const Vector &vx, Vector &dvx_dt) const;
89  virtual void ImplicitSolve(const double dt, const Vector &x, Vector &k);
90 
91  double ElasticEnergy(Vector &x) const;
92  double KineticEnergy(Vector &v) const;
93  void GetElasticEnergyDensity(GridFunction &x, GridFunction &w) const;
94 
95  virtual ~HyperelasticOperator();
96 };
97 
98 // Nonlinear operator of the form:
99 // k --> (M + dt*S)*k + H(x + dt*v + dt^2*k) + S*v,
100 // where M and S are given BilinearForms, H is a given NonlinearForm, v and x
101 // are given vectors, and dt is a scalar.
102 class BackwardEulerOperator : public Operator
103 {
104 private:
105  BilinearForm *M, *S;
106  NonlinearForm *H;
107  mutable SparseMatrix *Jacobian;
108  const Vector *v, *x;
109  double dt;
110  mutable Vector w, z;
111 
112 public:
113  BackwardEulerOperator(BilinearForm *M_, BilinearForm *S_, NonlinearForm *H_);
114  void SetParameters(double dt_, const Vector *v_, const Vector *x_);
115  virtual void Mult(const Vector &k, Vector &y) const;
116  virtual Operator &GetGradient(const Vector &k) const;
117  virtual ~BackwardEulerOperator();
118 };
119 
122 class ElasticEnergyCoefficient : public Coefficient
123 {
124 private:
125  HyperelasticModel &model;
126  GridFunction &x;
127  DenseMatrix J;
128 
129 public:
130  ElasticEnergyCoefficient(HyperelasticModel &m, GridFunction &x_)
131  : model(m), x(x_) { }
132  virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip);
133  virtual ~ElasticEnergyCoefficient() { }
134 };
135 
136 void InitialDeformation(const Vector &x, Vector &y);
137 
138 void InitialVelocity(const Vector &x, Vector &v);
139 
140 void visualize(ostream &out, Mesh *mesh, GridFunction *deformed_nodes,
141  GridFunction *field, const char *field_name = NULL,
142  bool init_vis = false);
143 
144 
145 int main(int argc, char *argv[])
146 {
147  // 1. Parse command-line options.
148  const char *mesh_file = "../data/beam-quad.mesh";
149  int ref_levels = 2;
150  int order = 2;
151  int ode_solver_type = 3;
152  double t_final = 300.0;
153  double dt = 3.0;
154  double visc = 1e-2;
155  double mu = 0.25;
156  double K = 5.0;
157  bool visualization = true;
158  int vis_steps = 1;
159 
160  OptionsParser args(argc, argv);
161  args.AddOption(&mesh_file, "-m", "--mesh",
162  "Mesh file to use.");
163  args.AddOption(&ref_levels, "-r", "--refine",
164  "Number of times to refine the mesh uniformly.");
165  args.AddOption(&order, "-o", "--order",
166  "Order (degree) of the finite elements.");
167  args.AddOption(&ode_solver_type, "-s", "--ode-solver",
168  "ODE solver: 1 - Backward Euler, 2 - SDIRK2, 3 - SDIRK3,\n\t"
169  "\t 11 - Forward Euler, 12 - RK2, 13 - RK3 SSP, 14 - RK4.");
170  args.AddOption(&t_final, "-tf", "--t-final",
171  "Final time; start time is 0.");
172  args.AddOption(&dt, "-dt", "--time-step",
173  "Time step.");
174  args.AddOption(&visc, "-v", "--viscosity",
175  "Viscosity coefficient.");
176  args.AddOption(&mu, "-mu", "--shear-modulus",
177  "Shear modulus in the Neo-Hookean hyperelastic model.");
178  args.AddOption(&K, "-K", "--bulk-modulus",
179  "Bulk modulus in the Neo-Hookean hyperelastic model.");
180  args.AddOption(&visualization, "-vis", "--visualization", "-no-vis",
181  "--no-visualization",
182  "Enable or disable GLVis visualization.");
183  args.AddOption(&vis_steps, "-vs", "--visualization-steps",
184  "Visualize every n-th timestep.");
185  args.Parse();
186  if (!args.Good())
187  {
188  args.PrintUsage(cout);
189  return 1;
190  }
191  args.PrintOptions(cout);
192 
193  // 2. Read the mesh from the given mesh file. We can handle triangular,
194  // quadrilateral, tetrahedral and hexahedral meshes with the same code.
195  Mesh *mesh = new Mesh(mesh_file, 1, 1);
196  int dim = mesh->Dimension();
197 
198  // 3. Define the ODE solver used for time integration. Several implicit
199  // singly diagonal implicit Runge-Kutta (SDIRK) methods, as well as
200  // explicit Runge-Kutta methods are available.
201  ODESolver *ode_solver;
202  switch (ode_solver_type)
203  {
204  // Implicit L-stable methods
205  case 1: ode_solver = new BackwardEulerSolver; break;
206  case 2: ode_solver = new SDIRK23Solver(2); break;
207  case 3: ode_solver = new SDIRK33Solver; break;
208  // Explicit methods
209  case 11: ode_solver = new ForwardEulerSolver; break;
210  case 12: ode_solver = new RK2Solver(0.5); break; // midpoint method
211  case 13: ode_solver = new RK3SSPSolver; break;
212  case 14: ode_solver = new RK4Solver; break;
213  // Implicit A-stable methods (not L-stable)
214  case 22: ode_solver = new ImplicitMidpointSolver; break;
215  case 23: ode_solver = new SDIRK23Solver; break;
216  case 24: ode_solver = new SDIRK34Solver; break;
217  default:
218  cout << "Unknown ODE solver type: " << ode_solver_type << '\n';
219  return 3;
220  }
221 
222  // 4. Refine the mesh to increase the resolution. In this example we do
223  // 'ref_levels' of uniform refinement, where 'ref_levels' is a
224  // command-line parameter.
225  for (int lev = 0; lev < ref_levels; lev++)
226  {
227  mesh->UniformRefinement();
228  }
229 
230  // 5. Define the vector finite element spaces representing the mesh
231  // deformation x, the velocity v, and the initial configuration, x_ref.
232  // Define also the elastic energy density, w, which is in a discontinuous
233  // higher-order space. Since x and v are integrated in time as a system,
234  // we group them together in block vector vx, with offsets given by the
235  // fe_offset array.
236  H1_FECollection fe_coll(order, dim);
237  FiniteElementSpace fespace(mesh, &fe_coll, dim);
238 
239  int fe_size = fespace.GetVSize();
240  cout << "Number of velocity/deformation unknowns: " << fe_size << endl;
241  Array<int> fe_offset(3);
242  fe_offset[0] = 0;
243  fe_offset[1] = fe_size;
244  fe_offset[2] = 2*fe_size;
245 
246  BlockVector vx(fe_offset);
247  GridFunction v, x;
248  v.MakeRef(&fespace, vx.GetBlock(0), 0);
249  x.MakeRef(&fespace, vx.GetBlock(1), 0);
250 
251  GridFunction x_ref(&fespace);
252  mesh->GetNodes(x_ref);
253 
254  L2_FECollection w_fec(order + 1, dim);
255  FiniteElementSpace w_fespace(mesh, &w_fec);
256  GridFunction w(&w_fespace);
257 
258  // 6. Set the initial conditions for v and x, and the boundary conditions on
259  // a beam-like mesh (see description above).
261  v.ProjectCoefficient(velo);
263  x.ProjectCoefficient(deform);
264 
265  Array<int> ess_bdr(fespace.GetMesh()->bdr_attributes.Max());
266  ess_bdr = 0;
267  ess_bdr[0] = 1; // boundary attribute 1 (index 0) is fixed
268 
269  // 7. Initialize the hyperelastic operator, the GLVis visualization and print
270  // the initial energies.
271  HyperelasticOperator oper(fespace, ess_bdr, visc, mu, K);
272 
273  socketstream vis_v, vis_w;
274  if (visualization)
275  {
276  char vishost[] = "localhost";
277  int visport = 19916;
278  vis_v.open(vishost, visport);
279  vis_v.precision(8);
280  visualize(vis_v, mesh, &x, &v, "Velocity", true);
281  vis_w.open(vishost, visport);
282  if (vis_w)
283  {
284  oper.GetElasticEnergyDensity(x, w);
285  vis_w.precision(8);
286  visualize(vis_w, mesh, &x, &w, "Elastic energy density", true);
287  }
288  }
289 
290  double ee0 = oper.ElasticEnergy(x);
291  double ke0 = oper.KineticEnergy(v);
292  cout << "initial elastic energy (EE) = " << ee0 << endl;
293  cout << "initial kinetic energy (KE) = " << ke0 << endl;
294  cout << "initial total energy (TE) = " << (ee0 + ke0) << endl;
295 
296  // 8. Perform time-integration (looping over the time iterations, ti, with a
297  // time-step dt).
298  ode_solver->Init(oper);
299  double t = 0.0;
300 
301  bool last_step = false;
302  for (int ti = 1; !last_step; ti++)
303  {
304  if (t + dt >= t_final - dt/2)
305  {
306  last_step = true;
307  }
308 
309  ode_solver->Step(vx, t, dt);
310 
311  if (last_step || (ti % vis_steps) == 0)
312  {
313  double ee = oper.ElasticEnergy(x);
314  double ke = oper.KineticEnergy(v);
315 
316  cout << "step " << ti << ", t = " << t << ", EE = " << ee << ", KE = "
317  << ke << ", ΔTE = " << (ee+ke)-(ee0+ke0) << endl;
318 
319  if (visualization)
320  {
321  visualize(vis_v, mesh, &x, &v);
322  if (vis_w)
323  {
324  oper.GetElasticEnergyDensity(x, w);
325  visualize(vis_w, mesh, &x, &w);
326  }
327  }
328  }
329  }
330 
331  // 9. Save the displaced mesh, the velocity and elastic energy.
332  {
333  GridFunction *nodes = &x;
334  int owns_nodes = 0;
335  mesh->SwapNodes(nodes, owns_nodes);
336  ofstream mesh_ofs("deformed.mesh");
337  mesh_ofs.precision(8);
338  mesh->Print(mesh_ofs);
339  mesh->SwapNodes(nodes, owns_nodes);
340  ofstream velo_ofs("velocity.sol");
341  velo_ofs.precision(8);
342  v.Save(velo_ofs);
343  ofstream ee_ofs("elastic_energy.sol");
344  ee_ofs.precision(8);
345  oper.GetElasticEnergyDensity(x, w);
346  w.Save(ee_ofs);
347  }
348 
349  // 10. Free the used memory.
350  delete ode_solver;
351  delete mesh;
352 
353  return 0;
354 }
355 
356 void visualize(ostream &out, Mesh *mesh, GridFunction *deformed_nodes,
357  GridFunction *field, const char *field_name, bool init_vis)
358 {
359  if (!out)
360  {
361  return;
362  }
363 
364  GridFunction *nodes = deformed_nodes;
365  int owns_nodes = 0;
366 
367  mesh->SwapNodes(nodes, owns_nodes);
368 
369  out << "solution\n" << *mesh << *field;
370 
371  mesh->SwapNodes(nodes, owns_nodes);
372 
373  if (init_vis)
374  {
375  out << "window_size 800 800\n";
376  out << "window_title '" << field_name << "'\n";
377  if (mesh->SpaceDimension() == 2)
378  {
379  out << "view 0 0\n"; // view from top
380  out << "keys jl\n"; // turn off perspective and light
381  }
382  out << "keys cm\n"; // show colorbar and mesh
383  out << "autoscale value\n"; // update value-range; keep mesh-extents fixed
384  out << "pause\n";
385  }
386  out << flush;
387 }
388 
389 BackwardEulerOperator::BackwardEulerOperator(
391  : Operator(M_->Height()), M(M_), S(S_), H(H_), Jacobian(NULL),
392  v(NULL), x(NULL), dt(0.0), w(height), z(height)
393 { }
394 
395 void BackwardEulerOperator::SetParameters(double dt_, const Vector *v_,
396  const Vector *x_)
397 {
398  dt = dt_; v = v_; x = x_;
399 }
400 
401 void BackwardEulerOperator::Mult(const Vector &k, Vector &y) const
402 {
403  // compute: y = H(x + dt*(v + dt*k)) + M*k + S*(v + dt*k)
404  add(*v, dt, k, w);
405  add(*x, dt, w, z);
406  H->Mult(z, y);
407  M->AddMult(k, y);
408  S->AddMult(w, y);
409 }
410 
411 Operator &BackwardEulerOperator::GetGradient(const Vector &k) const
412 {
413  delete Jacobian;
414  Jacobian = Add(1.0, M->SpMat(), dt, S->SpMat());
415  add(*v, dt, k, w);
416  add(*x, dt, w, z);
417  SparseMatrix *grad_H = dynamic_cast<SparseMatrix *>(&H->GetGradient(z));
418  Jacobian->Add(dt*dt, *grad_H);
419  return *Jacobian;
420 }
421 
422 BackwardEulerOperator::~BackwardEulerOperator()
423 {
424  delete Jacobian;
425 }
426 
427 
428 HyperelasticOperator::HyperelasticOperator(FiniteElementSpace &f,
429  Array<int> &ess_bdr, double visc,
430  double mu, double K)
431  : TimeDependentOperator(2*f.GetVSize(), 0.0), fespace(f),
432  M(&fespace), S(&fespace), H(&fespace), z(height/2)
433 {
434  const double rel_tol = 1e-8;
435  const int skip_zero_entries = 0;
436 
437  const double ref_density = 1.0; // density in the reference configuration
438  ConstantCoefficient rho0(ref_density);
439  M.AddDomainIntegrator(new VectorMassIntegrator(rho0));
440  M.Assemble(skip_zero_entries);
441  M.EliminateEssentialBC(ess_bdr);
442  M.Finalize(skip_zero_entries);
443 
444  M_solver.iterative_mode = false;
445  M_solver.SetRelTol(rel_tol);
446  M_solver.SetAbsTol(0.0);
447  M_solver.SetMaxIter(30);
448  M_solver.SetPrintLevel(0);
449  M_solver.SetPreconditioner(M_prec);
450  M_solver.SetOperator(M.SpMat());
451 
452  model = new NeoHookeanModel(mu, K);
453  H.AddDomainIntegrator(new HyperelasticNLFIntegrator(model));
454  H.SetEssentialBC(ess_bdr);
455 
456  viscosity = visc;
457  ConstantCoefficient visc_coeff(viscosity);
458  S.AddDomainIntegrator(new VectorDiffusionIntegrator(visc_coeff));
459  S.Assemble(skip_zero_entries);
460  S.EliminateEssentialBC(ess_bdr);
461  S.Finalize(skip_zero_entries);
462 
463  backward_euler_oper = new BackwardEulerOperator(&M, &S, &H);
464 
465 #ifndef MFEM_USE_SUITESPARSE
466  J_prec = new DSmoother(1);
467  MINRESSolver *J_minres = new MINRESSolver;
468  J_minres->SetRelTol(rel_tol);
469  J_minres->SetAbsTol(0.0);
470  J_minres->SetMaxIter(300);
471  J_minres->SetPrintLevel(-1);
472  J_minres->SetPreconditioner(*J_prec);
473  J_solver = J_minres;
474 #else
475  J_solver = new UMFPackSolver;
476  J_prec = NULL;
477 #endif
478 
479  newton_solver.iterative_mode = false;
480  newton_solver.SetSolver(*J_solver);
481  newton_solver.SetOperator(*backward_euler_oper);
482  newton_solver.SetPrintLevel(1); // print Newton iterations
483  newton_solver.SetRelTol(rel_tol);
484  newton_solver.SetAbsTol(0.0);
485  newton_solver.SetMaxIter(10);
486 }
487 
488 void HyperelasticOperator::Mult(const Vector &vx, Vector &dvx_dt) const
489 {
490  // Create views to the sub-vectors v, x of vx, and dv_dt, dx_dt of dvx_dt
491  int sc = height/2;
492  Vector v(vx.GetData() + 0, sc);
493  Vector x(vx.GetData() + sc, sc);
494  Vector dv_dt(dvx_dt.GetData() + 0, sc);
495  Vector dx_dt(dvx_dt.GetData() + sc, sc);
496 
497  H.Mult(x, z);
498  if (viscosity != 0.0)
499  {
500  S.AddMult(v, z);
501  }
502  z.Neg(); // z = -z
503  M_solver.Mult(z, dv_dt);
504 
505  dx_dt = v;
506 }
507 
508 void HyperelasticOperator::ImplicitSolve(const double dt,
509  const Vector &vx, Vector &dvx_dt)
510 {
511  int sc = height/2;
512  Vector v(vx.GetData() + 0, sc);
513  Vector x(vx.GetData() + sc, sc);
514  Vector dv_dt(dvx_dt.GetData() + 0, sc);
515  Vector dx_dt(dvx_dt.GetData() + sc, sc);
516 
517  // By eliminating kx from the coupled system:
518  // kv = -M^{-1}*[H(x + dt*kx) + S*(v + dt*kv)]
519  // kx = v + dt*kv
520  // we reduce it to a nonlinear equation for kv, represented by the
521  // backward_euler_oper. This equation is solved with the newton_solver
522  // object (using J_solver and J_prec internally).
523  backward_euler_oper->SetParameters(dt, &v, &x);
524  Vector zero; // empty vector is interpreted as zero r.h.s. by NewtonSolver
525  newton_solver.Mult(zero, dv_dt);
526  add(v, dt, dv_dt, dx_dt);
527 
528  MFEM_VERIFY(newton_solver.GetConverged(), "Newton Solver did not converge.");
529 }
530 
531 double HyperelasticOperator::ElasticEnergy(Vector &x) const
532 {
533  return H.GetEnergy(x);
534 }
535 
536 double HyperelasticOperator::KineticEnergy(Vector &v) const
537 {
538  return 0.5*M.InnerProduct(v, v);
539 }
540 
541 void HyperelasticOperator::GetElasticEnergyDensity(
542  GridFunction &x, GridFunction &w) const
543 {
544  ElasticEnergyCoefficient w_coeff(*model, x);
545  w.ProjectCoefficient(w_coeff);
546 }
547 
548 HyperelasticOperator::~HyperelasticOperator()
549 {
550  delete model;
551  delete backward_euler_oper;
552  delete J_solver;
553  delete J_prec;
554 }
555 
556 
558  const IntegrationPoint &ip)
559 {
560  model.SetTransformation(T);
561  x.GetVectorGradient(T, J);
562  // return model.EvalW(J); // in reference configuration
563  return model.EvalW(J)/J.Det(); // in deformed configuration
564 }
565 
566 
567 void InitialDeformation(const Vector &x, Vector &y)
568 {
569  // set the initial configuration to be the same as the reference, stress
570  // free, configuration
571  y = x;
572 }
573 
574 void InitialVelocity(const Vector &x, Vector &v)
575 {
576  const int dim = x.Size();
577  const double s = 0.1/64.;
578 
579  v = 0.0;
580  v(dim-1) = s*x(0)*x(0)*(8.0-x(0));
581  v(0) = -s*x(0)*x(0);
582 }
void visualize(ostream &out, Mesh *mesh, GridFunction *deformed_nodes, GridFunction *field, const char *field_name=NULL, bool init_vis=false)
Definition: ex10.cpp:356
int GetVSize() const
Definition: fespace.hpp:161
double Eval(ElementTransformation &T, const IntegrationPoint &ip, double t)
Definition: coefficient.hpp:45
void Add(const int i, const int j, const double a)
Definition: sparsemat.cpp:1816
void InitialDeformation(const Vector &x, Vector &y)
Definition: ex10.cpp:567
Conjugate gradient method.
Definition: solvers.hpp:110
Class for grid function - Vector with associated FE space.
Definition: gridfunc.hpp:27
Data type for scaled Jacobi-type smoother of sparse matrix.
void MakeRef(FiniteElementSpace *f, Vector &v, int v_offset)
Definition: gridfunc.cpp:176
Subclass constant coefficient.
Definition: coefficient.hpp:57
Base abstract class for time dependent operators: (x,t) -&gt; f(x,t)
Definition: operator.hpp:68
void SwapNodes(GridFunction *&nodes, int &own_nodes_)
Definition: mesh.cpp:5152
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
Definition: table.cpp:451
virtual void Step(Vector &x, double &t, double &dt)=0
Data type dense matrix using column-major storage.
Definition: densemat.hpp:22
int Size() const
Returns the size of the vector.
Definition: vector.hpp:86
Abstract class for solving systems of ODEs: dx/dt = f(x,t)
Definition: ode.hpp:22
bool iterative_mode
If true, use the second argument of Mult as an initial guess.
Definition: operator.hpp:106
MINRES method.
Definition: solvers.hpp:219
virtual void Init(TimeDependentOperator &_f)
Definition: ode.hpp:30
Hyperelastic integrator for any given HyperelasticModel.
int main(int argc, char *argv[])
Backward Euler ODE solver. L-stable.
Definition: ode.hpp:150
double * GetData() const
Definition: vector.hpp:90
void add(const Vector &v1, const Vector &v2, Vector &v)
Definition: vector.cpp:259
void InitialVelocity(const Vector &x, Vector &v)
Definition: ex10.cpp:574
Direct sparse solver using UMFPACK.
Definition: solvers.hpp:333
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
Definition: gridfunc.cpp:2116
void Add(const DenseMatrix &A, const DenseMatrix &B, double alpha, DenseMatrix &C)
C = A + alpha*B.
Definition: densemat.cpp:2809
int dim
Definition: ex3.cpp:47
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Definition: solvers.hpp:232
void SetPrintLevel(int print_lvl)
Definition: solvers.cpp:71
Data type sparse matrix.
Definition: sparsemat.hpp:38
Mesh * GetMesh() const
Returns the mesh.
Definition: fespace.hpp:136
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Definition: mesh.cpp:6402
void SetMaxIter(int max_it)
Definition: solvers.hpp:62
T Max() const
Definition: array.cpp:90
int Dimension() const
Definition: mesh.hpp:523
void PrintUsage(std::ostream &out) const
Definition: optparser.cpp:434
int SpaceDimension() const
Definition: mesh.hpp:524
virtual void Print(std::ostream &out=std::cout) const
Print the mesh to the given stream using the default MFEM mesh format.
Definition: mesh.cpp:6736
The classical explicit forth-order Runge-Kutta method, RK4.
Definition: ode.hpp:85
void SetAbsTol(double atol)
Definition: solvers.hpp:61
Array< int > bdr_attributes
Definition: mesh.hpp:141
void SetRelTol(double rtol)
Definition: solvers.hpp:60
Base class Coefficient that may optionally depend on time.
Definition: coefficient.hpp:31
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)
Definition: optparser.hpp:74
Third-order, strong stability preserving (SSP) Runge-Kutta method.
Definition: ode.hpp:72
Implicit midpoint method. A-stable, not L-stable.
Definition: ode.hpp:163
Class for integration point with weight.
Definition: intrules.hpp:25
void PrintOptions(std::ostream &out) const
Definition: optparser.cpp:304
void ProjectCoefficient(Coefficient &coeff)
Definition: gridfunc.cpp:1164
Abstract class for hyperelastic models.
Definition: nonlininteg.hpp:49
int open(const char hostname[], int port)
Vector data type.
Definition: vector.hpp:33
void GetNodes(Vector &node_coord) const
Definition: mesh.cpp:5114
Arbitrary order H1-conforming (continuous) finite elements.
Definition: fe_coll.hpp:77
Base class for solvers.
Definition: operator.hpp:102
The classical forward Euler method.
Definition: ode.hpp:39
Abstract operator.
Definition: operator.hpp:21
void GetVectorGradient(ElementTransformation &tr, DenseMatrix &grad)
Definition: gridfunc.cpp:942
Vector & GetBlock(int i)
Get the i-th vector in the block.
Arbitrary order &quot;L2-conforming&quot; discontinuous finite elements.
Definition: fe_coll.hpp:130
void Neg()
(*this) = -(*this)
Definition: vector.cpp:251
bool Good() const
Definition: optparser.hpp:120