Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
burgers_dg.cc

The Burgers equation by the discontinous Galerkin method.

The Burgers equation by the discontinous Galerkin method

#include "rheolef.h"
using namespace rheolef;
using namespace std;
#include "harten.h"
#include "burgers.icc"
int main(int argc, char**argv) {
environment rheolef (argc, argv);
geo omega (argv[1]);
space Xh (omega, argv[2]);
Float cfl = 1;
size_t nmax = (argc > 3) ? atoi(argv[3]) : numeric_limits<size_t>::max();
Float tf = (argc > 4) ? atof(argv[4]) : 2.5;
size_t p = (argc > 5) ? atoi(argv[5]) : ssp::pmax;
lopt.M = (argc > 6) ? atoi(argv[6]) : u_init().M();
if (nmax == numeric_limits<size_t>::max()) {
nmax = (size_t)floor(1+tf/(cfl*omega.hmin()));
}
Float delta_t = tf/nmax;
iopt.invert = true;
trial u (Xh); test v (Xh);
form inv_m = integrate (u*v, iopt);
vector<field> uh(p+1, field(Xh,0));
uh[0] = lazy_interpolate (Xh, u_init());
branch even("t","u");
dout << catchmark("delta_t") << delta_t << endl
<< even(0,uh[0]);
for (size_t n = 1; n <= nmax; ++n) {
for (size_t i = 1; i <= p; ++i) {
uh[i] = 0;
for (size_t j = 0; j < i; ++j) {
field lh =
- integrate (dot(compose(f,uh[j]),grad_h(v)))
+ integrate ("internal_sides",
compose (phi, normal(), inner(uh[j]), outer(uh[j]))*jump(v))
+ integrate ("boundary",
compose (phi, normal(), uh[j], g(n*delta_t))*v);
uh[i] += ssp::alpha[p][i][j]*uh[j] - delta_t*ssp::beta[p][i][j]*(inv_m*lh);
}
uh[i] = limiter(uh[i], g(n*delta_t)(point(-1)), lopt);
}
uh[0] = uh[p];
dout << even(n*delta_t,uh[0]);
}
}
The Burgers equation – the f function.
u_exact u_init
field lh(Float epsilon, Float t, const test &v)
The Burgers equation – the Godonov flux.
see the Float page for the full documentation
see the branch 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 point page for the full documentation
see the catchmark page for the full documentation
Definition catchmark.h:67
see the environment page for the full documentation
see the integrate_option page for the full documentation
see the space page for the full documentation
see the test page for the full documentation
see the test page for the full documentation
int main()
Definition field2bb.cc:58
The Burgers problem: the Harten exact solution.
This file is part of Rheolef.
Float beta[][pmax+1][pmax+1]
Float alpha[][pmax+1][pmax+1]
constexpr size_t pmax
STL namespace.
rheolef - reference manual
The strong stability preserving Runge-Kutta scheme – coefficients.
Definition cavity_dg.h:29
Definition cavity_dg.h:25
Definition sphere.icc:25
Definition phi.h:25
see the limiter page for the full documentation
Definition limiter.h:72
Float M() const
Definition leveque.h:25