Skip to content
This repository was archived by the owner on Apr 18, 2018. It is now read-only.

Commit 46dda88

Browse files
committed
Merge branch 'master' of https://github.com/altMITgcm/MITgcm into manual_edits
2 parents 63521cf + 1f93817 commit 46dda88

File tree

8 files changed

+108
-26
lines changed

8 files changed

+108
-26
lines changed

doc/_extensions/mitgcm.py

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,71 @@
1-
from docutils import nodes
1+
"""
2+
Sphinx extension for the MITgcm documentation
3+
4+
Provides two custom roles:
5+
6+
:filelink:`path/to/file`
7+
inserts a link to the file on github. The full path will be shown unless an
8+
explicit title is given as in :filelink:`title <path/to/file>` or the path is
9+
prefixed with a tilde, :filelink:`~path/to/file`, in which case only the last
10+
path component (file) is shown.
11+
12+
:varlink:`identifier`
13+
inserts a link to a code search based on lxr.
14+
15+
Slightly modified from http://protips.readthedocs.io/link-roles.html.
16+
"""
17+
18+
from docutils import nodes, utils
19+
20+
from sphinx.util.nodes import split_explicit_title
21+
222

323
def setup(app):
4-
app.add_role('filelink', autolink('https://github.com/altMITgcm/MITgcm/blob/master/%s'))
5-
app.add_role('varlink', autolink('http://mitgcm.org/lxr/ident/MITgcm?_i=%s'))
24+
app.add_role(
25+
'filelink',
26+
filelink('https://github.com/altMITgcm/MITgcm/blob/master/%s'))
27+
app.add_role(
28+
'varlink',
29+
autolink('http://mitgcm.org/lxr/ident/MITgcm?_i=%s'))
30+
31+
def filelink(pattern):
32+
"""
33+
Return a role processor for external links to files based on a URL pattern.
34+
35+
%s in *pattern* will be replaced by the role text, a file path, with two
36+
modifications:
37+
38+
- an explicit title can be specified as for internal sphinx cross
39+
references: :role:`title <target>` will display *title* but link to a URL
40+
formed from *target*.
41+
- if the role text is prefixed with ~, only the last path component will be
42+
displayed: :role:`~path/to/file` will display *file* but link to
43+
path/to/file.
44+
"""
45+
def role(name, rawtext, text, lineno, inliner, options={}, content=[]):
46+
# extract explicit title if provided
47+
text = utils.unescape(text)
48+
has_explicit_title, title, part = split_explicit_title(text)
49+
# if not, check for initial tilde
50+
if not has_explicit_title and part[:1] == '~':
51+
# remove it
52+
part = part[1:]
53+
# and extract last path component
54+
title = part.split('/')[-1]
55+
# form link target
56+
url = pattern % (part,)
57+
# make link node
58+
node = nodes.reference(rawtext, title, refuri=url, **options)
59+
# and return it (no messages)
60+
return [node], []
61+
return role
662

763
def autolink(pattern):
64+
"""
65+
Return a role processor for external links based on a URL pattern.
66+
67+
%s in *pattern* will be replaced by the role text.
68+
"""
869
def role(name, rawtext, text, lineno, inliner, options={}, content=[]):
970
url = pattern % (text,)
1071
node = nodes.reference(rawtext, text, refuri=url, **options)

doc/conf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,13 @@
142142
# Additional stuff for the LaTeX preamble.
143143
#
144144
# 'preamble': '',
145-
'preamble': '\setcounter{secnumdepth}{3}',
145+
'preamble': r'''
146+
\setcounter{secnumdepth}{3}
147+
\newcommand{\p}[1]{\frac{\partial }{\partial #1}}
148+
\newcommand{\pp}[2]{\frac{\partial #1}{\partial #2}}
149+
\newcommand{\dd}[2]{\frac{d #1}{d #2}}
150+
\newcommand{\h}{\frac{1}{2}}
151+
''',
146152

147153
# Latex figure (float) alignment
148154
#

doc/defs.hrst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. only:: html
2+
3+
:math:`\newcommand{\p}[1]{\frac{\partial }{\partial #1}}`
4+
:math:`\newcommand{\pp}[2]{\frac{\partial #1}{\partial #2}}`
5+
:math:`\newcommand{\dd}[2]{\frac{d #1}{d #2}}`
6+
:math:`\newcommand{\h}{\frac{1}{2}}`

doc/phys_pkgs/exf.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ General flags and parameters
124124
+-------------------------+------------------+-------------------------------------------------------------------------------+
125125
| twoDigitYear | :code:`.FALSE.` | instead of appending ``_YYYY`` append ``YY`` |
126126
+-------------------------+------------------+-------------------------------------------------------------------------------+
127-
| repeatPeriod | 0.0 | :math:`\gt` 0: cycle through all input fields at the same period (in seconds) |
127+
| repeatPeriod | 0.0 | > 0: cycle through all input fields at the same period (in seconds) |
128128
+ + +-------------------------------------------------------------------------------+
129129
| | | = 0: use period assigned to each field |
130130
+-------------------------+------------------+-------------------------------------------------------------------------------+

doc/phys_pkgs/fizhi.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. include:: ../defs.hrst
2+
13
.. _sub_phys_pkg_fizhi:
24

35
Fizhi: High-end Atmospheric Physics

doc/phys_pkgs/gmredi.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ The LDD97 tapering scheme is activated in the model by setting
443443
**GM\_taper\_scheme = ’ldd97’** in *data.gmredi*.
444444

445445

446-
.. figure:: figure_missing
446+
.. figure::
447447
:width: 70%
448448
:align: center
449449
:alt: Mixed layer depth with GM

doc/phys_pkgs/kl10.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ with the strength of the turbulence :math:`\epsilon`, and the
2929
stratification :math:`N`, as
3030

3131
.. math::
32+
:label: eq-pkg-kl10-Lo
3233
33-
\label{eq:pkg:kl10:Lo}
34-
L_O^2 \approx \epsilon N^{-3}.
34+
L_O^2 \approx \epsilon N^{-3}.
3535
3636
The Osborn relation relates the strength of the dissipation to the
3737
vertical diffusivity as

doc/phys_pkgs/seaice.rst

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ The momentum equation of the sea-ice model is
374374
:label: eq_momseaice
375375
376376
m \frac{D\mathbf{u}}{Dt} = -mf\mathbf{k}\times\mathbf{u} +
377-
\mathbf{\tau}_{air} + \mathbf\tau}_{ocean}
377+
\mathbf{\tau}_{air} + \mathbf{\tau}_{ocean}
378378
- m \nabla{\phi(0)} + \mathbf{F},
379379
380380
where :math:`m=m_{i}+m_{s}` is the ice and snow mass per unit area;
@@ -448,9 +448,9 @@ depends on both thickness :math:`h` and compactness (concentration)
448448
:math:`c`:
449449

450450
.. math::
451+
:label: eq_icestrength
451452
452453
P_{\max} = P^{*}c\,h\,\exp\{-C^{*}\cdot(1-c)\},
453-
\label{eq:icestrength}
454454
455455
with the constants :math:`P^{*}` (run-time parameter ``SEAICE_strength``) and
456456
:math:`C^{*}=20`. The nonlinear bulk and shear viscosities :math:`\eta`
@@ -487,8 +487,8 @@ Defining the CPP-flag ``SEAICE_ZETA_SMOOTHREG`` in ``SEAICE_OPTIONS.h`` before c
487487
bounding :math:`\zeta` by a smooth (differentiable) expression:
488488

489489
.. math::
490+
:label: eq_zetaregsmooth
490491
491-
\label{eq:zetaregsmooth}
492492
\begin{split}
493493
\zeta &= \zeta_{\max}\tanh\left(\frac{P}{2\,\min(\Delta,\Delta_{\min})
494494
\,\zeta_{\max}}\right)\\
@@ -693,17 +693,22 @@ shearing strain rates, :math:`D_T =
693693
the equations :eq:`eq_evpequation` can be written as:
694694

695695
.. math::
696+
:label: eq_evpstresstensor1
696697
697-
\begin{aligned}
698-
\label{eq:evpstresstensor1}
699698
\frac{\partial\sigma_{1}}{\partial{t}} + \frac{\sigma_{1}}{2T} +
700-
\frac{P}{2T} &= \frac{P}{2T\Delta} D_D \\
701-
\label{eq:evpstresstensor2}
699+
\frac{P}{2T} &= \frac{P}{2T\Delta} D_D
700+
701+
.. math::
702+
:label: eq_evpstresstensor2
703+
702704
\frac{\partial\sigma_{2}}{\partial{t}} + \frac{\sigma_{2} e^{2}}{2T}
703-
&= \frac{P}{2T\Delta} D_T \\
704-
\label{eq:evpstresstensor12}
705+
&= \frac{P}{2T\Delta} D_T
706+
707+
.. math::
708+
:label: eq_evpstresstensor12
709+
705710
\frac{\partial\sigma_{12}}{\partial{t}} + \frac{\sigma_{12} e^{2}}{2T}
706-
&= \frac{P}{4T\Delta} D_S \end{aligned}
711+
&= \frac{P}{4T\Delta} D_S
707712
708713
Here, the elastic parameter :math:`E` is redefined in terms of a damping
709714
timescale :math:`T` for elastic waves
@@ -751,17 +756,19 @@ terminology of , the evolution equations of stress :math:`\sigma_{ij}`
751756
and momentum :math:`\mathbf{u}` can be written as:
752757

753758
.. math::
759+
:label: eq_evpstarsigma
754760
755-
\begin{aligned}
756-
\label{eq:evpstarsigma}
757761
\sigma_{ij}^{p+1}&=\sigma_{ij}^p+\frac{1}{\alpha}
758762
\Big(\sigma_{ij}(\mathbf{u}^p)-\sigma_{ij}^p\Big),
759-
\phantom{\int}\\
760-
\label{eq:evpstarmom}
763+
\phantom{\int}
764+
765+
.. math::
766+
:label: eq_evpstarmom
767+
761768
\mathbf{u}^{p+1}&=\mathbf{u}^p+\frac{1}{\beta}
762769
\Big(\frac{\Delta t}{m}\nabla \cdot{\bf \sigma}^{p+1}+
763770
\frac{\Delta t}{m}\mathbf{R}^{p}+\mathbf{u}_n
764-
-\mathbf{u}^p\Big).\end{aligned}
771+
-\mathbf{u}^p\Big).
765772
766773
:math:`\mathbf{R}` contains all terms in the momentum equations except
767774
for the rheology terms and the time derivative; :math:`\alpha` and
@@ -782,8 +789,8 @@ Another variant is the aEVP scheme :cite:`kimmritz16`, where the value
782789
of :math:`\alpha` is set dynamically based on the stability criterion
783790

784791
.. math::
792+
:label: eq_aevpalpha
785793
786-
\label{eq:aevpalpha}
787794
\alpha = \beta = \max\left( \tilde{c}\pi\sqrt{c \frac{\zeta}{A_{c}}
788795
\frac{\Delta{t}}{\max(m,10^{-4}\text{\,kg})}},\alpha_{\min} \right)
789796
@@ -805,8 +812,8 @@ Truncated ellipse method (TEM) for yield curve
805812
In the so-called truncated ellipse method the shear viscosity :math:`\eta` is capped to suppress any tensile stress:
806813

807814
.. math::
815+
:label: eq_etatem
808816
809-
\label{eq:etatem}
810817
\eta = \min\left(\frac{\zeta}{e^2},
811818
\frac{\frac{P}{2}-\zeta(\dot{\epsilon}_{11}+\dot{\epsilon}_{22})}
812819
{\sqrt{\max(\Delta_{\min}^{2},(\dot{\epsilon}_{11}-\dot{\epsilon}_{22})^2
@@ -1085,8 +1092,8 @@ concentration :math:`c` and effective snow thickness
10851092
(:math:`c\cdot{h}_{s}`) are advected by ice velocities:
10861093

10871094
.. math::
1095+
:label: eq_advection
10881096
1089-
\label{eq:advection}
10901097
\frac{\partial{X}}{\partial{t}} = - \nabla\cdot\left({{\vec{\mathbf{u}}}}\,X\right) +
10911098
\Gamma_{X} + D_{X}
10921099

0 commit comments

Comments
 (0)