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

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

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

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

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22