MFEM  v3.0
ex10p.cpp
Go to the documentation of this file.
1 // MFEM Example 10 - Parallel Version
2 //
3 // Compile with: make ex10p
4 //
5 // Sample runs:
6 // mpirun -np 4 ex10p -m ../data/beam-quad.mesh -s 3 -rs 2 -dt 3
7 // mpirun -np 4 ex10p -m ../data/beam-tri.mesh -s 3 -rs 2 -dt 3
8 // mpirun -np 4 ex10p -m ../data/beam-hex.mesh -s 2 -rs 1 -dt 3
9 // mpirun -np 4 ex10p -m ../data/beam-tet.mesh -s 2 -rs 1 -dt 3
10 // mpirun -np 4 ex10p -m ../data/beam-quad.mesh -s 14 -rs 2 -dt 0.03 -vs 20
11 // mpirun -np 4 ex10p -m ../data/beam-hex.mesh -s 14 -rs 1 -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  ParFiniteElementSpace &fespace;
61
62  ParBilinearForm M, S;
64  double viscosity;
65  HyperelasticModel *model;
66
67  HypreParMatrix *Mmat; // Mass matrix from ParallelAssemble()
68  CGSolver M_solver; // Krylov solver for inverting the mass matrix M
69  HypreSmoother M_prec; // Preconditioner for the mass matrix M
70
73  BackwardEulerOperator *backward_euler_oper;
75  NewtonSolver newton_solver;
77  Solver *J_solver;
79  Solver *J_prec;
80
81  mutable Vector z; // auxiliary vector
82
83 public:
84  HyperelasticOperator(ParFiniteElementSpace &f, Array<int> &ess_bdr,
85  double visc);
86
87  virtual void Mult(const Vector &vx, Vector &dvx_dt) const;
90  virtual void ImplicitSolve(const double dt, const Vector &x, Vector &k);
91
92  double ElasticEnergy(ParGridFunction &x) const;
93  double KineticEnergy(ParGridFunction &v) const;
94  void GetElasticEnergyDensity(ParGridFunction &x, ParGridFunction &w) const;
95
96  virtual ~HyperelasticOperator();
97 };
98
99 // Nonlinear operator of the form:
100 // k --> (M + dt*S)*k + H(x + dt*v + dt^2*k) + S*v,
101 // where M and S are given BilinearForms, H is a given NonlinearForm, v and x
102 // are given vectors, and dt is a scalar.
103 class BackwardEulerOperator : public Operator
104 {
105 private:
106  ParBilinearForm *M, *S;
107  ParNonlinearForm *H;
108  mutable HypreParMatrix *Jacobian;
109  const Vector *v, *x;
110  double dt;
111  mutable Vector w, z;
112
113 public:
114  BackwardEulerOperator(ParBilinearForm *M_, ParBilinearForm *S_,
115  ParNonlinearForm *H_);
116  void SetParameters(double dt_, const Vector *v_, const Vector *x_);
117  virtual void Mult(const Vector &k, Vector &y) const;
118  virtual Operator &GetGradient(const Vector &k) const;
119  virtual ~BackwardEulerOperator();
120 };
121
124 class ElasticEnergyCoefficient : public Coefficient
125 {
126 private:
127  HyperelasticModel &model;
128  ParGridFunction &x;
129  DenseMatrix J;
130
131 public:
132  ElasticEnergyCoefficient(HyperelasticModel &m, ParGridFunction &x_)
133  : model(m), x(x_) { }
134  virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip);
135  virtual ~ElasticEnergyCoefficient() { }
136 };
137
138 void InitialDeformation(const Vector &x, Vector &y);
139
140 void InitialVelocity(const Vector &x, Vector &v);
141
142 void visualize(ostream &out, ParMesh *mesh, ParGridFunction *deformed_nodes,
143  ParGridFunction *field, const char *field_name = NULL,
144  bool init_vis = false);
145
146
147 int main(int argc, char *argv[])
148 {
149  // 1. Initialize MPI.
150  int num_procs, myid;
151  MPI_Init(&argc, &argv);
152  MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
153  MPI_Comm_rank(MPI_COMM_WORLD, &myid);
154
155  // 2. Parse command-line options.
156  const char *mesh_file = "../data/beam-quad.mesh";
157  int ser_ref_levels = 2;
158  int par_ref_levels = 0;
159  int order = 2;
160  int ode_solver_type = 3;
161  double t_final = 300.0;
162  double dt = 3;
163  double visc = 1e-2;
164  bool visualization = true;
165  int vis_steps = 1;
166
167  OptionsParser args(argc, argv);
169  "Mesh file to use.");
171  "Number of times to refine the mesh uniformly in serial.");
173  "Number of times to refine the mesh uniformly in parallel.");
175  "Order (degree) of the finite elements.");
177  "ODE solver: 1 - Backward Euler, 2 - SDIRK2, 3 - SDIRK3,\n\t"
178  "\t 11 - Forward Euler, 12 - RK2, 13 - RK3 SSP, 14 - RK4.");
180  "Final time; start time is 0.");
182  "Time step.");
184  "Viscosity coefficient.");
186  "--no-visualization",
187  "Enable or disable GLVis visualization.");
189  "Visualize every n-th timestep.");
190  args.Parse();
191  if (!args.Good())
192  {
193  if (myid == 0)
194  args.PrintUsage(cout);
195  MPI_Finalize();
196  return 1;
197  }
198  if (myid == 0)
199  args.PrintOptions(cout);
200
201  // 3. Read the serial mesh from the given mesh file on all processors. We can
202  // handle triangular, quadrilateral, tetrahedral and hexahedral meshes
203  // with the same code.
204  Mesh *mesh;
205  ifstream imesh(mesh_file);
206  if (!imesh)
207  {
208  if (myid == 0)
209  cerr << "\nCan not open mesh file: " << mesh_file << '\n' << endl;
210  MPI_Finalize();
211  return 2;
212  }
213  mesh = new Mesh(imesh, 1, 1);
214  imesh.close();
215  int dim = mesh->Dimension();
216
217  // 4. Define the ODE solver used for time integration. Several implicit
218  // singly diagonal implicit Runge-Kutta (SDIRK) methods, as well as
219  // explicit Runge-Kutta methods are available.
220  ODESolver *ode_solver;
221  switch (ode_solver_type)
222  {
223  // Implicit L-stable methods
224  case 1: ode_solver = new BackwardEulerSolver; break;
225  case 2: ode_solver = new SDIRK23Solver(2); break;
226  case 3: ode_solver = new SDIRK33Solver; break;
227  // Explicit methods
228  case 11: ode_solver = new ForwardEulerSolver; break;
229  case 12: ode_solver = new RK2Solver(0.5); break; // midpoint method
230  case 13: ode_solver = new RK3SSPSolver; break;
231  case 14: ode_solver = new RK4Solver; break;
232  // Implicit A-stable methods (not L-stable)
233  case 22: ode_solver = new ImplicitMidpointSolver; break;
234  case 23: ode_solver = new SDIRK23Solver; break;
235  case 24: ode_solver = new SDIRK34Solver; break;
236  default:
237  if (myid == 0)
238  cout << "Unknown ODE solver type: " << ode_solver_type << '\n';
239  MPI_Finalize();
240  return 3;
241  }
242
243  // 5. Refine the mesh in serial to increase the resolution. In this example
244  // we do 'ser_ref_levels' of uniform refinement, where 'ser_ref_levels' is
245  // a command-line parameter.
246  for (int lev = 0; lev < ser_ref_levels; lev++)
247  mesh->UniformRefinement();
248
249  // 6. Define a parallel mesh by a partitioning of the serial mesh. Refine
250  // this mesh further in parallel to increase the resolution. Once the
251  // parallel mesh is defined, the serial mesh can be deleted.
252  ParMesh *pmesh = new ParMesh(MPI_COMM_WORLD, *mesh);
253  delete mesh;
254  for (int lev = 0; lev < par_ref_levels; lev++)
255  pmesh->UniformRefinement();
256
257  // 7. Define the parallel vector finite element spaces representing the mesh
258  // deformation x_gf, the velocity v_gf, and the initial configuration,
259  // x_ref. Define also the elastic energy density, w_gf, which is in a
260  // discontinuous higher-order space. Since x and v are integrated in time
261  // as a system, we group them together in block vector vx, on the unique
262  // parallel degrees of freedom, with offsets given by array true_offset.
263  H1_FECollection fe_coll(order, dim);
264  ParFiniteElementSpace fespace(pmesh, &fe_coll, dim);
265
266  int glob_size = fespace.GlobalTrueVSize();
267  if (myid == 0)
268  cout << "Number of velocity/deformation unknowns: " << glob_size << endl;
269  int true_size = fespace.TrueVSize();
270  Array<int> true_offset(3);
271  true_offset[0] = 0;
272  true_offset[1] = true_size;
273  true_offset[2] = 2*true_size;
274
275  BlockVector vx(true_offset);
276  ParGridFunction v_gf(&fespace), x_gf(&fespace);
277
278  ParGridFunction x_ref(&fespace);
279  pmesh->GetNodes(x_ref);
280
281  L2_FECollection w_fec(order + 1, dim);
282  ParFiniteElementSpace w_fespace(pmesh, &w_fec);
283  ParGridFunction w_gf(&w_fespace);
284
285  // 8. Set the initial conditions for v_gf, x_gf and vx, and define the
286  // boundary conditions on a beam-like mesh (see description above).
288  v_gf.ProjectCoefficient(velo);
290  x_gf.ProjectCoefficient(deform);
291
292  v_gf.GetTrueDofs(vx.GetBlock(0));
293  x_gf.GetTrueDofs(vx.GetBlock(1));
294
295  Array<int> ess_bdr(fespace.GetMesh()->bdr_attributes.Max());
296  ess_bdr = 0;
297  ess_bdr[0] = 1; // boundary attribute 1 (index 0) is fixed
298
299  // 9. Initialize the hyperelastic operator, the GLVis visualization and print
300  // the initial energies.
301  HyperelasticOperator oper(fespace, ess_bdr, visc);
302
303  socketstream vis_v, vis_w;
304  if (visualization)
305  {
306  char vishost[] = "localhost";
307  int visport = 19916;
308  vis_v.open(vishost, visport);
309  vis_v.precision(8);
310  visualize(vis_v, pmesh, &x_gf, &v_gf, "Velocity", true);
311  // Make sure all ranks have sent their 'v' solution before initiating
312  // another set of GLVis connections (one from each rank):
313  MPI_Barrier(pmesh->GetComm());
314  vis_w.open(vishost, visport);
315  if (vis_w)
316  {
317  oper.GetElasticEnergyDensity(x_gf, w_gf);
318  vis_w.precision(8);
319  visualize(vis_w, pmesh, &x_gf, &w_gf, "Elastic energy density", true);
320  }
321  }
322
323  double ee0 = oper.ElasticEnergy(x_gf);
324  double ke0 = oper.KineticEnergy(v_gf);
325  if (myid == 0)
326  {
327  cout << "initial elastic energy (EE) = " << ee0 << endl;
328  cout << "initial kinetic energy (KE) = " << ke0 << endl;
329  cout << "initial total energy (TE) = " << (ee0 + ke0) << endl;
330  }
331
332  // 10. Perform time-integration (looping over the time iterations, ti, with a
333  // time-step dt).
334  ode_solver->Init(oper);
335  double t = 0.0;
336
337  bool last_step = false;
338  for (int ti = 1; !last_step; ti++)
339  {
340  if (t + dt >= t_final - dt/2)
341  last_step = true;
342
343  ode_solver->Step(vx, t, dt);
344
345  if (last_step || (ti % vis_steps) == 0)
346  {
347  v_gf.Distribute(vx.GetBlock(0));
348  x_gf.Distribute(vx.GetBlock(1));
349
350  double ee = oper.ElasticEnergy(x_gf);
351  double ke = oper.KineticEnergy(v_gf);
352
353  if (myid == 0)
354  cout << "step " << ti << ", t = " << t << ", EE = " << ee
355  << ", KE = " << ke << ", ΔTE = " << (ee+ke)-(ee0+ke0) << endl;
356
357  if (visualization)
358  {
359  visualize(vis_v, pmesh, &x_gf, &v_gf);
360  if (vis_w)
361  {
362  oper.GetElasticEnergyDensity(x_gf, w_gf);
363  visualize(vis_w, pmesh, &x_gf, &w_gf);
364  }
365  }
366  }
367  }
368
369  // 11. Save the displaced mesh, the velocity and elastic energy.
370  {
371  GridFunction *nodes = &x_gf;
372  int owns_nodes = 0;
373  pmesh->SwapNodes(nodes, owns_nodes);
374
375  ostringstream mesh_name, velo_name, ee_name;
376  mesh_name << "deformed." << setfill('0') << setw(6) << myid;
377  velo_name << "velocity." << setfill('0') << setw(6) << myid;
378  ee_name << "elastic_energy." << setfill('0') << setw(6) << myid;
379
380  ofstream mesh_ofs(mesh_name.str().c_str());
381  mesh_ofs.precision(8);
382  pmesh->Print(mesh_ofs);
383  pmesh->SwapNodes(nodes, owns_nodes);
384  ofstream velo_ofs(velo_name.str().c_str());
385  velo_ofs.precision(8);
386  v_gf.Save(velo_ofs);
387  ofstream ee_ofs(ee_name.str().c_str());
388  ee_ofs.precision(8);
389  oper.GetElasticEnergyDensity(x_gf, w_gf);
390  w_gf.Save(ee_ofs);
391  }
392
393  // 10. Free the used memory.
394  delete ode_solver;
395  delete pmesh;
396
397  MPI_Finalize();
398
399  return 0;
400 }
401
402 void visualize(ostream &out, ParMesh *mesh, ParGridFunction *deformed_nodes,
403  ParGridFunction *field, const char *field_name, bool init_vis)
404 {
405  if (!out)
406  return;
407
408  GridFunction *nodes = deformed_nodes;
409  int owns_nodes = 0;
410
411  mesh->SwapNodes(nodes, owns_nodes);
412
413  out << "parallel " << mesh->GetNRanks() << " " << mesh->GetMyRank() << "\n";
414  out << "solution\n" << *mesh << *field;
415
416  mesh->SwapNodes(nodes, owns_nodes);
417
418  if (init_vis)
419  {
420  out << "window_size 800 800\n";
421  out << "window_title '" << field_name << "'\n";
422  if (mesh->SpaceDimension() == 2)
423  {
424  out << "view 0 0\n"; // view from top
425  out << "keys jl\n"; // turn off perspective and light
426  }
427  out << "keys cm\n"; // show colorbar and mesh
428  out << "autoscale value\n"; // update value-range; keep mesh-extents fixed
429  out << "pause\n";
430  }
431  out << flush;
432 }
433
434 BackwardEulerOperator::BackwardEulerOperator(
436  : Operator(M_->ParFESpace()->TrueVSize()), M(M_), S(S_), H(H_),
437  Jacobian(NULL), v(NULL), x(NULL), dt(0.0), w(height), z(height)
438 { }
439
440 void BackwardEulerOperator::SetParameters(double dt_, const Vector *v_,
441  const Vector *x_)
442 {
443  dt = dt_; v = v_; x = x_;
444 }
445
446 void BackwardEulerOperator::Mult(const Vector &k, Vector &y) const
447 {
448  // compute: y = H(x + dt*(v + dt*k)) + M*k + S*(v + dt*k)
451  H->Mult(z, y);
454 }
455
456 Operator &BackwardEulerOperator::GetGradient(const Vector &k) const
457 {
458  delete Jacobian;
459  SparseMatrix *localJ = Add(1.0, M->SpMat(), dt, S->SpMat());
463  Jacobian = M->ParallelAssemble(localJ);
464  delete localJ;
465  return *Jacobian;
466 }
467
468 BackwardEulerOperator::~BackwardEulerOperator()
469 {
470  delete Jacobian;
471 }
472
473
474 HyperelasticOperator::HyperelasticOperator(ParFiniteElementSpace &f,
475  Array<int> &ess_bdr, double visc)
476  : TimeDependentOperator(2*f.TrueVSize(), 0.0), fespace(f),
477  M(&fespace), S(&fespace), H(&fespace), M_solver(f.GetComm()),
478  newton_solver(f.GetComm()), z(height/2)
479 {
480  const double rel_tol = 1e-8;
481  const int skip_zero_entries = 0;
482
483  const double ref_density = 1.0; // density in the reference configuration
484  ConstantCoefficient rho0(ref_density);
486  M.Assemble(skip_zero_entries);
487  M.EliminateEssentialBC(ess_bdr);
488  M.Finalize(skip_zero_entries);
489  Mmat = M.ParallelAssemble();
490
491  M_solver.iterative_mode = false;
492  M_solver.SetRelTol(rel_tol);
493  M_solver.SetAbsTol(0.0);
494  M_solver.SetMaxIter(30);
495  M_solver.SetPrintLevel(0);
496  M_prec.SetType(HypreSmoother::Jacobi);
497  M_solver.SetPreconditioner(M_prec);
498  M_solver.SetOperator(*Mmat);
499
500  double mu = 0.25; // shear modulus
501  double K = 5.0; // bulk modulus
502  model = new NeoHookeanModel(mu, K);
504  H.SetEssentialBC(ess_bdr);
505
506  viscosity = visc;
507  ConstantCoefficient visc_coeff(viscosity);
509  S.Assemble(skip_zero_entries);
510  S.EliminateEssentialBC(ess_bdr);
511  S.Finalize(skip_zero_entries);
512
513  backward_euler_oper = new BackwardEulerOperator(&M, &S, &H);
514
515  HypreSmoother *J_hypreSmoother = new HypreSmoother;
516  J_hypreSmoother->SetType(HypreSmoother::l1Jacobi);
517  J_prec = J_hypreSmoother;
518
519  MINRESSolver *J_minres = new MINRESSolver(f.GetComm());
520  J_minres->SetRelTol(rel_tol);
521  J_minres->SetAbsTol(0.0);
522  J_minres->SetMaxIter(300);
523  J_minres->SetPrintLevel(-1);
524  J_minres->SetPreconditioner(*J_prec);
525  J_solver = J_minres;
526
527  newton_solver.iterative_mode = false;
528  newton_solver.SetSolver(*J_solver);
529  newton_solver.SetOperator(*backward_euler_oper);
530  newton_solver.SetPrintLevel(1); // print Newton iterations
531  newton_solver.SetRelTol(rel_tol);
532  newton_solver.SetAbsTol(0.0);
533  newton_solver.SetMaxIter(10);
534 }
535
536 void HyperelasticOperator::Mult(const Vector &vx, Vector &dvx_dt) const
537 {
538  // Create views to the sub-vectors v, x of vx, and dv_dt, dx_dt of dvx_dt
539  int sc = height/2;
540  Vector v(vx.GetData() + 0, sc);
541  Vector x(vx.GetData() + sc, sc);
542  Vector dv_dt(dvx_dt.GetData() + 0, sc);
543  Vector dx_dt(dvx_dt.GetData() + sc, sc);
544
545  H.Mult(x, z);
546  if (viscosity != 0.0)
548  z.Neg(); // z = -z
549  M_solver.Mult(z, dv_dt);
550
551  dx_dt = v;
552 }
553
554 void HyperelasticOperator::ImplicitSolve(const double dt,
555  const Vector &vx, Vector &dvx_dt)
556 {
557  int sc = height/2;
558  Vector v(vx.GetData() + 0, sc);
559  Vector x(vx.GetData() + sc, sc);
560  Vector dv_dt(dvx_dt.GetData() + 0, sc);
561  Vector dx_dt(dvx_dt.GetData() + sc, sc);
562
563  // By eliminating kx from the coupled system:
564  // kv = -M^{-1}*[H(x + dt*kx) + S*(v + dt*kv)]
565  // kx = v + dt*kv
566  // we reduce it to a nonlinear equation for kv, represented by the
567  // backward_euler_oper. This equation is solved with the newton_solver
568  // object (using J_solver and J_prec internally).
569  backward_euler_oper->SetParameters(dt, &v, &x);
570  Vector zero; // empty vector is interpreted as zero r.h.s. by NewtonSolver
571  newton_solver.Mult(zero, dv_dt);
573
574  MFEM_VERIFY(newton_solver.GetConverged(), "Newton Solver did not converge.");
575 }
576
577 double HyperelasticOperator::ElasticEnergy(ParGridFunction &x) const
578 {
579  return H.GetEnergy(x);
580 }
581
582 double HyperelasticOperator::KineticEnergy(ParGridFunction &v) const
583 {
584  double loc_energy = 0.5*M.InnerProduct(v, v);
585  double energy;
586  MPI_Allreduce(&loc_energy, &energy, 1, MPI_DOUBLE, MPI_SUM,
587  fespace.GetComm());
588  return energy;
589 }
590
591 void HyperelasticOperator::GetElasticEnergyDensity(
592  ParGridFunction &x, ParGridFunction &w) const
593 {
594  ElasticEnergyCoefficient w_coeff(*model, x);
595  w.ProjectCoefficient(w_coeff);
596 }
597
598 HyperelasticOperator::~HyperelasticOperator()
599 {
600  delete model;
601  delete backward_euler_oper;
602  delete J_solver;
603  delete J_prec;
604  delete Mmat;
605 }
606
607
609  const IntegrationPoint &ip)
610 {
611  model.SetTransformation(T);
613  // return model.EvalW(J); // in reference configuration
614  return model.EvalW(J)/J.Det(); // in deformed configuration
615 }
616
617
618 void InitialDeformation(const Vector &x, Vector &y)
619 {
620  // set the initial configuration to be the same as the reference, stress
621  // free, configuration
622  y = x;
623 }
624
625 void InitialVelocity(const Vector &x, Vector &v)
626 {
627  const int dim = x.Size();
628  const double s = 0.1/64.;
629
630  v = 0.0;
631  v(dim-1) = s*x(0)*x(0)*(8.0-x(0));
632  v(0) = -s*x(0)*x(0);
633 }
void visualize(ostream &out, Mesh *mesh, GridFunction *deformed_nodes, GridFunction *field, const char *field_name=NULL, bool init_vis=false)
Definition: ex10.cpp:354
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
Definition: solvers.hpp:109
Class for grid function - Vector with associated FE space.
Definition: gridfunc.hpp:26
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
MPI_Comm GetComm()
Definition: pmesh.hpp:68
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
Parallel non-linear operator on the true dofs.
Abstract class for solving systems of ODEs: dx/dt = f(x,t)
Definition: ode.hpp:22
virtual void Save(std::ostream &out) const
Definition: pgridfunc.cpp:250
Abstract parallel finite element space.
Definition: pfespace.hpp:28
void ProjectCoefficient(Coefficient &coeff)
Definition: pgridfunc.cpp:229
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
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
Parallel smoothers in hypre.
Definition: hypre.hpp:250
int Dimension() const
Definition: mesh.hpp:417
void PrintUsage(std::ostream &out) const
Definition: optparser.cpp:385
void GetTrueDofs(Vector &tv) const
Returns the true dofs in a HypreParVector.
Definition: pgridfunc.cpp:83
int SpaceDimension() const
Definition: mesh.hpp:418
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
int GetNRanks()
Definition: pmesh.hpp:69
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
void Distribute(const Vector *tv)
Definition: pgridfunc.cpp:78
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
Class for parallel bilinear form.
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
Class for parallel grid function.
Definition: pgridfunc.hpp:31
The classical forward Euler method.
Definition: ode.hpp:39
Abstract operator.
Definition: operator.hpp:21
Wrapper for hypre&#39;s ParCSR matrix class.
Definition: hypre.hpp:103
Definition: gridfunc.cpp:757
Vector & GetBlock(int i)
Get the i-th vector in the block.
int GetMyRank()
Definition: pmesh.hpp:70
Class for parallel meshes.
Definition: pmesh.hpp:27
void SetType(HypreSmoother::Type type, int relax_times=1)
Set the relaxation type and number of sweeps.
Definition: hypre.cpp:1011
Arbitrary order &quot;L2-conforming&quot; discontinuous finite elements.
Definition: fe_coll.hpp:83
void Neg()
(*this) = -(*this)
Definition: vector.cpp:207
virtual void Print(std::ostream &out=std::cout) const
Definition: pmesh.cpp:2444
bool Good() const
Definition: optparser.hpp:120