Convection-diffusion equation by BDF2 scheme and the method of characteristics.
int main (
int argc,
char **argv) {
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");
iopt.
set_family (integrate_option::gauss_lobatto);
<< event (0, phi_h);
for (size_t n = 1; n <= n_max; n++) {
form c = integrate (alpha*varphi*
psi + beta*dot(grad(varphi),grad(
psi)), iopt);
field lh = integrate (omega, (2*compose(phi_h, X1) - 0.5*compose(phi_h_prec, X2))*
psi, iopt);
phi_h_prec = phi_h;
dout << event (t, phi_h);
}
}
field lh(Float epsilon, Float t, const test &v)
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 geo page for the full documentation
see the problem page for the full documentation
see the catchmark page for the full documentation
see the environment page for the full documentation
see the integrate_option page for the full documentation
void set_family(family_type type)
see the space page for the full documentation
see the test page for the full documentation
see the test page for the full documentation
This file is part of Rheolef.
rheolef - reference manual
Convection-diffusion equation – the rotating hill benchmark.