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

residue check

residue check

#include "rheolef.h"
using namespace rheolef;
using namespace std;
#include "sinusprod.h"
int main(int argc, char**argv) {
Float tol = (argc > 1) ? atof(argv[1]) : 1e-15;
environment rheolef (argc, argv);
field us_h, zeta_h;
din >> catchmark("us") >> us_h
>> catchmark("zeta") >> zeta_h;
const space& Xhs = us_h.get_space();
const space& Zh = zeta_h.get_space();
const geo& omega = Xhs.get_geo();
check_macro (Xhs.degree() > 0, "invalid Xhs degree");
size_t k = Xhs.degree() - 1, d = omega.dimension();
string Pkd = "P"+to_string(k)+"d",
Pld = (argc > 2) ? argv[2] : Pkd;
space Xh (omega, Pld),
Mh (omega["sides"], Pkd);
trial u(Xh), lambda(Mh), us(Xhs), zeta (Zh);
test v(Xh), mu (Mh), vs(Xhs), xi (Zh);
iopt.invert = true;
form as = integrate (dot(grad_h(us),A(d)*grad_h(vs)));
form bs = integrate (us*xi);
form inv_m = integrate (u*v, iopt);
form ms = integrate (lambda*mu);
field llh = integrate(u_exact(d)*v);
field rhs = integrate(u_exact(d)*mu);
field pi_Xh_u = inv_m*llh;
field pi_Mh_lambda(Mh);
problem pms (ms);
pms.solve (rhs, pi_Mh_lambda);
field lh = integrate (dot(grad_h(pi_Xh_u),A(d)*grad_h(vs))
+ on_local_sides((pi_Mh_lambda-pi_Xh_u)
*dot(normal(),A(d)*grad_h(vs))));
field kh = integrate (pi_Xh_u*xi);
field rus = as*us_h - lh;
field rz = bs*us_h - kh;
Float err_us = rus.max_abs();
Float err_z = rz.max_abs();
derr << "err_us = " << err_us << endl;
derr << "err_z = " << err_z << endl;
derr << "|zeta_h| = " << zeta_h.max_abs() << endl;
return (max(max(err_us,err_z), zeta_h.max_abs()) < tol) ? 0 : 1;
}
field lh(Float epsilon, Float t, const test &v)
see the Float 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 problem 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
Tensor diffusion – isotropic case.
int main()
Definition field2bb.cc:58
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
STL namespace.
rheolef - reference manual
The sinus product function.
Definition leveque.h:25