Rheolef  7.1
an efficient C++ finite element environment
zalesak_dg_error.cc

The Zalesak slotted disk benchmark – error analysis

#include "rheolef.h"
using namespace rheolef;
using namespace std;
#include "zalesak.h"
Float heaviside (const Float& x) { return (x <= 0) ? 0 : 1; }
int main(int argc, char**argv) {
environment rheolef (argc, argv);
size_t subdivide = (argc > 1) ? atoi(argv[1]) : 1;
Float tol = (argc > 2) ? atof(argv[2]) : 1e-12;
Float meas_gamma = phi_exact(0).perimeter();
branch event ("t","phi");
iopt.set_family ("equispaced");
iopt.set_order (subdivide);
dout << setprecision(numeric_limits<Float>::digits10)
<< "# meas_gamma = " << meas_gamma << endl
<< "# equispaced("<<subdivide<<")" << endl
<< "# t err_l1 v=(m-m0)/m0 m" << endl;
bool first = true;
Float t = 0, err_linf_l1 = 0, m0 = 0, v_max = 0;
field phi_h;
geo omega;
while (din >> event (t, phi_h)) {
omega = phi_h.get_geo();
Float err_l1 = integrate (omega, abs(compose(heaviside,phi_h)
- compose(heaviside,phi_exact(t))), iopt);
Float m = integrate (omega, 1. - compose(heaviside,phi_h), iopt);
if (first) {
m0 = m;
first = false;
}
Float v = (m-m0)/m0;
dout << t << " " << err_l1/meas_gamma
<< " " << v << " " << m << endl;
err_linf_l1 = max (err_linf_l1, err_l1/meas_gamma);
v_max = max (v_max, abs(v));
}
dout << "# omega.size = " << omega.size() << endl
<< "# omega.hmin = " << omega.hmin() << endl
<< "# err_linf_l1 = " << err_linf_l1 << endl
<< "# v_max = " << v_max << endl;
return (err_linf_l1 < tol && v_max < tol) ? 0 : 1;
}
main
int main(int argc, char **argv)
Definition: zalesak_dg_error.cc:30
rheolef::integrate_option::set_order
void set_order(size_t r)
Definition: integrate_option.h:254
field
see the field page for the full documentation
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:202
phi_exact::perimeter
Float perimeter() const
Definition: zalesak.h:82
phi_exact
Definition: transport_dg2.h:30
rheolef.h
rheolef - reference manual
rheolef::integrate_option
see the integrate_option page for the full documentation
Definition: integrate_option.h:125
rheolef::din
idiststream din
see the diststream page for the full documentation
Definition: diststream.h:427
rheolef::environment
see the environment page for the full documentation
Definition: environment.h:115
mkgeo_sector.m
m
Definition: mkgeo_sector.sh:118
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
Float
see the Float page for the full documentation
branch
see the branch page for the full documentation
rheolef::integrate_option::set_family
void set_family(family_type type)
Definition: integrate_option.h:260
rheolef::compose
details::field_expr_v2_nonlinear_node_nary< typename details::function_traits< Function >::functor_type,typename details::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:246
heaviside
Float heaviside(const Float &x)
Definition: zalesak_dg_error.cc:29
rheolef::dout
odiststream dout(cout)
see the diststream page for the full documentation
Definition: diststream.h:430
rheolef::std
Definition: vec_expr_v2.h:391
geo
see the geo page for the full documentation
zalesak.h
The Zalesak slotted disk benchmark – the exact solution.
mkgeo_contraction.m0
m0
Definition: mkgeo_contraction.sh:191