Loading...
Searching...
No Matches
burgers_dg.cc
Go to the documentation of this file.
#include "rheolef.h"
using namespace rheolef;
using namespace std;
#include "harten.h"
#include "burgers.icc"
#include "burgers_flux_godunov.icc"
#include "runge_kutta_ssp.icc"
int main(int argc, char**argv) {
environment rheolef (argc, argv);
geo omega (argv[1]);
space Xh (omega, argv[2]);
Float cfl = 1;
limiter_option lopt;
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;
integrate_option iopt;
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]);
}
}
burgers.icc
The Burgers equation – the f function.
g
u_exact g
Definition burgers_diffusion_exact.h:33
u_init
u_exact u_init
Definition burgers_diffusion_exact.h:32
lh
field lh(Float epsilon, Float t, const test &v)
Definition burgers_diffusion_operators.icc:25
burgers_flux_godunov.icc
The Burgers equation – the Godonov flux.
Float
see the Float page for the full documentation
branch
see the branch page for the full documentation
field
see the field page for the full documentation
form
see the form page for the full documentation
geo
see the geo page for the full documentation
point
see the point page for the full documentation
rheolef::catchmark
see the catchmark page for the full documentation
Definition catchmark.h:67
rheolef::environment
see the environment page for the full documentation
Definition environment.h:121
rheolef::integrate_option
see the integrate_option page for the full documentation
Definition integrate_option.h:125
rheolef::integrate_option::invert
bool invert
Definition integrate_option.h:168
space
see the space page for the full documentation
test
see the test page for the full documentation
trial
see the test page for the full documentation
u
point u(const point &x)
Definition diffusion_transport_tensor_exact.icc:25
main
int main()
Definition field2bb.cc:58
harten.h
The Burgers problem: the Harten exact solution.
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::compose
std::enable_if< sizeof...(Exprs)>=3, details::field_expr_v2_nonlinear_node_nary< typenamedetails::function_traits< Function >::functor_type, typenamedetails::field_expr_v2_nonlinear_terminal_wrapper_traits< Exprs >::type... > >::type compose(const Function &f, const Exprs &... exprs)
see the compose page for the full documentation
Definition compose.h:247
rheolef::lazy_interpolate
field_basic< T, M > lazy_interpolate(const space_basic< T, M > &X2h, const field_basic< T, M > &u1h)
see the interpolate page for the full documentation
Definition field.h:871
rheolef::grad_h
std::enable_if< details::has_field_rdof_interface< Expr >::value, details::field_expr_v2_nonlinear_terminal_field< typenameExpr::scalar_type, typenameExpr::memory_type, details::differentiate_option::gradient > >::type grad_h(const Expr &expr)
grad_h(uh): see the expression page for the full documentation
Definition field_expr_terminal.h:968
rheolef::normal
details::field_expr_v2_nonlinear_terminal_function< details::normal_pseudo_function< Float > > normal()
normal: see the expression page for the full documentation
Definition field_expr_terminal.h:432
rheolef::integrate
std::enable_if< details::is_field_expr_v2_nonlinear_arg< Expr >::value &&!is_undeterminated< Result >::value, Result >::type integrate(const geo_basic< T, M > &omega, const Expr &expr, const integrate_option &iopt, Result dummy=Result())
see the integrate page for the full documentation
Definition integrate.h:211
rheolef::limiter
field_basic< T, M > limiter(const field_basic< T, M > &uh, const T &bar_g_S, const limiter_option &opt)
see the limiter page for the full documentation
Definition limiter.cc:65
rheolef::dot
rheolef::std::enable_if< details::is_vec_expr_v2_arg< Expr1 >::value &&details::is_vec_expr_v2_arg< Expr2 >::value, promote< Expr1::float_type, Expr2::float_type >::type > type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
Definition vec_expr_v2.h:415
ssp::beta
Float beta[][pmax+1][pmax+1]
Definition runge_kutta_ssp.icc:40
ssp::alpha
Float alpha[][pmax+1][pmax+1]
Definition runge_kutta_ssp.icc:28
ssp::pmax
constexpr size_t pmax
Definition runge_kutta_ssp.icc:26
std
STL namespace.
rheolef.h
rheolef - reference manual
runge_kutta_ssp.icc
The strong stability preserving Runge-Kutta scheme – coefficients.
f
Definition cavity_dg.h:29
p
Definition sphere.icc:25
phi
Definition phi.h:25
rheolef::limiter_option
see the limiter page for the full documentation
Definition limiter.h:72
rheolef::limiter_option::M
Float M
Definition limiter.h:75
u_exact::M
Float M() const
Definition burgers_diffusion_exact.h:29
u
Definition leveque.h:25