28 field tau_h0 = tau_h, uh0 = uh, ph0 = ph;
29 derr <<
"# n t rel_err residue lambda_min" << endl;
32 derr <<
"0 0 0 " << r << endl;
33 for (
size_t n = 1; n <= max_iter; ++n) {
34 step (tau_h0, uh0, ph0, tau_h, uh, ph);
35 Float rel_err_prec = rel_err, r_prec = r;
37 rel_err =
field(tau_h-tau_h0).max_abs() +
field(uh-uh0).max_abs();
38 derr << n <<
" " << n*delta_t <<
" " << rel_err <<
" " << r << endl;
39 if (rel_err < tol)
return true;
40 if (rel_err_prec != 0 && ((rel_err > 10*rel_err_prec && r > 10*r_prec) ||
41 (rel_err > 1e5 && r > 1e5) ))
return false;
42 tau_h0 = tau_h; uh0 = uh; ph0 = ph;
44 return (rel_err < sqrt(tol));
52 uh = P::velocity_field (Xh);
54 form c0 = integrate (2*ddot(D(
u),D(v)));
58 field Duh = inv_mt*integrate(ddot(D(uh),xi));
63 idiststream in (restart,
"field");
64 in >> catchmark(
"tau") >> tau_h
65 >> catchmark(
"u") >> uh
66 >> catchmark(
"p") >> ph;
73 field tau_h1 = tau_h0, uh1 = uh0, ph1 = ph0;
74 sub_step1 (tau_h0, uh0, ph0, tau_h1, uh1, ph1);
75 field tau_h2 = tau_h1, uh2 = uh1;
76 sub_step2 (uh0, tau_h1, uh1, tau_h2, uh2);
77 sub_step1 (tau_h2, uh2, ph1, tau_h, uh, ph);
82 update_transport_stress (uh);
84 field Duh = inv_mt*integrate(ddot(D(uh),xi));
86 field rt = We*(th*tau_h-thb) + integrate (ddot(tau_h - alpha*
gh, xi));
87 field ru = b*(tau_h + (1-alpha)*
gh) -
d.trans_mult(ph);
90 return rt.u().max_abs() + ru.u().max_abs() + rp.u().max_abs();
field gh(Float epsilon, Float t, const field &uh, const test &v)
see the Float page for the full documentation
see the field page for the full documentation
see the geo page for the full documentation
see the problem_mixed page for the full documentation
see the test page for the full documentation
see the test page for the full documentation
field residue(Float p, const field &uh)
bool solve(field &tau_h, field &uh, field &ph)
void initial(const geo &omega, field &tau_h, field &uh, field &ph, string restart)
Float residue(field &tau_h, field &uh, field &ph) const
void step(const field &tau_h0, const field &uh0, const field &ph0, field &tau_h, field &uh, field &ph) const