MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
ex41.cpp
Go to the documentation of this file.
1// MFEM Example 41
2//
3// Compile with: make ex41
4//
5// Sample runs:
6// ex41
7// ex41 -cg
8// ex41 -m ../data/periodic-hexagon.mesh -p 0 -r 2 -dt 0.005 -tf 10
9// ex41 -m ../data/periodic-square.mesh -p 1 -r 2 -dt 0.005 -tf 9
10// ex41 -m ../data/periodic-hexagon.mesh -p 1 -r 2 -dt 0.005 -tf 9
11// ex41 -m ../data/amr-quad.mesh -p 1 -r 2 -dt 0.002 -tf 9
12// ex41 -m ../data/star-q3.mesh -p 1 -r 2 -dt 0.001 -tf 9
13// ex41 -m ../data/star-mixed.mesh -p 1 -r 2 -dt 0.005 -tf 9
14// ex41 -m ../data/disc-nurbs.mesh -p 1 -r 3 -dt 0.005 -tf 9
15// ex41 -m ../data/disc-nurbs.mesh -p 2 -r 3 -dt 0.005 -tf 9
16// ex41 -m ../data/periodic-square.mesh -p 3 -r 4 -dt 0.0025 -tf 9 -vs 20
17// ex41 -m ../data/periodic-cube.mesh -p 0 -r 2 -o 2 -dt 0.01 -tf 8
18//
19// Device sample runs:
20//
21// Description: This example code solves the time-dependent advection-diffusion
22// equation du/dt + v.grad(u) - a div(grad(u)) = 0, where v is a
23// given fluid velocity, a is the diffusion coefficient, and
24// u0(x)=u(0,x) is a given initial condition.
25//
26// The example demonstrates the use of Discontinuous Galerkin (DG)
27// bilinear forms in MFEM (face integrators), and the use of IMEX
28// ODE time integrators.
29//
30// The option to use continuous finite elements is available too.
31
32#include "mfem.hpp"
33
34using namespace std;
35using namespace mfem;
36
37// Mesh bounding box
39
40// Velocity coefficient
41template<int problem=0>
43{
44 int dim = x.Size();
45
46 // map to the reference [-1,1] domain
47 Vector X(dim);
48 for (int i = 0; i < dim; i++)
49 {
50 real_t center = (bb_min[i] + bb_max[i]) * 0.5;
51 X(i) = 2 * (x(i) - center) / (bb_max[i] - bb_min[i]);
52 }
53 switch (problem)
54 {
55 case 0:
56 {
57 // Translations in 1D, 2D, and 3D
58 switch (dim)
59 {
60 case 1: v(0) = 1.0; break;
61 case 2: v(0) = sqrt(2./3.); v(1) = sqrt(1./3.); break;
62 case 3: v(0) = sqrt(3./6.); v(1) = sqrt(2./6.); v(2) = sqrt(1./6.);
63 break;
64 }
65 break;
66 }
67 case 1:
68 case 2:
69 {
70 // Clockwise rotation in 2D around the origin
71 const real_t w = M_PI/2;
72 switch (dim)
73 {
74 case 1: v(0) = 1.0; break;
75 case 2: v(0) = w*X(1); v(1) = -w*X(0); break;
76 case 3: v(0) = w*X(1); v(1) = -w*X(0); v(2) = 0.0; break;
77 }
78 break;
79 }
80 case 3:
81 {
82 // Clockwise twisting rotation in 2D around the origin
83 const real_t w = M_PI/2;
84 real_t d = max((X(0)+1.)*(1.-X(0)),0.) * max((X(1)+1.)*(1.-X(1)),0.);
85 d = d*d;
86 switch (dim)
87 {
88 case 1: v(0) = 1.0; break;
89 case 2: v(0) = d*w*X(1); v(1) = -d*w*X(0); break;
90 case 3: v(0) = d*w*X(1); v(1) = -d*w*X(0); v(2) = 0.0; break;
91 }
92 break;
93 }
94 }
95}
96
97// Initial condition
98template<int problem=0>
100{
101 int dim = x.Size();
102
103 // map to the reference [-1,1] domain
104 Vector X(dim);
105 for (int i = 0; i < dim; i++)
106 {
107 real_t center = (bb_min[i] + bb_max[i]) * 0.5;
108 X(i) = 2 * (x(i) - center) / (bb_max[i] - bb_min[i]);
109 }
110
111 switch (problem)
112 {
113 case 0:
114 case 1:
115 {
116 switch (dim)
117 {
118 case 1:
119 return exp(-40.*pow(X(0)-0.5,2));
120 case 2:
121 case 3:
122 {
123 real_t rx = 0.45, ry = 0.25, cx = 0., cy = -0.2, w = 10.;
124 if (dim == 3)
125 {
126 const real_t s = (1. + 0.25*cos(2*M_PI*X(2)));
127 rx *= s;
128 ry *= s;
129 }
130 return ( std::erfc(w*(X(0)-cx-rx))*std::erfc(-w*(X(0)-cx+rx)) *
131 std::erfc(w*(X(1)-cy-ry))*std::erfc(-w*(X(1)-cy+ry)) )/16;
132 }
133 }
134 }
135 case 2:
136 {
137 real_t x_ = X(0), y_ = X(1), rho, phi;
138 rho = std::hypot(x_, y_);
139 phi = atan2(y_, x_);
140 return pow(sin(M_PI*rho),2)*sin(3*phi);
141 }
142 case 3:
143 {
144 const real_t f = M_PI;
145 return sin(f*X(0))*sin(f*X(1));
146 }
147 }
148 return 0.0;
149}
150
151/// Solver for the implicit part of the ODE (the diffusion term).
152/// Solves systems of the form: (M + dt*S) k = rhs.
153class Implicit_Solver : public Solver
154{
155private:
156 SparseMatrix &M, &S, A;
157 CGSolver linear_solver;
158 BlockILU prec;
159 real_t dt;
160public:
161 Implicit_Solver(SparseMatrix &M_, SparseMatrix &S_,
162 const FiniteElementSpace &fes)
163 : M(M_),
164 S(S_),
165 prec(fes.GetTypicalFE()->GetDof(),
166 BlockILU::Reordering::MINIMUM_DISCARDED_FILL),
167 dt(1.0)
168 {
169 linear_solver.iterative_mode = false;
170 linear_solver.SetRelTol(1e-9);
171 linear_solver.SetAbsTol(0.0);
172 linear_solver.SetMaxIter(100);
173 linear_solver.SetPrintLevel(0);
174 linear_solver.SetPreconditioner(prec);
175 }
176
177 void SetTimeStep(real_t dt_)
178 {
179 real_t ddt = dt-dt_;
180
182 epsilon = std::numeric_limits<real_t>::epsilon();
183 epsilon*=10;
184
185 if (std::abs(ddt) > epsilon)
186 {
187 dt = dt_;
188 // Form operator A = M + dt*S
189 A = S;
190 A *= dt;
191 A += M;
192
193 // this will also call SetOperator on the preconditioner
194 linear_solver.SetOperator(A);
195 }
196 }
197
198 void SetOperator(const Operator &op) override
199 {
200 linear_solver.SetOperator(op);
201 }
202
203 void Mult(const Vector &x, Vector &y) const override
204 {
205 linear_solver.Mult(x, y);
206 }
207};
208
209/** A time-dependent operator for the right-hand side of the ODE. The weak
210 form of the advection-diffusion equation is M du/dt = K u - S u + b,
211 where M is the mass matrix, K and S are the advection and diffusion
212 matrices, and b describes the flow on the boundary. In the case of IMEX
213 evolution, the diffusion term is treated implicitly, and the advection
214 term is treated explicitly. */
215class IMEX_Evolution : public TimeDependentOperator
216{
217private:
218 BilinearForm &M, &K, &S;
219 const Vector &b;
220 unique_ptr<Solver> M_prec;
221 CGSolver M_solver;
222 unique_ptr<Implicit_Solver> implicit_solver;
223
224 mutable Vector z;
225
226public:
227 IMEX_Evolution(BilinearForm &M_, BilinearForm &K_, BilinearForm &S_,
228 const Vector &b_);
229
230 /// Evaluate k1=M^{-1}*G1(u,t); -> k1 = M^{-1}*(K*u + b)
231 void Mult1(const Vector &x, Vector &y) const;
232
233 /// Evaluate k2: M*k2 = G2(u+k2*dt,t); -> (M+S*dt)*k2=-S*u
234 void ImplicitSolve2(const real_t dt, const Vector &x, Vector &k);
235
236 void Mult(const Vector &x, Vector &y) const override
237 {
238 if (TimeDependentOperator::EvalMode::ADDITIVE_TERM_1 == GetEvalMode())
239 {
240 Mult1(x,y);
241 }
242 else
243 {
244 mfem_error("TimeDependentOperator::Mult() is not overridden!");
245 }
246 }
247
248 void ImplicitSolve(const real_t dt, const Vector &x, Vector &k) override
249 {
250 if (TimeDependentOperator::EvalMode::ADDITIVE_TERM_2 == GetEvalMode())
251 {
252 ImplicitSolve2(dt,x,k);
253 }
254 else
255 {
256 mfem_error("TimeDependentOperator::ImplicitSolve() is not overridden!");
257 }
258 }
259
260};
261
262
263int main(int argc, char *argv[])
264{
265 // 1. Parse command-line options.
266 int problem = 0;
267 const char *mesh_file = "../data/periodic-square.mesh";
268 int ref_levels = 2;
269 int order = 3;
270 int ode_solver_type = 64; //IMEXRK3(3,4,3)
271 real_t t_final = 10.0;
272 real_t dt = 0.01;
273 bool paraview = false;
274 bool cg = false;
275 int vis_steps = 50;
276 real_t diffusion_term = 0.01;
277 real_t kappa = -1.0;
278 real_t sigma = -1.0;
279 bool visualization = true;
280 bool visit = false;
281 bool binary = false;
282 int precision = 8;
283 OptionsParser args(argc, argv);
284 args.AddOption(&mesh_file, "-m", "--mesh", "Mesh file to use.");
285 args.AddOption(&problem, "-p", "--problem",
286 "Problem setup to use. See options in velocity_function().");
287 args.AddOption(&ref_levels, "-r", "--refine",
288 "Number of times to refine the mesh uniformly.");
289 args.AddOption(&order, "-o", "--order", "Order of the finite elements.");
290 args.AddOption(&ode_solver_type, "-s", "--ode-solver",
291 ODESolver::IMEXTypes.c_str());
292 args.AddOption(&t_final, "-tf", "--t-final", "Final time; start time is 0.");
293 args.AddOption(&dt, "-dt", "--time-step", "Time step.");
294 args.AddOption(&diffusion_term, "-dc", "--diffusion-coeff",
295 "Diffusion coefficient in the PDE.");
296 args.AddOption(&paraview, "-paraview", "--paraview-datafiles", "-no-paraview",
297 "--no-paraview-datafiles",
298 "Save data files for ParaView (paraview.org) visualization.");
299 args.AddOption(&vis_steps, "-vs", "--visualization-steps",
300 "Visualize every n-th timestep.");
301 args.AddOption(&visualization, "-vis", "--visualization", "-no-vis",
302 "--no-visualization",
303 "Enable or disable GLVis visualization.");
304 args.AddOption(&binary, "-binary", "--binary-datafiles", "-ascii",
305 "--ascii-datafiles",
306 "Use binary (Sidre) or ascii format for VisIt data files.");
307 args.AddOption(&visit, "-visit", "--visit-datafiles", "-no-visit",
308 "--no-visit-datafiles",
309 "Save data files for VisIt (visit.llnl.gov) visualization.");
310 args.AddOption(&cg, "-cg", "--continuous-galerkin", "-dg",
311 "--discontinuous-galerkin",
312 "Use Continuous-Galerkin Finite elements (Default is DG)");
313 args.Parse();
314 if (!args.Good())
315 {
316 args.PrintUsage(cout);
317 return 1;
318 }
319 if (kappa < 0)
320 {
321 kappa = (order+1)*(order+1);
322 }
323 args.PrintOptions(cout);
324
325 // 2. Read the mesh from the given mesh file. We can handle geometrically
326 // periodic meshes in this code.
327 Mesh mesh(mesh_file);
328 const int dim = mesh.Dimension();
329
330 // 3. Define the IMEX (Split) ODE solver used for time integration. The IMEX
331 // solvers currently available are: 61 - Forward Backward Euler,
332 // 62 - IMEXRK2(2,2,2), 63 - IMEXRK2(2,3,2), and 64 - IMEX_DIRK_RK3.
333 unique_ptr<ODESolver> ode_solver = ODESolver::SelectIMEX(ode_solver_type);
334
335 // 4. Refine the mesh to increase the resolution. In this example we do
336 // 'ref_levels' of uniform refinement, where 'ref_levels' is a
337 // command-line parameter.
338 for (int lev = 0; lev < ref_levels; lev++) {mesh.UniformRefinement();}
339 if (mesh.NURBSext) {mesh.SetCurvature(max(order, 1));}
340 mesh.GetBoundingBox(bb_min, bb_max, max(order, 1));
341
342 // 5. Define the discontinuous DG finite element space of the given
343 // polynomial order on the refined mesh.
344 FiniteElementCollection *fec = NULL;
345 if (cg)
346 {
347 fec = new H1_FECollection(order, dim);
348 }
349 else
350 {
352 }
353 FiniteElementSpace fes(&mesh, fec);
354
355 cout << "Number of unknowns: " << fes.GetVSize() << endl;
356
357 // 6. Set up and assemble the bilinear and linear forms corresponding to the
358 // DG discretization. The DGTraceIntegrator involves integrals over mesh
359 // interior faces.
360 std::unique_ptr<VectorFunctionCoefficient> velocity;
361 if (0==problem)
362 {
364 }
365 else if (1==problem)
366 {
368 }
369 else if (2==problem)
370 {
372 }
373 else if (3==problem)
374 {
376 }
377
378 ConstantCoefficient diff_coeff(diffusion_term);
379
380 BilinearForm m(&fes);
381 BilinearForm k(&fes);
382 BilinearForm s(&fes);
383
384 Vector b(fes.GetTrueVSize());
385 b = 0.0; //The inflow on the boundaries is set to zero.
386
388
389 constexpr real_t alpha = -1.0;
391
392 s.AddDomainIntegrator(new DiffusionIntegrator(diff_coeff));
393 if (!cg)
394 {
396 alpha));
399 kappa));
401 }
402
403
404 int skip_zeros = 0;
405 m.Assemble(skip_zeros);
406 k.Assemble(skip_zeros);
407 s.Assemble(skip_zeros);
408
409 m.Finalize(skip_zeros);
410 k.Finalize(skip_zeros);
411 s.Finalize(skip_zeros);
412
413 // 7. Define the initial conditions.
414 std::unique_ptr<FunctionCoefficient> u0;
415 if (0==problem)
416 {
417 u0.reset(new FunctionCoefficient(u0_function<0>));
418 }
419 else if (1==problem)
420 {
421 u0.reset(new FunctionCoefficient(u0_function<1>));
422 }
423 else if (2==problem)
424 {
425 u0.reset(new FunctionCoefficient(u0_function<2>));
426 }
427 else if (3==problem)
428 {
429 u0.reset(new FunctionCoefficient(u0_function<3>));
430 }
431
432 GridFunction u(&fes);
433 u.ProjectCoefficient(*u0);
434
435 // Create data collection for solution output: either VisItDataCollection for
436 // ascii data files, or SidreDataCollection for binary data files.
437 DataCollection *dc = NULL;
438 if (visit)
439 {
440 if (binary)
441 {
442#ifdef MFEM_USE_SIDRE
443 dc = new SidreDataCollection("Example41", &mesh);
444#else
445 MFEM_ABORT("Must build with MFEM_USE_SIDRE=YES for binary output.");
446#endif
447 }
448 else
449 {
450 dc = new VisItDataCollection("Example41", &mesh);
451 dc->SetPrecision(precision);
452 }
453 dc->RegisterField("solution", &u);
454 dc->SetCycle(0);
455 dc->SetTime(0.0);
456 dc->Save();
457 }
458
459 // 8. Set up paraview visualization, if desired.
460 unique_ptr<ParaViewDataCollection> pv;
461 if (paraview)
462 {
463 pv = make_unique<ParaViewDataCollection>("Example41", &mesh);
464 pv->SetPrefixPath("ParaView");
465 pv->RegisterField("solution", &u);
466 pv->SetLevelsOfDetail(order);
467 pv->SetDataFormat(VTKFormat::BINARY);
468 pv->SetHighOrderOutput(true);
469 pv->SetCycle(0);
470 pv->SetTime(0.0);
471 pv->Save();
472 }
473
474 socketstream sout;
475 if (visualization)
476 {
477 char vishost[] = "localhost";
478 int visport = 19916;
479 sout.open(vishost, visport);
480 if (!sout)
481 {
482 cout << "Unable to connect to GLVis server at "
483 << vishost << ':' << visport << endl;
484 visualization = false;
485 cout << "GLVis visualization disabled.\n";
486 }
487 else
488 {
489 sout.precision(precision);
490 sout << "solution\n" << mesh << u;
491 sout << "pause\n";
492 sout << flush;
493 cout << "GLVis visualization paused."
494 << " Press space (in the GLVis window) to resume it.\n";
495 }
496 }
497
498 // 9. Define the time-dependent evolution operator describing the ODE
499 // right-hand side, and perform time-integration (looping over the time
500 // iterations, ti, with a time-step dt).
501 IMEX_Evolution adv(m, k, s, b);
502
503 real_t t = 0.0;
504 adv.SetTime(t);
505 ode_solver->Init(adv);
506
507 bool done = false;
508 for (int ti = 0; !done; )
509 {
510 real_t dt_real = min(dt, t_final - t);
511 ode_solver->Step(u, t, dt_real);
512 ti++;
513
514 done = (t >= t_final - 1e-8*dt);
515
516 if (done || ti % vis_steps == 0)
517 {
518 cout << "time step: " << ti << ", time: " << t << endl;
519 if (paraview)
520 {
521 pv->SetCycle(ti);
522 pv->SetTime(t);
523 pv->Save();
524 }
525 if (visualization)
526 {
527 sout << "solution\n" << mesh << u << flush;
528 }
529 if (visit)
530 {
531 dc->SetCycle(ti);
532 dc->SetTime(t);
533 dc->Save();
534 }
535
536 }
537 }
538
539 delete fec;
540 return 0;
541}
542
543
544// Implementation of class IMEX_Evolution
545IMEX_Evolution::IMEX_Evolution(BilinearForm &M_, BilinearForm &K_,
546 BilinearForm &S_, const Vector &b_)
547 : TimeDependentOperator(M_.FESpace()->GetTrueVSize()),
548 M(M_), K(K_), S(S_), b(b_), z(height)
549{
550 Array<int> ess_tdof_list;
551 if (M.GetAssemblyLevel() == AssemblyLevel::LEGACY)
552 {
553 M_prec = make_unique<DSmoother>(M.SpMat());
554 M_solver.SetOperator(M.SpMat());
555 implicit_solver = make_unique<Implicit_Solver>(M.SpMat(), S.SpMat(),
556 *M.FESpace());
557 }
558 else
559 {
560 MFEM_ABORT("Implicit time integration is not supported with partial assembly");
561 }
562 M_solver.SetPreconditioner(*M_prec);
563 M_solver.iterative_mode = false;
564 M_solver.SetRelTol(1e-9);
565 M_solver.SetAbsTol(0.0);
566 M_solver.SetMaxIter(100);
567 M_solver.SetPrintLevel(0);
568}
569
570void IMEX_Evolution::Mult1(const Vector &x, Vector &y) const
571{
572 // Perform the explicit step
573 // y = M^{-1} (K x + b)
574 K.Mult(x, z);
575 z += b;
576 M_solver.Mult(z, y);
577}
578
579void IMEX_Evolution::ImplicitSolve2(const real_t dt, const Vector &x, Vector &k)
580{
581 // Perform the implicit step
582 // solve for k, k = -(M+dt S)^{-1} S x
583 MFEM_VERIFY(implicit_solver != NULL,
584 "Implicit time integration is not supported with partial assembly");
585 S.Mult(x, z);
586 z.Neg();
587 implicit_solver->SetTimeStep(dt);
588 implicit_solver->Mult(z, k);
589}
@ GaussLobatto
Closed type.
Definition fe_base.hpp:36
A "square matrix" operator for the associated FE space and BLFIntegrators The sum of all the BLFInteg...
void AddDomainIntegrator(BilinearFormIntegrator *bfi)
Adds new Domain Integrator. Assumes ownership of bfi.
void Finalize(int skip_zeros=1) override
Finalizes the matrix initialization if the AssemblyLevel is AssemblyLevel::LEGACY....
FiniteElementSpace * FESpace()
Return the FE space associated with the BilinearForm.
void Assemble(int skip_zeros=1)
Assembles the form i.e. sums over all domain/bdr integrators.
AssemblyLevel GetAssemblyLevel() const
Returns the assembly level.
void AddBdrFaceIntegrator(BilinearFormIntegrator *bfi)
Adds new boundary Face Integrator. Assumes ownership of bfi.
void Mult(const Vector &x, Vector &y) const override
Matrix vector multiplication: .
const SparseMatrix & SpMat() const
Returns a const reference to the sparse matrix: .
void AddInteriorFaceIntegrator(BilinearFormIntegrator *bfi)
Adds new interior Face Integrator. Assumes ownership of bfi.
Conjugate gradient method.
Definition solvers.hpp:627
void Mult(const Vector &b, Vector &x) const override
Iterative solution of the linear system using the Conjugate Gradient method.
Definition solvers.cpp:869
void SetOperator(const Operator &op) override
Set/update the solver for the given operator.
Definition solvers.hpp:640
A coefficient that is constant across space and time.
void SetPrecision(int prec)
Set the precision (number of digits) used for the text output of doubles.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
void SetTime(real_t t)
Set physical time (for time-dependent simulations)
virtual void Save()
Save the collection to disk.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
Definition fe_coll.hpp:27
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:208
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
Definition fespace.hpp:829
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
Definition fespace.hpp:826
A general function coefficient.
Class for grid function - Vector with associated FE space.
Definition gridfunc.hpp:32
Arbitrary order H1-conforming (continuous) finite elements.
Definition fe_coll.hpp:279
void SetRelTol(real_t rtol)
Definition solvers.hpp:238
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Definition solvers.cpp:178
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
Definition solvers.cpp:76
void SetMaxIter(int max_it)
Definition solvers.hpp:240
void SetAbsTol(real_t atol)
Definition solvers.hpp:239
Mesh data type.
Definition mesh.hpp:65
NURBSExtension * NURBSext
Optional NURBS mesh extension.
Definition mesh.hpp:312
void GetBoundingBox(Vector &min, Vector &max, int ref=2)
Returns the minimum and maximum corners of the mesh bounding box.
Definition mesh.cpp:141
int Dimension() const
Dimension of the reference space used within the elements.
Definition mesh.hpp:1306
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
Set the curvature of the mesh nodes using the given polynomial degree.
Definition mesh.cpp:6799
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Definition mesh.cpp:11637
static MFEM_EXPORT std::unique_ptr< ODESolver > SelectIMEX(const int ode_solver_type)
Definition ode.cpp:115
static MFEM_EXPORT std::string IMEXTypes
Definition ode.hpp:198
Abstract operator.
Definition operator.hpp:25
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
Definition optparser.hpp:82
bool Good() const
Return true if the command line options were parsed successfully.
Data collection with Sidre routines following the Conduit mesh blueprint specification.
Base class for solvers.
Definition operator.hpp:792
bool iterative_mode
If true, use the second argument of Mult() as an initial guess.
Definition operator.hpp:795
Data type sparse matrix.
Definition sparsemat.hpp:51
Base abstract class for first order time dependent operators.
Definition operator.hpp:344
virtual void SetTime(const real_t t_)
Set the current time.
Definition operator.hpp:406
EvalMode GetEvalMode() const
Return the current evaluation mode. See SetEvalMode() for details.
Definition operator.hpp:416
A general vector function coefficient.
Vector data type.
Definition vector.hpp:82
void Neg()
(*this) = -(*this)
Definition vector.cpp:376
int Size() const
Returns the size of the vector.
Definition vector.hpp:234
Data collection with VisIt I/O routines.
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
real_t sigma(const Vector &x)
Definition maxwell.cpp:91
int problem
Definition ex15.cpp:62
const real_t alpha
Definition ex15.cpp:369
real_t kappa
Definition ex24.cpp:54
int dim
Definition ex24.cpp:53
real_t epsilon
Definition ex25.cpp:141
void velocity_function(const Vector &x, Vector &v)
Definition ex41.cpp:42
real_t u0_function(const Vector &x)
Definition ex41.cpp:99
Vector bb_min
Definition ex41.cpp:38
Vector bb_max
Definition ex41.cpp:38
int main()
real_t b
Definition lissajous.cpp:42
int GetTrueVSize(const FieldDescriptor &f)
Get the true dof size of a field descriptor.
Definition util.hpp:829
real_t u(const Vector &xvec)
Definition lor_mms.hpp:22
void mfem_error(const char *msg)
Definition error.cpp:154
L2_FECollection DG_FECollection
Declare an alternative name for L2_FECollection = DG_FECollection.
Definition fe_coll.hpp:403
float real_t
Definition config.hpp:46
std::function< real_t(const Vector &)> f(real_t mass_coeff)
Definition lor_mms.hpp:30
const char vishost[]
MFEM_HOST_DEVICE Complex exp(const Complex &q)