Skip to content

Commit 8d29988

Browse files
committed
Tidied
1 parent db8e7d3 commit 8d29988

8 files changed

Lines changed: 130 additions & 188 deletions

documentation/source/science_guide/tangent_linear_section/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Linear Model Section
1010
=======================
1111

12-
This describes the details of the tangent-linear model code for GungHo.
12+
This describes the scientific aspects of the tangent-linear model code for GungHo.
1313

1414
.. toctree::
1515
:maxdepth: 2
@@ -18,6 +18,6 @@ This describes the details of the tangent-linear model code for GungHo.
1818
tangent_linear_coding
1919
tangent_linear_timestepping
2020
tangent_linear_components
21-
tl_ffsl_transport
22-
tangent_linear_lin_state
21+
tangent_linear_mol_transport
22+
tangent_linear_ffsl_transport
2323
tangent_linear_tests

documentation/source/science_guide/tangent_linear_section/tangent_linear_coding.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
.. _tangent_linear_coding:
22

3-
Tangent Linear Coding
3+
General principles
44
=====================
55

6-
To obtain the tangent linear code, we need to differentiate the
7-
nonlinear model code.
6+
To obtain the tangent linear model, we need to differentiate the
7+
nonlinear model. There are two main ways to achieve this: differentiate the nonlinear continuous equations and then discretize, or differentiate the nonlinear discretized equations.
8+
9+
Mainly the approach of differentiating the discretized equations is used here - the so-called line-by-line approach, as each line of code can be treated individually. However, some parts such as the semi-implicit solve take the approach of differentiating the nonlinear equations and then discretizing (although in fact as the solver is already linear, in practice this just means reusing the nonlinear code).
10+
11+
The following examples demonstrate how the line-by-line approach is implemented, to differentiate the discretized equations.
812

913
First derivative
1014
----------------

documentation/source/science_guide/tangent_linear_section/tangent_linear_components.rst

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _tangent_linear_components:
22

3-
Components
3+
Right-hand-side Components
44
=====================
55

66
Kinetic energy gradient
@@ -163,67 +163,3 @@ The linear model is
163163
\delta N & = \frac{\partial N}{\partial E} \left( \frac{ \partial E}{\partial \Pi} \delta \Pi + \frac{ \partial E}{\partial \rho} \delta \rho + \frac{ \partial E}{\partial \theta} \delta \theta \right) \\
164164
& = - \frac{1}{E} \left( \frac{1-\kappa}{\kappa} \frac{\delta \Pi}{\Pi} - \frac{\delta \rho}{\rho} - \frac{\delta \theta}{\theta} \right)
165165
\end{aligned}
166-
167-
Method of Lines (MoL) and Runge-Kutta Transport
168-
-----------
169-
170-
The nonlinear model is:
171-
172-
.. math::
173-
174-
\begin{aligned}
175-
u^{(i)} & = u^n + \Delta t \sum_{k=0}^{i-1} \beta_{i,k} f(u^{(k)}) \quad i=1,\ldots,m \\
176-
u^{n+1} & = u^{(m)}
177-
\end{aligned}
178-
179-
In ``rk_alg_timestep``, the :math:`f(u^{(i)})` corresponds to
180-
``rhs_prediction``, and :math:`\sum_{k=0}^{i-1} \beta_{i,k} f(u^{(k)})`
181-
corresponds to rhs. (There is also an extra mass matrix inversion, so
182-
they are not directly equal).
183-
184-
The tangent linear model comprises two steps. First the linearisation
185-
state is computed:
186-
187-
.. math:: \bar{u}^{(i)} = \bar{u}^n + \Delta t \sum_{k=0}^{i-1} \beta_{i,k} f(\bar{u}^{(k)}) \quad i=1,\ldots,m
188-
189-
then the perturbations are computed:
190-
191-
.. math::
192-
193-
\begin{aligned}
194-
u'^{(i)} & = u'^n + \Delta t \sum_{k=0}^{i-1} \beta_{i,k} f'(u'^{(k)},\bar{u}^{(k)}) \quad i=1,\ldots,m \\
195-
u'^{n+1} & = u'^{(m)}
196-
\end{aligned}
197-
198-
In the nonlinear model, the method of lines transport code has switches
199-
to ensure that the transport scheme is upwinding. In the linear model,
200-
we use the same switches as the nonlinear model. This means that the
201-
direction is based on the linearisation state wind rather than the
202-
perturbation wind.
203-
204-
In the nonlinear model,
205-
206-
::
207-
208-
direction = wind(map_w2(df) + k )*v_dot_n(df)
209-
if ( direction > 0.0_r_def ) then
210-
211-
In the linear model,
212-
213-
::
214-
215-
direction = ls_wind(map_w2(df) + k )*v_dot_n(df)
216-
if ( direction > 0.0_r_def ) then
217-
218-
Similarly, where
219-
220-
::
221-
222-
sign_X(unit_wind,1.0_r_def, advecting_wind)
223-
224-
the corresponding tangent linear uses
225-
226-
::
227-
228-
sign_X(unit_wind, 1.0_r_def, ls_advecting_wind)
229-

documentation/source/science_guide/tangent_linear_section/tl_ffsl_transport.rst renamed to documentation/source/science_guide/tangent_linear_section/tangent_linear_ffsl_transport.rst

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ the form
2222

2323
.. math::
2424
25-
\label{eq:advective}
2625
q^{n+1}_{adv} = \frac{q^{n} - \Delta{t} F(u,q^n)}{\sigma - \Delta{t} F(u,\sigma)}
2726
2827
where :math:`\sigma=1` is the unity field, and therefore
@@ -54,15 +53,12 @@ Leaving the conservative perturbation transport equation as
5453

5554
.. math::
5655
57-
\label{eq:transport_equation}
5856
\frac{\partial q'}{\partial t} + \nabla \cdot( \bar{u}q' ) + \nabla \cdot( u'\bar{q} ) = 0
5957
6058
Flux Computation
6159
----------------------
6260

63-
The flux computation can be split into two parts, corresponding to the
64-
two terms in equation
65-
`[eq:transport_equation] <#eq:transport_equation>`__.
61+
The flux computation can be split into two parts.
6662

6763
The first term, corresponding to :math:`\bar{u}q'`, can be computed
6864
using standard FFSL operators, provided the scheme is linear (i.e. no
@@ -91,7 +87,7 @@ We can now use the notation
9187
Advective Update
9288
--------------------
9389

94-
Following `[eq:advective] <#eq:advective>`__, if we expand the variables
90+
If we expand the variables
9591
into linearisation state and perturbation parts we find the flux
9692
divergences can be written as
9793

@@ -105,7 +101,6 @@ and the advective form becomes
105101

106102
.. math::
107103
108-
\label{eq:advective_linear}
109104
q^{n+1}_{adv} = \frac{\bar{q} + q' - \Delta{t} F(\bar{u},\bar{q}) - \Delta{t}F_1(\bar{u},q') - \Delta{t}F_2(u',\bar{q}) }{\sigma - \Delta{t} F(\bar{u},\sigma)- \Delta{t} F_2(u',\sigma)}
110105
111106
Let
@@ -127,7 +122,6 @@ Noting that
127122

128123
.. math::
129124
130-
\label{eq:adv_ls}
131125
\bar{q}^{n+1}_{adv} = \frac{\bar{N}}{\bar{D}}
132126
133127
then the advective perturbation field can be found from
@@ -145,7 +139,7 @@ Using the first terms of the expansion
145139
=& \frac{N'}{\bar{D}} - \frac{\bar{N}D'}{\bar{D}\bar{D}} - \frac{N'D'}{\bar{D}\bar{D}}
146140
\end{aligned}
147141
148-
Using `[eq:adv_ls] <#eq:adv_ls>`__, and the fact products of prime
142+
Using the fact products of prime
149143
variables equals zero, this simplifies to
150144

151145
.. math:: q'^{n+1}_{adv} = \frac{N' - D' \bar{q}^{n+1}_{adv}}{\bar{D}}

documentation/source/science_guide/tangent_linear_section/tangent_linear_lin_state.rst

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
.. _tangent_linear_mol_transport:
2+
3+
MoL Transport
4+
====================
5+
6+
The Method of Lines (MoL) transport scheme is a Finite Volume Scheme that uses Runge-Kutta timestepping. For the linear model, we use the notation that :math:`\bar{u}` is the linearisation state and :math:`u'` is the perturbation.
7+
8+
Nonlinear MoL
9+
----------
10+
11+
The nonlinear continuous equation is
12+
13+
.. math:: \frac{\partial \theta}{\partial t} = - u. \nabla \theta
14+
15+
which is discretised using an upwind scheme. On each face,
16+
17+
.. math:: \begin{aligned} \frac{\partial \theta}{\partial t}
18+
& = - u. \nabla_L \theta & \text{ if } u>0 \\
19+
& = - u. \nabla_R \theta & \text{ if } u<0 \\
20+
& = 0 & \text{ if } u=0 \\
21+
\end{aligned}
22+
23+
where :math:`\nabla_L` uses the upwind reconstruction calculated from the left and :math:`\nabla_R` uses the upwind reconstruction calculated from the right.
24+
As required, :math:`\frac{\partial \theta}{\partial t}` tends to 0 as u tends to 0.
25+
26+
This is implemented by initialising
27+
:math:`\frac{\partial \theta}{\partial t}` as :math:`0` and then adding
28+
on an increment if :math:`u>0` or :math:`u<0`.
29+
30+
Linearised MoL
31+
----------
32+
33+
The linearised continuous equation is
34+
35+
.. math:: \frac{\partial \theta'}{\partial t} = - \bar{u}. \nabla \theta' - u'. \nabla \bar{\theta}
36+
37+
This is discretised as
38+
39+
.. math:: \begin{aligned} \frac{\partial \theta'}{\partial t}
40+
& = - \bar{u}. \nabla_L \theta' - u'. \frac{1}{2} (\nabla_L + \nabla_R) \bar{\theta}
41+
& \text{ if } \bar{u}>0 \\
42+
& = - \bar{u}. \nabla_R \theta' - u'. \frac{1}{2} (\nabla_L + \nabla_R) \bar{\theta}
43+
& \text{ if } \bar{u}<0 \\
44+
& = - u'. \frac{1}{2} (\nabla_L + \nabla_R) \bar{\theta}
45+
& \text{ if } \bar{u}=0 \\
46+
\end{aligned}
47+
48+
which, as required, tends to
49+
:math:`- u'. \frac{1}{2} (\nabla_L + \nabla_R) \bar{\theta}` as
50+
:math:`\bar{u}` tends to :math:`0`.
51+
52+
This is implemented by initialising
53+
:math:`\frac{\partial \theta'}{\partial t}` as
54+
:math:`- u'. \frac{1}{2} (\nabla_L + \nabla_R) \bar{\theta}` and then
55+
adding an increment if :math:`\bar{u}>0` or :math:`\bar{u}<0`.
56+
57+
Runge-Kutta
58+
-----------
59+
60+
The nonlinear Runge Kutta scheme is:
61+
62+
.. math::
63+
64+
\begin{aligned}
65+
u^{(i)} & = u^n + \Delta t \sum_{k=0}^{i-1} \beta_{i,k} f(u^{(k)}) \quad i=1,\ldots,m \\
66+
u^{n+1} & = u^{(m)}
67+
\end{aligned}
68+
69+
The tangent linear Runge Kutta scheme comprises two steps. First the linearisation
70+
state is computed:
71+
72+
.. math:: \bar{u}^{(i)} = \bar{u}^n + \Delta t \sum_{k=0}^{i-1} \beta_{i,k} f(\bar{u}^{(k)}) \quad i=1,\ldots,m
73+
74+
then the perturbations are computed:
75+
76+
.. math::
77+
78+
\begin{aligned}
79+
u'^{(i)} & = u'^n + \Delta t \sum_{k=0}^{i-1} \beta_{i,k} f'(u'^{(k)},\bar{u}^{(k)}) \quad i=1,\ldots,m \\
80+
u'^{n+1} & = u'^{(m)}
81+
\end{aligned}
82+
83+
84+
If ``transport_efficiency`` is set to true, then the ``ls_state`` is not updated, so that the same linearisation state is used for all iterations.

documentation/source/science_guide/tangent_linear_section/tangent_linear_overview.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _tangent_linear_overview:
22

3-
Tangent Linear Model Overview
3+
Overview
44
=======================
55

66
In variational data assimilation, the aim is to compute the optimal
@@ -17,7 +17,7 @@ is the observation operator (which we can assume is linear here), and
1717
:math:`\mathbf{B}` and :math:`\mathbf{R}` are the error covariance
1818
matrices.
1919

20-
As :math:`N` is nonlinear, there is no unique solution. Therefore, the
20+
As :math:`N` is nonlinear, there may not be a unique solution and it is difficult to solve. Therefore, the
2121
problem is rewritten in incremental form, by rewriting the initial state
2222
in terms of a linearisation state plus a perturbation,
2323
:math:`\mathbf{x}_0 = \tilde{\mathbf{x}} + \mathbf{\delta x}`, so that

0 commit comments

Comments
 (0)