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/chap_LBC.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/chap_LBC.tex

    r11571 r11577  
    1717% Boundary Condition at the Coast 
    1818% ================================================================ 
    19 \section[Boundary condition at the coast (\forcode{rn_shlat})]{Boundary condition at the coast (\protect\np{rn\_shlat})} 
     19\section[Boundary condition at the coast (\forcode{rn_shlat})]{Boundary condition at the coast (\protect\np{rn_shlat}{rn\_shlat})} 
    2020\label{sec:LBC_coast} 
    2121%--------------------------------------------namlbc------------------------------------------------------- 
     
    9191and is required in order to compute the vorticity at the coast. 
    9292Four different types of lateral boundary condition are available, 
    93 controlled by the value of the \np{rn\_shlat} namelist parameter 
     93controlled by the value of the \np{rn_shlat}{rn\_shlat} namelist parameter 
    9494(The value of the mask$_{f}$ array along the coastline is set equal to this parameter). 
    9595These are: 
     
    101101  \caption[Lateral boundary conditions]{ 
    102102    Lateral boundary conditions 
    103     (a) free-slip                       (\protect\np{rn\_shlat}\forcode{=0}); 
    104     (b) no-slip                         (\protect\np{rn\_shlat}\forcode{=2}); 
    105     (c) "partial" free-slip (\forcode{0<}\protect\np{rn\_shlat}\forcode{<2}) and 
    106     (d) "strong" no-slip    (\forcode{2<}\protect\np{rn\_shlat}). 
     103    (a) free-slip                       (\protect\np{rn_shlat}{rn\_shlat}\forcode{=0}); 
     104    (b) no-slip                         (\protect\np{rn_shlat}{rn\_shlat}\forcode{=2}); 
     105    (c) "partial" free-slip (\forcode{0<}\protect\np{rn_shlat}{rn\_shlat}\forcode{<2}) and 
     106    (d) "strong" no-slip    (\forcode{2<}\protect\np{rn_shlat}{rn\_shlat}). 
    107107    Implied "ghost" velocity inside land area is display in grey.} 
    108108  \label{fig:LBC_shlat} 
     
    112112\begin{description} 
    113113 
    114 \item[free-slip boundary condition (\np{rn\_shlat}\forcode{=0}):] the tangential velocity at 
     114\item[free-slip boundary condition (\np{rn_shlat}{rn\_shlat}\forcode{=0}):] the tangential velocity at 
    115115  the coastline is equal to the offshore velocity, 
    116116  \ie\ the normal derivative of the tangential velocity is zero at the coast, 
     
    118118  (\autoref{fig:LBC_shlat}-a). 
    119119 
    120 \item[no-slip boundary condition (\np{rn\_shlat}\forcode{=2}):] the tangential velocity vanishes at the coastline. 
     120\item[no-slip boundary condition (\np{rn_shlat}{rn\_shlat}\forcode{=2}):] the tangential velocity vanishes at the coastline. 
    121121  Assuming that the tangential velocity decreases linearly from 
    122122  the closest ocean velocity grid point to the coastline, 
     
    139139  \] 
    140140 
    141 \item["partial" free-slip boundary condition (0$<$\np{rn\_shlat}$<$2):] the tangential velocity at 
     141\item["partial" free-slip boundary condition (0$<$\np{rn_shlat}{rn\_shlat}$<$2):] the tangential velocity at 
    142142  the coastline is smaller than the offshore velocity, \ie\ there is a lateral friction but 
    143143  not strong enough to make the tangential velocity at the coast vanish (\autoref{fig:LBC_shlat}-c). 
    144144  This can be selected by providing a value of mask$_{f}$ strictly inbetween $0$ and $2$. 
    145145 
    146 \item["strong" no-slip boundary condition (2$<$\np{rn\_shlat}):] the viscous boundary layer is assumed to 
     146\item["strong" no-slip boundary condition (2$<$\np{rn_shlat}{rn\_shlat}):] the viscous boundary layer is assumed to 
    147147  be smaller than half the grid size (\autoref{fig:LBC_shlat}-d). 
    148148  The friction is thus larger than in the no-slip case. 
     
    333333 
    334334If the domain decomposition is automatically defined (when \np{jpni} and \np{jpnj} are < 1), the decomposition chosen by the model will minimise the sub-domain size (defined as $max_{all domains}(jpi \times jpj)$) and maximize the number of eliminated land subdomains. This means that no other domain decomposition (a set of \np{jpni} and \np{jpnj} values) will use less processes than $(jpni  \times  jpnj - N_{land})$ and get a smaller subdomain size. 
    335 In order to specify $N_{mpi}$ properly (minimize $N_{useless}$), you must run the model once with \np{ln\_list} activated. In this case, the model will start the initialisation phase, print the list of optimum decompositions ($N_{mpi}$, \np{jpni} and \np{jpnj}) in \texttt{ocean.output} and directly abort. The maximum value of $N_{mpi}$ tested in this list is given by $max(N_{MPI\_tasks}, jpni \times jpnj)$. For example, run the model on 40 nodes with ln\_list activated and $jpni = 10000$ and $jpnj = 1$, will print the list of optimum domains decomposition from 1 to about 10000. 
     335In order to specify $N_{mpi}$ properly (minimize $N_{useless}$), you must run the model once with \np{ln_list}{ln\_list} activated. In this case, the model will start the initialisation phase, print the list of optimum decompositions ($N_{mpi}$, \np{jpni} and \np{jpnj}) in \texttt{ocean.output} and directly abort. The maximum value of $N_{mpi}$ tested in this list is given by $max(N_{MPI\_tasks}, jpni \times jpnj)$. For example, run the model on 40 nodes with ln\_list activated and $jpni = 10000$ and $jpnj = 1$, will print the list of optimum domains decomposition from 1 to about 10000. 
    336336 
    337337Processors are numbered from 0 to $N_{mpi} - 1$. Subdomains containning some ocean points are numbered first from 0 to $jpni * jpnj - N_{land} -1$. The remaining $N_{useless}$ land subdomains are numbered next, which means that, for a given (\np{jpni}, \np{jpnj}), the numbers attributed to he ocean subdomains do not vary with $N_{useless}$. 
    338338 
    339 When land processors are eliminated, the value corresponding to these locations in the model output files is undefined. \np{ln\_mskland} must be activated in order avoid Not a Number values in output files. Note that it is better to not eliminate land processors when creating a meshmask file (\ie\ when setting a non-zero value to \np{nn\_msh}). 
     339When land processors are eliminated, the value corresponding to these locations in the model output files is undefined. \np{ln_mskland}{ln\_mskland} must be activated in order avoid Not a Number values in output files. Note that it is better to not eliminate land processors when creating a meshmask file (\ie\ when setting a non-zero value to \np{nn_msh}{nn\_msh}). 
    340340 
    341341%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    378378%----------------------------------------------------------------------------------------------- 
    379379 
    380 Options are defined through the \nam{bdy} and \nam{bdy\_dta} namelist variables. 
     380Options are defined through the \nam{bdy} and \nam{bdy_dta}{bdy\_dta} namelist variables. 
    381381The BDY module is the core implementation of open boundary conditions for regional configurations on 
    382382ocean temperature, salinity, barotropic-baroclinic velocities, ice-snow concentration, thicknesses, temperatures, salinity and melt ponds concentration and thickness. 
     
    393393\label{subsec:LBC_bdy_namelist} 
    394394 
    395 The BDY module is activated by setting \np{ln\_bdy}\forcode{=.true.} . 
     395The BDY module is activated by setting \np{ln_bdy}{ln\_bdy}\forcode{=.true.} . 
    396396It is possible to define more than one boundary ``set'' and apply different boundary conditions to each set. 
    397 The number of boundary sets is defined by \np{nb\_bdy}. 
     397The number of boundary sets is defined by \np{nb_bdy}{nb\_bdy}. 
    398398Each boundary set can be either defined as a series of straight line segments directly in the namelist 
    399 (\np{ln\_coords\_file}\forcode{=.false.}, and a namelist block \nam{bdy\_index} must be included for each set) or read in from a file (\np{ln\_coords\_file}\forcode{=.true.}, and a ``\ifile{coordinates.bdy}'' file must be provided). 
     399(\np{ln_coords_file}{ln\_coords\_file}\forcode{=.false.}, and a namelist block \nam{bdy_index}{bdy\_index} must be included for each set) or read in from a file (\np{ln\_coords\_file}\forcode{=.true.}, and a ``\ifile{coordinates.bdy}'' file must be provided). 
    400400The coordinates.bdy file is analagous to the usual \NEMO\ ``\ifile{coordinates}'' file. 
    401401In the example above, there are two boundary sets, the first of which is defined via a file and 
     
    406406(``u2d'':sea-surface height and barotropic velocities), for the baroclinic velocities (``u3d''), 
    407407for the active tracers \footnote{The BDY module does not deal with passive tracers at this version} (``tra''), and for sea-ice (``ice''). 
    408 For each set of variables one has to choose an algorithm and the boundary data (set resp. by \np{cn\_tra} and \np{nn\_tra\_dta} for tracers).\\ 
     408For each set of variables one has to choose an algorithm and the boundary data (set resp. by \np{cn_tra}{cn\_tra} and \np{nn_tra_dta}{nn\_tra\_dta} for tracers).\\ 
    409409 
    410410The choice of algorithm is currently as follows: 
     
    422422 
    423423The boundary data is either set to initial conditions 
    424 (\np{nn\_tra\_dta}\forcode{=0}) or forced with external data from a file (\np{nn\_tra\_dta}\forcode{=1}). 
     424(\np{nn_tra_dta}{nn\_tra\_dta}\forcode{=0}) or forced with external data from a file (\np{nn\_tra\_dta}\forcode{=1}). 
    425425In case the 3d velocity data contain the total velocity (ie, baroclinic and barotropic velocity), 
    426 the bdy code can derived baroclinic and barotropic velocities by setting \np{ln\_full\_vel}\forcode{=.true.} 
     426the bdy code can derived baroclinic and barotropic velocities by setting \np{ln_full_vel}{ln\_full\_vel}\forcode{=.true.} 
    427427For the barotropic solution there is also the option to use tidal harmonic forcing either by 
    428 itself (\np{nn\_dyn2d\_dta}\forcode{=2}) or in addition to other external data (\np{nn\_dyn2d\_dta}\forcode{=3}).\\ 
    429 If not set to initial conditions, sea-ice salinity, temperatures and melt ponds data at the boundary can either be read in a file or defined as constant (by \np{rn\_ice\_sal}, \np{rn\_ice\_tem}, \np{rn\_ice\_apnd}, \np{rn\_ice\_hpnd}). Ice age is constant and defined by \np{rn\_ice\_age}. 
    430  
    431 If external boundary data is required then the \nam{bdy\_dta} namelist must be defined. 
    432 One \nam{bdy\_dta} namelist is required for each boundary set, adopting the same order of indexes in which the boundary sets are defined in nambdy. 
    433 In the example given, two boundary sets have been defined. The first one is reading data file in the \nam{bdy\_dta} namelist shown above 
     428itself (\np{nn_dyn2d_dta}{nn\_dyn2d\_dta}\forcode{=2}) or in addition to other external data (\np{nn\_dyn2d\_dta}\forcode{=3}).\\ 
     429If not set to initial conditions, sea-ice salinity, temperatures and melt ponds data at the boundary can either be read in a file or defined as constant (by \np{rn_ice_sal}{rn\_ice\_sal}, \np{rn_ice_tem}{rn\_ice\_tem}, \np{rn_ice_apnd}{rn\_ice\_apnd}, \np{rn_ice_hpnd}{rn\_ice\_hpnd}). Ice age is constant and defined by \np{rn_ice_age}{rn\_ice\_age}. 
     430 
     431If external boundary data is required then the \nam{bdy_dta}{bdy\_dta} namelist must be defined. 
     432One \nam{bdy_dta}{bdy\_dta} namelist is required for each boundary set, adopting the same order of indexes in which the boundary sets are defined in nambdy. 
     433In the example given, two boundary sets have been defined. The first one is reading data file in the \nam{bdy_dta}{bdy\_dta} namelist shown above 
    434434and the second one is using data from intial condition (no namelist block needed). 
    435435The boundary data is read in using the fldread module, 
    436 so the \nam{bdy\_dta} namelist is in the format required for fldread. 
     436so the \nam{bdy_dta}{bdy\_dta} namelist is in the format required for fldread. 
    437437For each required variable, the filename, the frequency of the files and 
    438438the frequency of the data in the files are given. 
     
    441441 
    442442There is currently an option to vertically interpolate the open boundary data onto the native grid at run-time. 
    443 If \np{nn\_bdy\_jpk}$<-1$, it is assumed that the lateral boundary data are already on the native grid. 
    444 However, if \np{nn\_bdy\_jpk} is set to the number of vertical levels present in the boundary data, 
     443If \np{nn_bdy_jpk}{nn\_bdy\_jpk}$<-1$, it is assumed that the lateral boundary data are already on the native grid. 
     444However, if \np{nn_bdy_jpk}{nn\_bdy\_jpk} is set to the number of vertical levels present in the boundary data, 
    445445a bilinear interpolation onto the native grid will be triggered at runtime. 
    446446For this to be successful the additional variables: $gdept$, $gdepu$, $gdepv$, $e3t$, $e3u$ and $e3v$, are required to be present in the lateral boundary files. 
     
    492492  \alpha(d) = 1 - \tanh\left(\frac{d-1}{2}\right),       \quad d=1,N 
    493493\] 
    494 The width of the FRS zone is specified in the namelist as \np{nn\_rimwidth}. 
     494The width of the FRS zone is specified in the namelist as \np{nn_rimwidth}{nn\_rimwidth}. 
    495495This is typically set to a value between 8 and 10. 
    496496 
     
    557557\end{equation} 
    558558 
    559 Generally the relaxation time scale at inward propagation points (\np{rn\_time\_dmp}) is set much shorter than the time scale at outward propagation 
    560 points (\np{rn\_time\_dmp\_out}) so that the solution is constrained more strongly by the external data at inward propagation points. 
     559Generally the relaxation time scale at inward propagation points (\np{rn_time_dmp}{rn\_time\_dmp}) is set much shorter than the time scale at outward propagation 
     560points (\np{rn_time_dmp_out}{rn\_time\_dmp\_out}) so that the solution is constrained more strongly by the external data at inward propagation points. 
    561561See \autoref{subsec:LBC_bdy_relaxation} for detailed on the spatial shape of the scaling.\\ 
    562562The ``normal propagation of oblique radiation'' or NPO approximation (called \forcode{'orlanski_npo'}) involves assuming 
     
    569569\label{subsec:LBC_bdy_relaxation} 
    570570 
    571 In addition to a specific boundary condition specified as \np{cn\_tra} and \np{cn\_dyn3d}, relaxation on baroclinic velocities and tracers variables are available. 
    572 It is control by the namelist parameter \np{ln\_tra\_dmp} and \np{ln\_dyn3d\_dmp} for each boundary set. 
    573  
    574 The relaxation time scale value (\np{rn\_time\_dmp} and \np{rn\_time\_dmp\_out}, $\tau$) are defined at the boundaries itself. 
    575 This time scale ($\alpha$) is weighted by the distance ($d$) from the boundary over \np{nn\_rimwidth} cells ($N$): 
     571In addition to a specific boundary condition specified as \np{cn_tra}{cn\_tra} and \np{cn_dyn3d}{cn\_dyn3d}, relaxation on baroclinic velocities and tracers variables are available. 
     572It is control by the namelist parameter \np{ln_tra_dmp}{ln\_tra\_dmp} and \np{ln_dyn3d_dmp}{ln\_dyn3d\_dmp} for each boundary set. 
     573 
     574The relaxation time scale value (\np{rn_time_dmp}{rn\_time\_dmp} and \np{rn_time_dmp_out}{rn\_time\_dmp\_out}, $\tau$) are defined at the boundaries itself. 
     575This time scale ($\alpha$) is weighted by the distance ($d$) from the boundary over \np{nn_rimwidth}{nn\_rimwidth} cells ($N$): 
    576576 
    577577\[ 
     
    602602\jp{jpinft} give the start and end $i$ indices for each segment with similar for the other boundaries. 
    603603These segments define a list of $T$ grid points along the outermost row of the boundary ($nbr\,=\, 1$). 
    604 The code deduces the $U$ and $V$ points and also the points for $nbr\,>\, 1$ if \np{nn\_rimwidth}\forcode{>1}. 
     604The code deduces the $U$ and $V$ points and also the points for $nbr\,>\, 1$ if \np{nn_rimwidth}{nn\_rimwidth}\forcode{>1}. 
    605605 
    606606The boundary geometry may also be defined from a ``\ifile{coordinates.bdy}'' file. 
     
    617617For example, if an open boundary is defined along an isobath, say at the shelf break, 
    618618then the areas of ocean outside of this boundary will need to be masked out. 
    619 This can be done by reading a mask file defined as \np{cn\_mask\_file} in the nam\_bdy namelist. 
     619This can be done by reading a mask file defined as \np{cn_mask_file}{cn\_mask\_file} in the nam\_bdy namelist. 
    620620Only one mask file is used even if multiple boundary sets are defined. 
    621621 
     
    672672 
    673673There is an option to force the total volume in the regional model to be constant. 
    674 This is controlled  by the \np{ln\_vol} parameter in the namelist. 
    675 A value of \np{ln\_vol}\forcode{=.false.} indicates that this option is not used. 
    676 Two options to control the volume are available (\np{nn\_volctl}). 
    677 If \np{nn\_volctl}\forcode{=0} then a correction is applied to the normal barotropic velocities around the boundary at 
     674This is controlled  by the \np{ln_vol}{ln\_vol} parameter in the namelist. 
     675A value of \np{ln_vol}{ln\_vol}\forcode{=.false.} indicates that this option is not used. 
     676Two options to control the volume are available (\np{nn_volctl}{nn\_volctl}). 
     677If \np{nn_volctl}{nn\_volctl}\forcode{=0} then a correction is applied to the normal barotropic velocities around the boundary at 
    678678each timestep to ensure that the integrated volume flow through the boundary is zero. 
    679 If \np{nn\_volctl}\forcode{=1} then the calculation of the volume change on 
     679If \np{nn_volctl}{nn\_volctl}\forcode{=1} then the calculation of the volume change on 
    680680the timestep includes the change due to the freshwater flux across the surface and 
    681681the correction velocity corrects for this as well. 
     
    698698 
    699699Tidal forcing at open boundaries requires the activation of surface 
    700 tides (i.e., in \nam{\_tide}, \np{ln\_tide} needs to be set to 
     700tides (i.e., in \nam{_tide}{\_tide}, \np{ln_tide}{ln\_tide} needs to be set to 
    701701\forcode{.true.} and the required constituents need to be activated by 
    702702including their names in the \np{clname} array; see 
     
    704704the complex harmonic amplitudes of elevation (SSH) and barotropic 
    705705velocity (u,v) at open boundaries are defined through the 
    706 \nam{bdy\_tide} namelist parameters.\\ 
     706\nam{bdy_tide}{bdy\_tide} namelist parameters.\\ 
    707707 
    708708The tidal harmonic data at open boundaries can be specified in two 
    709709different ways, either on a two-dimensional grid covering the entire 
    710710model domain or along open boundary segments; these two variants can 
    711 be selected by setting \np{ln\_bdytide\_2ddta } to \forcode{.true.} or 
     711be selected by setting \np{ln_bdytide_2ddta }{ln\_bdytide\_2ddta } to \forcode{.true.} or 
    712712\forcode{.false.}, respectively. In either case, the real and 
    713713imaginary parts of SSH and the two barotropic velocity components for 
     
    729729\textit{v1} and \textit{v2} (real and imaginary part of v) are 
    730730expected to be available from file \np{filtide} with suffix 
    731 \ifile{tcname\_grid\_V}. If \np{ln\_bdytide\_conj} is set to 
     731\ifile{tcname\_grid\_V}. If \np{ln_bdytide_conj}{ln\_bdytide\_conj} is set to 
    732732\forcode{.true.}, the data is expected to be in complex conjugate 
    733733form. 
Note: See TracChangeset for help on using the changeset viewer.