Changes between Version 7 and Version 8 of doc/tec/discret


Ignore:
Timestamp:
May 10, 2016 4:15:23 PM (9 years ago)
Author:
Giersch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • doc/tec/discret

    v7 v8  
    22
    33The model domain in PALM is discretized in space using finite differences and equidistant horizontal grid spacings (''Δx'',
    4 ''Δy''). The grid can be stretched in the vertical direction well above the ABL to save computational time in the free atmosphere. The Arakawa staggered C-grid ([#harlow Harlow and Welch, 1965]; [#arakawa Arakawa and Lamb, 1977]) is used, where scalar quantities are defined at the center of each grid volume,
    5 whereas velocity components are shifted by half a~grid width in their respective direction so that they are defined at the edges of the grid volumes (see Fig. 1).
     4''Δy''). The grid can be stretched in the vertical direction well above the ABL to save computational time in the free atmosphere. The Arakawa staggered C-grid ([#harlow Harlow and Welch, 1965]; [#arakawa Arakawa and Lamb, 1977]) is used, where scalar quantities are defined at the center of each grid volume, whereas velocity components are shifted by half a grid width in their respective direction so that they are defined at the edges of the grid volumes (see Fig. 1).
    65
    76[[Image(02.png,600px,border=1)]]
     
    1211By default, the advection terms in the first five equations in Sect. [wiki:doc/tec/gov governing equations] are discretized using an upwind-biased 5th-order differencing scheme in combination with a 3rd-order Runge–Kutta  time-stepping scheme after [#williamson Williamson (1980)]. [#wicker Wicker and Skamarock(2002)] compared different time- and advection differencing schemes and found that this combination give the best results regarding accuracy and algorithmic simplicity. However, the 5th-order differencing scheme is known to be overly dissipative. It is thus also possible to use a 2nd-order scheme after [#piacsek Piacsek and Williams(1970)]. The latter scheme is non-dissipative, but it suffers from immense numerical dispersion. Time discretization can also be achieved using 2nd-order Runge–Kutta or 1st-order Euler schemes.
    1312
     13== Higher order advection scheme ==
     14
     15Based on a flux formulation of the advection term
     16{{{
     17#!Latex
     18\begin{align*}
     19\dfrac{\partial \psi}{\partial t} = -\dfrac{\partial ( u \psi )}{\partial x},
     20\end{align*}
     21}}}
     22the one dimensional advection equation can be written in the following semidiscrete form:
     23{{{
     24#!Latex
     25\begin{align*}
     26\dfrac{\partial  \psi_{i} }{\partial t} = - \dfrac{F_{i+\frac{1}{2}}(u\psi) - F_{i-\frac{1}{2}}(u\psi)}{\Delta x},
     27\end{align*}
     28}}}
     29where
     30{{{
     31#!Latex
     32$F_{i\pm\frac{1}{2}}$
     33}}}
     34denotes the fluxes staggered half a grid length related to the advected quantity. \\
     35[=#wicker Wicker and Skamarock (2002)] discretized the 6^th^ and 5^th^ order fluxes as follows:
     36{{{
     37#!Latex
     38\begin{align*}
     39F_{i-\frac{1}{2}}^{6} = \frac{u_{i-\frac{1}{2}}}{60} \left[ 37(\psi_{i}+\psi_{i-1}) - 8(\psi_{i+1} + \psi_{i-2}) +(\psi_{i+2} + \psi_{i-3}) \right] ,
     40\end{align*}
     41}}}
     42 
     43{{{
     44#!Latex
     45\begin{align*}
     46F_{i-\frac{1}{2}}^{5} = F_{i-\frac{1}{2}}^{6} - \dfrac{|u_{i-\frac{1}{2}}|}{60} \left[10(\psi_{i}-\psi_{i-1}) -5(\psi_{i+1} - \psi_{i-2})+(\psi_{i+2} - \psi_{i-3}) \right] .
     47\end{align*}
     48}}}
     49The 5^th^ order upwind discretization (WS5) consists of a centered non dissipative 6^th^ (WS6) order flux and an artificially added numerical dissipation term. This term is necessary to stabilize the numerical solution, because higher order centered fluxes exhibits worse stability properties. The absolute value of the advective velocity component in the dissipation term removes a sign-dependent effect of the velocity and assures a dissipative effect also for ''u < 0''.
     50
     51=== Numerical properties ===
     52
     53A semidiscrete fourier transformation for the spatial derivatives maps the one dimensional advection equation in fourier space as follows ([#baldauf Baldauf, 2008]):
     54{{{
     55#!Latex
     56\begin{align*}
     57\dfrac{\partial \hat{\psi}_{\kappa}}{\partial t}  =  - \dfrac{i}{\Delta t} C_{r} \kappa_{eff}\,\hat{\psi}_{\kappa},
     58\end{align*}
     59}}}
     60where
     61{{{
     62#!Latex
     63$\hat{\psi}$
     64}}}
     65denotes the fourier transformed of ψ. The Courant number
     66{{{
     67#!Latex
     68\begin{align*}
     69C_{r} = \dfrac{u \Delta t}{\Delta x}
     70\end{align*}
     71}}} 
     72characterizes stability properties and i is the imaginary unit.
     73''κ,,eff,,'' is the effective wavenumber of a mode in fourier space and characterizes the modified wavenumber through the discretization. The real part of the effective wavenumber describes the dispersion error, the imaginary part the dissipation error.
     74
     75[[Image(prop.png, 700px, border=1)]]
     76
     77Fig. 5 shows the dispersion and dissipation error as a function of the dimensionless wavenumber ''κ Δx'' for WS3 (3^rd^ order scheme), WS4 (4^th^ order scheme), WS5, WS6 and the 2^nd^ order scheme of [#piacsek Piacsek and Williams (1970)] (PW). The dispersion error of the upwind schemes and the dispersion error of the next higher, even ordered scheme are identical. Generally the dispersion error decreases with increasing order of the discretization. However, no of the depicted schemes is able to adequately resolve structures with wavelengths near 2-''Δx'' (generally no scheme based on finite differences is capable to do this). The centered, even ordered schemes hold no dissipation errors. With increasing order the numerical dissipation is more local. So the maximum wavelength affected by the dissipation term is round about 8-''Δx'' with WS5, whereas wavelength of 16-''Δx'' are still affected with WS3. Accordingly to the maximum of the amplification factor at ''κ Δx'' = 1.69 (these waves become unstable at first) in conjunction with the used [../rk3 Runge-Kutta method] ([#baldauf Baldauf, 2008]), the 5^th^ order dissipation is sufficient to avoid instabilities. The maximum stable Courant-number is C,,r,, = 1.4 ([#baldauf Baldauf, 2008]).
     78
     79'''Note: A stable numerical solution can only be guaranteed with the 3 rd order [../rk3 Runge-Kutta method].'''
     80
     81=== Boundaries ===
     82
     83Due to the large stencil of WS5, additional ghost layers are necessary on each lateral boundary of each processor subdomain to avoid local data dependencies. Therefore, the exchange of ghost layers is adapted to a dynamic number of ghost layers.  For the bottom and top boundaries, lateral non-cyclic boundaries as well as near topography walls the order of the discrertization is successively degraded from WS5 to WS3 to a 1^st^ order scheme. The degradation is controlled by three-dimensional bit flags, where several bits mark the order of the advection scheme in the ''x''-, ''y''-, and ''z''-direction. Technically, in case of topography, advective fluxes are calculated for the first-, third-, and fifth-order discretization at each grid point, while the respective bit controls which discretization is finally used.   
     84In the following, the respective flags are listed: 
     85
     86||='''Array'''  =||='''Bit'''  =||='''Meaning'''  =||
     87|----------------
     88{{{#!td  style="vertical-align:top"
     89wall_flags_0
     90}}}
     91{{{#!td  style="vertical-align:top"
     920
     93}}}
     94{{{#!td style="vertical-align:top"
     95scalar advection in the x-direction: first order
     96}}}
     97|----------------
     98{{{#!td  style="vertical-align:top"
     99wall_flags_0
     100}}}
     101{{{#!td  style="vertical-align:top"
     1021
     103}}}
     104{{{#!td style="vertical-align:top"
     105scalar advection in the x-direction: third order
     106}}}
     107|----------------
     108{{{#!td  style="vertical-align:top"
     109wall_flags_0
     110}}}
     111{{{#!td  style="vertical-align:top"
     1122
     113}}}
     114{{{#!td style="vertical-align:top"
     115scalar advection in the x-direction: fifth order
     116}}}
     117|----------------
     118{{{#!td  style="vertical-align:top"
     119wall_flags_0
     120}}}
     121{{{#!td  style="vertical-align:top"
     1223
     123}}}
     124{{{#!td style="vertical-align:top"
     125scalar advection in the y-direction: first order
     126}}}
     127|----------------
     128{{{#!td  style="vertical-align:top"
     129wall_flags_0
     130}}}
     131{{{#!td  style="vertical-align:top"
     1324
     133}}}
     134{{{#!td style="vertical-align:top"
     135scalar advection in the y-direction: third order
     136}}}
     137|----------------
     138{{{#!td  style="vertical-align:top"
     139wall_flags_0
     140}}}
     141{{{#!td  style="vertical-align:top"
     1425
     143}}}
     144{{{#!td style="vertical-align:top"
     145scalar advection in the y-direction: fifth order
     146}}}
     147|----------------
     148{{{#!td  style="vertical-align:top"
     149wall_flags_0
     150}}}
     151{{{#!td  style="vertical-align:top"
     1526
     153}}}
     154{{{#!td style="vertical-align:top"
     155scalar advection in the z-direction: first order
     156}}}
     157|----------------
     158{{{#!td  style="vertical-align:top"
     159wall_flags_0
     160}}}
     161{{{#!td  style="vertical-align:top"
     1627
     163}}}
     164{{{#!td style="vertical-align:top"
     165scalar advection in the z-direction: third order
     166}}}
     167|----------------
     168{{{#!td  style="vertical-align:top"
     169wall_flags_0
     170}}}
     171{{{#!td  style="vertical-align:top"
     1728
     173}}}
     174{{{#!td style="vertical-align:top"
     175scalar advection in the z-direction: fifth order
     176}}}
     177|----------------
     178{{{#!td  style="vertical-align:top"
     179wall_flags_0
     180}}}
     181{{{#!td  style="vertical-align:top"
     1829
     183}}}
     184{{{#!td style="vertical-align:top"
     185u advection in the x-direction: first order
     186}}}
     187|----------------
     188{{{#!td  style="vertical-align:top"
     189wall_flags_0
     190}}}
     191{{{#!td  style="vertical-align:top"
     19210
     193}}}
     194{{{#!td style="vertical-align:top"
     195u advection in the x-direction: third order
     196}}}
     197|----------------
     198{{{#!td  style="vertical-align:top"
     199wall_flags_0
     200}}}
     201{{{#!td  style="vertical-align:top"
     20211
     203}}}
     204{{{#!td style="vertical-align:top"
     205u advection in the x-direction: fifth order
     206}}}
     207|----------------
     208{{{#!td  style="vertical-align:top"
     209wall_flags_0
     210}}}
     211{{{#!td  style="vertical-align:top"
     21212
     213}}}
     214{{{#!td style="vertical-align:top"
     215u advection in the y-direction: first order
     216}}}
     217|----------------
     218{{{#!td  style="vertical-align:top"
     219wall_flags_0
     220}}}
     221{{{#!td  style="vertical-align:top"
     22213
     223}}}
     224{{{#!td style="vertical-align:top"
     225u advection in the y-direction: third order
     226}}}
     227|----------------
     228{{{#!td  style="vertical-align:top"
     229wall_flags_0
     230}}}
     231{{{#!td  style="vertical-align:top"
     23214
     233}}}
     234{{{#!td style="vertical-align:top"
     235u advection in the y-direction: fifth order
     236}}}
     237|----------------
     238{{{#!td  style="vertical-align:top"
     239wall_flags_0
     240}}}
     241{{{#!td  style="vertical-align:top"
     24215
     243}}}
     244{{{#!td style="vertical-align:top"
     245u advection in the z-direction: first order
     246}}}
     247|----------------
     248{{{#!td  style="vertical-align:top"
     249wall_flags_0
     250}}}
     251{{{#!td  style="vertical-align:top"
     25216
     253}}}
     254{{{#!td style="vertical-align:top"
     255u advection in the z-direction: third order
     256}}}
     257|----------------
     258{{{#!td  style="vertical-align:top"
     259wall_flags_0
     260}}}
     261{{{#!td  style="vertical-align:top"
     26217
     263}}}
     264{{{#!td style="vertical-align:top"
     265u advection in the z-direction: fifth order
     266}}}
     267|----------------
     268{{{#!td  style="vertical-align:top"
     269wall_flags_0
     270}}}
     271{{{#!td  style="vertical-align:top"
     27218
     273}}}
     274{{{#!td style="vertical-align:top"
     275v advection in the x-direction: first order
     276}}}
     277|----------------
     278{{{#!td  style="vertical-align:top"
     279wall_flags_0
     280}}}
     281{{{#!td  style="vertical-align:top"
     28219
     283}}}
     284{{{#!td style="vertical-align:top"
     285v advection in the x-direction: third order
     286}}}
     287|----------------
     288{{{#!td  style="vertical-align:top"
     289wall_flags_0
     290}}}
     291{{{#!td  style="vertical-align:top"
     29220
     293}}}
     294{{{#!td style="vertical-align:top"
     295v advection in the x-direction: fifth order
     296}}}
     297|----------------
     298{{{#!td  style="vertical-align:top"
     299wall_flags_0
     300}}}
     301{{{#!td  style="vertical-align:top"
     30221
     303}}}
     304{{{#!td style="vertical-align:top"
     305v advection in the y-direction: first order
     306}}}
     307|----------------
     308{{{#!td  style="vertical-align:top"
     309wall_flags_0
     310}}}
     311{{{#!td  style="vertical-align:top"
     31222
     313}}}
     314{{{#!td style="vertical-align:top"
     315v advection in the y-direction: third order
     316}}}
     317|----------------
     318{{{#!td  style="vertical-align:top"
     319wall_flags_0
     320}}}
     321{{{#!td  style="vertical-align:top"
     32223
     323}}}
     324{{{#!td style="vertical-align:top"
     325v advection in the y-direction: fifth order
     326}}}
     327|----------------
     328{{{#!td  style="vertical-align:top"
     329wall_flags_0
     330}}}
     331{{{#!td  style="vertical-align:top"
     33224
     333}}}
     334{{{#!td style="vertical-align:top"
     335v advection in the z-direction: first order
     336}}}
     337|----------------
     338{{{#!td  style="vertical-align:top"
     339wall_flags_0
     340}}}
     341{{{#!td  style="vertical-align:top"
     34225
     343}}}
     344{{{#!td style="vertical-align:top"
     345v advection in the z-direction: third order
     346}}}
     347|----------------
     348{{{#!td  style="vertical-align:top"
     349wall_flags_0
     350}}}
     351{{{#!td  style="vertical-align:top"
     35226
     353}}}
     354{{{#!td style="vertical-align:top"
     355v advection in the z-direction: fifth order
     356}}}
     357|----------------
     358{{{#!td  style="vertical-align:top"
     359wall_flags_0
     360}}}
     361{{{#!td  style="vertical-align:top"
     36227
     363}}}
     364{{{#!td style="vertical-align:top"
     365w advection in the x-direction: first order
     366}}}
     367|----------------
     368{{{#!td  style="vertical-align:top"
     369wall_flags_0
     370}}}
     371{{{#!td  style="vertical-align:top"
     37228
     373}}}
     374{{{#!td style="vertical-align:top"
     375w advection in the x-direction: third order
     376}}}
     377|----------------
     378{{{#!td  style="vertical-align:top"
     379wall_flags_0
     380}}}
     381{{{#!td  style="vertical-align:top"
     38229
     383}}}
     384{{{#!td style="vertical-align:top"
     385w advection in the x-direction: fifth order
     386}}}
     387|----------------
     388{{{#!td  style="vertical-align:top"
     389wall_flags_0
     390}}}
     391{{{#!td  style="vertical-align:top"
     39220
     393}}}
     394{{{#!td style="vertical-align:top"
     395w advection in the y-direction: first order
     396}}}
     397|----------------
     398{{{#!td  style="vertical-align:top"
     399wall_flags_0
     400}}}
     401{{{#!td  style="vertical-align:top"
     40231
     403}}}
     404{{{#!td style="vertical-align:top"
     405w advection in the y-direction: third order
     406}}}
     407|----------------
     408{{{#!td  style="vertical-align:top"
     409wall_flags_00
     410}}}
     411{{{#!td  style="vertical-align:top"
     4120
     413}}}
     414{{{#!td style="vertical-align:top"
     415w advection in the y-direction: fifth order
     416}}}
     417|----------------
     418{{{#!td  style="vertical-align:top"
     419wall_flags_00
     420}}}
     421{{{#!td  style="vertical-align:top"
     4221
     423}}}
     424{{{#!td style="vertical-align:top"
     425w advection in the z-direction: first order
     426}}}
     427|----------------
     428{{{#!td  style="vertical-align:top"
     429wall_flags_00
     430}}}
     431{{{#!td  style="vertical-align:top"
     4322
     433}}}
     434{{{#!td style="vertical-align:top"
     435w advection in the z-direction: third order
     436}}}
     437|----------------
     438{{{#!td  style="vertical-align:top"
     439wall_flags_00
     440}}}
     441{{{#!td  style="vertical-align:top"
     4423
     443}}}
     444{{{#!td style="vertical-align:top"
     445w advection in the z-direction: fifth order
     446}}}
     447
     448=== [=#statistical_evaluation Statistical evaluation of turbulent fluxes] ===
     449
     450The statistical evaluation of turbulent fluxes should be consistent with the discretization in the prognostic equations because otherwise some unphysical effects occur. For example the computation of the turbulent fluxes as variances and covariances induces some conspicuous kinks in the vertical heat and momentum fluxes near the surface, while the temperature and velocity profiles show no conspicuity. In order to compute the turbulent fluxes as they appear in the prognostic equations, the fluxes are computed in the advection routines, buffered and then reused for the statistics. To receive the turbulent and not the mean signal and to remove the influence of Galilei transformation, the centered fraction of the flux ''F,,i+1/2,,'' has to be multiplied with a factor
     451{{{
     452#!Latex
     453\begin{align*}
     454 \frac{u_{i+\frac{1}{2}} - \overline u}{u_{i+\frac{1}{2}} - u_{i, Galilei}}
     455\end{align*}
     456}}}
     457and the dissipative fraction with a factor
     458{{{
     459#!Latex
     460\begin{align*}
     461\frac{|u_{i+\frac{1}{2}} - \overline u|}{|u_{i+\frac{1}{2}} - u_{i, Galilei}|},
     462\end{align*}
     463}}}
     464
     465where ''u'' denotes the corresponding velocity component. Furthermore, the turbulent fluxes are evaluated on each Runge-Kutta substep and weighted with the respective Runge-Kutta coefficients to remove dependencies of the Runge-Kutta substeps. The interpretation of the turbulent fluxes as variances and covariances is no longer valid when using WS5. For other advection schemes, like the PW-scheme, the interpretation of turbulent fluxes as co/variances is still valid, because the discretization is alike the computation of the co/variances. 
     466
    14467== References ==
    15468* [=#harlow]'''Harlow FH, Welch JE.''' 1965. Numerical calculation of time-dependent viscous incompressible flow of fluid with free surface. Phys. Fluids 8: 2182–2189.
     
    20473* [=#williamson]'''Williamson JH.''' 1980. Low-storage Runge–Kutta schemes. J. Comput. Phys. 35: 48–56.
    21474
    22 * [=#wicker]'''Wicker LJ, Skamarock WC.''' 1980. Time-splitting methods for elastic models using forward time schemes. Mon. Weather Rev. 130: 2088–2097.
     475* [=#wicker]'''Wicker LJ, Skamarock WC.''' 2002. Time-splitting methods for elastic models using forward time schemes. Mon. Weather Rev. 130: 2088–2097.
    23476
    24477* [=#piacsek]'''Piacsek SA, Williams GP.''' 1970. Conservation properties of convection difference schemes. J. Comput. Phys. 198: 580–616.
     478
     479* [=#baldauf]'''Baldauf, M.''' 2008 Stability analysis for linear discretisations of the advection equation with Runge-Kutta time integration. J. Comput. Phys. 227: 6638-6659.