The DNS1) 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…
The differents DNS flags are :
The DNS class implements seven different time-stepping algorithms. (The default is SBDF3.)
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.
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.
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.
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.
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
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.
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.