rheolef  6.3
convect_error.cc
Go to the documentation of this file.
1 #include "rheolef.h"
2 using namespace rheolef;
3 using namespace std;
4 #include "rotating-hill.h"
5 int main (int argc, char **argv) {
6  environment rheolef (argc,argv);
7  Float nu;
8  din >> catchmark("nu") >> nu;
9  branch get ("t","phi");
10  branch put ("t","phi_h","pi_h_phi");
11  derr << "# t\terror_l2\terror_linf" << endl;
12  field phi_h;
13  Float err_l2_l2 = 0;
14  Float err_linf_linf = 0;
15  for (Float t = 0, t_prec = 0; din >> get (t, phi_h); t_prec = t) {
16  const space& Xh = phi_h.get_space();
17  size_t d = Xh.get_geo().dimension();
18  field pi_h_phi = interpolate (Xh, phi(d,nu,t));
19  form m (Xh, Xh, "mass");
20  field eh = phi_h - pi_h_phi;
21  Float err_l2 = sqrt(m(eh,eh));
22  Float err_linf = eh.max_abs();
23  err_l2_l2 += sqr(err_l2)*(t - t_prec);
24  err_linf_linf = max(err_linf_linf, err_linf);
25  dout << put (t, phi_h, pi_h_phi);
26  derr << t << "\t" << err_l2 << "\t" << err_linf << endl;
27  }
28  derr << "# error_l2_l2 = " << sqrt(err_l2_l2) << endl;
29  derr << "# error_linf_linf = " << err_linf_linf << endl;
30 }
31