New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 11577 for NEMO/trunk/doc/latex/NEMO/subfiles/apdx_DOMAINcfg.tex – NEMO

Ignore:
Timestamp:
2019-09-19T19:01:38+02:00 (5 years ago)
Author:
nicolasmartin
Message:

New LaTeX commands \nam and \np to mention namelist content
(Partial commit to serve as a backup before other large edits)
In order to benefit of the syntax highlighting and to have a simpler syntax for
citing namelist block (\nam) and parameter (\np) with an optional variable assignment (\forcode{...}),
at this time the only viable solution I found is to require a double marker for
what it looks like the same item:

  1. Marker with the real name: 'tra_adv' block or 'ln_flx' parameter
  2. Marker with underscore character escaping: 'tra\_adv' block or 'ln\_flx' parameter

Despite many searches and attempts, I did not find a workaround to edit on-the-fly one or
the other marker.
In fact, the problem is on one side that the LaTeX index interprets '_' as a switch for lowering like
in math mode while on the other hand the backslash is considered for Pygments as a typo in Fortran
(red box).

For instance, \nam and \np have as of now the aforementioned 2 mandatory arguments in
the previous order (between braces) + an optional argument for \np when the parameter is defined
(between brackets at the first position):

  • \nam: LaTeX code in the \nam{tra_adv}{tra\_adv} -> PDF ' in the &namtra_adv (namelist X.X) ' with syntax highlighting, the hyperlink and the index entry
  • \np: LaTeX code \np[=.true.]{ln_flx}{ln\_flx} -> PDF ln_flux=.true. with syntax highlighting for the whole string and the entry in the 'parameters' index
File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/doc/latex/NEMO/subfiles/apdx_DOMAINcfg.tex

    r11571 r11577  
    5151 
    5252The user has three options available in defining a horizontal grid, which involve the 
    53 namelist variable \np{jphgr\_mesh} of the \nam{dom} (\texttt{DOMAINcfg} variant only) 
     53namelist variable \np{jphgr_mesh}{jphgr\_mesh} of the \nam{dom} (\texttt{DOMAINcfg} variant only) 
    5454namelist. 
    5555 
    5656\begin{description} 
    57  \item[\np{jphgr\_mesh}=0]  The most general curvilinear orthogonal grids. 
     57 \item[\np{jphgr_mesh}{jphgr\_mesh}=0]  The most general curvilinear orthogonal grids. 
    5858  The coordinates and their first derivatives with respect to $i$ and $j$ are provided 
    5959  in a input file (\ifile{coordinates}), read in \rou{hgr\_read} subroutine of the domhgr module. 
    6060  This is now the only option available within \NEMO\ itself from v4.0 onwards. 
    61 \item[\np{jphgr\_mesh}=1 to 5] A few simple analytical grids are provided (see below). 
     61\item[\np{jphgr_mesh}{jphgr\_mesh}=1 to 5] A few simple analytical grids are provided (see below). 
    6262  For other analytical grids, the \mdl{domhgr} module (\texttt{DOMAINcfg} variant) must be 
    6363  modified by the user. In most cases, modifying the \mdl{usrdef\_hgr} module of \NEMO\ is 
     
    6767 
    6868There are two simple cases of geographical grids on the sphere. With 
    69 \np{jphgr\_mesh}=1, the grid (expressed in degrees) is regular in space, 
    70 with grid sizes specified by parameters \np{ppe1\_deg} and \np{ppe2\_deg}, 
     69\np{jphgr_mesh}{jphgr\_mesh}=1, the grid (expressed in degrees) is regular in space, 
     70with grid sizes specified by parameters \np{ppe1_deg}{ppe1\_deg} and \np{ppe2_deg}{ppe2\_deg}, 
    7171respectively. Such a geographical grid can be very anisotropic at high latitudes 
    7272because of the convergence of meridians (the zonal scale factors $e_1$ 
    7373become much smaller than the meridional scale factors $e_2$). The Mercator 
    74 grid (\np{jphgr\_mesh}=4) avoids this anisotropy by refining the meridional scale 
     74grid (\np{jphgr_mesh}{jphgr\_mesh}=4) avoids this anisotropy by refining the meridional scale 
    7575factors in the same way as the zonal ones. In this case, meridional scale factors 
    7676and latitudes are calculated analytically using the formulae appropriate for 
    77 a Mercator projection, based on \np{ppe1\_deg} which is a reference grid spacing 
     77a Mercator projection, based on \np{ppe1_deg}{ppe1\_deg} which is a reference grid spacing 
    7878at the equator (this applies even when the geographical equator is situated outside 
    7979the model domain). 
    8080 
    81 In these two cases (\np{jphgr\_mesh}=1 or 4), the grid position is defined by the 
     81In these two cases (\np{jphgr_mesh}{jphgr\_mesh}=1 or 4), the grid position is defined by the 
    8282longitude and latitude of the south-westernmost point (\np{ppglamt0} 
    8383and \np{ppgphi0}). Note that for the Mercator grid the user need only provide 
     
    8787 
    8888Rectangular grids ignoring the spherical geometry are defined with 
    89 \np{jphgr\_mesh} = 2, 3, 5. The domain is either an $f$-plane (\np{jphgr\_mesh} = 2, 
    90 Coriolis factor is constant) or a beta-plane (\np{jphgr\_mesh} = 3, the Coriolis factor 
     89\np{jphgr_mesh}{jphgr\_mesh} = 2, 3, 5. The domain is either an $f$-plane (\np{jphgr\_mesh} = 2, 
     90Coriolis factor is constant) or a beta-plane (\np{jphgr_mesh}{jphgr\_mesh} = 3, the Coriolis factor 
    9191is linear in the $j$-direction). The grid size is uniform in meter in each direction, 
    92 and given by the parameters \np{ppe1\_m} and \np{ppe2\_m} respectively. 
     92and given by the parameters \np{ppe1_m}{ppe1\_m} and \np{ppe2_m}{ppe2\_m} respectively. 
    9393The zonal grid coordinate (\textit{glam} arrays) is in kilometers, starting at zero 
    9494with the first $t$-point. The meridional coordinate (gphi. arrays) is in kilometers, 
     
    9797latitude for computation of the Coriolis parameter. In the case of the beta plane, 
    9898\np{ppgphi0} corresponds to the center of the domain. Finally, the special case 
    99 \np{jphgr\_mesh}=5 corresponds to a beta plane in a rotated domain for the 
     99\np{jphgr_mesh}{jphgr\_mesh}=5 corresponds to a beta plane in a rotated domain for the 
    100100GYRE configuration, representing a classical mid-latitude double gyre system. 
    101101The rotation allows us to maximize the jet length relative to the gyre areas 
     
    170170\end{gather} 
    171171 
    172 If the ice shelf cavities are opened (\np{ln\_isfcav}\forcode{ = .true.}), the definition 
     172If the ice shelf cavities are opened (\np{ln_isfcav}{ln\_isfcav}\forcode{ = .true.}), the definition 
    173173of $z_0$ is the same.  However, definition of $e_3^0$ at $t$- and $w$-points is 
    174174respectively changed to: 
     
    312312 
    313313Three options are possible for defining the bathymetry, according to the namelist variable 
    314 \np{nn\_bathy} (found in \nam{dom} namelist (\texttt{DOMAINCFG} variant) ): 
     314\np{nn_bathy}{nn\_bathy} (found in \nam{dom} namelist (\texttt{DOMAINCFG} variant) ): 
    315315\begin{description} 
    316 \item[\np{nn\_bathy}\forcode{ = 0}]: 
     316\item[\np{nn_bathy}{nn\_bathy}\forcode{ = 0}]: 
    317317  a flat-bottom domain is defined. 
    318318  The total depth $z_w (jpk)$ is given by the coordinate transformation. 
    319319  The domain can either be a closed basin or a periodic channel depending on the parameter \np{jperio}. 
    320 \item[\np{nn\_bathy}\forcode{ = -1}]: 
     320\item[\np{nn_bathy}{nn\_bathy}\forcode{ = -1}]: 
    321321  a domain with a bump of topography one third of the domain width at the central latitude. 
    322322  This is meant for the "EEL-R5" configuration, a periodic or open boundary channel with a seamount. 
    323 \item[\np{nn\_bathy}\forcode{ = 1}]: 
     323\item[\np{nn_bathy}{nn\_bathy}\forcode{ = 1}]: 
    324324  read a bathymetry and ice shelf draft (if needed). 
    325325  The \ifile{bathy\_meter} file (Netcdf format) provides the ocean depth (positive, in meters) at 
     
    332332  The \ifile{isfdraft\_meter} file (Netcdf format) provides the ice shelf draft (positive, in meters) at 
    333333  each grid point of the model grid. 
    334   This file is only needed if \np{ln\_isfcav}\forcode{ = .true.}. 
     334  This file is only needed if \np{ln_isfcav}{ln\_isfcav}\forcode{ = .true.}. 
    335335  Defining the ice shelf draft will also define the ice shelf edge and the grounding line position. 
    336336\end{description} 
     
    359359%        z-coordinate with constant thickness 
    360360% ------------------------------------------------------------------------------------------------------------- 
    361 \subsubsection[$Z$-coordinate with uniform thickness levels (\forcode{ln_zco})]{$Z$-coordinate with uniform thickness levels (\protect\np{ln\_zco})} 
     361\subsubsection[$Z$-coordinate with uniform thickness levels (\forcode{ln_zco})]{$Z$-coordinate with uniform thickness levels (\protect\np{ln_zco}{ln\_zco})} 
    362362\label{subsec:DOMCFG_zco} 
    363363 
     
    371371%        z-coordinate with partial step 
    372372% ------------------------------------------------------------------------------------------------------------- 
    373 \subsubsection[$Z$-coordinate with partial step (\forcode{ln_zps})]{$Z$-coordinate with partial step (\protect\np{ln\_zps})} 
     373\subsubsection[$Z$-coordinate with partial step (\forcode{ln_zps})]{$Z$-coordinate with partial step (\protect\np{ln_zps}{ln\_zps})} 
    374374\label{subsec:DOMCFG_zps} 
    375375 
     
    394394$250~m$).  Two variables in the namdom namelist are used to define the partial step 
    395395vertical grid.  The mimimum water thickness (in meters) allowed for a cell partially 
    396 filled with bathymetry at level jk is the minimum of \np{rn\_e3zps\_min} (thickness in 
    397 meters, usually $20~m$) or $e_{3t}(jk)*$\np{rn\_e3zps\_rat} (a fraction, usually 10\%, of 
     396filled with bathymetry at level jk is the minimum of \np{rn_e3zps_min}{rn\_e3zps\_min} (thickness in 
     397meters, usually $20~m$) or $e_{3t}(jk)*$\np{rn_e3zps_rat}{rn\_e3zps\_rat} (a fraction, usually 10\%, of 
    398398the default thickness $e_{3t}(jk)$). 
    399399 
     
    401401%        s-coordinate 
    402402% ------------------------------------------------------------------------------------------------------------- 
    403 \subsubsection[$S$-coordinate (\forcode{ln_sco})]{$S$-coordinate (\protect\np{ln\_sco})} 
     403\subsubsection[$S$-coordinate (\forcode{ln_sco})]{$S$-coordinate (\protect\np{ln_sco}{ln\_sco})} 
    404404\label{sec:DOMCFG_sco} 
    405405%------------------------------------------nam_zgr_sco--------------------------------------------------- 
     
    411411\end{listing} 
    412412%-------------------------------------------------------------------------------------------------------------- 
    413 Options are defined in \nam{zgr\_sco} (\texttt{DOMAINcfg} only). 
    414 In $s$-coordinate (\np{ln\_sco}\forcode{ = .true.}), the depth and thickness of the model levels are defined from 
     413Options are defined in \nam{zgr_sco}{zgr\_sco} (\texttt{DOMAINcfg} only). 
     414In $s$-coordinate (\np{ln_sco}{ln\_sco}\forcode{ = .true.}), the depth and thickness of the model levels are defined from 
    415415the product of a depth field and either a stretching function or its derivative, respectively: 
    416416 
     
    426426since a mixed step-like and bottom-following representation of the topography can be used 
    427427(\autoref{fig:DOM_z_zps_s_sps}) or an envelop bathymetry can be defined (\autoref{fig:DOM_z_zps_s_sps}). 
    428 The namelist parameter \np{rn\_rmax} determines the slope at which 
     428The namelist parameter \np{rn_rmax}{rn\_rmax} determines the slope at which 
    429429the terrain-following coordinate intersects the sea bed and becomes a pseudo z-coordinate. 
    430 The coordinate can also be hybridised by specifying \np{rn\_sbot\_min} and \np{rn\_sbot\_max} as 
     430The coordinate can also be hybridised by specifying \np{rn_sbot_min}{rn\_sbot\_min} and \np{rn_sbot_max}{rn\_sbot\_max} as 
    431431the minimum and maximum depths at which the terrain-following vertical coordinate is calculated. 
    432432 
     
    435435 
    436436The original default \NEMO\ s-coordinate stretching is available if neither of the other options are specified as true 
    437 (\np{ln\_s\_SH94}\forcode{ = .false.} and \np{ln\_s\_SF12}\forcode{ = .false.}). 
     437(\np{ln_s_SH94}{ln\_s\_SH94}\forcode{ = .false.} and \np{ln_s_SF12}{ln\_s\_SF12}\forcode{ = .false.}). 
    438438This uses a depth independent $\tanh$ function for the stretching \citep{madec.delecluse.ea_JPO96}: 
    439439 
     
    455455 
    456456A stretching function, 
    457 modified from the commonly used \citet{song.haidvogel_JCP94} stretching (\np{ln\_s\_SH94}\forcode{ = .true.}), 
     457modified from the commonly used \citet{song.haidvogel_JCP94} stretching (\np{ln_s_SH94}{ln\_s\_SH94}\forcode{ = .true.}), 
    458458is also available and is more commonly used for shelf seas modelling: 
    459459 
     
    476476%% %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    477477 
    478 where $H_c$ is the critical depth (\np{rn\_hc}) at which the coordinate transitions from pure $\sigma$ to 
    479 the stretched coordinate, and $\theta$ (\np{rn\_theta}) and $b$ (\np{rn\_bb}) are the surface and 
     478where $H_c$ is the critical depth (\np{rn_hc}{rn\_hc}) at which the coordinate transitions from pure $\sigma$ to 
     479the stretched coordinate, and $\theta$ (\np{rn_theta}{rn\_theta}) and $b$ (\np{rn_bb}{rn\_bb}) are the surface and 
    480480bottom control parameters such that $0 \leqslant \theta \leqslant 20$, and $0 \leqslant b \leqslant 1$. 
    481481$b$ has been designed to allow surface and/or bottom increase of the vertical resolution 
    482482(\autoref{fig:DOMCFG_sco_function}). 
    483483 
    484 Another example has been provided at version 3.5 (\np{ln\_s\_SF12}) that allows a fixed surface resolution in 
     484Another example has been provided at version 3.5 (\np{ln_s_SF12}{ln\_s\_SF12}) that allows a fixed surface resolution in 
    485485an analytical terrain-following stretching \citet{siddorn.furner_OM13}. 
    486486In this case the a stretching function $\gamma$ is defined such that: 
     
    504504 
    505505This gives an analytical stretching of $\sigma$ that is solvable in $A$ and $B$ as a function of 
    506 the user prescribed stretching parameter $\alpha$ (\np{rn\_alpha}) that stretches towards 
     506the user prescribed stretching parameter $\alpha$ (\np{rn_alpha}{rn\_alpha}) that stretches towards 
    507507the surface ($\alpha > 1.0$) or the bottom ($\alpha < 1.0$) and 
    508 user prescribed surface (\np{rn\_zs}) and bottom depths. 
     508user prescribed surface (\np{rn_zs}{rn\_zs}) and bottom depths. 
    509509The bottom cell depth in this example is given as a function of water depth: 
    510510 
     
    514514\] 
    515515 
    516 where the namelist parameters \np{rn\_zb\_a} and \np{rn\_zb\_b} are $a$ and $b$ respectively. 
     516where the namelist parameters \np{rn_zb_a}{rn\_zb\_a} and \np{rn_zb_b}{rn\_zb\_b} are $a$ and $b$ respectively. 
    517517 
    518518%% %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    542542the critical depth $h_c$. 
    543543In this example two options are available in depths shallower than $h_c$, 
    544 with pure sigma being applied if the \np{ln\_sigcrit} is true and pure z-coordinates if it is false 
     544with pure sigma being applied if the \np{ln_sigcrit}{ln\_sigcrit} is true and pure z-coordinates if it is false 
    545545(the z-coordinate being equal to the depths of the stretched coordinate at $h_c$). 
    546546 
     
    553553%        z*- or s*-coordinate 
    554554% ------------------------------------------------------------------------------------------------------------- 
    555 \subsubsection[\zstar- or \sstar-coordinate (\forcode{ln_linssh})]{\zstar- or \sstar-coordinate (\protect\np{ln\_linssh})} 
     555\subsubsection[\zstar- or \sstar-coordinate (\forcode{ln_linssh})]{\zstar- or \sstar-coordinate (\protect\np{ln_linssh}{ln\_linssh})} 
    556556\label{subsec:DOMCFG_zgr_star} 
    557557 
Note: See TracChangeset for help on using the changeset viewer.