Rheolef  7.2
an efficient C++ finite element environment
 
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);
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);
}
}
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 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 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
int main()
Definition field2bb.cc:58
This file is part of Rheolef.
STL namespace.
rheolef - reference manual
Convection-diffusion equation – the rotating hill benchmark.
Definition nu.h:26
Definition sphere.icc:25
Definition phi.h:25
Definition leveque.h:25