This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docs:classes:dns [2009/02/16 18:14] gibson |
docs:classes:dns [2010/02/02 07:55] (current) |
||
---|---|---|---|
Line 23: | Line 23: | ||
FlowField u(Nx,Ny,Nz,3,Lx,Lz,a,b); // velocity | FlowField u(Nx,Ny,Nz,3,Lx,Lz,a,b); // velocity | ||
- | FlowField p(Nx,Ny,Nz,3,Lx,Lz,a,b); // pressure | + | FlowField p(Nx,Ny,Nz,1,Lx,Lz,a,b); // pressure |
DNS dns(u, nu, dt, flags); | DNS dns(u, nu, dt, flags); | ||
for (Real t=T0; t<=T1; t += N*dt) { | for (Real t=T0; t<=T1; t += N*dt) { | ||
- | dns.advance(u,p,N); | + | dns.advance(u,p,N); // advance u,p forward N steps of length dt |
... | ... | ||
} | } | ||
Line 36: | Line 36: | ||
===== DNSFlags ===== | ===== DNSFlags ===== | ||
+ | |||
+ | The differents DNS flags are : | ||
+ | * baseflow | ||
+ | * timestepping | ||
+ | * initstepping | ||
+ | * nonlinearity | ||
+ | * dealiasing | ||
+ | * taucorrection | ||
+ | * constraint | ||
+ | * verbosity | ||
+ | |||
+ | |||
===== Time-stepping algorithms ===== | ===== 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 ===== | ===== Nonlinearity ===== | ||
- | ===== Base flow ===== | + | 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. | ||
- | ===== Mean constraint ===== | + | * **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 <latex> y </latex> | ||
+ | * **Parabolic** : plane Poiseuille mean velocity profile <latex> 1-y^2 </latex> | ||
+ | |||
+ | |||
+ | ===== 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. | ||