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

The Mossolov problem – residue analysis.

The Mossolov problem – residue analysis

#include "rheolef.h"
using namespace std;
using namespace rheolef;
int main(int argc, char**argv) {
environment rheolef(argc,argv);
Float tol = (argc > 1) ? atof(argv[1]) : 1e-12;
Float Bi, n, r;
field uh, sigma_h;
din >> catchmark("Bi") >> Bi
>> catchmark("n") >> n
>> catchmark("r") >> r
>> catchmark("sigma") >> sigma_h
>> catchmark("u") >> uh;
space Th = sigma_h.get_space();
space Xh = uh.get_space();
trial u (Xh), sigma (Th);
test v (Xh), tau (Th);
form m = integrate(u*v);
form a = integrate(dot(grad(u),grad(v)));
form b = integrate(dot(grad(u),tau));
form mt = integrate(dot(sigma,tau));
iopt.invert = true;
form inv_mt = integrate(dot(sigma,tau), iopt);
field lh = integrate(2*v);
field grad_uh = inv_mt*(b*uh);
auto c = compose (vector_projection(Bi,n), norm(sigma_h));
field r_sigma_h = lazy_interpolate(Th, grad_uh - c*sigma_h);
field mr_uh = lh - b.trans_mult(sigma_h-r*grad_uh) - r*(a*uh);
mr_uh["boundary"] = 0;
field r_uh (Xh);
problem pm (m);
pm.solve (mr_uh, r_uh);
Float residue_uh = sqrt(m(r_uh,r_uh));
Float residue_sigma_h = sqrt(mt(r_sigma_h,r_sigma_h));
derr << "norm_linf residue(uh) = " << r_uh.max_abs() << endl
<< "norm_l2 residue(uh) = " << residue_uh << endl
<< "norm_linf residue(sigma_h) = " << r_sigma_h.max_abs() << endl
<< "norm_l2 residue(sigma_h) = " << residue_sigma_h << endl;
Float residue = max(residue_uh, residue_sigma_h);
return (residue <= 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 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
int main()
Definition field2bb.cc:58
This file is part of Rheolef.
STL namespace.
field residue(Float p, const field &uh)
rheolef - reference manual
Definition leveque.h:25
The projection for yield-stress rheologies – vector-valued case for the Mossolov problem.