convect_error.cc
Go to the documentation of this file.
#include "rheolef.h"
using namespace rheolef;
using namespace std;
#include "rotating-hill.h"
int main (int argc, char **argv) {
environment rheolef (argc,argv);
Float tol = (argc > 1) ? atof(argv[1]) : 1e-10;
Float nu;
din >> catchmark("nu") >> nu;
branch get ("t","phi");
branch put ("t","phi_h","pi_h_phi");
derr << "# t\terror_l2\terror_linf" << endl;
field phi_h;
Float err_l2_l2 = 0;
Float err_linf_linf = 0;
for (Float t = 0, t_prec = 0; din >> get (t, phi_h); t_prec = t) {
const space& Xh = phi_h.get_space();
size_t d = Xh.get_geo().dimension();
field pi_h_phi = interpolate (Xh, phi(d,nu,t));
trial phi (Xh); test psi (Xh);
form m = integrate (phi*psi);
field eh = phi_h - pi_h_phi;
Float err_l2 = sqrt(m(eh,eh));
Float err_linf = eh.max_abs();
err_l2_l2 += sqr(err_l2)*(t - t_prec);
err_linf_linf = max(err_linf_linf, err_linf);
dout << put (t, phi_h, pi_h_phi);
derr << t << "\t" << err_l2 << "\t" << err_linf << endl;
}
derr << "# error_l2_l2 = " << sqrt(err_l2_l2) << endl;
derr << "# error_linf_linf = " << err_linf_linf << endl;
return (err_linf_linf <= tol) ? 0 : 1;
}
phi
Float phi(const point &nu, Float a, Float b)
Definition: burgers_flux_godunov.icc:25
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
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:115
rheolef::field_basic::max_abs
T max_abs() const
Definition: field.h:731
rheolef::std
Definition: vec_expr_v2.h:402
rheolef::din
idiststream din
see the diststream page for the full documentation
Definition: diststream.h:427
rheolef::dout
odiststream dout(cout)
see the diststream page for the full documentation
Definition: diststream.h:430
rheolef::derr
odiststream derr(cerr)
see the diststream page for the full documentation
Definition: diststream.h:436
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
main
int main(int argc, char **argv)
Definition: convect_error.cc:29
eh
field_basic< T, M > eh
Definition: form_field_expr.h:58
mkgeo_ball.d
int d
Definition: mkgeo_ball.sh:154
mkgeo_sector.m
m
Definition: mkgeo_sector.sh:118
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::put
void put(std::ostream &out, std::string name, const tiny_matrix< T > &a)
Definition: tiny_lu.h:155
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
rheolef::interpolate
field_basic< T, M > interpolate(const space_basic< T, M > &V2h, const field_basic< T, M > &u1h)
see the interpolate page for the full documentation
Definition: interpolate.cc:233
rheolef.h
rheolef - reference manual
rotating-hill.h
Convection-diffusion equation – the rotating hill benchmark.
nu
Definition: nu.h:26
phi
Definition: phi.h:25
psi
Definition: interpolate_RTk_polynom.icc:34