MFEM  v3.1
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;
196  ifstream imesh(mesh_file);
197  if (!imesh)
198  {
199  cerr << "Can not open mesh: " << mesh_file << endl;
200  return 2;
201  }
202  mesh = new Mesh(imesh, 1, 1);
203  imesh.close();
204  int dim = mesh->Dimension();
205 
206  // 3. Define the ODE solver used for time integration. Several implicit
207  // singly diagonal implicit Runge-Kutta (SDIRK) methods, as well as
208  // explicit Runge-Kutta methods are available.
209  ODESolver *ode_solver;
210  switch (ode_solver_type)
211  {
212  // Implicit L-stable methods
213  case 1: ode_solver = new BackwardEulerSolver; break;
214  case 2: ode_solver = new SDIRK23Solver(2); break;
215  case 3: ode_solver = new SDIRK33Solver; break;
216  // Explicit methods
217  case 11: ode_solver = new ForwardEulerSolver; break;
218  case 12: ode_solver = new RK2Solver(0.5); break; // midpoint method
219  case 13: ode_solver = new RK3SSPSolver; break;
220  case 14: ode_solver = new RK4Solver; break;
221  // Implicit A-stable methods (not L-stable)
222  case 22: ode_solver = new ImplicitMidpointSolver; break;
223  case 23: ode_solver = new SDIRK23Solver; break;
224  case 24: ode_solver = new SDIRK34Solver; break;
225  default:
226  cout << "Unknown ODE solver type: " << ode_solver_type << '\n';
227  return 3;
228  }
229 
230  // 4. Refine the mesh to increase the resolution. In this example we do
231  // 'ref_levels' of uniform refinement, where 'ref_levels' is a
232  // command-line parameter.
233  for (int lev = 0; lev < ref_levels; lev++)
234  {
235  mesh->UniformRefinement();
236  }
237 
238  // 5. Define the vector finite element spaces representing the mesh
239  // deformation x, the velocity v, and the initial configuration, x_ref.
240  // Define also the elastic energy density, w, which is in a discontinuous
241  // higher-order space. Since x and v are integrated in time as a system,
242  // we group them together in block vector vx, with offsets given by the
243  // fe_offset array.
244  H1_FECollection fe_coll(order, dim);
245  FiniteElementSpace fespace(mesh, &fe_coll, dim);
246 
247  int fe_size = fespace.GetVSize();
248  cout << "Number of velocity/deformation unknowns: " << fe_size << endl;
249  Array<int> fe_offset(3);
250  fe_offset[0] = 0;
251  fe_offset[1] = fe_size;
252  fe_offset[2] = 2*fe_size;
253 
254  BlockVector vx(fe_offset);
255  GridFunction v, x;
256  v.Update(&fespace, vx.GetBlock(0), 0);
257  x.Update(&fespace, vx.GetBlock(1), 0);
258 
259  GridFunction x_ref(&fespace);
260  mesh->GetNodes(x_ref);
261 
262  L2_FECollection w_fec(order + 1, dim);
263  FiniteElementSpace w_fespace(mesh, &w_fec);
264  GridFunction w(&w_fespace);
265 
266  // 6. Set the initial conditions for v and x, and the boundary conditions on
267  // a beam-like mesh (see description above).
269  v.ProjectCoefficient(velo);
271  x.ProjectCoefficient(deform);
272 
273  Array<int> ess_bdr(fespace.GetMesh()->bdr_attributes.Max());
274  ess_bdr = 0;
275  ess_bdr[0] = 1; // boundary attribute 1 (index 0) is fixed
276 
277  // 7. Initialize the hyperelastic operator, the GLVis visualization and print
278  // the initial energies.
279  HyperelasticOperator oper(fespace, ess_bdr, visc, mu, K);
280 
281  socketstream vis_v, vis_w;
282  if (visualization)
283  {
284  char vishost[] = "localhost";
285  int visport = 19916;
286  vis_v.open(vishost, visport);
287  vis_v.precision(8);
288  visualize(vis_v, mesh, &x, &v, "Velocity", true);
289  vis_w.open(vishost, visport);
290  if (vis_w)
291  {
292  oper.GetElasticEnergyDensity(x, w);
293  vis_w.precision(8);
294  visualize(vis_w, mesh, &x, &w, "Elastic energy density", true);
295  }
296  }
297 
298  double ee0 = oper.ElasticEnergy(x);
299  double ke0 = oper.KineticEnergy(v);
300  cout << "initial elastic energy (EE) = " << ee0 << endl;
301  cout << "initial kinetic energy (KE) = " << ke0 << endl;
302  cout << "initial total energy (TE) = " << (ee0 + ke0) << endl;
303 
304  // 8. Perform time-integration (looping over the time iterations, ti, with a
305  // time-step dt).
306  ode_solver->Init(oper);
307  double t = 0.0;
308 
309  bool last_step = false;
310  for (int ti = 1; !last_step; ti++)
311  {
312  if (t + dt >= t_final - dt/2)
313  {
314  last_step = true;
315  }
316 
317  ode_solver->Step(vx, t, dt);
318 
319  if (last_step || (ti % vis_steps) == 0)
320  {
321  double ee = oper.ElasticEnergy(x);
322  double ke = oper.KineticEnergy(v);
323 
324  cout << "step " << ti << ", t = " << t << ", EE = " << ee << ", KE = "
325  << ke << ", ΔTE = " << (ee+ke)-(ee0+ke0) << endl;
326 
327  if (visualization)
328  {
329  visualize(vis_v, mesh, &x, &v);
330  if (vis_w)
331  {
332  oper.GetElasticEnergyDensity(x, w);
333  visualize(vis_w, mesh, &x, &w);
334  }
335  }
336  }
337  }
338 
339  // 9. Save the displaced mesh, the velocity and elastic energy.
340  {
341  GridFunction *nodes = &x;
342  int owns_nodes = 0;
343  mesh->SwapNodes(nodes, owns_nodes);
344  ofstream mesh_ofs("deformed.mesh");
345  mesh_ofs.precision(8);
346  mesh->Print(mesh_ofs);
347  mesh->SwapNodes(nodes, owns_nodes);
348  ofstream velo_ofs("velocity.sol");
349  velo_ofs.precision(8);
350  v.Save(velo_ofs);
351  ofstream ee_ofs("elastic_energy.sol");
352  ee_ofs.precision(8);
353  oper.GetElasticEnergyDensity(x, w);
354  w.Save(ee_ofs);
355  }
356 
357  // 10. Free the used memory.
358  delete ode_solver;
359  delete mesh;
360 
361  return 0;
362 }
363 
364 void visualize(ostream &out, Mesh *mesh, GridFunction *deformed_nodes,
365  GridFunction *field, const char *field_name, bool init_vis)
366 {
367  if (!out)
368  {
369  return;
370  }
371 
372  GridFunction *nodes = deformed_nodes;
373  int owns_nodes = 0;
374 
375  mesh->SwapNodes(nodes, owns_nodes);
376 
377  out << "solution\n" << *mesh << *field;
378 
379  mesh->SwapNodes(nodes, owns_nodes);
380 
381  if (init_vis)
382  {
383  out << "window_size 800 800\n";
384  out << "window_title '" << field_name << "'\n";
385  if (mesh->SpaceDimension() == 2)
386  {
387  out << "view 0 0\n"; // view from top
388  out << "keys jl\n"; // turn off perspective and light
389  }
390  out << "keys cm\n"; // show colorbar and mesh
391  out << "autoscale value\n"; // update value-range; keep mesh-extents fixed
392  out << "pause\n";
393  }
394  out << flush;
395 }
396 
397 BackwardEulerOperator::BackwardEulerOperator(
399  : Operator(M_->Height()), M(M_), S(S_), H(H_), Jacobian(NULL),
400  v(NULL), x(NULL), dt(0.0), w(height), z(height)
401 { }
402 
403 void BackwardEulerOperator::SetParameters(double dt_, const Vector *v_,
404  const Vector *x_)
405 {
406  dt = dt_; v = v_; x = x_;
407 }
408 
409 void BackwardEulerOperator::Mult(const Vector &k, Vector &y) const
410 {
411  // compute: y = H(x + dt*(v + dt*k)) + M*k + S*(v + dt*k)
412  add(*v, dt, k, w);
413  add(*x, dt, w, z);
414  H->Mult(z, y);
415  M->AddMult(k, y);
416  S->AddMult(w, y);
417 }
418 
419 Operator &BackwardEulerOperator::GetGradient(const Vector &k) const
420 {
421  delete Jacobian;
422  Jacobian = Add(1.0, M->SpMat(), dt, S->SpMat());
423  add(*v, dt, k, w);
424  add(*x, dt, w, z);
425  SparseMatrix *grad_H = dynamic_cast<SparseMatrix *>(&H->GetGradient(z));
426  Jacobian->Add(dt*dt, *grad_H);
427  return *Jacobian;
428 }
429 
430 BackwardEulerOperator::~BackwardEulerOperator()
431 {
432  delete Jacobian;
433 }
434 
435 
436 HyperelasticOperator::HyperelasticOperator(FiniteElementSpace &f,
437  Array<int> &ess_bdr, double visc,
438  double mu, double K)
439  : TimeDependentOperator(2*f.GetVSize(), 0.0), fespace(f),
440  M(&fespace), S(&fespace), H(&fespace), z(height/2)
441 {
442  const double rel_tol = 1e-8;
443  const int skip_zero_entries = 0;
444 
445  const double ref_density = 1.0; // density in the reference configuration
446  ConstantCoefficient rho0(ref_density);
447  M.AddDomainIntegrator(new VectorMassIntegrator(rho0));
448  M.Assemble(skip_zero_entries);
449  M.EliminateEssentialBC(ess_bdr);
450  M.Finalize(skip_zero_entries);
451 
452  M_solver.iterative_mode = false;
453  M_solver.SetRelTol(rel_tol);
454  M_solver.SetAbsTol(0.0);
455  M_solver.SetMaxIter(30);
456  M_solver.SetPrintLevel(0);
457  M_solver.SetPreconditioner(M_prec);
458  M_solver.SetOperator(M.SpMat());
459 
460  model = new NeoHookeanModel(mu, K);
461  H.AddDomainIntegrator(new HyperelasticNLFIntegrator(model));
462  H.SetEssentialBC(ess_bdr);
463 
464  viscosity = visc;
465  ConstantCoefficient visc_coeff(viscosity);
466  S.AddDomainIntegrator(new VectorDiffusionIntegrator(visc_coeff));
467  S.Assemble(skip_zero_entries);
468  S.EliminateEssentialBC(ess_bdr);
469  S.Finalize(skip_zero_entries);
470 
471  backward_euler_oper = new BackwardEulerOperator(&M, &S, &H);
472 
473 #ifndef MFEM_USE_SUITESPARSE
474  J_prec = new DSmoother(1);
475  MINRESSolver *J_minres = new MINRESSolver;
476  J_minres->SetRelTol(rel_tol);
477  J_minres->SetAbsTol(0.0);
478  J_minres->SetMaxIter(300);
479  J_minres->SetPrintLevel(-1);
480  J_minres->SetPreconditioner(*J_prec);
481  J_solver = J_minres;
482 #else
483  J_solver = new UMFPackSolver;
484  J_prec = NULL;
485 #endif
486 
487  newton_solver.iterative_mode = false;
488  newton_solver.SetSolver(*J_solver);
489  newton_solver.SetOperator(*backward_euler_oper);
490  newton_solver.SetPrintLevel(1); // print Newton iterations
491  newton_solver.SetRelTol(rel_tol);
492  newton_solver.SetAbsTol(0.0);
493  newton_solver.SetMaxIter(10);
494 }
495 
496 void HyperelasticOperator::Mult(const Vector &vx, Vector &dvx_dt) const
497 {
498  // Create views to the sub-vectors v, x of vx, and dv_dt, dx_dt of dvx_dt
499  int sc = height/2;
500  Vector v(vx.GetData() + 0, sc);
501  Vector x(vx.GetData() + sc, sc);
502  Vector dv_dt(dvx_dt.GetData() + 0, sc);
503  Vector dx_dt(dvx_dt.GetData() + sc, sc);
504 
505  H.Mult(x, z);
506  if (viscosity != 0.0)
507  {
508  S.AddMult(v, z);
509  }
510  z.Neg(); // z = -z
511  M_solver.Mult(z, dv_dt);
512 
513  dx_dt = v;
514 }
515 
516 void HyperelasticOperator::ImplicitSolve(const double dt,
517  const Vector &vx, Vector &dvx_dt)
518 {
519  int sc = height/2;
520  Vector v(vx.GetData() + 0, sc);
521  Vector x(vx.GetData() + sc, sc);
522  Vector dv_dt(dvx_dt.GetData() + 0, sc);
523  Vector dx_dt(dvx_dt.GetData() + sc, sc);
524 
525  // By eliminating kx from the coupled system:
526  // kv = -M^{-1}*[H(x + dt*kx) + S*(v + dt*kv)]
527  // kx = v + dt*kv
528  // we reduce it to a nonlinear equation for kv, represented by the
529  // backward_euler_oper. This equation is solved with the newton_solver
530  // object (using J_solver and J_prec internally).
531  backward_euler_oper->SetParameters(dt, &v, &x);
532  Vector zero; // empty vector is interpreted as zero r.h.s. by NewtonSolver
533  newton_solver.Mult(zero, dv_dt);
534  add(v, dt, dv_dt, dx_dt);
535 
536  MFEM_VERIFY(newton_solver.GetConverged(), "Newton Solver did not converge.");
537 }
538 
539 double HyperelasticOperator::ElasticEnergy(Vector &x) const
540 {
541  return H.GetEnergy(x);
542 }
543 
544 double HyperelasticOperator::KineticEnergy(Vector &v) const
545 {
546  return 0.5*M.InnerProduct(v, v);
547 }
548 
549 void HyperelasticOperator::GetElasticEnergyDensity(
550  GridFunction &x, GridFunction &w) const
551 {
552  ElasticEnergyCoefficient w_coeff(*model, x);
553  w.ProjectCoefficient(w_coeff);
554 }
555 
556 HyperelasticOperator::~HyperelasticOperator()
557 {
558  delete model;
559  delete backward_euler_oper;
560  delete J_solver;
561  delete J_prec;
562 }
563 
564 
566  const IntegrationPoint &ip)
567 {
568  model.SetTransformation(T);
569  x.GetVectorGradient(T, J);
570  // return model.EvalW(J); // in reference configuration
571  return model.EvalW(J)/J.Det(); // in deformed configuration
572 }
573 
574 
575 void InitialDeformation(const Vector &x, Vector &y)
576 {
577  // set the initial configuration to be the same as the reference, stress
578  // free, configuration
579  y = x;
580 }
581 
582 void InitialVelocity(const Vector &x, Vector &v)
583 {
584  const int dim = x.Size();
585  const double s = 0.1/64.;
586 
587  v = 0.0;
588  v(dim-1) = s*x(0)*x(0)*(8.0-x(0));
589  v(0) = -s*x(0)*x(0);
590 }
void visualize(ostream &out, Mesh *mesh, GridFunction *deformed_nodes, GridFunction *field, const char *field_name=NULL, bool init_vis=false)
Definition: ex10.cpp:364
int GetVSize() const
Definition: fespace.hpp:164
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:1790
void InitialDeformation(const Vector &x, Vector &y)
Definition: ex10.cpp:575
Conjugate gradient method.
Definition: solvers.hpp:109
Class for grid function - Vector with associated FE space.
Definition: gridfunc.hpp:27
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:5882
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
Definition: table.cpp:445
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:84
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:88
void add(const Vector &v1, const Vector &v2, Vector &v)
Definition: vector.cpp:259
void InitialVelocity(const Vector &x, Vector &v)
Definition: ex10.cpp:582
Direct sparse solver using UMFPACK.
Definition: solvers.hpp:332
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
Definition: gridfunc.cpp:2138
void Add(const DenseMatrix &A, const DenseMatrix &B, double alpha, DenseMatrix &C)
C = A + alpha*B.
Definition: densemat.cpp:2769
int dim
Definition: ex3.cpp:48
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:140
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Definition: mesh.cpp:7316
void SetMaxIter(int max_it)
Definition: solvers.hpp:61
T Max() const
Definition: array.cpp:90
int Dimension() const
Definition: mesh.hpp:475
void PrintUsage(std::ostream &out) const
Definition: optparser.cpp:434
int SpaceDimension() const
Definition: mesh.hpp:476
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:8332
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:140
int main(int argc, char *argv[])
Definition: ex1.cpp:45
void SetRelTol(double rtol)
Definition: solvers.hpp:59
Abstract finite element space.
Definition: fespace.hpp:62
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:1140
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:5844
Arbitrary order H1-conforming (continuous) finite elements.
Definition: fe_coll.hpp:54
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:918
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:95
void Neg()
(*this) = -(*this)
Definition: vector.cpp:251
bool Good() const
Definition: optparser.hpp:120