/[MITgcm]/manual/s_algorithm/text/time_stepping.tex
ViewVC logotype

Contents of /manual/s_algorithm/text/time_stepping.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Thu Aug 9 16:22:09 2001 UTC (23 years, 11 months ago) by jmc
Branch: MAIN
Changes since 1.1: +10 -8 lines
File MIME type: application/x-tex
add doc for Non-linear Free surface

1 % $Header: /u/gcmpack/mitgcmdoc/part2/time_stepping.tex,v 1.1.1.1 2001/08/08 16:15:16 adcroft Exp $
2 % $Name: $
3
4 The convention used in this section is as follows:
5 Time is "discretize" using a time step $\Delta t$
6 and $\Phi^n$ refers to the variable $\Phi$
7 at time $t = n \Delta t$ . We used the notation $\Phi^{(n)}$
8 when time interpolation is required to estimate the value of $\phi$
9 at the time $n \Delta t$.
10
11 \section{Time Integration}
12
13 The discretization in time of the model equations (cf section I )
14 does not depend of the discretization in space of each
15 term, so that this section can be read independently.
16 Also for this purpose, we will refers to the continuous
17 space-derivative form of model equations, and focus on
18 the time discretization.
19
20 The continuous form of the model equations is:
21
22 \begin{eqnarray}
23 \partial_t \theta & = & G_\theta
24 \\
25 \partial_t S & = & G_s
26 \\
27 b' & = & b'(\theta,S,r)
28 \\
29 \partial_r \phi'_{hyd} & = & -b'
30 \label{eq-r-split-hyd}
31 \\
32 \partial_t \vec{\bf v}
33 + {\bf \nabla}_r B_o \eta
34 + \epsilon_{nh} {\bf \nabla}_r \phi'_{nh}
35 & = & \vec{\bf G}_{\vec{\bf v}}
36 - {\bf \nabla}_r \phi'_{hyd}
37 \label{eq-r-split-hmom}
38 \\
39 \epsilon_{nh} \frac {\partial{\dot{r}}}{\partial{t}}
40 + \epsilon_{nh} \partial_r \phi'_{nh}
41 & = & \epsilon_{nh} G_{\dot{r}}
42 \label{eq-r-split-rdot}
43 \\
44 {\bf \nabla}_r \cdot \vec{\bf v} + \partial_r \dot{r}
45 & = & 0
46 \label{eq-r-cont}
47 \end{eqnarray}
48 where
49 \begin{eqnarray*}
50 G_\theta & = &
51 - \vec{\bf v} \cdot {\bf \nabla}_r \theta + {\cal Q}_\theta
52 \\
53 G_S & = &
54 - \vec{\bf v} \cdot {\bf \nabla}_r S + {\cal Q}_S
55 \\
56 \vec{\bf G}_{\vec{\bf v}}
57 & = &
58 - \vec{\bf v} \cdot {\bf \nabla}_r \vec{\bf v}
59 - f \hat{\bf k} \wedge \vec{\bf v}
60 + \vec{\cal F}_{\vec{\bf v}}
61 \\
62 G_{\dot{r}}
63 & = &
64 - \vec{\bf v} \cdot {\bf \nabla}_r \dot{r}
65 + {\cal F}_{\dot{r}}
66 \end{eqnarray*}
67 The exact form of all the "{\it G}"s terms is described in the next
68 section (). Here its sufficient to mention that they contains
69 all the RHS terms except the pressure / geo- potential terms.
70
71 The switch $\epsilon_{nh}$ allows to activate the non hydrostatic
72 mode ($\epsilon_{nh}=1$) for the ocean model. Otherwise,
73 in the hydrostatic limit $\epsilon_{nh} = 0$ and the 3rd equation vanishes.
74
75 The equation for $\eta$ is obtained by integrating the
76 continuity equation over the entire depth of the fluid,
77 from $R_{min}(x,y)$ up to $R_o(x,y)$
78 (Linear free surface):
79 \begin{eqnarray}
80 \epsilon_{fs} \partial_t \eta =
81 \left. \dot{r} \right|_{r=r_{surf}} + \epsilon_{fw} (P-E) =
82 - {\bf \nabla}_r \cdot \int_{R_{min}}^{R_o} \vec{\bf v} dr
83 + \epsilon_{fw} (P-E)
84 \label{eq-cont-2D}
85 \end{eqnarray}
86
87 Where $\epsilon_{fs}$,$\epsilon_{fw}$ are two flags to
88 distinguish between a free-surface equation ($\epsilon_{fs}=1$)
89 or the rigid-lid approximation ($\epsilon_{fs}=0$);
90 and to distinguish when exchange of Fresh-Water is included
91 at the ocean surface (natural BC) ($\epsilon_{fw} = 1$)
92 or not ($\epsilon_{fw} = 0$).
93
94 The hydrostatic potential is found by
95 integrating \ref{eq-r-split-hyd} with the boundary condition that
96 $\phi'_{hyd}(r=R_o) = 0$:
97 \begin{eqnarray*}
98 & &
99 \int_{r'}^{R_o} \partial_r \phi'_{hyd} dr =
100 \left[ \phi'_{hyd} \right]_{r'}^{R_o} =
101 \int_{r'}^{R_o} - b' dr
102 \\
103 \Rightarrow & &
104 \phi'_{hyd}(x,y,r') = \int_{r'}^{R_o} b' dr
105 \end{eqnarray*}
106
107 \subsection{standard synchronous time stepping}
108
109 In the standard formulation, the surface pressure is
110 evaluated at time step n+1 (implicit method).
111 The above set of equations is then discretized in time
112 as follows:
113 \begin{eqnarray}
114 \left[ 1 - \partial_r \kappa_v^\theta \partial_r \right]
115 \theta^{n+1} & = & \theta^*
116 \\
117 \left[ 1 - \partial_r \kappa_v^S \partial_r \right]
118 S^{n+1} & = & S^*
119 \\
120 %{b'}^{n} & = & b'(\theta^{n},S^{n},r)
121 %\partial_r {\phi'_{hyd}}^{n} & = & {-b'}^{n}
122 %\\
123 {\phi'_{hyd}}^{n} & = & \int_{r'}^{R_o} b'(\theta^{n},S^{n},r) dr
124 \label{eq-rtd-hyd}
125 \\
126 \vec{\bf v} ^{n+1}
127 + \Delta t {\bf \nabla}_r B_o {\eta}^{n+1}
128 + \epsilon_{nh} \Delta t {\bf \nabla}_r {\phi'_{nh}}^{n+1}
129 - \partial_r A_v \partial_r \vec{\bf v}^{n+1}
130 & = &
131 \vec{\bf v}^*
132 \label{eq-rtd-hmom}
133 \\
134 \epsilon_{fs} {\eta}^{n+1} + \Delta t
135 {\bf \nabla}_r \cdot \int_{R_{min}}^{R_o} \vec{\bf v}^{n+1} dr
136 & = &
137 \epsilon_{fs} {\eta}^{n} + \epsilon_{fw} \Delta_t (P-E)^{n}
138 \nonumber
139 \\
140 % = \epsilon_{fs} {\eta}^{n} & + & \epsilon_{fw} \Delta_t (P-E)^{n}
141 \label{eq-rtd-eta}
142 \\
143 \epsilon_{nh} \left( \dot{r} ^{n+1}
144 + \Delta t \partial_r {\phi'_{nh}} ^{n+1}
145 \right)
146 & = & \epsilon_{nh} \dot{r}^*
147 \label{eq-rtd-rdot}
148 \\
149 {\bf \nabla}_r \cdot \vec{\bf v}^{n+1} + \partial_r \dot{r}^{n+1}
150 & = & 0
151 \label{eq-rtd-cont}
152 \end{eqnarray}
153 where
154 \begin{eqnarray}
155 \theta^* & = &
156 \theta ^{n} + \Delta t G_{\theta} ^{(n+1/2)}
157 \\
158 S^* & = &
159 S ^{n} + \Delta t G_{S} ^{(n+1/2)}
160 \\
161 \vec{\bf v}^* & = &
162 \vec{\bf v}^{n} + \Delta t \vec{\bf G}_{\vec{\bf v}} ^{(n+1/2)}
163 + \Delta t {\bf \nabla}_r {\phi'_{hyd}}^{(n+1/2)}
164 \\
165 \dot{r}^* & = &
166 \dot{r} ^{n} + \Delta t G_{\dot{r}} ^{(n+1/2)}
167 \end{eqnarray}
168
169 Note that implicit vertical terms (viscosity and diffusivity) are
170 not considered as part of the "{\it G}" terms, but are
171 written separately here.
172
173 To ensure a second order time discretization for both
174 momentum and tracer,
175 The "G" terms are "extrapolated" forward in time
176 (Adams Bashforth time stepping)
177 from the values computed at time step $n$ and $n-1$
178 to the time $n+1/2$:
179 $$G^{(n+1/2)} = G^n + (1/2+\epsilon_{AB}) (G^n - G^{n-1})$$
180 A small number for the parameter $\epsilon_{AB}$ is generally used
181 to stabilize this time stepping.
182
183 In the standard non-stagger formulation,
184 the Adams-Bashforth time stepping is also applied to the
185 hydrostatic (pressure / geo-) potential term $\nabla_h \Phi'_{hyd}$.
186 Note that presently, this term is in fact incorporated to the
187 $\vec{\bf G}_{\vec{\bf v}}$ arrays ({\it gU,gV}).
188
189 \subsection{general method}
190
191 The general algorithm consist in a "predictor step" that computes
192 the forward tendencies ("G" terms") and all
193 the "first guess" values star notation):
194 $\vec{\bf v}^*, \theta^*, S^*$ (and $\dot{r}^*$
195 in non-hydrostatic mode). This is done in the routine {\it DYNAMICS}.
196
197 Then the implicit terms that appear here on the left hand side (LHS),
198 are solved as follows:
199 Since implicit vertical diffusion and viscosity terms
200 are independent from the barotropic flow adjustment,
201 they are computed first, solving a 3 diagonal Nr x Nr linear system,
202 and incorporated at the end of the {\it DYNAMICS} routines.
203 Then the surface pressure and non hydrostatic pressure
204 are evaluated ({\it SOLVE\_FOR\_PRESSURE});
205
206 Finally, within a "corrector step',
207 (routine {\it THE\_CORRECTION\_STEP})
208 the new values of $u,v,w,\theta,S$
209 are derived according to the above equations
210 (see details in II.1.3).
211
212 At this point, the regular time step is over, but
213 the correction step contains also other optional
214 adjustments such as convective adjustment algorithm, or filters
215 (zonal FFT filter, shapiro filter)
216 that applied on both momentum and tracer fields.
217 just before setting the $n+1$ new time step value.
218
219 Since the pressure solver precision is of the order of
220 the "target residual" that could be lower than the
221 the computer truncation error, and also because some filters
222 might alter the divergence part of the flow field,
223 a final evaluation of the surface r anomaly $\eta^{n+1}$
224 is performed, according to \ref{eq-rtd-eta} ({\it CALC\_EXACT\_ETA}).
225 This ensures a perfect volume conservation.
226 Note that there is no need for an equivalent Non-hydrostatic
227 "exact conservation" step, since W is already computed after
228 the filters applied.
229
230 optionnal forcing terms (package):\\
231 Regarding optional forcing terms (usually part of a "package"),
232 that a account for a specific source or sink term (e.g.: condensation
233 as a sink of water vapor Q), they are generally incorporated
234 in the main algorithm as follows;
235 At the the beginning of the time step,
236 the additionnal tendencies are computed
237 as function of the present state (time step $n$) and external forcing ;
238 Then within the main part of model,
239 only those new tendencies are added to the model variables.
240
241 [mode details needed]
242 The atmospheric physics follows this general scheme.
243
244 \subsection{stagger baroclinic time stepping}
245
246 An alternative is to evaluate $\phi'_{hyd}$ with the
247 new tracer fields, and step forward the momentum after.
248 This option is known as stagger baroclinic time stepping,
249 since tracer and momentum are step forward in time one after the other.
250 It can be activated turning on a running flag parameter
251 {\it staggerTimeStep} in file "{\it data}").
252
253 The main advantage of this time stepping compared to a synchronous one,
254 is a better stability, specially regarding internal gravity waves,
255 and a very natural implementation of a 2nd order in time
256 hydrostatic pressure / geo- potential term.
257 In the other hand, a synchronous time step might be better
258 for convection problems; Its also make simpler time dependent forcing
259 and diagnostic implementation ; and allows a more efficient threading.
260
261 Although the stagger time step does not affect deeply the
262 structure of the code --- a switch allows to evaluate the
263 hydrostatic pressure / geo- potential from new $\theta,S$
264 instead of the Adams-Bashforth estimation ---
265 this affect the way the time discretization is presented :
266
267 \begin{eqnarray*}
268 \left[ 1 - \partial_r \kappa_v^\theta \partial_r \right]
269 \theta^{n+1/2} & = & \theta^*
270 \\
271 \left[ 1 - \partial_r \kappa_v^S \partial_r \right]
272 S^{n+1/2} & = & S^*
273 \end{eqnarray*}
274 with
275 \begin{eqnarray*}
276 \theta^* & = &
277 \theta ^{(n-1/2)} + \Delta t G_{\theta} ^{(n)}
278 \\
279 S^* & = &
280 S ^{(n-1/2)} + \Delta t G_{S} ^{(n)}
281 \end{eqnarray*}
282 And
283 \begin{eqnarray*}
284 %{b'}^{n+1/2} & = & b'(\theta^{n+1/2},S^{n+1/2},r)
285 %\\
286 %\partial_r {\phi'_{hyd}}^{n+1/2} & = & {-b'}^{n+1/2}
287 {\phi'_{hyd}}^{n+1/2} & = & \int_{r'}^{R_o} b'(\theta^{n+1/2},S^{n+1/2},r) dr
288 %\label{eq-rtd-hyd}
289 \\
290 \vec{\bf v} ^{n+1}
291 + \Delta t {\bf \nabla}_r B_o {\eta}^{n+1}
292 + \epsilon_{nh} \Delta t {\bf \nabla}_r {\phi'_{nh}}^{n+1}
293 - \partial_r A_v \partial_r \vec{\bf v}^{n+1}
294 & = &
295 \vec{\bf v}^*
296 %\label{eq-rtd-hmom}
297 \\
298 \epsilon_{fs} {\eta}^{n+1} + \Delta t
299 {\bf \nabla}_r \cdot \int_{R_{min}}^{R_o} \vec{\bf v}^{n+1} dr
300 & = &
301 \epsilon_{fs} {\eta}^{n} + \epsilon_{fw} \Delta_t (P-E)^{n}
302 \\
303 \epsilon_{nh} \left( \dot{r} ^{n+1}
304 + \Delta t \partial_r {\phi'_{nh}} ^{n+1}
305 \right)
306 & = & \epsilon_{nh} \dot{r}^*
307 %\label{eq-rtd-rdot}
308 \\
309 {\bf \nabla}_r \cdot \vec{\bf v}^{n+1} + \partial_r \dot{r}^{n+1}
310 & = & 0
311 %\label{eq-rtd-cont}
312 \end{eqnarray*}
313 with
314 \begin{eqnarray*}
315 \vec{\bf v}^* & = &
316 \vec{\bf v} ^{n} + \Delta t \vec{\bf G}_{\vec{\bf v}} ^{(n+1/2)}
317 + \Delta t {\bf \nabla}_r {\phi'_{hyd}}^{n+1/2}
318 \\
319 \dot{r}^* & = &
320 \dot{r} ^{n} + \Delta t G_{\dot{r}} ^{(n+1/2)}
321 \end{eqnarray*}
322
323 %---------------------------------------------------------------------
324
325 \subsection{surface pressure}
326
327 Substituting \ref{eq-rtd-hmom} into \ref{eq-rtd-cont}, assuming
328 $\epsilon_{nh} = 0$ yields a Helmholtz equation for ${\eta}^{n+1}$:
329 \begin{eqnarray}
330 \epsilon_{fs} {\eta}^{n+1} -
331 {\bf \nabla}_r \cdot \Delta t^2 (R_o-R_{min})
332 {\bf \nabla}_r B_o {\eta}^{n+1}
333 = {\eta}^*
334 \label{solve_2d}
335 \end{eqnarray}
336 where
337 \begin{eqnarray}
338 {\eta}^* = \epsilon_{fs} \: {\eta}^{n} -
339 \Delta t {\bf \nabla}_r \cdot \int_{R_{min}}^{R_o} \vec{\bf v}^* dr
340 \: + \: \epsilon_{fw} \Delta_t (P-E)^{n}
341 \label{solve_2d_rhs}
342 \end{eqnarray}
343
344 Once ${\eta}^{n+1}$ has been found substituting into \ref{eq-rtd-hmom}
345 would yield $\vec{\bf v}^{n+1}$ if the model is hydrostatic
346 ($\epsilon_{nh}=0$):
347 $$
348 \vec{\bf v}^{n+1} = \vec{\bf v}^{*}
349 - \Delta t {\bf \nabla}_r B_o {\eta}^{n+1}
350 $$
351
352 This is known as the correction step. However, when the model is
353 non-hydrostatic ($\epsilon_{nh}=1$) we need an additional step and an
354 additional equation for $\phi'_{nh}$. This is obtained by
355 substituting \ref{eq-rtd-hmom} and \ref{eq-rtd-rdot} into
356 \ref{eq-rtd-cont}:
357 \begin{equation}
358 \left[ {\bf \nabla}_r^2 + \partial_{rr} \right] {\phi'_{nh}}^{n+1}
359 = \frac{1}{\Delta t} \left(
360 {\bf \nabla}_r \cdot \vec{\bf v}^{**} + \partial_r \dot{r}^* \right)
361 \end{equation}
362 where
363 \begin{displaymath}
364 \vec{\bf v}^{**} = \vec{\bf v}^* - \Delta t {\bf \nabla}_r B_o {\eta}^{n+1}
365 \end{displaymath}
366 Note that $\eta^{n+1}$ is also used to update the second RHS term
367 $\partial_r \dot{r}^* $ since
368 the vertical velocity at the surface ($\dot{r}_{surf}$)
369 is evaluated as $(\eta^{n+1} - \eta^n) / \Delta t$.
370
371 Finally, the horizontal velocities at the new time level are found by:
372 \begin{equation}
373 \vec{\bf v}^{n+1} = \vec{\bf v}^{**}
374 - \epsilon_{nh} \Delta t {\bf \nabla}_r {\phi'_{nh}}^{n+1}
375 \end{equation}
376 and the vertical velocity is found by integrating the continuity
377 equation vertically.
378 Note that, for convenience regarding the restart procedure,
379 the integration of the continuity equation has been
380 moved at the beginning of the time step (instead of at the end),
381 without any consequence on the solution.
382
383 Regarding the implementation, all those computation are done
384 within the routine {\it SOLVE\_FOR\_PRESSURE} and its dependent
385 {\it CALL}s.
386 The standard method to solve the 2D elliptic problem (\ref{solve_2d})
387 uses the conjugate gradient method (routine {\it CG2D}); The
388 the solver matrix and conjugate gradient operator are only function
389 of the discretized domain and are therefore evaluated separately,
390 before the time iteration loop, within {\it INI\_CG2D}.
391 The computation of the RHS $\eta^*$ is partly
392 done in {\it CALC\_DIV\_GHAT} and in {\it SOLVE\_FOR\_PRESSURE}.
393
394 The same method is applied for the non hydrostatic part, using
395 a conjugate gradient 3D solver ({\it CG3D}) that is initialized
396 in {\it INI\_CG3D}. The RHS terms of 2D and 3D problems
397 are computed together, within the same part of the code.
398
399 \newpage
400 %-----------------------------------------------------------------------------------
401 \subsection{Crank-Nickelson barotropic time stepping}
402
403 The full implicit time stepping described previously is unconditionally stable
404 but damps the fast gravity waves, resulting in a loss of
405 gravity potential energy.
406 The modification presented hereafter allows to combine an implicit part
407 ($\beta,\gamma$) and an explicit part ($1-\beta,1-\gamma$) for the surface
408 pressure gradient ($\beta$) and for the barotropic flow divergence ($\gamma$).
409 \\
410 For instance, $\beta=\gamma=1$ is the previous fully implicit scheme;
411 $\beta=\gamma=1/2$ is the non damping (energy conserving), unconditionally
412 stable, Crank-Nickelson scheme; $(\beta,\gamma)=(1,0)$ or $=(0,1)$
413 corresponds to the forward - backward scheme that conserves energy but is
414 only stable for small time steps.\\
415 In the code, $\beta,\gamma$ are defined as parameters, respectively
416 {\it implicSurfPress}, {\it implicDiv2DFlow}. They are read from
417 the main data file "{\it data}" and are set by default to 1,1.
418
419 Equations \ref{eq-rtd-hmom} and \ref{eq-rtd-eta} are modified as follows:
420 $$
421 \frac{ \vec{\bf v}^{n+1} }{ \Delta t }
422 + {\bf \nabla}_r B_o [ \beta {\eta}^{n+1} + (1-\beta) {\eta}^{n} ]
423 + \epsilon_{nh} {\bf \nabla}_r {\phi'_{nh}}^{n+1}
424 = \frac{ \vec{\bf v}^* }{ \Delta t }
425 $$
426 $$
427 \epsilon_{fs} \frac{ {\eta}^{n+1} - {\eta}^{n} }{ \Delta t}
428 + {\bf \nabla}_r \cdot \int_{R_{min}}^{R_o}
429 [ \gamma \vec{\bf v}^{n+1} + (1-\gamma) \vec{\bf v}^{n}] dr
430 = \epsilon_{fw} (P-E)
431 $$
432 where:
433 \begin{eqnarray*}
434 \vec{\bf v}^* & = &
435 \vec{\bf v} ^{n} + \Delta t \vec{\bf G}_{\vec{\bf v}} ^{(n+1/2)}
436 + (\beta-1) \Delta t {\bf \nabla}_r B_o {\eta}^{n}
437 + \Delta t {\bf \nabla}_r {\phi'_{hyd}}^{(n+1/2)}
438 \\
439 {\eta}^* & = &
440 \epsilon_{fs} {\eta}^{n} + \epsilon_{fw} \Delta t (P-E)
441 - \Delta t {\bf \nabla}_r \cdot \int_{R_{min}}^{R_o}
442 [ \gamma \vec{\bf v}^* + (1-\gamma) \vec{\bf v}^{n}] dr
443 \end{eqnarray*}
444 \\
445 In the hydrostatic case ($\epsilon_{nh}=0$),
446 this allow to find ${\eta}^{n+1}$, according to:
447 $$
448 \epsilon_{fs} {\eta}^{n+1} -
449 {\bf \nabla}_r \cdot \beta\gamma \Delta t^2 B_o (R_o - R_{min})
450 {\bf \nabla}_r {\eta}^{n+1}
451 = {\eta}^*
452 $$
453 and then to compute (correction step):
454 $$
455 \vec{\bf v}^{n+1} = \vec{\bf v}^{*}
456 - \beta \Delta t {\bf \nabla}_r B_o {\eta}^{n+1}
457 $$
458
459 The non-hydrostatic part is solved as described previously.
460 \\ \\
461 N.B:
462 \\
463 a) The non-hydrostatic part of the code has not yet been
464 updated, %since it falls out of the purpose of this test,
465 so that this option cannot be used with $(\beta,\gamma) \neq (1,1)$.
466 \\
467 b) To remind, the stability criteria with the Crank-Nickelson time stepping
468 for the pure linear gravity wave problem in cartesian coordinate is:
469 \\
470 $\star$~ $\beta + \gamma < 1$ : unstable
471 \\
472 $\star$~ $\beta \geq 1/2$ and $ \gamma \geq 1/2$ : stable
473 \\
474 $\star$~ $\beta + \gamma \geq 1$ : stable if
475 %, for all wave length $(k\Delta x,l\Delta y)$
476 $$
477 c_{max}^2 (\beta - 1/2)(\gamma - 1/2) + 1 \geq 0
478 $$
479 $$
480 \mbox{with }~
481 %c^2 = 2 g H {\Delta t}^2
482 %(\frac{1-cos 2 \pi / k}{\Delta x^2}
483 %+\frac{1-cos 2 \pi / l}{\Delta y^2})
484 %$$
485 %Practically, the most stringent condition is obtained with $k=l=2$ :
486 %$$
487 c_{max} = 2 \Delta t \: \sqrt{g H} \:
488 \sqrt{ \frac{1}{\Delta x^2} + \frac{1}{\Delta y^2} }
489 $$

  ViewVC Help
Powered by ViewVC 1.1.22