Rheolef  7.2
an efficient C++ finite element environment
convect.cc
Go to the documentation of this file.
1 #include "rheolef.h"
26 using namespace rheolef;
27 using namespace std;
28 #include "rotating-hill.h"
29 int main (int argc, char **argv) {
30  environment rheolef (argc,argv);
31  geo omega (argv[1]);
32  string approx = (argc > 2) ? argv[2] : "P1";
33  Float nu = (argc > 3) ? atof(argv[3]) : 1e-2;
34  size_t n_max = (argc > 4) ? atoi(argv[4]) : 50;
35  size_t d = omega.dimension();
36  Float delta_t = 2*acos(-1.)/n_max;
37  space Vh (omega, approx, "vector");
38  field uh = lazy_interpolate (Vh, u(d));
39  space Xh (omega, approx);
40  Xh.block ("boundary");
41  field phi_h = lazy_interpolate (Xh, phi(d,nu,0));
42  characteristic X (-delta_t*uh);
43  integrate_option iopt;
45  iopt.set_order (Xh.degree());
46  trial phi (Xh); test psi (Xh);
47  branch event ("t","phi");
48  dout << catchmark("nu") << nu << endl
49  << event (0, phi_h);
50  for (size_t n = 1; n <= n_max; n++) {
51  Float t = n*delta_t;
52  Float c1 = 1 + delta_t*phi::sigma(d,nu,t);
53  Float c2 = delta_t*nu;
54  form a = integrate (c1*phi*psi + c2*dot(grad(phi),grad(psi)), iopt);
55  field lh = integrate (compose(phi_h, X)*psi, iopt);
56  problem p (a);
57  p.solve (lh, phi_h);
58  dout << event (t, phi_h);
59  }
60 }
field lh(Float epsilon, Float t, const test &v)
Float phi(const point &nu, Float a, Float b)
see the Float page for the full documentation
see the branch page for the full documentation
see the characteristic 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
Definition: environment.h:121
see the integrate_option page for the full documentation
void set_family(family_type type)
rheolef::space_base_rep< T, M > t
odiststream dout(cout)
see the diststream page for the full documentation
Definition: diststream.h:467
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(int argc, char **argv)
Definition: convect.cc:29
point u(const point &x)
This file is part of Rheolef.
std::enable_if< details::has_field_rdof_interface< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::gradient >>::type grad(const Expr &expr)
grad(uh): see the expression page for the full documentation
field_basic< T, M > lazy_interpolate(const space_basic< T, M > &X2h, const field_basic< T, M > &u1h)
see the interpolate page for the full documentation
Definition: field.h:871
rheolef::std enable_if ::type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
dot(x,y): see the expression page for the full documentation
Definition: vec_expr_v2.h:415
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
details::field_expr_v2_nonlinear_node_nary< typename details::function_traits< Function >::functor_type,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits< Exprs >::type... > ::type compose(const Function &f, const Exprs &... exprs)
see the compose page for the full documentation
Definition: compose.h:247
rheolef - reference manual
Convection-diffusion equation – the rotating hill benchmark.
Definition: nu.h:26
Definition: sphere.icc:25
Definition: phi.h:25
Float sigma