Version 1 (modified by davestorkey, 10 years ago) (diff)

Open Boundary modules in NEMO: OBC/BDY merge

Last edited Timestamp?

As part of the 2011 workplan, it is planned to merge the OBC and BDY modules to provide a single module to do one-way nesting in NEMO. This page outlines the design for the new module. It is intended as a discussion document. Please feel free to add comments.



High-level control and coding structure

The namelist for the new module would look like this:

&namobc        !  unstructured open boundaries               ("key_obc")
   cn_mask     =  ''                      !  name of mask file (ln_mask=T)
   cn_dta      = 'obcdata1', 'obcdta2'    !  root name of data file
   nn_freq     = 6         , -1           !  frequency of data in file (hours)
                                          !  negative value => months
   cn_type     = 'daily'   , 'yearly'     !  'yearly','monthly','daily' files
   ln_clim     = .false.   , .true.       !  climatological data or not
   ln_tint     = .true.    , .true.       !  time interpolation of boundary
                                          !  data or not
   nn_dyn         = 0, 1,   !  Choice of schemes for velocities
   nn_tra         = 0, 1,   !  Choice of schemes for T and S 
   nn_barotropic  = 1, 0,   !  Choice of schemes for barotropic solution
   nn_ice_lim2    = 0, 0,   !  Choice of schemes for ice (LIM2)
   ln_vol         = .false.,.false.,  !  total volume correction (see volbdy parameter)
   ln_mask        = .false.,.false.,  !  boundary mask from filbdy_mask (T), boundaries are on edges of domain (F)
   ln_tides       = .false.,.false.,  !  Apply tidal harmonic forcing with Flather condition
   nn_rimwidth    =  1, 9,            !  width of the relaxation zone
   nn_dtactl      =  1, 1,            !  = 0, bdy data are equal to the initial state
                                      !  = 1, bdy data are read in 'bdydata   .nc' files
   nn_volctl      =  0, 0,            !  = 0, the total water flux across open boundaries is zero
                                      !  = 1, the total volume of the system is conserved

You can define several boundary streams. The example here has two streams defined. The number of streams is defined by the cn_dta parameter which is the filename root. For cn_dta=bdydta1, it will look for files called, etc. For each stream you select which boundary conditions you want to apply to which fields using nn_dyn, nn_tra, nn_barotropic etc. Zero means do not apply open boundary conditions. The other numbers refer to different schemes. For example, nn_tra=0 means don't apply open boundary conditions to T and S, nn_tra=1 might mean apply FRS conditions, nn_tra=2 might mean apply radiation conditions etc.

For each set of variables there is a module which applies the boundary conditions each timestep, eg. for T and S you have obctra.F90 which looks like this:

   MODULE obctra

   SUBROUTINE obc_tra( kt ) 
   DO ib_stream = 1, nb_stream

      SELECT CASE ( nn_tra(ib_stream) )
         CALL obc_tra_frs( kt, ib_stream )
         CALL obc_tra_rad( kt, ib_stream ) 
   SUBROUTINE obc_tra_frs( kt, ib_stream )

This structure allows one to define different boundaries with different boundary conditions, eg. you might want to apply different algorithms on east and west boundaries, or you might want to apply boundary conditions from a large scale model for part of the boundary but apply climatological boundary conditons for another part of the boundary.

The module to read in the boundary data from files would be rewritten to use fldread.F90. For each boundary stream a TYPE FLD structure array would be constructed depending on which fields need to be read in. We can merge the obc_dta and obc_dta_bt routines by making the barotropic subloop counter jit an optional argument.

   MODULE obcdta

   USE fldread

   INTEGER, PARAMETER :: nb_dta_max = 10   
   SUBROUTINE obc_dta( kt, jit ) 

   INTEGER            :: kt        ! time step index
   INTEGER, OPTIONAL  :: jit       ! barotropic subloop index
   ALLOCATE( bf   (nb_stream, nb_dta_max), STAT=ierror )
   ALLOCATE( blf_i(nb_stream, nb_dta_max), STAT=ierror )

   DO ib_stream = 1, nb_stream

      IF( kt == nit000 ) THEN

         zcount = 0
         ! nn_barotropic must come first
         IF( nn_barotropic .gt. 0 ) THEN         
            ! set up information for SSH 
            zcount = zcount + 1
            ALLOCATE( bf(ib_stream,zcount)%fnow(jpib,jpjb,1) )
            IF( ln_tint(ib_stream) ) ALLOCATE( bf(ib_stream,zcount)%fdta(jpib,jpjb,1,2) )
            blf_i(ib_stream,zcount)%clname = cn_dta(ib_stream)//""
            ! set up information for U
            zcount = zcount + 1
            ! set up information for V
            zcount = zcount + 1
         IF ( nn_tra .gt. 0 ) THEN
            ! set up information for T and S
         nn_dta(ib_stream) = zcount
         CALL fld_fill( bf(ib_stream,1:nn_dta(ib_stream)), blf_i(ib_stream,1:nn_dta(ib_stream)), ... )
      ENDIF ! kt == nit000
      IF( PRESENT(jit) && nn_barotropic(ib_stream) .gt. 0 ) THEN
         ! Update barotropic boundary conditions only
         ! jit is optional argument for fld_read
         CALL fld_read( kt, jit, nn_fobc, bf(ib_stream, 1:3) )
         CALL fld_read( kt, nn_fobc, bf(ib_stream, 1:nb_dta(ib_stream) )
      ! Update internal boundary data arrays from bf%fnow

   END DO  ! ib_stream

Attachments (1)

Download all attachments as: .zip