[BDY][TOP] Structure of open boundaries

Dear all,
I’m trying to run NEMOv4.0_PISCES-v2 in an offline mode for a regional configuration. I have two open boundaries (W,E) and set then in namelist_cfg as

&nambdy_index  !  structured open boundaries definition     ("key_bdy")
!-----------------------------------------------------------------------
    ctypebdy ='W'         ! Open boundary type (W,E,S or N)
    nbdyind  = 2            ! indice of velocity row or column
                                    ! if ==-1, set obc at the domain boundary
                                    !        , discard start and end indices
    nbdybeg  =  95        ! indice of segment start
    nbdyend  = 353       ! indice of segment end
/
!-----------------------------------------------------------------------
&nambdy_index  !  structured open boundaries definition     ("key_bdy")
!-----------------------------------------------------------------------
    ctypebdy ='E'          ! Open boundary type (W,E,S or N)
    nbdyind  = 1281      ! indice of velocity row or column
                                    ! if ==-1, set obc at the domain boundary
                                    !        , discard start and end indices
    nbdybeg  =  486      ! indice of segment start
    nbdyend  =  496      ! indice of segment end

and

   nn_rimwidth   = 10,3         !  width of the relaxation zone

What I would like to ask is the format of the OBC files for the passive tracers. What should be their dimensions? They should be contain variables of shape (time_counter,deptht,y,x) where y is always 1 and x is 259x10 (259 is the length of west boundary and 10 is the rimwidth) or something different?

I would be really grateful for any help!

Marilia

That’s something different !
In your case the bdy data should have the following dimensions:
West:
x=10
y=259

East:
x=3
y=11

Be careful that for the Eastern boundary, data located at x=1 is the outermost point (x increases from the boundary).

NB: If you would have used a coordinate file to define boundary segments (hence no need to fill nambdy_index blocks), then the bdy data size would indeed have been x=259x10 and y=1 for the western segment and x=11x3 and y=1 for the eastern. Alternatively a single file with size x=259x10+11x3 and y=1 could have been used.

1 Like

Thank you for your help!

I have one more question about the structure of the namelist_top_cfg. When I add one boundary (for example east or west) the model reads correctly the OBC for the passive tracers. However, when I add both boundaries I get an error (trc_bc_ini : unable to allocate passive tracer OBC data arrays). The structure of the namelist_top that I follow is

&namtrc          !   tracers definition
!-----------------------------------------------------------------------
  sn_tracer(1)%llobc = .true.
  sn_tracer(3)%llobc = .true.
/
!----------------------------------------------------------------------
&namtrc_bc       !   data for boundary conditions (west boundary)
!-----------------------------------------------------------------------
!
!              !  file name      ! frequency (hours) ! variable   ! time interp.   !  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
!              !                 !  (if <0  months)  !   name     !   (logical)    !  (T/F ) ! 'monthly' ! filename ! pairing  ! filename      !

 sn_trcobc(1)  = 'DIC_west.nc' ,  -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , '' , ''  , ''
 sn_trcobc(3)  = 'O2_west.nc'  ,   -1        ,  'O2'      ,    .true.    , .true. , 'yearly'  , '' , ''  , ''

 cn_dir_obc        =  './BDY_BIO/'      !  root directory for the location of OPEN data files

 rn_trofac(1)   =   1.0e-06  !  -      -      -     -
 rn_trofac(3)   =  44.6e-06  !  -      -      -     -

/
!----------------------------------------------------------------------
&namtrc_bc       !   data for boundary conditions (east boundary)
!-----------------------------------------------------------------------
!
!              !  file name      ! frequency (hours) ! variable   ! time interp.   !  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
!              !                 !  (if <0  months)  !   name     !   (logical)    !  (T/F ) ! 'monthly' ! filename ! pairing  ! filename      !

 sn_trcobc(1)  = 'DIC_east.nc' ,  -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , '' , ''  , ''
 sn_trcobc(3)  = 'O2_east.nc'  ,   -1        ,  'O2'      ,    .true.    , .true. , 'yearly'  , '' , ''  , ''

 cn_dir_obc        =  './BDY_BIO/'      !  root directory for the location of OPEN data files

 rn_trofac(1)   =   1.0e-06  !  -      -      -     -
 rn_trofac(3)   =  44.6e-06  !  -      -      -     -
/

In namelist_cfg I set

!-----------------------------------------------------------------------
&nambdy        !  unstructured open boundaries                          (default: OFF)
!-----------------------------------------------------------------------
   ln_bdy         = .true.   !  Use unstructured open boundaries
   nb_bdy         = 2         !  number of open boundary sets
   ln_coords_file = .false.,.false.    !  =T : read bdy coordinates from file
      cn_coords_file = 'coordinates.bdy.nc'  !  bdy coordinates files
   ln_mask_file   = .false.   !  =T : read mask from file
      cn_mask_file = ''        !  name of mask file (if ln_mask_file=.TRUE.)
   cn_dyn2d    = 'flather','flather'       !
   nn_dyn2d_dta   =  1,1        !  = 0, bdy data are equal to the initial state
      !                       !  = 1, bdy data are read in 'bdydata   .nc' files
      !                       !  = 2, use tidal harmonic forcing data from files
      !                       !  = 3, use external data AND tidal harmonic forcing
   cn_dyn3d      =  'specified','specified'    !
   nn_dyn3d_dta  =  1,1         !  = 0, bdy data are equal to the initial state
   !                          !  = 1, bdy data are read in 'bdydata   .nc' files
   cn_tra        =  'specified','specified'    !
   nn_tra_dta    =  1,1         !  = 0, bdy data are equal to the initial state
   !                          !  = 1, bdy data are read in 'bdydata   .nc' files
   cn_ice        =  'none'    !
   nn_ice_dta    =  0         !  = 0, bdy data are equal to the initial state
   !                          !  = 1, bdy data are read in 'bdydata   .nc' files
   !
   ln_tra_dmp    =.true.,.true.     !  open boudaries conditions for tracers
   ln_dyn3d_dmp  =.true.,.true.     !  open boundary condition for baroclinic velocities
   rn_time_dmp   =  30.,1.        !  Damping time scale in days
   rn_time_dmp_out = 30.,1.       !  Outflow damping time scale
   nn_rimwidth   = 10,3         !  width of the relaxation zone
   ln_vol        = .false.    !  total volume correction (see nn_volctl parameter)
   nn_volctl     =  1         !  = 0, the total water flux across open boundaries is zero
/
!-----------------------------------------------------------------------
&nambdy_index  !  structured open boundaries definition     ("key_bdy")
!-----------------------------------------------------------------------
    ctypebdy ='W'                   ! Open boundary type (W,E,S or N)
    nbdyind  = 2                    ! indice of velocity row or column
                                    ! if ==-1, set obc at the domain boundary
                                    !        , discard start and end indices
    nbdybeg  =  95                  ! indice of segment start
    nbdyend  = 353                  ! indice of segment end
/
!-----------------------------------------------------------------------
&nambdy_index  !  structured open boundaries definition     ("key_bdy")
!-----------------------------------------------------------------------
    ctypebdy ='E'                   ! Open boundary type (W,E,S or N)
    nbdyind  = 1281                 ! indice of velocity row or column
                                    ! if ==-1, set obc at the domain boundary
                                    !        , discard start and end indices
    nbdybeg  =  486                 ! indice of segment start
    nbdyend  =  496                 ! indice of segment end

/

Is there any mistake? Or something to add in namelists to read both boundaries?

How many passive tracers do you use ?
It looks strange to me that you define sn_trcobc(1) and sn_trcobc(3) and not sn_trcobc(2).
Could you attach your ocean.output ?

I have 8 passive tracers that I use both as initial conditions and open boundary conditions. In this step I make some quick tests and I use only the 2 passive tracers for OBC (for example DIC, O2). In the full run I will use the tracer 1,2,3,5,7,10,14,23. I set the indices following the tracers definition :

!-----------------------------------------------------------------------
&namtrc          !   tracers definition
!-----------------------------------------------------------------------
   jp_bgc        =  24
!
   ln_pisces     =  .true.
   ln_trcdta     =  .true.  !  Initialisation from data input file (T) or not (F)
!                !           !                                         !            !                               !
!                !    name   !           title of the field            !   units    ! initial data from file or not !
   sn_tracer(1)   = 'DIC     ' , 'Dissolved inorganic Concentration      ',  'mol-C/L' ,  .true.
   sn_tracer(2)   = 'Alkalini' , 'Total Alkalinity Concentration         ',  'eq/L '   ,  .true.
   sn_tracer(3)   = 'O2      ' , 'Dissolved Oxygen Concentration         ',  'mol-C/L' ,  .true.
   sn_tracer(4)   = 'CaCO3   ' , 'Calcite Concentration                  ',  'mol-C/L' ,  .false.
   sn_tracer(5)   = 'PO4     ' , 'Phosphate Concentration                ',  'mol-C/L' ,  .true.
   sn_tracer(6)   = 'POC     ' , 'Small organic carbon Concentration     ',  'mol-C/L' ,  .false.
   sn_tracer(7)   = 'Si      ' , 'Silicate Concentration                 ',  'mol-C/L' ,  .true.
   sn_tracer(8)   = 'PHY     ' , 'Nanophytoplankton Concentration        ',  'mol-C/L' ,  .false.
   sn_tracer(9)   = 'ZOO     ' , 'Microzooplankton Concentration         ',  'mol-C/L' ,  .false.
   sn_tracer(10)  = 'DOC     ' , 'Dissolved organic Concentration        ',  'mol-C/L' ,  .true.
   sn_tracer(11)  = 'PHY2    ' , 'Diatoms Concentration                  ',  'mol-C/L' ,  .false.
   sn_tracer(12)  = 'ZOO2    ' , 'Mesozooplankton Concentration          ',  'mol-C/L' ,  .false.
   sn_tracer(13)  = 'DSi     ' , 'Diatoms Silicate Concentration         ',  'mol-C/L' ,  .false.
   sn_tracer(14)  = 'Fer     ' , 'Dissolved Iron Concentration           ',  'mol-C/L' ,  .true.
   sn_tracer(15)  = 'BFe     ' , 'Big iron particles Concentration       ',  'mol-C/L' ,  .false.
   sn_tracer(16)  = 'GOC     ' , 'Big organic carbon Concentration       ',  'mol-C/L' ,  .false.
   sn_tracer(17)  = 'SFe     ' , 'Small iron particles Concentration     ',  'mol-C/L' ,  .false.
   sn_tracer(18)  = 'DFe     ' , 'Diatoms iron  Concentration            ',  'mol-C/L' ,  .false.
   sn_tracer(19)  = 'GSi     ' , 'Sinking biogenic Silicate Concentration',  'mol-C/L' ,  .false.
   sn_tracer(20)  = 'NFe     ' , 'Nano iron Concentration                ',  'mol-C/L' ,  .false.
   sn_tracer(21)  = 'NCHL    ' , 'Nano chlorophyl Concentration          ',  'mol-C/L' ,  .false.
   sn_tracer(22)  = 'DCHL    ' , 'Diatoms chlorophyl Concentration       ',  'mol-C/L' ,  .false.
   sn_tracer(23)  = 'NO3     ' , 'Nitrates Concentration                 ',  'mol-C/L' ,  .true.
   sn_tracer(24)  = 'NH4     ' , 'Ammonium Concentration                 ',  'mol-C/L' ,  .false.

   sn_tracer(1)%llobc = .true.
   sn_tracer(3)%llobc = .true.
/

When I set one boundary itself with sn_trcobc(1) and sn_trcobc(3), it works.

I quickly had a look at your ocean.output.
I noticed that you run a pretty huge configuration (1651 x 787 x 75) with 24 passive tracers over 1 processor. Before proceeding further, does it fit in your core memory (without bdy) ?

In the full set-up I use ~ 800 processors and the model runs correctly, but in order to check if the model could read the bdy and avoid the queue of HPC server, I am making some quick tests with one proseccor and see the ocean.output.

Ok. So you may have to reduce a bit the memory size of the problem (by reducing the number of passive tracers for instance) if you want to rule out it’s not truly a memory issue (the model stops because it can not allocate data after all).

So, I checked the memory size. I used 840 processors (plus XIOS) and one tracer for the boundary, but the problem still remains (it can not allocate data when I use both the two boundaries). Is there anything else to set up in the model

HI Marilia,
I think the issue you are having with the setup of bdy input data within TOP interface (in namtrc_bc) relates to the fact that this namelist is read only once, so input file should contain a single file with data structure containing both your boundary segments.
This differs from the organization of the bdy for active tracers when using the definition of bdy segments through the namelists ‘nambdy_index’.

As proposed by @jchanut in a earlier reply it would probably be more efficient to create a general bdy coordinate file.
I think you can even concatenate the two segments in a single one, which may turn out to be also more handy for data files handling and nemo namelists setup.

Thank you Tomas for your suggestion. I would like to ask if there is any tool to create the coordinates.bdy.nc file or any other instructions about how to create the file, because I have only used the
‘nambdy_index’ for the bdy definition so far.

Hi Tomas,

It seems to me there is a defect in the bdy/TOP implementation. If I summarize the way TOP bdy is managed (correct me if I’m wrong, I’m clearly biased by my experience with bdy for physical variables):

  • BDY segments are in any case (with TOP or not) defined in OCE namelist_cfg (eventually in the form of “straight” segments as defined in nambdy_index blocks)

  • BDY in TOP rely on this definition of boundary points, and then assume their own set of boundary schemes for ALL passive tracers as defined in namtrc_bdy. One can assume two segments here (for example), by setting for instance in namelist_top_cfg:

!----------------------------------------------------------------------
&namtrc_bdy      !   Setup of tracer boundary conditions
!-----------------------------------------------------------------------
   cn_trc        = 'frs', 'frs'   
/
  • Then comes the data part. If I understand well, only ONE namtrc_bc block in namelist_top_cfg is read and we don’t assign each bdy segment a data block as it is done for ocean physics ? Something similar to what is done in bdydta eventually needed ?:
            nbdy_loc = INDEX( numnam_cfg( nbdy_rdstart: ), 'nambdy_dta' )
            IF( nbdy_loc .GT. 0 ) THEN
               nbdy_rdstart = nbdy_rdstart + nbdy_loc
            ELSE
               WRITE(cerrmsg,'(A,I4,A)') 'Error: entry number ',jbdy,' of nambdy_dta not found'
               ios = -1
               CALL ctl_nam ( ios , cerrmsg )
            ENDIF
            READ  ( numnam_cfg( MAX( 1, nbdy_rdstart - 2 ): ), nambdy_dta, IOSTAT = ios, ERR = 902)
902         IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist' )
            IF(lwm) WRITE( numond, nambdy_dta )

It seems that the problem is the way that set the bdy file and not the nambdy_index blocks (correct me if I’m wrong). But I don’t understand if I need to set each nambdy_bc block separately for each boundary as I described above OR if I need to create ONE file for both boundaries. If the last is true, is there any example about how to create it. Is there any other configuration that uses more than one boundary for TOP? Based on this
https://salishsea-meopar-docs.readthedocs.io/en/latest/SMELTDocs/openBDY.html
each boundary is set separately.

I guess that, as is, you need to have only ONE file (provided as cn_coords_file) and containing indexes of both boundaries. With respect to the link you provide, there has been quite a lot of changes made to the code.

So, I need a cn_coords_file for both indexes and after that in nambdy_bc I would hat two files (one for west and one for east) or I need again one file which contains both boundaries. I repeat my answer because I don’t know how to create such a file (cn_coords_file) or how to merge the two boundaries in one file. Is there any instruction about that?

You would have in that case one data file. Concerning the tools to create such a cn_coords_file, I’m pretty sure there may be something, but I don’t know exactly where. People from NOC could answer ?

All in all, I think it’s worth a ticket, because one should be able to have more than one segments for both OCE and TOP boundaries.

1 Like

Actually this repository is not part of official NEMO, as far as I understand… but they picked up my old development branch and splitted the TOP boundary conditions handling. Be aware that changes noted in there are for NEMO v3.6.

Nevertheless, it may be a starting point for revising the BDY interface…

1 Like

So, could I make the ticket myself or any of you?

I’ll have a look to the latest code of v4.0.x and try to better frame the issue to create an adequate ticket.

As a backup solution for the meantime, you may think to use a single file with concatenated segments …

1 Like