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.
trcbc.F90 in trunk/NEMOGCM/NEMO/TOP_SRC – NEMO

source: trunk/NEMOGCM/NEMO/TOP_SRC/trcbc.F90 @ 6140

Last change on this file since 6140 was 6140, checked in by timgraham, 8 years ago

Merge of branches/2015/dev_merge_2015 back into trunk. Merge excludes NEMOGCM/TOOLS/OBSTOOLS/ for now due to issues with the change of file type. Will sort these manually with further commits.

Branch merged as follows:
In the working copy of branch ran:
svn merge svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk@HEAD
Small conflicts due to bug fixes applied to trunk since the dev_merge_2015 was copied. Bug fixes were applied to the branch as well so these were easy to resolve.
Branch committed at this stage

In working copy run:
svn switch svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk
to switch working copy

Run:
svn merge --reintegrate svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2015/dev_merge_2015
to merge the branch into the trunk and then commit - no conflicts at this stage.

  • Property svn:keywords set to Id
File size: 20.1 KB
Line 
1MODULE trcbc
2   !!======================================================================
3   !!                     ***  MODULE  trcbc  ***
4   !! TOP :  module for passive tracer boundary conditions
5   !!=====================================================================
6   !! History :  3.5 !  2014-04  (M. Vichi, T. Lovato)  Original
7   !!            3.6 !  2015-03  (T . Lovato) Revision and BDY support
8   !!----------------------------------------------------------------------
9#if defined key_top
10   !!----------------------------------------------------------------------
11   !!   'key_top'                                                TOP model
12   !!----------------------------------------------------------------------
13   !!   trc_bc       : read and time interpolated tracer Boundary Conditions
14   !!----------------------------------------------------------------------
15   USE par_trc       !  passive tracers parameters
16   USE oce_trc       !  shared variables between ocean and passive tracers
17   USE trc           !  passive tracers common variables
18   USE iom           !  I/O manager
19   USE lib_mpp       !  MPP library
20   USE fldread       !  read input fields
21#if defined key_bdy
22   USE bdy_oce, only: nb_bdy , idx_bdy, ln_coords_file, rn_time_dmp, rn_time_dmp_out
23#endif
24
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   trc_bc_init    ! called in trcini.F90
29   PUBLIC   trc_bc_read    ! called in trcstp.F90 or within
30
31   INTEGER  , SAVE, PUBLIC                             :: nb_trcobc    ! number of tracers with open BC
32   INTEGER  , SAVE, PUBLIC                             :: nb_trcsbc    ! number of tracers with surface BC
33   INTEGER  , SAVE, PUBLIC                             :: nb_trccbc    ! number of tracers with coastal BC
34   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_indobc ! index of tracer with OBC data
35   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_indsbc ! index of tracer with SBC data
36   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_indcbc ! index of tracer with CBC data
37   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trsfac    ! multiplicative factor for SBC tracer values
38   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trcsbc    ! structure of data input SBC (file informations, fields read)
39   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trcfac    ! multiplicative factor for CBC tracer values
40   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trccbc    ! structure of data input CBC (file informations, fields read)
41   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trofac    ! multiplicative factor for OBCtracer values
42   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:), TARGET  :: sf_trcobc    ! structure of data input OBC (file informations, fields read)
43   TYPE(MAP_POINTER), ALLOCATABLE, DIMENSION(:) :: nbmap_ptr   ! array of pointers to nbmap
44
45   !!----------------------------------------------------------------------
46   !! NEMO/OPA 3.6 , NEMO Consortium (2015)
47   !! $Id$
48   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
49   !!----------------------------------------------------------------------
50CONTAINS
51
52   SUBROUTINE trc_bc_init( ntrc )
53      !!----------------------------------------------------------------------
54      !!                   ***  ROUTINE trc_bc_init  ***
55      !!                   
56      !! ** Purpose :   initialisation of passive tracer BC data
57      !!
58      !! ** Method  : - Read namtsd namelist
59      !!              - allocates passive tracer BC data structure
60      !!----------------------------------------------------------------------
61      !
62      INTEGER,INTENT(IN) :: ntrc                           ! number of tracers
63      INTEGER            :: jl, jn , ib, ibd, ii, ij, ik   ! dummy loop indices
64      INTEGER            :: ierr0, ierr1, ierr2, ierr3     ! temporary integers
65      INTEGER            :: ios                            ! Local integer output status for namelist read
66      INTEGER            :: nblen, igrd                    ! support arrays for BDY
67      CHARACTER(len=100) :: clndta, clntrc
68      !
69      CHARACTER(len=100) :: cn_dir_sbc, cn_dir_cbc, cn_dir_obc
70
71      TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) :: slf_i  ! local array of namelist informations on the fields to read
72      TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcobc    ! open
73      TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcsbc    ! surface
74      TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trccbc    ! coastal
75      REAL(wp)   , DIMENSION(jpmaxtrc) :: rn_trofac    ! multiplicative factor for tracer values
76      REAL(wp)   , DIMENSION(jpmaxtrc) :: rn_trsfac    ! multiplicative factor for tracer values
77      REAL(wp)   , DIMENSION(jpmaxtrc) :: rn_trcfac    ! multiplicative factor for tracer values
78      !!
79      NAMELIST/namtrc_bc/ cn_dir_sbc, cn_dir_cbc, cn_dir_obc, sn_trcobc, rn_trofac, sn_trcsbc, rn_trsfac, sn_trccbc, rn_trcfac
80#if defined key_bdy
81      NAMELIST/namtrc_bdy/ cn_trc_dflt, cn_trc, nn_trcdmp_bdy
82#endif
83      !!----------------------------------------------------------------------
84      IF( nn_timing == 1 )  CALL timing_start('trc_bc_init')
85      !
86      IF( lwp ) THEN
87         WRITE(numout,*) ' '
88         WRITE(numout,*) 'trc_bc_init : Tracers Boundary Conditions (BC)'
89         WRITE(numout,*) '~~~~~~~~~~~ '
90      ENDIF
91      !  Initialisation and local array allocation
92      ierr0 = 0  ;  ierr1 = 0  ;  ierr2 = 0  ;  ierr3 = 0 
93      ALLOCATE( slf_i(ntrc), STAT=ierr0 )
94      IF( ierr0 > 0 ) THEN
95         CALL ctl_stop( 'trc_bc_init: unable to allocate local slf_i' )   ;   RETURN
96      ENDIF
97
98      ! Compute the number of tracers to be initialised with open, surface and boundary data
99      ALLOCATE( n_trc_indobc(ntrc), STAT=ierr0 )
100      IF( ierr0 > 0 ) THEN
101         CALL ctl_stop( 'trc_bc_init: unable to allocate n_trc_indobc' )   ;   RETURN
102      ENDIF
103      nb_trcobc      = 0
104      n_trc_indobc(:) = 0
105      !
106      ALLOCATE( n_trc_indsbc(ntrc), STAT=ierr0 )
107      IF( ierr0 > 0 ) THEN
108         CALL ctl_stop( 'trc_bc_init: unable to allocate n_trc_indsbc' )   ;   RETURN
109      ENDIF
110      nb_trcsbc      = 0
111      n_trc_indsbc(:) = 0
112      !
113      ALLOCATE( n_trc_indcbc(ntrc), STAT=ierr0 )
114      IF( ierr0 > 0 ) THEN
115         CALL ctl_stop( 'trc_bc_init: unable to allocate n_trc_indcbc' )   ;   RETURN
116      ENDIF
117      nb_trccbc      = 0
118      n_trc_indcbc(:) = 0
119      !
120      ! Read Boundary Conditions Namelists
121      REWIND( numnat_ref )              ! Namelist namtrc_bc in reference namelist : Passive tracer data structure
122      READ  ( numnat_ref, namtrc_bc, IOSTAT = ios, ERR = 901)
123901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bc in reference namelist', lwp )
124
125      REWIND( numnat_cfg )              ! Namelist namtrc_bc in configuration namelist : Passive tracer data structure
126      READ  ( numnat_cfg, namtrc_bc, IOSTAT = ios, ERR = 902 )
127902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bc in configuration namelist', lwp )
128      IF(lwm) WRITE ( numont, namtrc_bc )
129
130#if defined key_bdy
131      REWIND( numnat_ref )              ! Namelist namtrc_bc in reference namelist : Passive tracer data structure
132      READ  ( numnat_ref, namtrc_bdy, IOSTAT = ios, ERR = 903)
133903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in reference namelist', lwp )
134
135      REWIND( numnat_cfg )              ! Namelist namtrc_bc in configuration namelist : Passive tracer data structure
136      READ  ( numnat_cfg, namtrc_bdy, IOSTAT = ios, ERR = 904 )
137904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in configuration namelist', lwp )
138      IF(lwm) WRITE ( numont, namtrc_bdy )
139      ! setup up preliminary informations for BDY structure
140      DO jn = 1, ntrc
141         DO ib = 1, nb_bdy
142            ! Set type of obc in BDY data structure (around here we may plug user override of obc type from nml)
143            IF ( ln_trc_obc(jn) ) THEN
144               trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc(ib) )
145            ELSE
146               trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc_dflt(ib) )
147            ENDIF
148            ! set damping use in BDY data structure
149            trcdta_bdy(jn,ib)%dmp = .false.
150            IF(nn_trcdmp_bdy(ib) .EQ. 1 .AND. ln_trc_obc(jn) ) trcdta_bdy(jn,ib)%dmp = .true.
151            IF(nn_trcdmp_bdy(ib) .EQ. 2 ) trcdta_bdy(jn,ib)%dmp = .true.
152            IF(trcdta_bdy(jn,ib)%cn_obc == 'frs' .AND. nn_trcdmp_bdy(ib) .NE. 0 )  &
153                & CALL ctl_stop( 'Use FRS OR relaxation' )
154            IF (nn_trcdmp_bdy(ib) .LT. 0 .OR. nn_trcdmp_bdy(ib) .GT. 2)            &
155                & CALL ctl_stop( 'Not a valid option for nn_trcdmp_bdy. Allowed: 0,1,2.' )
156         ENDDO
157      ENDDO
158
159#else
160      ! Force all tracers OBC to false if bdy not used
161      ln_trc_obc = .false.
162#endif
163      ! compose BC data indexes
164      DO jn = 1, ntrc
165         IF( ln_trc_obc(jn) ) THEN
166             nb_trcobc       = nb_trcobc + 1  ; n_trc_indobc(jn) = nb_trcobc
167         ENDIF
168         IF( ln_trc_sbc(jn) ) THEN
169             nb_trcsbc       = nb_trcsbc + 1  ; n_trc_indsbc(jn) = nb_trcsbc
170         ENDIF
171         IF( ln_trc_cbc(jn) ) THEN
172             nb_trccbc       = nb_trccbc + 1  ; n_trc_indcbc(jn) = nb_trccbc
173         ENDIF
174      ENDDO
175
176      ! Print summmary of Boundary Conditions
177      IF( lwp ) THEN
178         WRITE(numout,*) ' '
179         WRITE(numout,'(a,i3)') '   Total tracers to be initialized with SURFACE BCs data:', nb_trcsbc
180         IF ( nb_trcsbc > 0 ) THEN
181            WRITE(numout,*) '   #trc        NAME        Boundary     Mult.Fact. '
182            DO jn = 1, ntrc
183               IF ( ln_trc_sbc(jn) ) WRITE(numout,9001) jn, TRIM( sn_trcsbc(jn)%clvar ), 'SBC', rn_trsfac(jn)
184            ENDDO
185         ENDIF
186         WRITE(numout,'(2a)') '   SURFACE BC data repository : ', TRIM(cn_dir_sbc)
187
188         WRITE(numout,*) ' '
189         WRITE(numout,'(a,i3)') '   Total tracers to be initialized with COASTAL BCs data:', nb_trccbc
190         IF ( nb_trccbc > 0 ) THEN
191            WRITE(numout,*) '   #trc        NAME        Boundary     Mult.Fact. '
192            DO jn = 1, ntrc
193               IF ( ln_trc_cbc(jn) ) WRITE(numout, 9001) jn, TRIM( sn_trccbc(jn)%clvar ), 'CBC', rn_trcfac(jn)
194            ENDDO
195         ENDIF
196         WRITE(numout,'(2a)') '   COASTAL BC data repository : ', TRIM(cn_dir_cbc)
197
198         WRITE(numout,*) ' '
199         WRITE(numout,'(a,i3)') '   Total tracers to be initialized with OPEN BCs data:', nb_trcobc
200#if defined key_bdy
201         IF ( nb_trcobc > 0 ) THEN
202            WRITE(numout,*) '   #trc        NAME        Boundary     Mult.Fact.   OBC Settings'
203            DO jn = 1, ntrc
204               IF ( ln_trc_obc(jn) )  WRITE(numout, 9001) jn, TRIM( sn_trcobc(jn)%clvar ), 'OBC', rn_trofac(jn), (trcdta_bdy(jn,ib)%cn_obc,ib=1,nb_bdy)
205               IF ( .NOT. ln_trc_obc(jn) )  WRITE(numout, 9002) jn, 'Set data to IC and use default condition', (trcdta_bdy(jn,ib)%cn_obc,ib=1,nb_bdy)
206            ENDDO
207            WRITE(numout,*) ' '
208            DO ib = 1, nb_bdy
209                IF (nn_trcdmp_bdy(ib) .EQ. 0) WRITE(numout,9003) '   Boundary ',ib,' -> NO damping of tracers'
210                IF (nn_trcdmp_bdy(ib) .EQ. 1) WRITE(numout,9003) '   Boundary ',ib,' -> damping ONLY for tracers with external data provided'
211                IF (nn_trcdmp_bdy(ib) .EQ. 2) WRITE(numout,9003) '   Boundary ',ib,' -> damping of ALL tracers'
212                IF (nn_trcdmp_bdy(ib) .GT. 0) THEN
213                   WRITE(numout,9003) '     USE damping parameters from nambdy for boundary ', ib,' : '
214                   WRITE(numout,'(a,f10.2,a)') '     - Inflow damping time scale  : ',rn_time_dmp(ib),' days'
215                   WRITE(numout,'(a,f10.2,a)') '     - Outflow damping time scale : ',rn_time_dmp_out(ib),' days'
216                ENDIF
217            ENDDO
218         ENDIF
219#endif
220         WRITE(numout,'(2a)') '   OPEN BC data repository : ', TRIM(cn_dir_obc)
221      ENDIF
2229001  FORMAT(2x,i5, 3x, a15, 3x, a5, 6x, e11.3, 4x, 10a13)
2239002  FORMAT(2x,i5, 3x, a41, 3x, 10a13)
2249003  FORMAT(a, i5, a)
225
226      !
227#if defined key_bdy
228      ! OPEN Lateral boundary conditions
229      IF( nb_trcobc > 0 ) THEN
230         ALLOCATE ( sf_trcobc(nb_trcobc), rf_trofac(nb_trcobc), nbmap_ptr(nb_trcobc), STAT=ierr1 )
231         IF( ierr1 > 0 ) THEN
232            CALL ctl_stop( 'trc_bc_init: unable to allocate sf_trcobc structure' )   ;   RETURN
233         ENDIF
234
235         igrd = 1                       ! Everything is at T-points here
236
237         DO jn = 1, ntrc
238            DO ib = 1, nb_bdy
239
240               nblen = idx_bdy(ib)%nblen(igrd)
241
242               IF ( ln_trc_obc(jn) ) THEN
243               ! Initialise from external data
244                  jl = n_trc_indobc(jn)
245                  slf_i(jl)    = sn_trcobc(jn)
246                  rf_trofac(jl) = rn_trofac(jn)
247                                               ALLOCATE( sf_trcobc(jl)%fnow(nblen,1,jpk)   , STAT=ierr2 )
248                  IF( sn_trcobc(jn)%ln_tint )  ALLOCATE( sf_trcobc(jl)%fdta(nblen,1,jpk,2) , STAT=ierr3 )
249                  IF( ierr2 + ierr3 > 0 ) THEN
250                    CALL ctl_stop( 'trc_bc_init : unable to allocate passive tracer OBC data arrays' )   ;   RETURN
251                  ENDIF
252                  trcdta_bdy(jn,ib)%trc => sf_trcobc(jl)%fnow(:,1,:)
253                  trcdta_bdy(jn,ib)%rn_fac = rf_trofac(jl)
254                  ! create OBC mapping array
255                  nbmap_ptr(jl)%ptr => idx_bdy(ib)%nbmap(:,igrd)
256                  nbmap_ptr(jl)%ll_unstruc = ln_coords_file(igrd)
257               ELSE
258               ! Initialise obc arrays from initial conditions
259                  ALLOCATE ( trcdta_bdy(jn,ib)%trc(nblen,jpk) )
260                  DO ibd = 1, nblen
261                     DO ik = 1, jpkm1
262                        ii = idx_bdy(ib)%nbi(ibd,igrd)
263                        ij = idx_bdy(ib)%nbj(ibd,igrd)
264                        trcdta_bdy(jn,ib)%trc(ibd,ik) = trn(ii,ij,ik,jn) * tmask(ii,ij,ik)
265                     END DO
266                  END DO
267                  trcdta_bdy(jn,ib)%rn_fac = 1._wp
268               ENDIF
269            ENDDO
270         ENDDO
271
272         CALL fld_fill( sf_trcobc, slf_i, cn_dir_obc, 'trc_bc_init', 'Passive tracer OBC data', 'namtrc_bc' )
273      ENDIF
274#endif
275      ! SURFACE Boundary conditions
276      IF( nb_trcsbc > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero
277         ALLOCATE( sf_trcsbc(nb_trcsbc), rf_trsfac(nb_trcsbc), STAT=ierr1 )
278         IF( ierr1 > 0 ) THEN
279            CALL ctl_stop( 'trc_bc_init: unable to allocate  sf_trcsbc structure' )   ;   RETURN
280         ENDIF
281         !
282         DO jn = 1, ntrc
283            IF( ln_trc_sbc(jn) ) THEN      ! update passive tracers arrays with input data read from file
284               jl = n_trc_indsbc(jn)
285               slf_i(jl)    = sn_trcsbc(jn)
286               rf_trsfac(jl) = rn_trsfac(jn)
287                                            ALLOCATE( sf_trcsbc(jl)%fnow(jpi,jpj,1)   , STAT=ierr2 )
288               IF( sn_trcsbc(jn)%ln_tint )  ALLOCATE( sf_trcsbc(jl)%fdta(jpi,jpj,1,2) , STAT=ierr3 )
289               IF( ierr2 + ierr3 > 0 ) THEN
290                 CALL ctl_stop( 'trc_bc_init : unable to allocate passive tracer SBC data arrays' )   ;   RETURN
291               ENDIF
292            ENDIF
293            !   
294         ENDDO
295         !                         ! fill sf_trcsbc with slf_i and control print
296         CALL fld_fill( sf_trcsbc, slf_i, cn_dir_sbc, 'trc_bc_init', 'Passive tracer SBC data', 'namtrc_bc' )
297         !
298      ENDIF
299      !
300      ! COSTAL Boundary conditions
301      IF( nb_trccbc > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero
302         ALLOCATE( sf_trccbc(nb_trccbc), rf_trcfac(nb_trccbc), STAT=ierr1 )
303         IF( ierr1 > 0 ) THEN
304            CALL ctl_stop( 'trc_bc_ini: unable to allocate  sf_trccbc structure' )   ;   RETURN
305         ENDIF
306         !
307         DO jn = 1, ntrc
308            IF( ln_trc_cbc(jn) ) THEN      ! update passive tracers arrays with input data read from file
309               jl = n_trc_indcbc(jn)
310               slf_i(jl)    = sn_trccbc(jn)
311               rf_trcfac(jl) = rn_trcfac(jn)
312                                            ALLOCATE( sf_trccbc(jl)%fnow(jpi,jpj,1)   , STAT=ierr2 )
313               IF( sn_trccbc(jn)%ln_tint )  ALLOCATE( sf_trccbc(jl)%fdta(jpi,jpj,1,2) , STAT=ierr3 )
314               IF( ierr2 + ierr3 > 0 ) THEN
315                 CALL ctl_stop( 'trc_bc_ini : unable to allocate passive tracer CBC data arrays' )   ;   RETURN
316               ENDIF
317            ENDIF
318            !   
319         ENDDO
320         !                         ! fill sf_trccbc with slf_i and control print
321         CALL fld_fill( sf_trccbc, slf_i, cn_dir_cbc, 'trc_bc_init', 'Passive tracer CBC data', 'namtrc_bc' )
322         !
323      ENDIF
324      !
325      DEALLOCATE( slf_i )          ! deallocate local field structure
326      IF( nn_timing == 1 )  CALL timing_stop('trc_bc_init')
327      !
328   END SUBROUTINE trc_bc_init
329
330
331   SUBROUTINE trc_bc_read(kt, jit)
332      !!----------------------------------------------------------------------
333      !!                   ***  ROUTINE trc_bc_init  ***
334      !!
335      !! ** Purpose :  Read passive tracer Boundary Conditions data
336      !!
337      !! ** Method  :  Read BC inputs and update data structures using fldread
338      !!             
339      !!----------------------------------------------------------------------
340      USE fldread
341     
342      !! * Arguments
343      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
344      INTEGER, INTENT( in ), OPTIONAL ::   jit   ! subcycle time-step index (for timesplitting option)
345      !!---------------------------------------------------------------------
346      !
347      IF( nn_timing == 1 )  CALL timing_start('trc_bc_read')
348
349      IF( kt == nit000 .AND. lwp) THEN
350         WRITE(numout,*)
351         WRITE(numout,*) 'trc_bc_read : Surface boundary conditions for passive tracers.'
352         WRITE(numout,*) '~~~~~~~~~~~ '
353      ENDIF
354
355      IF ( PRESENT(jit) ) THEN 
356
357         ! OPEN boundary conditions (use time_offset=+1 as they are applied at the end of the step)
358         IF( nb_trcobc > 0 ) THEN
359           if (lwp) write(numout,'(a,i5,a,i10)') '   reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt
360           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trcobc, map=nbmap_ptr, kit=jit, kt_offset=+1)
361         ENDIF
362
363         ! SURFACE boundary conditions
364         IF( nb_trcsbc > 0 ) THEN
365           if (lwp) write(numout,'(a,i5,a,i10)') '   reading SBC data for ', nb_trcsbc ,' variable(s) at step ', kt
366           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trcsbc, kit=jit)
367         ENDIF
368
369         ! COASTAL boundary conditions
370         IF( nb_trccbc > 0 ) THEN
371           if (lwp) write(numout,'(a,i5,a,i10)') '   reading CBC data for ', nb_trccbc ,' variable(s) at step ', kt
372           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trccbc, kit=jit)
373         ENDIF
374
375      ELSE
376
377         ! OPEN boundary conditions (use time_offset=+1 as they are applied at the end of the step)
378         IF( nb_trcobc > 0 ) THEN
379           if (lwp) write(numout,'(a,i5,a,i10)') '   reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt
380           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trcobc, map=nbmap_ptr, kt_offset=+1)
381         ENDIF
382
383         ! SURFACE boundary conditions
384         IF( nb_trcsbc > 0 ) THEN
385           if (lwp) write(numout,'(a,i5,a,i10)') '   reading SBC data for ', nb_trcsbc ,' variable(s) at step ', kt
386           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trcsbc)
387         ENDIF
388
389         ! COASTAL boundary conditions
390         IF( nb_trccbc > 0 ) THEN
391           if (lwp) write(numout,'(a,i5,a,i10)') '   reading CBC data for ', nb_trccbc ,' variable(s) at step ', kt
392           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trccbc)
393         ENDIF
394
395      ENDIF
396
397      !
398      IF( nn_timing == 1 )  CALL timing_stop('trc_bc_read')
399      !
400   END SUBROUTINE trc_bc_read
401
402#else
403   !!----------------------------------------------------------------------
404   !!   Dummy module                              NO 3D passive tracer data
405   !!----------------------------------------------------------------------
406CONTAINS
407
408   SUBROUTINE trc_bc_init( ntrc )        ! Empty routine
409      INTEGER,INTENT(IN) :: ntrc                           ! number of tracers
410      WRITE(*,*) 'trc_bc_init: You should not have seen this print! error?', kt
411   END SUBROUTINE trc_bc_init
412
413   SUBROUTINE trc_bc_read( kt )        ! Empty routine
414      WRITE(*,*) 'trc_bc_read: You should not have seen this print! error?', kt
415   END SUBROUTINE trc_bc_read
416#endif
417
418   !!======================================================================
419END MODULE trcbc
Note: See TracBrowser for help on using the repository browser.