MFEM v4.10.0
Finite element discretization library
Loading...
Searching...
No Matches
ex9.cpp
Go to the documentation of this file.
1// MFEM Example 9
2//
3// Compile with: make ex9
4//
5// Sample runs:
6// ex9 -m ../data/periodic-segment.mesh -p 0 -r 2 -dt 0.005
7// ex9 -m ../data/periodic-square.mesh -p 0 -r 2 -dt 0.01 -tf 10
8// ex9 -m ../data/periodic-hexagon.mesh -p 0 -r 2 -dt 0.01 -tf 10
9// ex9 -m ../data/periodic-square.mesh -p 1 -r 2 -dt 0.005 -tf 9
10// ex9 -m ../data/periodic-hexagon.mesh -p 1 -r 2 -dt 0.005 -tf 9
11// ex9 -m ../data/amr-quad.mesh -p 1 -r 2 -dt 0.002 -tf 9
12// ex9 -m ../data/amr-quad.mesh -p 1 -r 2 -dt 0.02 -s 23 -tf 9
13// ex9 -m ../data/star-q3.mesh -p 1 -r 2 -dt 0.005 -tf 9
14// ex9 -m ../data/star-mixed.mesh -p 1 -r 2 -dt 0.005 -tf 9
15// ex9 -m ../data/disc-nurbs.mesh -p 1 -r 3 -dt 0.005 -tf 9
16// ex9 -m ../data/disc-nurbs.mesh -p 2 -r 3 -dt 0.005 -tf 9
17// ex9 -m ../data/periodic-square.mesh -p 3 -r 4 -dt 0.0025 -tf 9 -vs 20
18// ex9 -m ../data/periodic-cube.mesh -p 0 -r 2 -o 2 -dt 0.02 -tf 8
19// ex9 -m ../data/periodic-square.msh -p 0 -r 2 -dt 0.005 -tf 2
20// ex9 -m ../data/periodic-cube.msh -p 0 -r 1 -o 2 -tf 2
21// ex9 -m ../data/amr-hex.mesh -p 1 -r 1 -dt 0.005 -tf 0.5 -s 21 -imp-state
22//
23// Device sample runs:
24// ex9 -pa
25// ex9 -ea
26// ex9 -fa
27// ex9 -pa -m ../data/periodic-cube.mesh
28// ex9 -pa -m ../data/periodic-cube.mesh -d cuda
29// ex9 -ea -m ../data/periodic-cube.mesh -d cuda
30// ex9 -fa -m ../data/periodic-cube.mesh -d cuda
31// ex9 -pa -m ../data/amr-quad.mesh -p 1 -r 2 -dt 0.002 -tf 9 -d cuda
32//
33// Description: This example code solves the time-dependent advection equation
34// du/dt + v.grad(u) = 0, where v is a given fluid velocity, and
35// u0(x)=u(0,x) is a given initial condition.
36//
37// The example demonstrates the use of Discontinuous Galerkin (DG)
38// bilinear forms in MFEM (face integrators), the use of implicit
39// and explicit ODE time integrators, the definition of periodic
40// boundary conditions through periodic meshes, as well as the use
41// of GLVis for persistent visualization of a time-evolving
42// solution. The saving of time-dependent data files for external
43// visualization with VisIt (visit.llnl.gov) and ParaView
44// (paraview.org) is also illustrated.
45
46#include "mfem.hpp"
47#include <fstream>
48#include <iostream>
49#include <algorithm>
50
51using namespace std;
52using namespace mfem;
53
54// Choice for the problem setup. The fluid velocity, initial condition and
55// inflow boundary condition are chosen based on this parameter.
57
58// Velocity coefficient
59void velocity_function(const Vector &x, Vector &v);
60
61// Initial condition
62real_t u0_function(const Vector &x);
63
64// Inflow boundary condition
66
67// Mesh bounding box
69
70class DG_Solver : public Solver
71{
72private:
73 SparseMatrix &M, &K, A;
74 GMRESSolver linear_solver;
75 BlockILU prec;
76 real_t dt;
77public:
78 DG_Solver(SparseMatrix &M_, SparseMatrix &K_, const FiniteElementSpace &fes)
79 : M(M_),
80 K(K_),
81 prec(fes.GetTypicalFE()->GetDof(),
82 BlockILU::Reordering::MINIMUM_DISCARDED_FILL),
83 dt(-1.0)
84 {
85 linear_solver.iterative_mode = false;
86 linear_solver.SetRelTol(1e-9);
87 linear_solver.SetAbsTol(0.0);
88 linear_solver.SetMaxIter(100);
89 linear_solver.SetPrintLevel(0);
90 linear_solver.SetPreconditioner(prec);
91 }
92
93 void SetTimeStep(real_t dt_)
94 {
95 if (dt_ != dt)
96 {
97 dt = dt_;
98 // Form operator A = M - dt*K
99 A = K;
100 A *= -dt;
101 A += M;
102
103 // this will also call SetOperator on the preconditioner
104 linear_solver.SetOperator(A);
105 }
106 }
107
108 void SetOperator(const Operator &op) override
109 {
110 linear_solver.SetOperator(op);
111 }
112
113 void Mult(const Vector &x, Vector &y) const override
114 {
115 linear_solver.Mult(x, y);
116 }
117};
118
119/** A time-dependent operator for the right-hand side of the ODE. The DG weak
120 form of du/dt = -v.grad(u) is M du/dt = K u + b, where M and K are the mass
121 and advection matrices, and b describes the flow on the boundary. This can
122 be written as a general ODE, du/dt = M^{-1} (K u + b), and this class is
123 used to evaluate the right-hand side. */
124class FE_Evolution : public TimeDependentOperator
125{
126private:
127 BilinearForm &M, &K;
128 const Vector &b;
129 Solver *M_prec;
130 CGSolver M_solver;
131 DG_Solver *dg_solver;
132
133 mutable Vector z;
134
135public:
136 FE_Evolution(BilinearForm &M_, BilinearForm &K_, const Vector &b_);
137
138 void Mult(const Vector &x, Vector &y) const override;
139 void ImplicitSolve(const real_t dt, const Vector &x, Vector &k) override;
140
141 ~FE_Evolution() override;
142};
143
144
145int main(int argc, char *argv[])
146{
147 // 1. Parse command-line options.
148 problem = 0;
149 const char *mesh_file = "../data/periodic-hexagon.mesh";
150 int ref_levels = 2;
151 int order = 3;
152 bool pa = false;
153 bool ea = false;
154 bool fa = false;
155 const char *device_config = "cpu";
156 int ode_solver_type = 4;
157 real_t t_final = 10.0;
158 real_t dt = 0.01;
159 bool visualization = true;
160 bool visit = false;
161 bool paraview = false;
162 bool binary = false;
163 int vis_steps = 5;
164 bool solve_implicit_state = false;
165
166 int precision = 8;
167 cout.precision(precision);
168
169 OptionsParser args(argc, argv);
170 args.AddOption(&mesh_file, "-m", "--mesh",
171 "Mesh file to use.");
172 args.AddOption(&problem, "-p", "--problem",
173 "Problem setup to use. See options in velocity_function().");
174 args.AddOption(&ref_levels, "-r", "--refine",
175 "Number of times to refine the mesh uniformly.");
176 args.AddOption(&order, "-o", "--order",
177 "Order (degree) of the finite elements.");
178 args.AddOption(&pa, "-pa", "--partial-assembly", "-no-pa",
179 "--no-partial-assembly", "Enable Partial Assembly.");
180 args.AddOption(&ea, "-ea", "--element-assembly", "-no-ea",
181 "--no-element-assembly", "Enable Element Assembly.");
182 args.AddOption(&fa, "-fa", "--full-assembly", "-no-fa",
183 "--no-full-assembly", "Enable Full Assembly.");
184 args.AddOption(&device_config, "-d", "--device",
185 "Device configuration string, see Device::Configure().");
186 args.AddOption(&ode_solver_type, "-s", "--ode-solver",
187 ODESolver::Types.c_str());
188 args.AddOption(&t_final, "-tf", "--t-final",
189 "Final time; start time is 0.");
190 args.AddOption(&dt, "-dt", "--time-step",
191 "Time step.");
192 args.AddOption(&solve_implicit_state, "-imp-state", "--implicit-state",
193 "-imp-slope", "--implicit-slope",
194 "Implicitly solve for stage state or slope.");
195 args.AddOption(&visualization, "-vis", "--visualization", "-no-vis",
196 "--no-visualization",
197 "Enable or disable GLVis visualization.");
198 args.AddOption(&visit, "-visit", "--visit-datafiles", "-no-visit",
199 "--no-visit-datafiles",
200 "Save data files for VisIt (visit.llnl.gov) visualization.");
201 args.AddOption(&paraview, "-paraview", "--paraview-datafiles", "-no-paraview",
202 "--no-paraview-datafiles",
203 "Save data files for ParaView (paraview.org) visualization.");
204 args.AddOption(&binary, "-binary", "--binary-datafiles", "-ascii",
205 "--ascii-datafiles",
206 "Use binary (Sidre) or ascii format for VisIt data files.");
207 args.AddOption(&vis_steps, "-vs", "--visualization-steps",
208 "Visualize every n-th timestep.");
209 args.Parse();
210 if (!args.Good())
211 {
212 args.PrintUsage(cout);
213 return 1;
214 }
215 args.PrintOptions(cout);
216
217 Device device(device_config);
218 device.Print();
219
220 // 2. Read the mesh from the given mesh file. We can handle geometrically
221 // periodic meshes in this code.
222 Mesh mesh(mesh_file, 1, 1);
223 int dim = mesh.Dimension();
224
225 // 3. Define the ODE solver used for time integration. Several explicit
226 // Runge-Kutta methods are available.
227 unique_ptr<ODESolver> ode_solver = ODESolver::Select(ode_solver_type);
228
229 // 4. Refine the mesh to increase the resolution. In this example we do
230 // 'ref_levels' of uniform refinement, where 'ref_levels' is a
231 // command-line parameter. If the mesh is of NURBS type, we convert it to
232 // a (piecewise-polynomial) high-order mesh.
233 for (int lev = 0; lev < ref_levels; lev++)
234 {
235 mesh.UniformRefinement();
236 }
237 if (mesh.NURBSext)
238 {
239 mesh.SetCurvature(max(order, 1));
240 }
241 mesh.GetBoundingBox(bb_min, bb_max, max(order, 1));
242
243 // 5. Define the discontinuous DG finite element space of the given
244 // polynomial order on the refined mesh.
246 FiniteElementSpace fes(&mesh, &fec);
247
248 cout << "Number of unknowns: " << fes.GetVSize() << endl;
249
250 // 6. Set up and assemble the bilinear and linear forms corresponding to the
251 // DG discretization. The DGTraceIntegrator involves integrals over mesh
252 // interior faces.
256
257 BilinearForm m(&fes);
258 BilinearForm k(&fes);
259 if (pa)
260 {
261 m.SetAssemblyLevel(AssemblyLevel::PARTIAL);
262 k.SetAssemblyLevel(AssemblyLevel::PARTIAL);
263 }
264 else if (ea)
265 {
266 m.SetAssemblyLevel(AssemblyLevel::ELEMENT);
267 k.SetAssemblyLevel(AssemblyLevel::ELEMENT);
268 }
269 else if (fa)
270 {
271 m.SetAssemblyLevel(AssemblyLevel::FULL);
272 k.SetAssemblyLevel(AssemblyLevel::FULL);
273 }
275 constexpr real_t alpha = -1.0;
281
282 LinearForm b(&fes);
283 b.AddBdrFaceIntegrator(
284 new BoundaryFlowIntegrator(inflow, velocity, alpha));
285
286 m.Assemble();
287 int skip_zeros = 0;
288 k.Assemble(skip_zeros);
289 b.Assemble();
290 m.Finalize();
291 k.Finalize(skip_zeros);
292
293 // 7. Define the initial conditions, save the corresponding grid function to
294 // a file and (optionally) save data in the VisIt format and initialize
295 // GLVis visualization.
296 GridFunction u(&fes);
297 u.ProjectCoefficient(u0);
298
299 {
300 ofstream omesh("ex9.mesh");
301 omesh.precision(precision);
302 mesh.Print(omesh);
303 ofstream osol("ex9-init.gf");
304 osol.precision(precision);
305 u.Save(osol);
306 }
307
308 // Create data collection for solution output: either VisItDataCollection for
309 // ascii data files, or SidreDataCollection for binary data files.
310 DataCollection *dc = NULL;
311 if (visit)
312 {
313 if (binary)
314 {
315#ifdef MFEM_USE_SIDRE
316 dc = new SidreDataCollection("Example9", &mesh);
317#else
318 MFEM_ABORT("Must build with MFEM_USE_SIDRE=YES for binary output.");
319#endif
320 }
321 else
322 {
323 dc = new VisItDataCollection("Example9", &mesh);
324 dc->SetPrecision(precision);
325 }
326 dc->RegisterField("solution", &u);
327 dc->SetCycle(0);
328 dc->SetTime(0.0);
329 dc->Save();
330 }
331
332 ParaViewDataCollection *pd = NULL;
333 if (paraview)
334 {
335 pd = new ParaViewDataCollection("Example9", &mesh);
336 pd->SetPrefixPath("ParaView");
337 pd->RegisterField("solution", &u);
338 pd->SetLevelsOfDetail(order);
339 pd->SetDataFormat(VTKFormat::BINARY);
340 pd->SetHighOrderOutput(true);
341 pd->SetCycle(0);
342 pd->SetTime(0.0);
343 pd->Save();
344 }
345
346 socketstream sout;
347 if (visualization)
348 {
349 char vishost[] = "localhost";
350 int visport = 19916;
351 sout.open(vishost, visport);
352 if (!sout)
353 {
354 cout << "Unable to connect to GLVis server at "
355 << vishost << ':' << visport << endl;
356 visualization = false;
357 cout << "GLVis visualization disabled.\n";
358 }
359 else
360 {
361 sout.precision(precision);
362 sout << "solution\n" << mesh << u;
363 sout << "pause\n";
364 sout << flush;
365 cout << "GLVis visualization paused."
366 << " Press space (in the GLVis window) to resume it.\n";
367 }
368 }
369
370 // 8. Define the time-dependent evolution operator describing the ODE
371 // right-hand side, and perform time-integration (looping over the time
372 // iterations, ti, with a time-step dt).
373 FE_Evolution adv(m, k, b);
374 using ImplicitVariableType = FE_Evolution::ImplicitVariableType;
375 ImplicitVariableType imp_var = solve_implicit_state ?
376 ImplicitVariableType::STATE
377 : ImplicitVariableType::SLOPE;
378
379 real_t t = 0.0;
380 adv.SetTime(t);
381 ode_solver->Init(adv);
382 ode_solver->SetImplicitVariableType(imp_var);
383
384 bool done = false;
385 for (int ti = 0; !done; )
386 {
387 real_t dt_real = min(dt, t_final - t);
388 ode_solver->Step(u, t, dt_real);
389 ti++;
390
391 done = (t >= t_final - 1e-8*dt);
392
393 if (done || ti % vis_steps == 0)
394 {
395 cout << "time step: " << ti << ", time: " << t << endl;
396
397 if (visualization)
398 {
399 sout << "solution\n" << mesh << u << flush;
400 }
401
402 if (visit)
403 {
404 dc->SetCycle(ti);
405 dc->SetTime(t);
406 dc->Save();
407 }
408
409 if (paraview)
410 {
411 pd->SetCycle(ti);
412 pd->SetTime(t);
413 pd->Save();
414 }
415 }
416 }
417
418 // 9. Save the final solution. This output can be viewed later using GLVis:
419 // "glvis -m ex9.mesh -g ex9-final.gf".
420 {
421 ofstream osol("ex9-final.gf");
422 osol.precision(precision);
423 u.Save(osol);
424 }
425
426 // 10. Free the used memory.
427 delete pd;
428 delete dc;
429
430 return 0;
431}
432
433
434// Implementation of class FE_Evolution
435FE_Evolution::FE_Evolution(BilinearForm &M_, BilinearForm &K_, const Vector &b_)
436 : TimeDependentOperator(M_.FESpace()->GetTrueVSize()),
437 M(M_), K(K_), b(b_), z(height)
438{
440 if (M.GetAssemblyLevel() == AssemblyLevel::LEGACY)
441 {
442 M_prec = new DSmoother(M.SpMat());
443 M_solver.SetOperator(M.SpMat());
444 dg_solver = new DG_Solver(M.SpMat(), K.SpMat(), *M.FESpace());
445 }
446 else
447 {
448 M_prec = new OperatorJacobiSmoother(M, ess_tdof_list);
449 M_solver.SetOperator(M);
450 dg_solver = NULL;
451 }
452 M_solver.SetPreconditioner(*M_prec);
453 M_solver.iterative_mode = false;
454 M_solver.SetRelTol(1e-9);
455 M_solver.SetAbsTol(0.0);
456 M_solver.SetMaxIter(100);
457 M_solver.SetPrintLevel(0);
458}
459
460void FE_Evolution::Mult(const Vector &x, Vector &y) const
461{
462 // y = M^{-1} (K x + b)
463 K.Mult(x, z);
464 z += b;
465 M_solver.Mult(z, y);
466}
467
468void FE_Evolution::ImplicitSolve(const real_t dt, const Vector &x, Vector &k)
469{
470 MFEM_VERIFY(dg_solver != NULL,
471 "Implicit time integration is not supported with partial assembly");
472 // Construct current right-hand side for stage state vs. slope solve
473 real_t c = 1.0;
475 {
476 // k, on return, is the stage value u
477 M.Mult(x, z);
478 c = dt;
479 }
480 else
481 {
482 // k, on return, is the stage slope du/dt
483 K.Mult(x, z);
484 }
485 z.Add(c, b);
486 dg_solver->SetTimeStep(dt);
487 dg_solver->Mult(z, k);
488}
489
490FE_Evolution::~FE_Evolution()
491{
492 delete M_prec;
493 delete dg_solver;
494}
495
496// Velocity coefficient
498{
499 int dim = x.Size();
500
501 // map to the reference [-1,1] domain
502 Vector X(dim);
503 for (int i = 0; i < dim; i++)
504 {
505 real_t center = (bb_min[i] + bb_max[i]) * 0.5;
506 X(i) = 2 * (x(i) - center) / (bb_max[i] - bb_min[i]);
507 }
508
509 switch (problem)
510 {
511 case 0:
512 {
513 // Translations in 1D, 2D, and 3D
514 switch (dim)
515 {
516 case 1: v(0) = 1.0; break;
517 case 2: v(0) = sqrt(2./3.); v(1) = sqrt(1./3.); break;
518 case 3: v(0) = sqrt(3./6.); v(1) = sqrt(2./6.); v(2) = sqrt(1./6.);
519 break;
520 }
521 break;
522 }
523 case 1:
524 case 2:
525 {
526 // Clockwise rotation in 2D around the origin
527 const real_t w = M_PI/2;
528 switch (dim)
529 {
530 case 1: v(0) = 1.0; break;
531 case 2: v(0) = w*X(1); v(1) = -w*X(0); break;
532 case 3: v(0) = w*X(1); v(1) = -w*X(0); v(2) = 0.0; break;
533 }
534 break;
535 }
536 case 3:
537 {
538 // Clockwise twisting rotation in 2D around the origin
539 const real_t w = M_PI/2;
540 real_t d = max((X(0)+1.)*(1.-X(0)),0.) * max((X(1)+1.)*(1.-X(1)),0.);
541 d = d*d;
542 switch (dim)
543 {
544 case 1: v(0) = 1.0; break;
545 case 2: v(0) = d*w*X(1); v(1) = -d*w*X(0); break;
546 case 3: v(0) = d*w*X(1); v(1) = -d*w*X(0); v(2) = 0.0; break;
547 }
548 break;
549 }
550 }
551}
552
553// Initial condition
555{
556 int dim = x.Size();
557
558 // map to the reference [-1,1] domain
559 Vector X(dim);
560 for (int i = 0; i < dim; i++)
561 {
562 real_t center = (bb_min[i] + bb_max[i]) * 0.5;
563 X(i) = 2 * (x(i) - center) / (bb_max[i] - bb_min[i]);
564 }
565
566 switch (problem)
567 {
568 case 0:
569 case 1:
570 {
571 switch (dim)
572 {
573 case 1:
574 return exp(-40.*pow(X(0)-0.5,2));
575 case 2:
576 case 3:
577 {
578 real_t rx = 0.45, ry = 0.25, cx = 0., cy = -0.2, w = 10.;
579 if (dim == 3)
580 {
581 const real_t s = (1. + 0.25*cos(2*M_PI*X(2)));
582 rx *= s;
583 ry *= s;
584 }
585 return ( std::erfc(w*(X(0)-cx-rx))*std::erfc(-w*(X(0)-cx+rx)) *
586 std::erfc(w*(X(1)-cy-ry))*std::erfc(-w*(X(1)-cy+ry)) )/16;
587 }
588 }
589 }
590 case 2:
591 {
592 real_t x_ = X(0), y_ = X(1), rho, phi;
593 rho = std::hypot(x_, y_);
594 phi = atan2(y_, x_);
595 return pow(sin(M_PI*rho),2)*sin(3*phi);
596 }
597 case 3:
598 {
599 const real_t f = M_PI;
600 return sin(f*X(0))*sin(f*X(1));
601 }
602 }
603 return 0.0;
604}
605
606// Inflow boundary condition (zero for the problems considered in this example)
608{
609 switch (problem)
610 {
611 case 0:
612 case 1:
613 case 2:
614 case 3: return 0.0;
615 }
616 return 0.0;
617}
@ 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 SetAssemblyLevel(AssemblyLevel assembly_level)
Set the desired assembly level.
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....
void Assemble(int skip_zeros=1)
Assembles the form i.e. sums over all domain/bdr integrators.
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: .
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
Jacobi-type diagonal smoother of a sparse matrix.
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)
void SetPrefixPath(const std::string &prefix)
Set the path where the DataCollection will be saved.
virtual void Save()
Save the collection to disk.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
Definition device.hpp:129
void Print(std::ostream &os=mfem::out)
Print the configuration of the MFEM virtual device object.
Definition device.cpp:319
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:210
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
Definition fespace.hpp:824
const FiniteElement * GetTypicalFE() const
Return GetFE(0) if the local mesh is not empty; otherwise return a typical FE based on the Geometry t...
Definition fespace.cpp:3896
int GetDof() const
Returns the number of degrees of freedom in the finite element.
Definition fe_base.hpp:410
A general function coefficient.
GMRES method.
Definition solvers.hpp:661
void Mult(const Vector &b, Vector &x) const override
Iterative solution of the linear system using the GMRES method.
Definition solvers.cpp:1134
Class for grid function - Vector with associated FE space.
Definition gridfunc.hpp:53
void SetOperator(const Operator &op) override
Also calls SetOperator for the preconditioner if there is one.
Definition solvers.cpp:184
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
Arbitrary order "L2-conforming" discontinuous finite elements.
Definition fe_coll.hpp:369
Vector with associated FE space and LinearFormIntegrators.
Mesh data type.
Definition mesh.hpp:67
NURBSExtension * NURBSext
Optional NURBS mesh extension.
Definition mesh.hpp:317
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
Print the mesh to the given stream using the default MFEM mesh format.
Definition mesh.hpp:2610
void GetBoundingBox(Vector &min, Vector &max, int ref=2)
Returns the minimum and maximum corners of the mesh bounding box.
Definition mesh.cpp:142
int Dimension() const
Dimension of the reference space used within the elements.
Definition mesh.hpp:1314
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1, int pyr_type=1)
Set the curvature of the mesh nodes using the given polynomial degree.
Definition mesh.cpp:7211
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Definition mesh.cpp:12125
static MFEM_EXPORT std::string Types
Definition ode.hpp:235
static MFEM_EXPORT std::unique_ptr< ODESolver > Select(const int ode_solver_type)
Definition ode.cpp:41
Jacobi smoothing for a given bilinear form (no matrix necessary).
Definition solvers.hpp:422
Abstract operator.
Definition operator.hpp:27
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.
void SetLevelsOfDetail(int levels_of_detail_)
Set the refinement level.
void SetHighOrderOutput(bool high_order_output_)
Sets whether or not to output the data as high-order elements (false by default).
void SetDataFormat(VTKFormat fmt)
Set the data format for the ParaView output files.
Writer for ParaView visualization (PVD and VTU format)
Data collection with Sidre routines following the Conduit mesh blueprint specification.
Base class for solvers.
Definition operator.hpp:855
bool iterative_mode
If true, use the second argument of Mult() as an initial guess.
Definition operator.hpp:858
Data type sparse matrix.
Definition sparsemat.hpp:51
Base abstract class for first order time dependent operators.
Definition operator.hpp:367
virtual bool ImplicitVarTypeIsState() const
Returns true if implicit variable is STATE and false otherwise. Used by ODESolver to identify the sta...
Definition operator.hpp:484
virtual void SetTime(const real_t t_)
Set the current time.
Definition operator.hpp:442
A general vector function coefficient.
Vector data type.
Definition vector.hpp:82
int Size() const
Returns the size of the vector.
Definition vector.hpp:234
Vector & Add(const real_t a, const Vector &Va)
(*this) += a * Va
Definition vector.cpp:326
Data collection with VisIt I/O routines.
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
const int * ess_tdof_list
const real_t alpha
Definition ex15.cpp:369
int dim
Definition ex24.cpp:53
void velocity_function(const Vector &x, Vector &v)
Definition ex9.cpp:497
int problem
Definition ex9.cpp:56
real_t u0_function(const Vector &x)
Definition ex9.cpp:554
real_t inflow_function(const Vector &x)
Definition ex9.cpp:607
Vector bb_min
Definition ex9.cpp:68
Vector bb_max
Definition ex9.cpp:68
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:786
real_t u(const Vector &xvec)
Definition lor_mms.hpp:22
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[]
STL namespace.
MFEM_HOST_DEVICE Complex exp(const Complex &q)