====== DNS and DNSFlags ======
The DNS((Direct Numerical Simulation)) class advances velocity fields under the
Navier-Stokes equations, with a variety of times-stepping algorithms, boundary
conditions, and external constraints. There are quite a few options to the DNS
class, so many that there is a special DNSFlags class to group them all together.
DNSFLags and DNS work together like this. You construct a DNSFlags object and set
its member variables to values that define the flow you want to integrate. Then you
construct a FlowField, which defines the grid and cell sizes. Lastly you construct
a DNS object combining the DNSFlags, the velocity field, the kinematic viscosity,
and the time step. In C++ code it looks like this
DNSFlags flags;
flags.baseflow = PlaneCouette;
flags.timestepping = SBDF3; // 3rd order semi-implicit backwards differentiation
flags.initstepping = SMRK2; // 2nd order spalart-moser runge-kutta
flags.nonlinearity = Rotational;
flags.dealiasing = DealiasXZ;
flags.constraint = PressureGradient; // enforce constant pressure gradient
flags.dPdx = 0.0; // hold mean pressure gradient at zero
FlowField u(Nx,Ny,Nz,3,Lx,Lz,a,b); // velocity
FlowField p(Nx,Ny,Nz,1,Lx,Lz,a,b); // pressure
DNS dns(u, nu, dt, flags);
for (Real t=T0; t<=T1; t += N*dt) {
dns.advance(u,p,N); // advance u,p forward N steps of length dt
...
}
Sections to be written...
===== DNSFlags =====
The differents DNS flags are :
* baseflow
* timestepping
* initstepping
* nonlinearity
* dealiasing
* taucorrection
* constraint
* verbosity
===== Time-stepping algorithms =====
The DNS class implements seven different time-stepping algorithms. (The default is SBDF3.)
* **CNFE1 or SBDF1**: 1st-order Crank-Nicolson, Foward-Euler or 1st-order Semi-implicit Back-
ward Differentiation Formula –two names for the same algorithm. This algorithms is extremely
simple and needs no initialization need, but its 1st-order error scaling makes it practically worth-
less, except for initializing other algorithms.
* **CNAB2** 2nd-order Crank-Nicolson, Adams-Bashforth. A popular algorithm, but higher-frequency
modes are poorly damped. Requires one initialization step. Zang warns against us-
ing CNAB2 in combination with Rotational nonlinearity unless the high-frequency modes are
dealiased. CNAB2 enforces zero-divergence at successive timesteps and momentum equa-
tions halfway between successive time steps, which can lead to slowly decaying period-2dt os-
cillation in the pressure field, unless pressure and velocity are initialized accurately.
* **CNRK2**: a three-substep, 2nd-order semi-implicit Crank-Nicolson, Runge-Kutta algorithm, devel-
oped by Zang and Hussaini and but implemented in Channelflow from the Peyret’s exposition
. According to Peyret, Zang and Hussaini observed 3rd-order scaling for this algorithm applied
to low-viscosity flows, even though it is theoretically 2nd-order. Numerical tests in Channelflow
show 2nd-order scaling for velocity fields at Re = 103 − 104 , and 1st-order scaling for pressure,
due to a phase error in the pressure field. CNRK2 requires no initialization.
* **SMRK2**: a three-substep, 2nd-order semi-implicit Runge-Kutta developed by Spalart, Moser, and
Rogers. Identical characteristics as CNRK2, including observed 2nd-order scaling consistent
with theory, contrary to authors’ claim of 3rd-order scaling, and 1st-order phase error in pressure.
Requires no initialization.
*** SBDF2, SBDF3, SBDF4**: 2nd, 3rd, and 4th-order Semi-implicit Backward Differentiation
Formulae, requiring 1,2, and 3 initialization steps. I have found the SBDF schemes to be the
best-behaved of the lot. When solving un+1 and pn+1 , SBDF schemes enforce divergence and
momentum equations at tn+1 . This strongly implicit formulation poduces strong damping for
high-frequency modes and results in pressure field as accurate as the velocity field. SBDF3 is par-
ticularly good: it has the strongest asympotitc decay of all 3rd-order implicit-explicit linear multi-
step schemes. For these reasons, SBDF3 is the default value of flags.timestepping. Peyret
terms these algorithms AB/BDEk (kth-order Adams-Bashforth Backward-Differentiation).
To summerize : **CNFE1, CNAB2, CNKR2, SMRK2, SBDF1, SBDF2, SBDF3, SBDF4**
===== Nonlinearity =====
The nonlinear term in the Navier-Stokes calculation can be computed in a
number of forms that are equivalent in continuous mathematics but slightly different when computed
with spectral expansions and collocation. The default is SkewSymmetric.
* **Rotational:** Fast but generates high-frequency errors unless dealiased
* **SkewSymmetric:** Comparatively expensive to compute compared to Rotational
* **Convective**
* **Divergence**
* **Alternating** convection/divergence an alternating time steps. A cheap approximation to SkewSymmetric, which is an average of the convective and divergence forms. Not yet analyzed how the alternating nonlinearity method interacts with multistepping algorithms.
* **Linearized** about the base flow.
===== Base flow =====
* **Zeros**
* **PlaneCouette** : plane Couette mean velocity profile y
* **Parabolic** : plane Poiseuille mean velocity profile 1-y^2
===== Mean constraint =====
Periodic channel flows satisfy the Navier-Stokes equations with either the **bulk velocity** or the **spatial-mean pressure gradient** set as an external constraint. This flag sets which constraint is to be enforced. DNS’s default behavior determines the spatial-mean pressure gradient or bulk velocity from the fluctuation’s initial condition u and matches this as a fixed constraint at each time step. DNS can match time-varying constraints as well.