Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
stokes_cavity_check.cc
Go to the documentation of this file.
1
21#include "rheolef.h"
22using namespace rheolef;
23using namespace std;
24#include "cavity.h"
25int main(int argc, char**argv) {
26 environment rheolef (argc, argv);
27 Float tol = (argc > 1) ? atof(argv[1]) : 1e-10;
28 field uh;
29warning_macro("get field...");
30 din >> catchmark("u") >> uh;
31warning_macro("get field done");
32 const space& Xh = uh.get_space();
33 const geo& omega = Xh.get_geo();
34 space Qh (omega, "P1");
35 field ph (Qh);
36 din >> catchmark("p") >> ph;
37 trial u (Xh), p (Qh); test v (Xh), q (Qh);
38 form a = integrate (2*ddot(D(u),D(v)));
39 form b = -integrate (div(u)*q);
40 form mp = integrate (p*q);
41 field m_ru = a*uh + b.trans_mult(ph);
42 field m_rp = b*uh;
43warning_macro("field_indirect...");
44 m_ru["top"] = 0; m_ru["bottom"] = 0;
45warning_macro("field_indirect done");
46 if (Xh.get_geo().dimension() == 3) {
47 m_ru[1]["left"] = 0; m_ru[1]["right"] = 0;
48 m_ru["front"] = 0; m_ru["back"] = 0;
49 } else {
50 m_ru["left"] = 0; m_ru["right"] = 0;
51 }
52 field rp (Qh);
53 problem pmp (mp);
54 pmp.solve (m_rp, rp);
55 Float res_u = m_ru.u().max_abs();
56 Float res_p = sqrt(mp(rp,rp));
57 Float res = max(res_u, res_p);
58 Float p_constant = mp(ph, field(Qh,1.));
59 derr << "check: residue(uh) = " << res_u << endl
60 << "check: residue(ph) = " << res_p << endl
61 << "check: residue = " << res << endl
62 << "m(p,1) = " << p_constant << endl;
63 return (res <= tol) ? 0 : 1;
64}
The driven cavity benchmark: 2D boundary conditions.
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 space page for the full documentation
see the test page for the full documentation
see the test page for the full documentation
#define warning_macro(message)
Definition dis_macros.h:53
int main()
Definition field2bb.cc:58
This file is part of Rheolef.
std::enable_if< details::has_field_rdof_interface< Expr >::value, details::field_expr_v2_nonlinear_terminal_field< typenameExpr::scalar_type, typenameExpr::memory_type, details::differentiate_option::gradient > >::type D(const Expr &expr)
D(uh): see the expression page for the full documentation.
T ddot(const tensor_basic< T > &a, const tensor_basic< T > &b)
ddot(x,y): see the expression page for the full documentation
Definition tensor.cc:278
std::enable_if< details::has_field_rdof_interface< Expr >::value, details::field_expr_v2_nonlinear_terminal_field< typenameExpr::scalar_type, typenameExpr::memory_type, details::differentiate_option::divergence > >::type div(const Expr &expr)
div(uh): see the expression page for the full documentation
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:211
STL namespace.
rheolef - reference manual
Definition sphere.icc:25
Definition leveque.h:25