Lateral Boundary Conditions
The lateral boundary conditions are specified by logical switches to facilitate applications with nested grids. It also allows to set different boundary conditions between the nonlinear model and the adjoint/tangent models. In addition we can have different boundary conditions between active and passive tracers. The LBC structure is allocated as:
where 1:4 are the numbered boundary edges, nLBCvar is the number of LBC state variables, and Ngrids is the number of nested grids. For example, for free-surface gradient boundary conditions we have:
      LBC(
iwest,  
isFsur, ng) % gradient      
LBC(
ieast,  
isFsur, ng) % gradient      
LBC(
isouth, 
isFsur, ng) % gradient      
LBC(
inorth, 
isFsur, ng) % gradient
      integer :: 
nLBCvar      TYPE T_LBC
        logical :: acquire        ! process lateral boundary data
        logical :: Chapman
        logical :: clamped
        logical :: closed
        logical :: Flather
        logical :: gradient
        logical :: nested
        logical :: nudging
        logical :: periodic
        logical :: radiation
       logical :: reduced
      END TYPE T_LBC
      TYPE (T_LBC), allocatable :: 
LBC(:,:,:)
      TYPE (T_LBC), allocatable :: 
ad_LBC(:,:,:)
      TYPE (T_LBC), allocatable :: 
tl_LBC(:,:,:) 
 
Changes
Conversion from CPP options to logical switches for free-surface:
| CPP | Logical Switch, IF (...) THEN | 
| WEST_FSCHAPMAN | LBC(iwest,  isFsur, ng) % Chapman | 
| EAST_FSCHAPMAN | LBC(ieast,  isFsur, ng) % Chapman | 
| SOUTH_FSCHAPMAN | LBC(isouth, isFsur, ng) % Chapman | 
| NORTH_FSCHAPMAN | LBC(inorth, isFsur, ng) % Chapman | 
| WEST_FSCLAMPED | LBC(iwest,  isFsur, ng) % clamped | 
| EAST_FSCLAMPED | LBC(ieast,  isFsur, ng) % clamped | 
| SOUTH_FSCLAMPED | LBC(isouth, isFsur, ng) % clamped | 
| NORTH_FSCLAMPED | LBC(inorth, isFsur, ng) % clamped | 
| WESTERN_WALL | LBC(iwest,  isFsur, ng) % closed | 
| EASTERN_WALL | LBC(ieast,  isFsur, ng) % closed | 
| SOUTHERN_WALL | LBC(isouth, isFsur, ng) % closed | 
| NORTHERN_WALL | LBC(inorth, isFsur, ng) % closed | 
| WEST_FSGRADIENT | LBC(iwest,  isFsur, ng) % gradient | 
| EAST_FSGRADIENT | LBC(ieast,  isFsur, ng) % gradient | 
| SOUTH_FSGRADIENT | LBC(isouth, isFsur, ng) % gradient | 
| NORTH_FSGRADIENT | LBC(inorth, isFsur, ng) % gradient | 
| WEST_FSNUDGING | LBC(iwest,  isFsur, ng) % nudging | 
| EAST_FSNUDGING | LBC(ieast,  isFsur, ng) % nudging | 
| SOUTH_FSNUDGING | LBC(isouth, isFsur, ng) % nudging | 
| NORTH_FSNUDGING | LBC(inorth, isFsur, ng) % nudging | 
| EW_PERIODIC | LBC(iwest,  isFsur, ng) % periodic LBC(ieast,  isFsur, ng) % periodic
 | 
| NS_PERIODIC | LBC(isouth, isFsur, ng) % periodic LBC(inorth, isFsur, ng) % periodic
 | 
| WEST_FSRADIATION | LBC(iwest,  isFsur, ng) % radiation | 
| EAST_FSRADIATION | LBC(ieast,  isFsur, ng) % radiation | 
| SOUTH_FSRADIATION | LBC(isouth, isFsur, ng) % radiation | 
| NORTH_FSRADIATION | LBC(inorth, isFsur, ng) % radiation | 
Conversion from CPP options to logical switches for 2D U-momentum:
| CPP | Logical Switch, IF (...) THEN | 
| WEST_M2CLAMPED | LBC(iwest,  isUbar, ng) % clamped | 
| EAST_M2CLAMPED | LBC(ieast,  isUbar, ng) % clamped | 
| SOUTH_M2CLAMPED | LBC(isouth, isUbar, ng) % clamped | 
| NORTH_M2CLAMPED | LBC(inorth, isUbar, ng) % clamped | 
| WESTERN_WALL | LBC(iwest,  isUbar, ng) % closed | 
| EASTERN_WALL | LBC(ieast,  isUbar, ng) % closed | 
| SOUTHERN_WALL | LBC(isouth, isUbar, ng) % closed | 
| NORTHERN_WALL | LBC(inorth, isUbar, ng) % closed | 
| WEST_M2FLATHER | LBC(iwest,  isUbar, ng) % Flather | 
| EAST_M2FLATHER | LBC(ieast,  isUbar, ng) % Flather | 
| SOUTH_M2FLATHER | LBC(isouth, isUbar, ng) % Flather | 
| NORTH_M2FLATHER | LBC(inorth, isUbar, ng) % Flather | 
| WEST_M2GRADIENT | LBC(iwest,  isUbar, ng) % gradient | 
| EAST_M2GRADIENT | LBC(ieast,  isUbar, ng) % gradient | 
| SOUTH_M2GRADIENT | LBC(isouth, isUbar, ng) % gradient | 
| NORTH_M2GRADIENT | LBC(inorth, isUbar, ng) % gradient | 
| WEST_M2NUDGING | LBC(iwest,  isUbar, ng) % nudging | 
| EAST_M2NUDGING | LBC(ieast,  isUbar, ng) % nudging | 
| SOUTH_M2NUDGING | LBC(isouth, isUbar, ng) % nudging | 
| NORTH_M2NUDGING | LBC(inorth, isUbar, ng) % nudging | 
| EW_PERIODIC | LBC(iwest,  isUbar, ng) % periodic LBC(ieast,  isUbar, ng) % periodic
 | 
| NS_PERIODIC | LBC(isouth, isUbar, ng) % periodic LBC(inorth, isUbar, ng) % periodic
 | 
| WEST_M2RADIATION | LBC(iwest,  isUbar, ng) % radiation | 
| EAST_M2RADIATION | LBC(ieast,  isUbar, ng) % radiation | 
| SOUTH_M2RADIATION | LBC(isouth, isUbar, ng) % radiation | 
| NORTH_M2RADIATION | LBC(inorth, isUbar, ng) % radiation | 
| WEST_M2REDUCED | LBC(iwest,  isUbar, ng) % reduced | 
| EAST_M2REDUCED | LBC(ieast,  isUbar, ng) % reduced | 
| SOUTH_M2REDUCED | LBC(isouth, isUbar, ng) % reduced | 
| NORTH_M2REDUCED | LBC(inorth, isUbar, ng) % reduced | 
Conversion from CPP options to logical switches for 2D V-momentum:
| CPP | Logical Switch, IF (...) THEN | 
| WEST_M2CLAMPED | LBC(iwest,  isVbar, ng) % clamped | 
| EAST_M2CLAMPED | LBC(ieast,  isVbar, ng) % clamped | 
| SOUTH_M2CLAMPED | LBC(isouth, isVbar, ng) % clamped | 
| NORTH_M2CLAMPED | LBC(inorth, isVbar, ng) % clamped | 
| WESTERN_WALL | LBC(iwest,  isVbar, ng) % closed | 
| EASTERN_WALL | LBC(ieast,  isVbar, ng) % closed | 
| SOUTHERN_WALL | LBC(isouth, isVbar, ng) % closed | 
| NORTHERN_WALL | LBC(inorth, isVbar, ng) % closed | 
| WEST_M2FLATHER | LBC(iwest,  isVbar, ng) % Flather | 
| EAST_M2FLATHER | LBC(ieast,  isVbar, ng) % Flather | 
| SOUTH_M2FLATHER | LBC(isouth, isVbar, ng) % Flather | 
| NORTH_M2FLATHER | LBC(inorth, isVbar, ng) % Flather | 
| WEST_M2GRADIENT | LBC(iwest,  isVbar, ng) % gradient | 
| EAST_M2GRADIENT | LBC(ieast,  isVbar, ng) % gradient | 
| SOUTH_M2GRADIENT | LBC(isouth, isVbar, ng) % gradient | 
| NORTH_M2GRADIENT | LBC(inorth, isVbar, ng) % gradient | 
| WEST_M2NUDGING | LBC(iwest,  isVbar, ng) % nudging | 
| EAST_M2NUDGING | LBC(ieast,  isVbar, ng) % nudging | 
| SOUTH_M2NUDGING | LBC(isouth, isVbar, ng) % nudging | 
| NORTH_M2NUDGING | LBC(inorth, isVbar, ng) % nudging | 
| EW_PERIODIC | LBC(iwest,  isVbar, ng) % periodic LBC(ieast,  isVbar, ng) % periodic
 | 
| NS_PERIODIC | LBC(isouth, isVbar, ng) % periodic LBC(inorth, isVbar, ng) % periodic
 | 
| WEST_M2RADIATION | LBC(iwest,  isVbar, ng) % radiation | 
| EAST_M2RADIATION | LBC(ieast,  isVbar, ng) % radiation | 
| SOUTH_M2RADIATION | LBC(isouth, isVbar, ng) % radiation | 
| NORTH_M2RADIATION | LBC(inorth, isVbar, ng) % radiation | 
| WEST_M2REDUCED | LBC(iwest,  isVbar, ng) % reduced | 
| EAST_M2REDUCED | LBC(ieast,  isVbar, ng) % reduced | 
| SOUTH_M2REDUCED | LBC(isouth, isVbar, ng) % reduced | 
| NORTH_M2REDUCED | LBC(inorth, isVbar, ng) % reduced | 
Conversion from CPP options to logical switches for 3D U-momentum:
| CPP | Logical Switch, IF (...) THEN | 
| WEST_M3CLAMPED | LBC(iwest,  isUvel, ng) % clamped | 
| EAST_M3CLAMPED | LBC(ieast,  isUvel, ng) % clamped | 
| SOUTH_M3CLAMPED | LBC(isouth, isUvel, ng) % clamped | 
| NORTH_M3CLAMPED | LBC(inorth, isUvel, ng) % clamped | 
| WESTERN_WALL | LBC(iwest,  isUvel, ng) % closed | 
| EASTERN_WALL | LBC(ieast,  isUvel, ng) % closed | 
| SOUTHERN_WALL | LBC(isouth, isUvel, ng) % closed | 
| NORTHERN_WALL | LBC(inorth, isUvel, ng) % closed | 
| WEST_M3GRADIENT | LBC(iwest,  isUvel, ng) % gradient | 
| EAST_M3GRADIENT | LBC(ieast,  isUvel, ng) % gradient | 
| SOUTH_M3GRADIENT | LBC(isouth, isUvel, ng) % gradient | 
| NORTH_M3GRADIENT | LBC(inorth, isUvel, ng) % gradient | 
| WEST_M3NUDGING | LBC(iwest,  isUvel, ng) % nudging | 
| EAST_M3NUDGING | LBC(ieast,  isUvel, ng) % nudging | 
| SOUTH_M3NUDGING | LBC(isouth, isUvel, ng) % nudging | 
| NORTH_M3NUDGING | LBC(inorth, isUvel, ng) % nudging | 
| EW_PERIODIC | LBC(iwest,  isUvel, ng) % periodic LBC(ieast,  isUvel, ng) % periodic
 | 
| NS_PERIODIC | LBC(isouth, isUvel, ng) % periodic LBC(inorth, isUvel, ng) % periodic
 | 
| WEST_M3RADIATION | LBC(iwest,  isUvel, ng) % radiation | 
| EAST_M3RADIATION | LBC(ieast,  isUvel, ng) % radiation | 
| SOUTH_M3RADIATION | LBC(isouth, isUvel, ng) % radiation | 
| NORTH_M3RADIATION | LBC(inorth, isUvel, ng) % radiation | 
Conversion from CPP options to logical switches for 3D V-momentum:
| CPP | Logical Switch, IF (...) THEN | 
| WEST_M3CLAMPED | LBC(iwest,  isVvel, ng) % clamped | 
| EAST_M3CLAMPED | LBC(ieast,  isVvel, ng) % clamped | 
| SOUTH_M3CLAMPED | LBC(isouth, isVvel, ng) % clamped | 
| NORTH_M3CLAMPED | LBC(inorth, isVvel, ng) % clamped | 
| WESTERN_WALL | LBC(iwest,  isVvel, ng) % closed | 
| EASTERN_WALL | LBC(ieast,  isVvel, ng) % closed | 
| SOUTHERN_WALL | LBC(isouth, isVvel, ng) % closed | 
| NORTHERN_WALL | LBC(inorth, isVvel, ng) % closed | 
| WEST_M3GRADIENT | LBC(iwest,  isVvel, ng) % gradient | 
| EAST_M3GRADIENT | LBC(ieast,  isVvel, ng) % gradient | 
| SOUTH_M3GRADIENT | LBC(isouth, isVvel, ng) % gradient | 
| NORTH_M3GRADIENT | LBC(inorth, isVvel, ng) % gradient | 
| WEST_M3NUDGING | LBC(iwest,  isVvel, ng) % nudging | 
| EAST_M3NUDGING | LBC(ieast,  isVvel, ng) % nudging | 
| SOUTH_M3NUDGING | LBC(isouth, isVvel, ng) % nudging | 
| NORTH_M3NUDGING | LBC(inorth, isVvel, ng) % nudging | 
| EW_PERIODIC | LBC(iwest,  isVvel, ng) % periodic LBC(ieast,  isVvel, ng) % periodic
 | 
| NS_PERIODIC | LBC(isouth, isVvel, ng) % periodic LBC(inorth, isVvel, ng) % periodic
 | 
| WEST_M3RADIATION | LBC(iwest,  isVvel, ng) % radiation | 
| EAST_M3RADIATION | LBC(ieast,  isVvel, ng) % radiation | 
| SOUTH_M3RADIATION | LBC(isouth, isVvel, ng) % radiation | 
| NORTH_M3RADIATION | LBC(inorth, isVvel, ng) % radiation | 
Conversion from CPP options to logical switches for TKE mixing:
| CPP | Logical Switch, IF (...) THEN | 
| WESTERN_WALL | LBC(iwest,  isMtke, ng) % closed | 
| EASTERN_WALL | LBC(ieast,  isMtke, ng) % closed | 
| SOUTHERN_WALL | LBC(isouth, isMtke, ng) % closed | 
| NORTHERN_WALL | LBC(inorth, isMtke, ng) % closed | 
| WEST_KGRADIENT | LBC(iwest,  isMtke, ng) % gradient | 
| EAST_KGRADIENT | LBC(ieast,  isMtke, ng) % gradient | 
| SOUTH_KGRADIENT | LBC(isouth, isMtke, ng) % gradient | 
| NORTH_KGRADIENT | LBC(inorth, isMtke, ng) % gradient | 
| EW_PERIODIC | LBC(iwest,  isMtke, ng) % periodic LBC(ieast,  isMtke, ng) % periodic
 | 
| NS_PERIODIC | LBC(isouth, isMtke, ng) % periodic LBC(inorth, isFsur, ng) % periodic
 | 
| WEST_KRADIATION | LBC(iwest,  isMtke, ng) % radiation | 
| EAST_KRADIATION | LBC(ieast,  isMtke, ng) % radiation | 
| SOUTH_KRADIATION | LBC(isouth, isMtke, ng) % radiation | 
| NORTH_KRADIATION | LBC(inorth, isMtke, ng) % radiation | 
Conversion from CPP options to logical switches for tracers:
| CPP | Logical Switch, IF (...) THEN | 
| WEST_TCLAMPED | LBC(iwest,  isTvar(:), ng) % clamped | 
| EAST_TCLAMPED | LBC(ieast,  isTvar(:), ng) % clamped | 
| SOUTH_TCLAMPED | LBC(isouth, isTvar(:), ng) % clamped | 
| NORTH_TCLAMPED | LBC(inorth, isTvar(:), ng) % clamped | 
| WESTERN_WALL | LBC(iwest,  isTvar(:), ng) % closed | 
| EASTERN_WALL | LBC(ieast,  isTvar(:), ng) % closed | 
| SOUTHERN_WALL | LBC(isouth, isTvar(:), ng) % closed | 
| NORTHERN_WALL | LBC(inorth, isTvar(:), ng) % closed | 
| WEST_TGRADIENT | LBC(iwest,  isTvar(:), ng) % gradient | 
| EAST_TGRADIENT | LBC(ieast,  isTvar(:), ng) % gradient | 
| SOUTH_TGRADIENT | LBC(isouth, isTvar(:), ng) % gradient | 
| NORTH_TGRADIENT | LBC(inorth, isTvar(:), ng) % gradient | 
| WEST_TNUDGING | LBC(iwest,  isTvar(:), ng) % nudging | 
| EAST_TNUDGING | LBC(ieast,  isTvar(:), ng) % nudging | 
| SOUTH_TNUDGING | LBC(isouth, isTvar(:), ng) % nudging | 
| NORTH_TNUDGING | LBC(inorth, isTvar(:), ng) % nudging | 
| EW_PERIODIC | LBC(iwest,  isTvar(:), ng) % periodic LBC(ieast,  isTvar(:), ng) % periodic
 | 
| NS_PERIODIC | LBC(isouth, isTvar(:), ng) % periodic LBC(inorth, isTvar(:), ng) % periodic
 | 
| WEST_TRADIATION | LBC(iwest,  isTvar(:), ng) % radiation | 
| EAST_TRADIATION | LBC(ieast,  isTvar(:), ng) % radiation | 
| SOUTH_TRADIATION | LBC(isouth, isTvar(:), ng) % radiation | 
| NORTH_TRADIATION | LBC(inorth, isTvar(:), ng) % radiation |