Rheolef  7.2
an efficient C++ finite element environment
navier_stokes_taylor_dg.cc

The Navier-Stokes equations for the Taylor benchmark with fixed-point and discontinuous Galerkin methods – di Pietro & Ern variant

#include "rheolef.h"
using namespace rheolef;
using namespace std;
#include "taylor.h"
#include "inertia.h"
int main(int argc, char**argv) {
environment rheolef (argc, argv);
geo omega (argv[1]);
space Xh (omega, argv[2], "vector");
space Qh (omega, argv[2]);
Float Re = (argc > 3) ? atof(argv[3]) : 1;
size_t max_iter = (argc > 4) ? atoi(argv[4]) : 1;
form a, b, c, mp;
field lh, kh;
stokes_dirichlet_dg (Xh, Qh, a, b, c, mp, lh, kh);
field uh (Xh, 0), ph (Qh, 0);
problem_mixed stokes (a, b, c);
stokes.set_metric (mp);
stokes.solve (lh, kh, uh, ph);
trial u (Xh); test v (Xh);
form a1 = a + Re*inertia (uh, u, v);
lh += Re*inertia_fix_rhs (v);
derr << "#k r as" << endl;
for (size_t k = 0; k < max_iter; ++k) {
stokes = problem_mixed (a1, b, c);
stokes.set_metric (mp);
stokes.solve (lh, kh, uh, ph);
form th = inertia (uh, u, v);
a1 = a + Re*th;
field rh = a1*uh + b.trans_mult(ph) - lh;
derr << k << " " << rh.max_abs() << " " << th(uh,uh) << endl;
}
dout << catchmark("Re") << Re << endl
<< catchmark("u") << uh
<< catchmark("p") << ph;
}
field lh(Float epsilon, Float t, const test &v)
see the Float page for the full documentation
see the field page for the full documentation
see the form page for the full documentation
see the geo page for the full documentation
see the problem_mixed page for the full documentation
odiststream dout(cout)
see the diststream page for the full documentation
Definition: diststream.h:467
problem_mixed_basic< Float > problem_mixed
see the problem_mixed page for the full documentation
odiststream derr(cerr)
see the diststream page for the full documentation
Definition: diststream.h:473
see the space page for the full documentation
see the test page for the full documentation
see the test page for the full documentation
point u(const point &x)
The inertia term of the Navier-Stokes equation with the discontinuous Galerkin method – di Pietro & E...
form inertia(W w, U u, V v, integrate_option iopt=integrate_option())
Definition: inertia.h:26
field inertia_fix_rhs(test v, integrate_option iopt=integrate_option())
Definition: inertia.h:37
This file is part of Rheolef.
int main(int argc, char **argv)
rheolef - reference manual
The Stokes problem with Dirichlet boundary condition by the discontinuous Galerkin method – solver fu...
void stokes_dirichlet_dg(const space &Xh, const space &Qh, form &a, form &b, form &c, form &mp, field &lh, field &kh, integrate_option iopt=integrate_option())
Definition: leveque.h:25
The Taylor benchmark – right-hand-side and boundary condition.