MFEM  v3.0
 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);
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;
154  double visc = 1e-2;
155  bool visualization = true;
156  int vis_steps = 1;
157 
158  OptionsParser args(argc, argv);
159  args.AddOption(&mesh_file, "-m", "--mesh",
160  "Mesh file to use.");
161  args.AddOption(&ref_levels, "-r", "--refine",
162  "Number of times to refine the mesh uniformly.");
163  args.AddOption(&order, "-o", "--order",
164  "Order (degree) of the finite elements.");
165  args.AddOption(&ode_solver_type, "-s", "--ode-solver",
166  "ODE solver: 1 - Backward Euler, 2 - SDIRK2, 3 - SDIRK3,\n\t"
167  "\t 11 - Forward Euler, 12 - RK2, 13 - RK3 SSP, 14 - RK4.");
168  args.AddOption(&t_final, "-tf", "--t-final",
169  "Final time; start time is 0.");
170  args.AddOption(&dt, "-dt", "--time-step",
171  "Time step.");
172  args.AddOption(&visc, "-v", "--viscosity",
173  "Viscosity coefficient.");
174  args.AddOption(&visualization, "-vis", "--visualization", "-no-vis",
175  "--no-visualization",
176  "Enable or disable GLVis visualization.");
177  args.AddOption(&vis_steps, "-vs", "--visualization-steps",
178  "Visualize every n-th timestep.");
179  args.Parse();
180  if (!args.Good())
181  {
182  args.PrintUsage(cout);
183  return 1;
184  }
185  args.PrintOptions(cout);
186 
187  // 2. Read the mesh from the given mesh file. We can handle triangular,
188  // quadrilateral, tetrahedral and hexahedral meshes with the same code.
189  Mesh *mesh;
190  ifstream imesh(mesh_file);
191  if (!imesh)
192  {
193  cerr << "Can not open mesh: " << mesh_file << endl;
194  return 2;
195  }
196  mesh = new Mesh(imesh, 1, 1);
197  imesh.close();
198  int dim = mesh->Dimension();
199 
200  // 3. Define the ODE solver used for time integration. Several implicit
201  // singly diagonal implicit Runge-Kutta (SDIRK) methods, as well as
202  // explicit Runge-Kutta methods are available.
203  ODESolver *ode_solver;
204  switch (ode_solver_type)
205  {
206  // Implicit L-stable methods
207  case 1: ode_solver = new BackwardEulerSolver; break;
208  case 2: ode_solver = new SDIRK23Solver(2); break;
209  case 3: ode_solver = new SDIRK33Solver; break;
210  // Explicit methods
211  case 11: ode_solver = new ForwardEulerSolver; break;
212  case 12: ode_solver = new RK2Solver(0.5); break; // midpoint method
213  case 13: ode_solver = new RK3SSPSolver; break;
214  case 14: ode_solver = new RK4Solver; break;
215  // Implicit A-stable methods (not L-stable)
216  case 22: ode_solver = new ImplicitMidpointSolver; break;
217  case 23: ode_solver = new SDIRK23Solver; break;
218  case 24: ode_solver = new SDIRK34Solver; break;
219  default:
220  cout << "Unknown ODE solver type: " << ode_solver_type << '\n';
221  return 3;
222  }
223 
224  // 4. Refine the mesh to increase the resolution. In this example we do
225  // 'ref_levels' of uniform refinement, where 'ref_levels' is a
226  // command-line parameter.
227  for (int lev = 0; lev < ref_levels; lev++)
228  mesh->UniformRefinement();
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.Update(&fespace, vx.GetBlock(0), 0);
249  x.Update(&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);
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  last_step = true;
306 
307  ode_solver->Step(vx, t, dt);
308 
309  if (last_step || (ti % vis_steps) == 0)
310  {
311  double ee = oper.ElasticEnergy(x);
312  double ke = oper.KineticEnergy(v);
313 
314  cout << "step " << ti << ", t = " << t << ", EE = " << ee << ", KE = "
315  << ke << ", ΔTE = " << (ee+ke)-(ee0+ke0) << endl;
316 
317  if (visualization)
318  {
319  visualize(vis_v, mesh, &x, &v);
320  if (vis_w)
321  {
322  oper.GetElasticEnergyDensity(x, w);
323  visualize(vis_w, mesh, &x, &w);
324  }
325  }
326  }
327  }
328 
329  // 9. Save the displaced mesh, the velocity and elastic energy.
330  {
331  GridFunction *nodes = &x;
332  int owns_nodes = 0;
333  mesh->SwapNodes(nodes, owns_nodes);
334  ofstream mesh_ofs("deformed.mesh");
335  mesh_ofs.precision(8);
336  mesh->Print(mesh_ofs);
337  mesh->SwapNodes(nodes, owns_nodes);
338  ofstream velo_ofs("velocity.sol");
339  velo_ofs.precision(8);
340  v.Save(velo_ofs);
341  ofstream ee_ofs("elastic_energy.sol");
342  ee_ofs.precision(8);
343  oper.GetElasticEnergyDensity(x, w);
344  w.Save(ee_ofs);
345  }
346 
347  // 10. Free the used memory.
348  delete ode_solver;
349  delete mesh;
350 
351  return 0;
352 }
353 
354 void visualize(ostream &out, Mesh *mesh, GridFunction *deformed_nodes,
355  GridFunction *field, const char *field_name, bool init_vis)
356 {
357  if (!out)
358  return;
359 
360  GridFunction *nodes = deformed_nodes;
361  int owns_nodes = 0;
362 
363  mesh->SwapNodes(nodes, owns_nodes);
364 
365  out << "solution\n" << *mesh << *field;
366 
367  mesh->SwapNodes(nodes, owns_nodes);
368 
369  if (init_vis)
370  {
371  out << "window_size 800 800\n";
372  out << "window_title '" << field_name << "'\n";
373  if (mesh->SpaceDimension() == 2)
374  {
375  out << "view 0 0\n"; // view from top
376  out << "keys jl\n"; // turn off perspective and light
377  }
378  out << "keys cm\n"; // show colorbar and mesh
379  out << "autoscale value\n"; // update value-range; keep mesh-extents fixed
380  out << "pause\n";
381  }
382  out << flush;
383 }
384 
385 BackwardEulerOperator::BackwardEulerOperator(
387  : Operator(M_->Height()), M(M_), S(S_), H(H_), Jacobian(NULL),
388  v(NULL), x(NULL), dt(0.0), w(height), z(height)
389 { }
390 
391 void BackwardEulerOperator::SetParameters(double dt_, const Vector *v_,
392  const Vector *x_)
393 {
394  dt = dt_; v = v_; x = x_;
395 }
396 
397 void BackwardEulerOperator::Mult(const Vector &k, Vector &y) const
398 {
399  // compute: y = H(x + dt*(v + dt*k)) + M*k + S*(v + dt*k)
400  add(*v, dt, k, w);
401  add(*x, dt, w, z);
402  H->Mult(z, y);
403  M->AddMult(k, y);
404  S->AddMult(w, y);
405 }
406 
407 Operator &BackwardEulerOperator::GetGradient(const Vector &k) const
408 {
409  delete Jacobian;
410  Jacobian = Add(1.0, M->SpMat(), dt, S->SpMat());
411  add(*v, dt, k, w);
412  add(*x, dt, w, z);
413  SparseMatrix *grad_H = dynamic_cast<SparseMatrix *>(&H->GetGradient(z));
414  Jacobian->Add(dt*dt, *grad_H);
415  return *Jacobian;
416 }
417 
418 BackwardEulerOperator::~BackwardEulerOperator()
419 {
420  delete Jacobian;
421 }
422 
423 
424 HyperelasticOperator::HyperelasticOperator(FiniteElementSpace &f,
425  Array<int> &ess_bdr, double visc)
426  : TimeDependentOperator(2*f.GetVSize(), 0.0), fespace(f),
427  M(&fespace), S(&fespace), H(&fespace), z(height/2)
428 {
429  const double rel_tol = 1e-8;
430  const int skip_zero_entries = 0;
431 
432  const double ref_density = 1.0; // density in the reference configuration
433  ConstantCoefficient rho0(ref_density);
434  M.AddDomainIntegrator(new VectorMassIntegrator(rho0));
435  M.Assemble(skip_zero_entries);
436  M.EliminateEssentialBC(ess_bdr);
437  M.Finalize(skip_zero_entries);
438 
439  M_solver.iterative_mode = false;
440  M_solver.SetRelTol(rel_tol);
441  M_solver.SetAbsTol(0.0);
442  M_solver.SetMaxIter(30);
443  M_solver.SetPrintLevel(0);
444  M_solver.SetPreconditioner(M_prec);
445  M_solver.SetOperator(M.SpMat());
446 
447  double mu = 0.25; // shear modulus
448  double K = 5.0; // bulk modulus
449  model = new NeoHookeanModel(mu, K);
450  H.AddDomainIntegrator(new HyperelasticNLFIntegrator(model));
451  H.SetEssentialBC(ess_bdr);
452 
453  viscosity = visc;
454  ConstantCoefficient visc_coeff(viscosity);
455  S.AddDomainIntegrator(new VectorDiffusionIntegrator(visc_coeff));
456  S.Assemble(skip_zero_entries);
457  S.EliminateEssentialBC(ess_bdr);
458  S.Finalize(skip_zero_entries);
459 
460  backward_euler_oper = new BackwardEulerOperator(&M, &S, &H);
461 
462 #ifndef MFEM_USE_SUITESPARSE
463  J_prec = new DSmoother(1);
464  MINRESSolver *J_minres = new MINRESSolver;
465  J_minres->SetRelTol(rel_tol);
466  J_minres->SetAbsTol(0.0);
467  J_minres->SetMaxIter(300);
468  J_minres->SetPrintLevel(-1);
469  J_minres->SetPreconditioner(*J_prec);
470  J_solver = J_minres;
471 #else
472  J_solver = new UMFPackSolver;
473  J_prec = NULL;
474 #endif
475 
476  newton_solver.iterative_mode = false;
477  newton_solver.SetSolver(*J_solver);
478  newton_solver.SetOperator(*backward_euler_oper);
479  newton_solver.SetPrintLevel(1); // print Newton iterations
480  newton_solver.SetRelTol(rel_tol);
481  newton_solver.SetAbsTol(0.0);
482  newton_solver.SetMaxIter(10);
483 }
484 
485 void HyperelasticOperator::Mult(const Vector &vx, Vector &dvx_dt) const
486 {
487  // Create views to the sub-vectors v, x of vx, and dv_dt, dx_dt of dvx_dt
488  int sc = height/2;
489  Vector v(vx.GetData() + 0, sc);
490  Vector x(vx.GetData() + sc, sc);
491  Vector dv_dt(dvx_dt.GetData() + 0, sc);
492  Vector dx_dt(dvx_dt.GetData() + sc, sc);
493 
494  H.Mult(x, z);
495  if (viscosity != 0.0)
496  S.AddMult(v, z);
497  z.Neg(); // z = -z
498  M_solver.Mult(z, dv_dt);
499 
500  dx_dt = v;
501 }
502 
503 void HyperelasticOperator::ImplicitSolve(const double dt,
504  const Vector &vx, Vector &dvx_dt)
505 {
506  int sc = height/2;
507  Vector v(vx.GetData() + 0, sc);
508  Vector x(vx.GetData() + sc, sc);
509  Vector dv_dt(dvx_dt.GetData() + 0, sc);
510  Vector dx_dt(dvx_dt.GetData() + sc, sc);
511 
512  // By eliminating kx from the coupled system:
513  // kv = -M^{-1}*[H(x + dt*kx) + S*(v + dt*kv)]
514  // kx = v + dt*kv
515  // we reduce it to a nonlinear equation for kv, represented by the
516  // backward_euler_oper. This equation is solved with the newton_solver
517  // object (using J_solver and J_prec internally).
518  backward_euler_oper->SetParameters(dt, &v, &x);
519  Vector zero; // empty vector is interpreted as zero r.h.s. by NewtonSolver
520  newton_solver.Mult(zero, dv_dt);
521  add(v, dt, dv_dt, dx_dt);
522 
523  MFEM_VERIFY(newton_solver.GetConverged(), "Newton Solver did not converge.");
524 }
525 
526 double HyperelasticOperator::ElasticEnergy(Vector &x) const
527 {
528  return H.GetEnergy(x);
529 }
530 
531 double HyperelasticOperator::KineticEnergy(Vector &v) const
532 {
533  return 0.5*M.InnerProduct(v, v);
534 }
535 
536 void HyperelasticOperator::GetElasticEnergyDensity(
537  GridFunction &x, GridFunction &w) const
538 {
539  ElasticEnergyCoefficient w_coeff(*model, x);
540  w.ProjectCoefficient(w_coeff);
541 }
542 
543 HyperelasticOperator::~HyperelasticOperator()
544 {
545  delete model;
546  delete backward_euler_oper;
547  delete J_solver;
548  delete J_prec;
549 }
550 
551 
553  const IntegrationPoint &ip)
554 {
555  model.SetTransformation(T);
556  x.GetVectorGradient(T, J);
557  // return model.EvalW(J); // in reference configuration
558  return model.EvalW(J)/J.Det(); // in deformed configuration
559 }
560 
561 
562 void InitialDeformation(const Vector &x, Vector &y)
563 {
564  // set the initial configuration to be the same as the reference, stress
565  // free, configuration
566  y = x;
567 }
568 
569 void InitialVelocity(const Vector &x, Vector &v)
570 {
571  const int dim = x.Size();
572  const double s = 0.1/64.;
573 
574  v = 0.0;
575  v(dim-1) = s*x(0)*x(0)*(8.0-x(0));
576  v(0) = -s*x(0)*x(0);
577 }
void visualize(ostream &out, Mesh *mesh, GridFunction *deformed_nodes, GridFunction *field, const char *field_name=NULL, bool init_vis=false)
Definition: ex10.cpp:354
int GetVSize() const
Definition: fespace.hpp:151
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:1525
void InitialDeformation(const Vector &x, Vector &y)
Definition: ex10.cpp:562
Conjugate gradient method.
Definition: solvers.hpp:109
Class for grid function - Vector with associated FE space.
Definition: gridfunc.hpp:26
Data type for scaled Jacobi-type smoother of sparse matrix.
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:4978
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
Definition: table.cpp:351
virtual void Step(Vector &x, double &t, double &dt)=0
Data type dense matrix.
Definition: densemat.hpp:22
int Size() const
Returns the size of the vector.
Definition: vector.hpp:76
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:218
virtual void Init(TimeDependentOperator &_f)
Definition: ode.hpp:30
Hyperelastic integrator for any given HyperelasticModel.
Backward Euler ODE solver. L-stable.
Definition: ode.hpp:150
double * GetData() const
Definition: vector.hpp:80
void add(const Vector &v1, const Vector &v2, Vector &v)
Definition: vector.cpp:227
void InitialVelocity(const Vector &x, Vector &v)
Definition: ex10.cpp:569
Direct sparse solver using UMFPACK.
Definition: solvers.hpp:329
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
Definition: gridfunc.cpp:1797
void Add(const DenseMatrix &A, const DenseMatrix &B, double alpha, DenseMatrix &C)
C = A + alpha*B.
Definition: densemat.cpp:2430
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Definition: solvers.hpp:231
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:132
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Definition: mesh.cpp:6225
void SetMaxIter(int max_it)
Definition: solvers.hpp:61
T Max() const
Definition: array.cpp:78
int Dimension() const
Definition: mesh.hpp:417
void PrintUsage(std::ostream &out) const
Definition: optparser.cpp:385
int SpaceDimension() const
Definition: mesh.hpp:418
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:7136
The classical explicit forth-order Runge-Kutta method, RK4.
Definition: ode.hpp:85
void SetAbsTol(double atol)
Definition: solvers.hpp:60
Array< int > bdr_attributes
Definition: mesh.hpp:305
int main(int argc, char *argv[])
Definition: ex1.cpp:39
void SetRelTol(double rtol)
Definition: solvers.hpp:59
Abstract finite element space.
Definition: fespace.hpp:61
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:266
void ProjectCoefficient(Coefficient &coeff)
Definition: gridfunc.cpp:967
Abstract class for hyperelastic models.
Definition: nonlininteg.hpp:49
int open(const char hostname[], int port)
Vector data type.
Definition: vector.hpp:29
void GetNodes(Vector &node_coord) const
Definition: mesh.cpp:4948
Arbitrary order H1-conforming (continuous) finite elements.
Definition: fe_coll.hpp:52
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:757
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:83
void Neg()
(*this) = -(*this)
Definition: vector.cpp:207
bool Good() const
Definition: optparser.hpp:120