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.
2011WP/2011Stream2/OpenBoundaries (diff) – NEMO

Changes between Initial Version and Version 1 of 2011WP/2011Stream2/OpenBoundaries


Ignore:
Timestamp:
2011-03-10T13:57:59+01:00 (12 years ago)
Author:
davestorkey
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 2011WP/2011Stream2/OpenBoundaries

    v1 v1  
     1= Open Boundary modules in NEMO: OBC/BDY merge = 
     2Last edited [[Timestamp]] 
     3 
     4[[PageOutline]] 
     5 
     6As part of the 2011 workplan, it is planned to merge the OBC and BDY modules to 
     7provide a single module to do one-way nesting in NEMO. This page outlines the 
     8design for the new module. It is intended as a discussion document. Please feel 
     9free to add comments. 
     10 
     11== Introduction == 
     12Blah 
     13 
     14== High-level control and coding structure == 
     15The namelist for the new module would look like this: 
     16 
     17{{{ 
     18!----------------------------------------------------------------------- 
     19&namobc        !  unstructured open boundaries               ("key_obc") 
     20!----------------------------------------------------------------------- 
     21   cn_mask     =  ''                      !  name of mask file (ln_mask=T) 
     22   cn_dta      = 'obcdata1', 'obcdta2'    !  root name of data file 
     23   nn_freq     = 6         , -1           !  frequency of data in file (hours) 
     24                                          !  negative value => months 
     25   cn_type     = 'daily'   , 'yearly'     !  'yearly','monthly','daily' files 
     26   ln_clim     = .false.   , .true.       !  climatological data or not 
     27   ln_tint     = .true.    , .true.       !  time interpolation of boundary 
     28                                          !  data or not 
     29    
     30   nn_dyn         = 0, 1,   !  Choice of schemes for velocities 
     31   nn_tra         = 0, 1,   !  Choice of schemes for T and S  
     32   nn_barotropic  = 1, 0,   !  Choice of schemes for barotropic solution 
     33   nn_ice_lim2    = 0, 0,   !  Choice of schemes for ice (LIM2) 
     34   ln_vol         = .false.,.false.,  !  total volume correction (see volbdy parameter) 
     35   ln_mask        = .false.,.false.,  !  boundary mask from filbdy_mask (T), boundaries are on edges of domain (F) 
     36   ln_tides       = .false.,.false.,  !  Apply tidal harmonic forcing with Flather condition 
     37   nn_rimwidth    =  1, 9,            !  width of the relaxation zone 
     38   nn_dtactl      =  1, 1,            !  = 0, bdy data are equal to the initial state 
     39                                      !  = 1, bdy data are read in 'bdydata   .nc' files 
     40   nn_volctl      =  0, 0,            !  = 0, the total water flux across open boundaries is zero 
     41                                      !  = 1, the total volume of the system is conserved 
     42 / 
     43}}} 
     44 
     45You can define several boundary streams. The example here has two streams 
     46defined. The number of streams is defined by the '''cn_dta''' parameter which is 
     47the filename root. For '''cn_dta'''=''bdydta1'', it will look for files called 
     48''bdydta1_grid_T.nc'', ''bdydta1_grid_U.nc'' etc. For each stream you select 
     49which boundary conditions you want to apply to which fields using '''nn_dyn''', 
     50'''nn_tra''', '''nn_barotropic''' etc. Zero means do not apply open boundary 
     51conditions. The other numbers refer to different schemes. For example, 
     52'''nn_tra'''=0 means don't apply open boundary conditions to T and S, 
     53'''nn_tra'''=1 might mean apply FRS conditions, '''nn_tra'''=2 might mean apply 
     54radiation conditions etc.  
     55 
     56For each set of variables there is a module which applies the boundary 
     57conditions each timestep, eg. for T and S you have '''obctra.F90''' which looks 
     58like this: 
     59 
     60{{{ 
     61   MODULE obctra 
     62 
     63CONTAINS 
     64    
     65   SUBROUTINE obc_tra( kt )  
     66    
     67   DO ib_stream = 1, nb_stream 
     68 
     69      SELECT CASE ( nn_tra(ib_stream) ) 
     70      CASE(0) 
     71         CYCLE 
     72      CASE(1) 
     73         CALL obc_tra_frs( kt, ib_stream ) 
     74      CASE(2)  
     75         CALL obc_tra_rad( kt, ib_stream )  
     76      END SELECT 
     77   
     78   END DO 
     79    
     80   END SUBROUTINE 
     81    
     82   SUBROUTINE obc_tra_frs( kt, ib_stream ) 
     83   ... 
     84}}} 
     85 
     86This structure allows one to define different boundaries with different boundary 
     87conditions, eg. you might want to apply different algorithms on east 
     88and west boundaries, or you might want to apply boundary conditions from a large 
     89scale model for part of the boundary but apply climatological boundary conditons 
     90for another part of the boundary. 
     91 
     92The module to read in the boundary data from files would be rewritten to use 
     93fldread.F90. For each boundary stream a '''TYPE FLD''' structure array would be 
     94constructed depending on which fields need to be read in. We can merge the 
     95obc_dta and obc_dta_bt routines by making the barotropic subloop counter 
     96'''jit''' an optional argument. 
     97 
     98{{{ 
     99   MODULE obcdta 
     100 
     101   USE fldread 
     102 
     103   INTEGER, PARAMETER :: nb_dta_max = 10    
     104   TYPE(FLD), ALLOCATABLE, DIMENSION(:,:) ::   bf 
     105    
     106CONTAINS 
     107    
     108   SUBROUTINE obc_dta( kt, jit )  
     109 
     110   INTEGER            :: kt        ! time step index 
     111   INTEGER, OPTIONAL  :: jit       ! barotropic subloop index 
     112    
     113   TYPE(FLD_N), ALLOCATABLE, DIMENSION(:,:) ::   blf_i 
     114    
     115   ALLOCATE( bf   (nb_stream, nb_dta_max), STAT=ierror ) 
     116   ALLOCATE( blf_i(nb_stream, nb_dta_max), STAT=ierror ) 
     117 
     118   DO ib_stream = 1, nb_stream 
     119 
     120      IF( kt == nit000 ) THEN 
     121 
     122         zcount = 0 
     123         ! nn_barotropic must come first 
     124         IF( nn_barotropic .gt. 0 ) THEN          
     125            ! set up information for SSH  
     126            zcount = zcount + 1 
     127            ALLOCATE( bf(ib_stream,zcount)%fnow(jpib,jpjb,1) ) 
     128            IF( ln_tint(ib_stream) ) ALLOCATE( bf(ib_stream,zcount)%fdta(jpib,jpjb,1,2) ) 
     129            blf_i(ib_stream,zcount)%clname = cn_dta(ib_stream)//"_grid_T.nc" 
     130            ... 
     131            ! set up information for U 
     132            zcount = zcount + 1 
     133            ... 
     134            ! set up information for V 
     135            zcount = zcount + 1 
     136         ENDIF 
     137         IF ( nn_tra .gt. 0 ) THEN 
     138            ! set up information for T and S 
     139            ... 
     140         ENDIF 
     141         .... 
     142             
     143         nn_dta(ib_stream) = zcount 
     144         CALL fld_fill( bf(ib_stream,1:nn_dta(ib_stream)), blf_i(ib_stream,1:nn_dta(ib_stream)), ... ) 
     145       
     146      ENDIF ! kt == nit000 
     147       
     148      IF( PRESENT(jit) && nn_barotropic(ib_stream) .gt. 0 ) THEN 
     149         ! Update barotropic boundary conditions only 
     150         ! jit is optional argument for fld_read 
     151         CALL fld_read( kt, jit, nn_fobc, bf(ib_stream, 1:3) ) 
     152      ELSE 
     153         CALL fld_read( kt, nn_fobc, bf(ib_stream, 1:nb_dta(ib_stream) ) 
     154      ENDIF 
     155       
     156      ! 
     157      ! Update internal boundary data arrays from bf%fnow 
     158      !       
     159 
     160   END DO  ! ib_stream 
     161    
     162   END SUBROUTINE 
     163}}} 
     164