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 1320 for trunk/DOC/TexFiles/Chapters/Chap_SBC.tex – NEMO

Ignore:
Timestamp:
2009-02-19T14:26:35+01:00 (15 years ago)
Author:
rblod
Message:

Update documentation for interpolation on the fly, see ticket #279

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DOC/TexFiles/Chapters/Chap_SBC.tex

    r1224 r1320  
    2727(\np{ln\_cpl}=true). The frequency at which the six fields have to be updated is 
    2828the  \np{nf\_sbc} namelist parameter.  
     29When the fields are supplied from data files (flux and bulk formulations), the input fields  
     30need not be supplied on the model grid.  Instead a file of coordinates and weights can be supplied which 
     31maps the data from the supplied grid to the model points (so called "Interpolation on the Fly"). 
    2932In addition, the resulting fields can be further modified using  
    30 several namelist options. These options control the addition of a surface restoring  
    31 term to observed SST and/or SSS (\np{ln\_ssr}=true), the modification of fluxes  
     33several namelist options. These options control  the rotation of vector components 
     34supplied relative to an east-north coordinate system onto the local grid directions in the model; 
     35the addition of a surface restoring  
     36term to observed SST and/or SSS (\np{ln\_ssr}=true); the modification of fluxes  
    3237below ice-covered areas (using observed ice-cover or a sea-ice model)  
    33 (\np{nn\_ice}=0,1, 2 or 3), the addition of river runoffs as surface freshwater  
    34 fluxes (\np{ln\_rnf}=true), the addition of a freshwater flux adjustment in  
    35 order to avoid a mean sea-level drift (\np{nn\_fwb}= 0, 1 or 2), and the  
     38(\np{nn\_ice}=0,1, 2 or 3); the addition of river runoffs as surface freshwater  
     39fluxes (\np{ln\_rnf}=true); the addition of a freshwater flux adjustment in  
     40order to avoid a mean sea-level drift (\np{nn\_fwb}= 0, 1 or 2); and the  
    3641transformation of the solar radiation (if provided as daily mean) into a diurnal  
    3742cycle (\np{ln\_dm2dc}=true). 
     
    3944In this chapter, we first discuss where the surface boundary condition  
    4045appears in the model equations. Then we present the four ways of providing  
    41 the surface boundary condition. Finally, the different options that further modify  
     46the surface boundary condition. Next the scheme for interpolation on the fly is described. 
     47Finally, the different options that further modify 
    4248the fluxes applied to the ocean are discussed. 
    4349 
     
    101107For example: 
    102108 
    103 When rigid-lid assumption is made, the ocean volume becomes constant and  
     109When the rigid-lid assumption is made, the ocean volume becomes constant and  
    104110thus, EMP$=$0, not EMP$_{S }$. 
    105111 
     
    110116only the volume flux. In addition, in the current version of \NEMO, the  
    111117sea-ice is assumed to be above the ocean. Freezing/melting does not change  
    112 the ocean volume (not impact on EMP) but it modifies the SSS. 
     118the ocean volume (no impact on EMP) but it modifies the SSS. 
    113119%gm  \colorbox{yellow}{(see {\S} on LIM sea-ice model)}. 
    114120 
     
    354360atmospheric GCM (ARPEGE, ECHAM, ECMWF, HadAM, LMDz). 
    355361 
     362% ================================================================ 
     363% Interpolation on the Fly 
     364% ================================================================ 
     365 
     366\section [Interpolation on the Fly] {Interpolation on the Fly} 
     367\label{SBC_iof} 
     368 
     369Interpolation on the Fly allows the user to supply input files required 
     370for the surface forcing on grids other than the model grid. 
     371To do this he or she must supply, in addition to the source data file, 
     372a file of weights to be used to interpolate from the data grid to the model 
     373grid. 
     374The original development of this code used the SCRIP package (freely available  
     375under a copyright agreement from http://climate.lanl.gov/Software/SCRIP). 
     376In principle, any package can be used to generate the weights, but the 
     377variables in the input weights file must have the same names and meanings as 
     378assumed by the model. 
     379Two methods are currently available: bilinear and bicubic interpolation. 
     380 
     381\subsection{Bilinear Interpolation} 
     382\label{SBC_iof_bilinear} 
     383 
     384The input weights file in this case has two sets of variables: src01, src02, 
     385src03, src04 and wgt01, wgt02, wgt03, wgt04. 
     386The "src" variables correspond to the point in the input grid to which the weight 
     387"wgt" is to be applied. Each src value is an integer corresponding to the index of a  
     388point in the input grid when written as a one dimensional array.  For example, for an input grid 
     389of size 5x10, point (3,2) is referenced as point 8, since (2-1)*5+3=8. 
     390There are four of each variable because bilinear interpolation uses the four points defining 
     391the grid box containing the point to be interpolated. 
     392All of these arrays are on the model grid, so that values src01(i,j) and 
     393wgt01(i,j) are used to generate a value for point (i,j) in the model. 
     394 
     395Symbolically, the algorithm used is: 
     396 
     397\begin{equation} 
     398f_{m}(i,j) = f_{m}(i,j) + \sum_{k=1}^{4} {wgt(k)f(idx(src(k)))} 
     399\end{equation} 
     400where function idx() transforms a one dimensional index src(k) into a two dimensional index, 
     401and wgt(1) corresponds to variable "wgt01" for example. 
     402 
     403\subsection{Bicubic Interpolation} 
     404\label{SBC_iof_bicubic} 
     405 
     406Again there are two sets of variables: "src" and "wgt". 
     407But in this case there are 16 of each. 
     408The symbolic algorithm used to calculate values on the model grid is now: 
     409 
     410\begin{multline*} 
     411f_{m}(i,j) = f_{m}(i,j) + \sum_{k=1}^{4} {wgt(k)f(idx(src(k)))} 
     412\\ 
     413                        + \sum_{k=5}^{8} {wgt(k)\left.\frac{\partial f}{\partial i}\right| _{idx(src(k))} } 
     414\\ 
     415                        + \sum_{k=9}^{12} {wgt(k)\left.\frac{\partial f}{\partial j}\right| _{idx(src(k))} } 
     416\\ 
     417                        + \sum_{k=13}^{16} {wgt(k)\left.\frac{\partial ^2 f}{\partial i \partial j}\right| _{idx(src(k))} } 
     418\end{multline*} 
     419The gradients here are taken with respect to the horizontal indices and not distances since the spatial dependency has been absorbed into the weights. 
     420 
     421\subsection{Implementation} 
     422\label{SBC_iof_imp} 
     423 
     424To activate this option, a non-empty string should be supplied in the weights filename column of the relevant namelist; 
     425if this is left as an empty string no action is taken. 
     426In the model, weights files are read in and stored in a structured type (WGT) in the fldread module, as and when they are first required. 
     427This initialisation procedure tries to determine whether the input data grid should be treated as cyclical or not. 
     428(In fact this only matters when bicubic interpolation is required.) 
     429To do this the model looks in the input data file (i.e. the data to which the weights are to be applied) for a variable with name "nav\_lon" or "lon". 
     430If found, it checks the difference between the first and last values of longitude along a single row. 
     431If the absolute value of this difference is close to 360 degrees or less than twice the maximum spacing from 360 degrees, the grid is assumed to be cyclical, and the difference determines whether the first column is a repeat of the last one or not. 
     432If neither "nav\_lon" or "lon" can be found, the model resorts to looking at the first and last columns of data. 
     433If the sum of the absolute values of the differences between the columns is very small, then the grid is assumed to be cyclical with coincident first and last columns. 
     434If both of these tests fail, the grid is assumed not to be cyclical. 
     435 
     436Next the routine reads in the weights. 
     437Bicubic interpolation is assumed if it finds a variable with name "src05", otherwise bilinear interpolation is used. 
     438The WGT structure includes dynamic arrays both for the storage of the weights (on the model grid), and when required, for reading in the variable to be interpolated (on the input data grid). 
     439The size of the input data array is determined by examining the values in the "src" arrays to find the minimum and maximum i and j values required. 
     440Since bicubic interpolation requires the calculation of gradients at each point on the grid, the corresponding arrays are dimensioned with a halo of width one grid point all the way around. 
     441When the array of points from the data file is adjacent to an edge of the data grid, the halo is either a copy of the row/column next to it (non-cyclical case), or is a copy of one from the first two rows/columns on the opposite side of the grid (cyclical case with coincident end rows/columns, or cyclical case with non-coincident end rows/columns). 
     442 
     443\subsection{Limitations} 
     444\label{SBC_iof_lim} 
     445 
     446\begin{description} 
     447\item 
     448Input data grids must be logically rectangular. 
     449\item 
     450This code is not guaranteed to produce positive definite answers from positive definite inputs. 
     451\item 
     452The cyclic condition is only applied on left and right columns, and not to top and bottom rows. 
     453\item 
     454The gradients across the ends of a cyclical grid assume that the grid spacing between the two columns involved are consistent with the weights used. 
     455\item 
     456Neither interpolation scheme is conservative. 
     457(There is a conservative scheme available in SCRIP, but this has not been implemented.) 
     458\end{description} 
     459 
     460\subsection{Utilities} 
     461\label{SBC_iof_util} 
     462 
     463% to be completed 
     464A set of utilities to create a weights file for a rectilinear input grid is available. 
    356465 
    357466% ================================================================ 
     
    360469\section{Miscellaneous options} 
    361470\label{SBC_misc} 
     471 
     472% ------------------------------------------------------------------------------------------------------------- 
     473%        Rotation of vector pairs onto the model grid directions 
     474% ------------------------------------------------------------------------------------------------------------- 
     475\subsection{Rotation of vector pairs onto the model grid directions} 
     476\label{SBC_rotation} 
     477 
     478When using a flux (\np{ln\_flx}=true) or bulk (\np{ln\_clio}=true or \np{ln\_core}=true) formulation,  
     479pairs of vector components can be rotated from east-north directions onto the local grid directions.   
     480This is particularly useful when interpolation on the fly is used since here any vectors are likely to be defined  
     481relative to a rectilinear grid. 
     482To activate this option a non-empty string is supplied in the rotation pair column of the relevant namelist. 
     483The eastward component must start with "U" and the northward component with "V".   
     484The remaining characters in the strings are used to identify which pair of components go together. 
     485So for example, strings "U1" and "V1" next to "utau" and "vtau" would pair the wind stress components together 
     486and rotate them on to the model grid directions; "U2" and "V2" could be used against a second pair of components,  
     487and so on. 
     488The extra characters used in the strings are arbitrary. 
     489The rot\_rep routine from the \mdl{geo2ocean} module is used to perform the rotation. 
    362490 
    363491% ------------------------------------------------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.