Loading...
Searching...
No Matches
convect.cc

Convection-diffusion equation by the method of characteristics.

Convection-diffusion equation by the method of characteristics

#include "rheolef.h"
using namespace rheolef;
using namespace std;
#include "rotating-hill.h"
int main (int argc, char **argv) {
environment rheolef (argc,argv);
geo omega (argv[1]);
string approx = (argc > 2) ? argv[2] : "P1";
Float nu = (argc > 3) ? atof(argv[3]) : 1e-2;
size_t n_max = (argc > 4) ? atoi(argv[4]) : 50;
size_t d = omega.dimension();
Float delta_t = 2*acos(-1.)/n_max;
space Vh (omega, approx, "vector");
field uh = lazy_interpolate (Vh, u(d));
space Xh (omega, approx);
Xh.block ("boundary");
field phi_h = lazy_interpolate (Xh, phi(d,nu,0));
characteristic X (-delta_t*uh);
integrate_option iopt;
iopt.set_family (integrate_option::gauss_lobatto);
iopt.set_order (Xh.degree());
trial phi (Xh); test psi (Xh);
branch event ("t","phi");
dout << catchmark("nu") << nu << endl
<< event (0, phi_h);
for (size_t n = 1; n <= n_max; n++) {
Float t = n*delta_t;
Float c1 = 1 + delta_t*phi::sigma(d,nu,t);
Float c2 = delta_t*nu;
form a = integrate (c1*phi*psi + c2*dot(grad(phi),grad(psi)), iopt);
field lh = integrate (compose(phi_h, X)*psi, iopt);
problem p (a);
p.solve (lh, phi_h);
dout << event (t, phi_h);
}
}
lh
field lh(Float epsilon, Float t, const test &v)
Definition burgers_diffusion_operators.icc:25
phi
Float phi(const point &nu, Float a, Float b)
Definition burgers_flux_godunov.icc:25
Float
see the Float page for the full documentation
branch
see the branch page for the full documentation
characteristic
see the characteristic page for the full documentation
field
see the field page for the full documentation
form
see the form page for the full documentation
geo
see the geo page for the full documentation
problem
see the problem page for the full documentation
rheolef::catchmark
see the catchmark page for the full documentation
Definition catchmark.h:67
rheolef::environment
see the environment page for the full documentation
Definition environment.h:121
rheolef::integrate_option
see the integrate_option page for the full documentation
Definition integrate_option.h:125
rheolef::integrate_option::gauss_lobatto
@ gauss_lobatto
Definition integrate_option.h:133
rheolef::integrate_option::set_family
void set_family(family_type type)
Definition integrate_option.h:260
rheolef::integrate_option::set_order
void set_order(size_t r)
Definition integrate_option.h:254
space
see the space page for the full documentation
test
see the test page for the full documentation
trial
see the test page for the full documentation
u
point u(const point &x)
Definition diffusion_transport_tensor_exact.icc:25
main
int main()
Definition field2bb.cc:58
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::compose
std::enable_if< sizeof...(Exprs)>=3, details::field_expr_v2_nonlinear_node_nary< typenamedetails::function_traits< Function >::functor_type, typenamedetails::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::grad
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 grad(const Expr &expr)
grad(uh): see the expression page for the full documentation
Definition field_expr_terminal.h:930
rheolef::lazy_interpolate
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::integrate
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
rheolef::dot
rheolef::std::enable_if< details::is_vec_expr_v2_arg< Expr1 >::value &&details::is_vec_expr_v2_arg< Expr2 >::value, promote< Expr1::float_type, Expr2::float_type >::type > type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
Definition vec_expr_v2.h:415
std
STL namespace.
d
size_t d
Definition neumann-laplace-lambda.cc:28
rheolef.h
rheolef - reference manual
rotating-hill.h
Convection-diffusion equation – the rotating hill benchmark.
nu
Definition nu.h:26
p
Definition sphere.icc:25
phi
Definition phi.h:25
phi::sigma
Float sigma
Definition transport_dg_error.cc:27
psi
Definition interpolate_RTk_polynom.icc:34