diff --git a/cfgs/SHARED/namelist_top_ref b/cfgs/SHARED/namelist_top_ref index 08aa0139b5a469031f4e03362939ba8de3cc3fd6..69fc61fb7510434c3aaa83bad89e04c0c0a73aab 100644 --- a/cfgs/SHARED/namelist_top_ref +++ b/cfgs/SHARED/namelist_top_ref @@ -146,6 +146,14 @@ / !---------------------------------------------------------------------- &namtrc_bc ! data for boundary conditions +!---------------------------------------------------------------------- +! Surface and coastal input data must be specified individually for each tracer. +! Lateral open boundary inputs are specified for each BDY segment and related inputfiles +! must contain data for the variables with active open boundary (set through &namtrc). +! By default, variable names of BDY inputfiles are the same as in &namtrc, but using +! cn_tronam it is possible to specify alternative variable names to match with inputfiles. +! ! file name ! freq ! variable ! time interp. ! clim !'yearly' ! weights ! rotation | land/sea +! sn_trcobc(1) = 'bdy_dta_trc_North_y1980', -1 , 'dummy' , .false. , .true. ,'yearly' , '', '', '' !----------------------------------------------------------------------- cn_dir_sbc = './' ! root directory for the location of SURFACE data files cn_dir_cbc = './' ! root directory for the location of COASTAL data files @@ -153,6 +161,7 @@ ln_rnf_ctl = .false. ! Remove runoff dilution on tracers with absent river load rn_sbc_time = 86400. ! Time scaling factor for SBC data (seconds in a day) rn_cbc_time = 86400. ! Time scaling factor for CBC data (seconds in a day) +! cn_tronam(1) = 'var1' ! Tracer-name to variable-name translation / !---------------------------------------------------------------------- &namtrc_bdy ! Setup of tracer boundary conditions @@ -164,6 +173,8 @@ ! = 0 NO damping of tracers at open boudaries ! = 1 Only for tracers forced with external data ! = 2 Damping applied to all tracers + ln_zintobc = .false. ! T if a vertical interpolation is required. Variables gdep[t] and e3[t] must exist in the file + ! automatically defined to T if the number of vertical levels in bdy dta /= jpk / !----------------------------------------------------------------------- &namtrc_ais ! Representation of Antarctic Ice Sheet tracers supply diff --git a/src/OCE/BDY/bdyini.F90 b/src/OCE/BDY/bdyini.F90 index e0b1fe6d85d0fd968a65e778b9df0ee6ecf40a2a..a89ac081aac738aa61de56ac4c8e03d07c302c37 100644 --- a/src/OCE/BDY/bdyini.F90 +++ b/src/OCE/BDY/bdyini.F90 @@ -95,6 +95,7 @@ CONTAINS rn_time_dmp_out(2:jp_bdy) = rn_time_dmp_out(1) cn_ice (2:jp_bdy) = cn_ice (1) nn_ice_dta (2:jp_bdy) = nn_ice_dta (1) + nn_rimwidth (2:jp_bdy) = nn_rimwidth (1) READ ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 902 ) 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nambdy in configuration namelist' ) IF(lwm) WRITE ( numond, nambdy ) diff --git a/src/OFF/dtadyn.F90 b/src/OFF/dtadyn.F90 index aed7dfb5c9a29aa077fea2856deec25aa9901dde..6fd6804d1a5631c8910b7d3ed2d719a24d3760e6 100644 --- a/src/OFF/dtadyn.F90 +++ b/src/OFF/dtadyn.F90 @@ -173,7 +173,6 @@ CONTAINS ENDIF ! CALL eos ( ts(:,:,:,:,:), Kmm, rhd ) ! In any case, we need rhd -!!st CALL eos ( ts(:,:,:,:,Kmm), rhd, gdept_0(:,:,:) ) ! In any case, we need rhd CALL eos_rab( ts(:,:,:,:,Kmm), rab_n, Kmm ) ! now local thermal/haline expension ratio at T-points CALL bn2 ( ts(:,:,:,:,Kmm), rab_n, rn2, Kmm ) ! before Brunt-Vaisala frequency need for zdfmxl @@ -190,10 +189,6 @@ CONTAINS ahu_bbl(:,:) = sf_dyn(jf_ubl)%fnow(:,:,1) * umask(:,:,1) ! bbl diffusive coef ahv_bbl(:,:) = sf_dyn(jf_vbl)%fnow(:,:,1) * vmask(:,:,1) ENDIF - ! - ! - CALL eos ( ts(:,:,:,:,:), Kmm, rhd ) ! In any case, we need rhd -!!st CALL eos( ts(:,:,:,:,Kmm), rhd, gdept_0(:,:,:) ) ! In any case, we need rhd ! IF(sn_cfctl%l_prtctl) THEN ! print control CALL prt_ctl(tab3d_1=ts(:,:,:,jp_tem,Kmm), clinfo1=' tn - : ', mask1=tmask ) diff --git a/src/TOP/TRP/trcrad.F90 b/src/TOP/TRP/trcrad.F90 index 21766f4bad0e9ec98c45f3cb27802480616189a5..096409e852f9f300088ec6ef73f2aa365c3e03dd 100644 --- a/src/TOP/TRP/trcrad.F90 +++ b/src/TOP/TRP/trcrad.F90 @@ -28,7 +28,7 @@ MODULE trcrad PUBLIC trc_rad_ini LOGICAL , PUBLIC :: ln_trcrad !: flag to artificially correct negative concentrations - REAL(wp), DIMENSION(:,:), ALLOCATABLE:: gainmass + REAL(wp), DIMENSION(:), ALLOCATABLE:: gainmass !! * Substitutions # include "do_loop_substitute.h90" @@ -109,8 +109,8 @@ CONTAINS ENDIF ENDIF ! - ALLOCATE( gainmass(jptra,2) ) - gainmass(:,:) = 0. + ALLOCATE( gainmass(jptra) ) + gainmass(:) = 0. ! END SUBROUTINE trc_rad_ini @@ -181,7 +181,7 @@ CONTAINS zcoef = 1. + ztrneg(ji,jj,jn) / ztrpos(ji,jj,jn) ! ztrpos > 0 as ptr > 0 ptr(ji,jj,jk,jn,itime) = ptr(ji,jj,jk,jn,itime) * zcoef IF( zcoef < 0. ) THEN ! if the compensation exceed the positive value - gainmass(jn,1) = gainmass(jn,1) - ptr(ji,jj,jk,jn,itime) * cvol(ji,jj,jk) ! we are adding mass... + gainmass(jn) = gainmass(jn) - ptr(ji,jj,jk,jn,itime) * cvol(ji,jj,jk) ! we are adding mass... ptr(ji,jj,jk,jn,itime) = 0. ! limit the compensation to keep positive value ENDIF ENDIF @@ -197,12 +197,12 @@ CONTAINS END DO IF( kt == nitend ) THEN - CALL mpp_sum( 'trcrad', gainmass(:,1) ) + CALL mpp_sum( 'trcrad', gainmass(:) ) DO jn = jp_sms0, jp_sms1 - IF( gainmass(jn,1) > 0. ) THEN + IF( gainmass(jn) > 0. ) THEN ztotmass = glob_sum( 'trcrad', ptr(:,:,:,jn,itime) * cvol(:,:,:) ) IF(lwp) WRITE(numout, '(a, i2, a, D23.16, a, D23.16)') 'trcrad ptrb, traceur ', jn & - & , ' total mass : ', ztotmass, ', mass gain : ', gainmass(jn,1) + & , ' total mass : ', ztotmass, ', mass gain : ', gainmass(jn) END IF END DO ENDIF diff --git a/src/TOP/trc.F90 b/src/TOP/trc.F90 index 4836efb7e2ff7ac1923e05e1bee94743ce36aa42..a7c48feba6eb9c5c79f4a29b12a01cf01c76bcff 100644 --- a/src/TOP/trc.F90 +++ b/src/TOP/trc.F90 @@ -131,6 +131,7 @@ MODULE trc CHARACTER(len=20), PUBLIC, DIMENSION(jp_bdy) :: cn_trc_dflt ! Default OBC condition for all tracers CHARACTER(len=20), PUBLIC, DIMENSION(jp_bdy) :: cn_trc ! Choice of boundary condition for tracers INTEGER, PUBLIC, DIMENSION(jp_bdy) :: nn_trcdmp_bdy !: =T Tracer damping + LOGICAL, PUBLIC, DIMENSION(jp_bdy) :: ln_zintobc !: =T obc data requires a vertical interpolation ! ! Vertical axis used in the sediment module REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: profsed diff --git a/src/TOP/trcbc.F90 b/src/TOP/trcbc.F90 index 141ecf03c6db857d1a90b0e03d7def0c8745592b..4ee76fcfece45e0d3d4aa600ad82e7c91fc8bf08 100644 --- a/src/TOP/trcbc.F90 +++ b/src/TOP/trcbc.F90 @@ -35,9 +35,9 @@ MODULE trcbc TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:) :: sf_trccbc ! structure of data input CBC (file informations, fields read) REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:) :: rf_trofac ! multiplicative factor for OBCtracer values #if defined key_agrif - TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:) :: sf_trcobc ! structure of data input OBC (file informations, fields read) + TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:,:) :: sf_trcobc ! structure of data input OBC (file informations, fields read) #else - TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:), TARGET :: sf_trcobc + TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:,:), TARGET :: sf_trcobc #endif #if defined key_top @@ -71,20 +71,22 @@ CONTAINS INTEGER :: ierr0, ierr1, ierr2, ierr3 ! temporary integers INTEGER :: ios ! Local integer output status for namelist read INTEGER :: nblen, igrd ! support arrays for BDY - CHARACTER(len=100) :: clndta, clntrc + CHARACTER(len=10) :: clnbdy ! CHARACTER(len=100) :: cn_dir_sbc, cn_dir_cbc, cn_dir_obc TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) :: slf_i ! local array of namelist informations on the fields to read - TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcobc ! open + TYPE(FLD_N), DIMENSION(jp_bdy) :: sn_trcobc ! open TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcsbc ! surface TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trccbc ! coastal REAL(wp) , DIMENSION(jpmaxtrc) :: rn_trofac ! multiplicative factor for tracer values REAL(wp) , DIMENSION(jpmaxtrc) :: rn_trsfac ! multiplicative factor for tracer values REAL(wp) , DIMENSION(jpmaxtrc) :: rn_trcfac ! multiplicative factor for tracer values + CHARACTER(len=lca), DIMENSION(jpmaxtrc) :: cn_tronam ! tracer- to variable-name translation !! - NAMELIST/namtrc_bc/ cn_dir_obc, sn_trcobc, rn_trofac, cn_dir_sbc, sn_trcsbc, rn_trsfac, & - & cn_dir_cbc, sn_trccbc, rn_trcfac, ln_rnf_ctl, rn_sbc_time, rn_cbc_time - NAMELIST/namtrc_bdy/ cn_trc_dflt, cn_trc, nn_trcdmp_bdy + NAMELIST/namtrc_bc/ cn_dir_obc, sn_trcobc, rn_trofac, cn_tronam, & + & cn_dir_sbc, sn_trcsbc, rn_trsfac, & + & cn_dir_cbc, sn_trccbc, rn_trcfac, & + & ln_rnf_ctl, rn_sbc_time, rn_cbc_time !!---------------------------------------------------------------------- ! IF( lwp ) THEN @@ -106,6 +108,10 @@ CONTAINS ENDIF nb_trcobc = 0 n_trc_indobc(:) = 0 + rn_trofac(:) = 1._wp + DO jn = 1, ntrc + cn_tronam(jn) = TRIM( ctrcnm(jn) ) ! Default variable name of open-boundary input data + END DO ! ALLOCATE( n_trc_indsbc(ntrc), STAT=ierr0 ) IF( ierr0 > 0 ) THEN @@ -113,6 +119,7 @@ CONTAINS ENDIF nb_trcsbc = 0 n_trc_indsbc(:) = 0 + rn_trsfac(:) = 1._wp ! ALLOCATE( n_trc_indcbc(ntrc), STAT=ierr0 ) IF( ierr0 > 0 ) THEN @@ -120,6 +127,7 @@ CONTAINS ENDIF nb_trccbc = 0 n_trc_indcbc(:) = 0 + rn_trcfac(:) = 1._wp ! ! Read Boundary Conditions Namelists READ ( numnat_ref, namtrc_bc, IOSTAT = ios, ERR = 901) @@ -128,37 +136,8 @@ CONTAINS 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namtrc_bc in configuration namelist' ) IF(lwm) WRITE ( numont, namtrc_bc ) - IF ( ln_bdy ) THEN - READ ( numnat_ref, namtrc_bdy, IOSTAT = ios, ERR = 903) -903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in reference namelist' ) - ! make sur that all elements of the namelist variables have a default definition from namelist_ref - cn_trc (2:jp_bdy) = cn_trc (1) - cn_trc_dflt(2:jp_bdy) = cn_trc_dflt(1) - READ ( numnat_cfg, namtrc_bdy, IOSTAT = ios, ERR = 904 ) -904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in configuration namelist' ) - IF(lwm) WRITE ( numont, namtrc_bdy ) - - ! setup up preliminary informations for BDY structure - DO jn = 1, ntrc - DO ib = 1, nb_bdy - ! Set type of obc in BDY data structure (around here we may plug user override of obc type from nml) - IF ( ln_trc_obc(jn) ) THEN ; trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc (ib) ) - ELSE ; trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc_dflt(ib) ) - ENDIF - ! set damping use in BDY data structure - trcdta_bdy(jn,ib)%dmp = .false. - IF(nn_trcdmp_bdy(ib) == 1 .AND. ln_trc_obc(jn) ) trcdta_bdy(jn,ib)%dmp = .true. - IF(nn_trcdmp_bdy(ib) == 2 ) trcdta_bdy(jn,ib)%dmp = .true. - IF(trcdta_bdy(jn,ib)%cn_obc == 'frs' .AND. nn_trcdmp_bdy(ib) /= 0 ) & - & CALL ctl_stop( 'trc_bc_ini: Use FRS OR relaxation' ) - IF( .NOT.( 0 <= nn_trcdmp_bdy(ib) .AND. nn_trcdmp_bdy(ib) <= 2 ) ) & - & CALL ctl_stop( 'trc_bc_ini: Not a valid option for nn_trcdmp_bdy. Allowed: 0,1,2.' ) - END DO - END DO - ELSE - ! Force all tracers OBC to false if bdy not used - ln_trc_obc = .false. - ENDIF + ! Disable passive-tracer OBC data input if BDY is inactive + IF( .NOT. ln_bdy ) ln_trc_obc(:) = .FALSE. ! compose BC data indexes DO jn = 1, ntrc @@ -174,6 +153,7 @@ CONTAINS END DO ! Print summmary of Boundary Conditions + IF( .NOT.ln_rnf .OR. .NOT.ln_linssh ) ln_rnf_ctl = .FALSE. IF( lwp ) THEN WRITE(numout,*) WRITE(numout,'(a,i3)') ' Total tracers to be initialized with SURFACE BCs data:', nb_trcsbc @@ -194,67 +174,47 @@ CONTAINS END DO ENDIF WRITE(numout,'(2a)') ' COASTAL BC data repository : ', TRIM(cn_dir_cbc) - IF( .NOT.ln_rnf .OR. .NOT.ln_linssh ) ln_rnf_ctl = .FALSE. IF( ln_rnf_ctl ) WRITE(numout,'(a)') & & ' -> Remove runoff dilution effect on tracers with absent river load (ln_rnf_ctl = .TRUE.)' WRITE(numout,*) WRITE(numout,'(a,i3)') ' Total tracers to be initialized with OPEN BCs data:', nb_trcobc - - IF( ln_bdy .AND. nb_trcobc > 0 ) THEN - WRITE(numout,*) ' #trc NAME Boundary Mult.Fact. OBC Settings' + IF( nb_trcobc > 0 ) THEN + WRITE(numout,*) ' #trc NAME Boundary Mult.Fact. ' DO jn = 1, ntrc - 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) - 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) - END DO - WRITE(numout,*) ' ' - DO ib = 1, nb_bdy - IF(nn_trcdmp_bdy(ib) == 0) WRITE(numout,9003) ' Boundary ', ib, & - & ' -> NO damping of tracers' - IF(nn_trcdmp_bdy(ib) == 1) WRITE(numout,9003) ' Boundary ', ib, & - & ' -> damping ONLY for tracers with external data provided' - IF(nn_trcdmp_bdy(ib) == 2) WRITE(numout,9003) ' Boundary ', ib, & - & ' -> damping of ALL tracers' - IF(nn_trcdmp_bdy(ib) > 0) THEN - WRITE(numout,9003) ' USE damping parameters from nambdy for boundary ', ib,' : ' - WRITE(numout,'(a,f10.2,a)') ' - Inflow damping time scale : ',rn_time_dmp (ib),' days' - WRITE(numout,'(a,f10.2,a)') ' - Outflow damping time scale : ',rn_time_dmp_out(ib),' days' - ENDIF + IF ( ln_trc_obc(jn) ) WRITE(numout, 9001) jn, TRIM( cn_tronam(jn) ), 'OBC', rn_trofac(jn) END DO - ENDIF - ! + END IF WRITE(numout,'(2a)') ' OPEN BC data repository : ', TRIM(cn_dir_obc) ENDIF 9001 FORMAT(2x,i5, 3x, a15, 3x, a5, 6x, e11.3, 4x, 10a13) -9002 FORMAT(2x,i5, 3x, a41, 3x, 10a13) -9003 FORMAT(a, i5, a) ! ! ! OPEN Lateral boundary conditions IF( ln_bdy .AND. nb_trcobc > 0 ) THEN - ALLOCATE ( sf_trcobc(nb_trcobc), rf_trofac(nb_trcobc), STAT=ierr1 ) + ALLOCATE ( sf_trcobc(nb_trcobc, nb_bdy), rf_trofac(nb_trcobc), STAT=ierr1 ) IF( ierr1 > 0 ) THEN CALL ctl_stop( 'trc_bc_ini: unable to allocate sf_trcobc structure' ) ; RETURN ENDIF ! igrd = 1 ! Everything is at T-points here ! - DO jn = 1, ntrc - DO ib = 1, nb_bdy + DO ib = 1, nb_bdy + write(clnbdy,'(i2)') ib + DO jn = 1, ntrc ! nblen = idx_bdy(ib)%nblen(igrd) ! IF( ln_trc_obc(jn) ) THEN !* Initialise from external data *! jl = n_trc_indobc(jn) - slf_i(jl) = sn_trcobc(jn) + slf_i(jl) = sn_trcobc(ib) + slf_i(jl)%clvar = TRIM(cn_tronam(jn)) rf_trofac(jl) = rn_trofac(jn) - ALLOCATE( sf_trcobc(jl)%fnow(nblen,1,jpk) , STAT=ierr2 ) - IF( sn_trcobc(jn)%ln_tint ) ALLOCATE( sf_trcobc(jl)%fdta(nblen,1,jpk,2) , STAT=ierr3 ) + ALLOCATE( sf_trcobc(jl,ib)%fnow(nblen,1,jpk) , STAT=ierr2 ) + IF( sn_trcobc(ib)%ln_tint ) ALLOCATE( sf_trcobc(jl,ib)%fdta(nblen,1,jpk,2) , STAT=ierr3 ) IF( ierr2 + ierr3 > 0 ) THEN CALL ctl_stop( 'trc_bc_ini : unable to allocate passive tracer OBC data arrays' ) ; RETURN ENDIF - trcdta_bdy(jn,ib)%trc => sf_trcobc(jl)%fnow(:,1,:) + trcdta_bdy(jn,ib)%trc => sf_trcobc(jl,ib)%fnow(:,1,:) trcdta_bdy(jn,ib)%rn_fac = rf_trofac(jl) ELSE !* Initialise obc arrays from initial conditions *! ALLOCATE ( trcdta_bdy(jn,ib)%trc(nblen,jpk) ) @@ -268,14 +228,18 @@ CONTAINS trcdta_bdy(jn,ib)%rn_fac = 1._wp ENDIF END DO + ! + CALL fld_fill( sf_trcobc(:,ib), slf_i, cn_dir_obc, 'trc_bc_ini', 'Passive tracer OBC data at boundary '//TRIM(clnbdy), 'namtrc_bc' ) END DO ! - CALL fld_fill( sf_trcobc, slf_i, cn_dir_obc, 'trc_bc_ini', 'Passive tracer OBC data', 'namtrc_bc' ) DO jn = 1, ntrc ! define imap pointer, must be done after the call to fld_fill DO ib = 1, nb_bdy IF( ln_trc_obc(jn) ) THEN !* Initialise from external data *! jl = n_trc_indobc(jn) - sf_trcobc(jl)%imap => idx_bdy(ib)%nbmap(1:idx_bdy(ib)%nblen(igrd),igrd) + sf_trcobc(jl,ib)%imap => idx_bdy(ib)%nbmap(1:idx_bdy(ib)%nblen(igrd),igrd) + sf_trcobc(jl,ib)%igrd = igrd + sf_trcobc(jl,ib)%ibdy = ib + sf_trcobc(jl,ib)%lzint = ln_zintobc(ib) ! vertical interpolation ENDIF END DO END DO @@ -353,7 +317,7 @@ CONTAINS INTEGER , INTENT(in), OPTIONAL :: jit ! subcycle time-step index (for timesplitting option) REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr ! passive tracers and RHS of tracer equation !! - INTEGER :: ji, jj, jk, jn, jl ! Loop index + INTEGER :: ji, jj, jk, jn, jl, ib ! Loop index REAL(wp) :: zfact, zrnf !!--------------------------------------------------------------------- ! @@ -370,8 +334,10 @@ CONTAINS ! ! BDY: use pt_offset=0.5 as applied at the end of the step and fldread is referenced at the middle of the step IF( nb_trcobc > 0 ) THEN - if (lwp) write(numout,'(a,i5,a,i10)') ' reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt - CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, kit=jit, pt_offset = 0.5_wp ) + DO ib = 1, nb_bdy + if (lwp) write(numout,'(a,i3,a,i10)') ' reading OBC data for segment ', ib ,' at step ', kt + CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc(:,ib), kit=jit, pt_offset = 0.5_wp ) + ENDDO ENDIF ! ! SURFACE boundary conditions @@ -390,8 +356,10 @@ CONTAINS ! ! BDY: use pt_offset=0.5 as applied at the end of the step and fldread is referenced at the middle of the step IF( nb_trcobc > 0 ) THEN - if (lwp) write(numout,'(a,i5,a,i10)') ' reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt - CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, pt_offset = 0.5_wp ) + DO ib = 1, nb_bdy + if (lwp) write(numout,'(a,i3,a,i10)') ' reading OBC data for segment ', ib ,' at step ', kt + CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc(:,ib), pt_offset = 0.5_wp ) + ENDDO ENDIF ! ! SURFACE boundary conditions diff --git a/src/TOP/trcbdy.F90 b/src/TOP/trcbdy.F90 index 062ad24f6e624aa18a9b461edb2993900ebc9cff..fd5486b2eecf35b2170ca0698ab9d33b49e67a44 100644 --- a/src/TOP/trcbdy.F90 +++ b/src/TOP/trcbdy.F90 @@ -26,8 +26,9 @@ MODULE trcbdy IMPLICIT NONE PRIVATE - PUBLIC trc_bdy ! routine called in trcnxt.F90 - PUBLIC trc_bdy_dmp ! routine called in trcstp.F90 + PUBLIC trc_bdy_ini ! routine called in trcini.F90 + PUBLIC trc_bdy ! routine called in trcnxt.F90 + PUBLIC trc_bdy_dmp ! routine called in trcstp.F90 !!---------------------------------------------------------------------- !! NEMO/TOP 4.0 , NEMO Consortium (2018) @@ -36,6 +37,90 @@ MODULE trcbdy !!---------------------------------------------------------------------- CONTAINS + SUBROUTINE trc_bdy_ini( ntrc ) + !!---------------------------------------------------------------------- + !! *** ROUTINE trc_bdy_ini *** + !! + !! ** Purpose : initialisation of the passive-tracer open boundary + !! conditions + !! + !! ** Action : reading in of the namtrc_bdy namelist + !! + !!---------------------------------------------------------------------- + INTEGER, INTENT(in) :: ntrc ! number of tracers + !! + INTEGER :: jn, ib ! loop indices + INTEGER :: ios ! namelist input status + !! + NAMELIST/namtrc_bdy/ cn_trc_dflt, cn_trc, nn_trcdmp_bdy, ln_zintobc + !!---------------------------------------------------------------------- + ! + IF(lwp) THEN + WRITE(numout,*) + WRITE(numout,*) 'trc_bdy_ini : passive-tracer open boundary conditions' + WRITE(numout,*) '~~~~~~~~~~~' + END IF + ! + READ( numnat_ref, namtrc_bdy, IOSTAT = ios, ERR = 903 ) +903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in reference namelist' ) + ! make sure that all elements of the namelist variables have a default definition from namelist_top_ref + cn_trc (2:jp_bdy) = cn_trc (1) + cn_trc_dflt (2:jp_bdy) = cn_trc_dflt (1) + nn_trcdmp_bdy(2:jp_bdy) = nn_trcdmp_bdy(1) + READ( numnat_cfg, namtrc_bdy, IOSTAT = ios, ERR = 904 ) +904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in configuration namelist' ) + IF(lwm) WRITE ( numont, namtrc_bdy ) + ! setup up preliminary information for BDY structure + DO jn = 1, ntrc + DO ib = 1, nb_bdy + ! set type of obc in BDY data structure + IF ( ln_trc_obc(jn) ) THEN + trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc (ib) ) + ELSE + trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc_dflt(ib) ) + ENDIF + ! set damping use in BDY data structure + trcdta_bdy(jn,ib)%dmp = .FALSE. + IF(nn_trcdmp_bdy(ib) == 1 .AND. ln_trc_obc(jn) ) trcdta_bdy(jn,ib)%dmp = .TRUE. + IF(nn_trcdmp_bdy(ib) == 2 ) trcdta_bdy(jn,ib)%dmp = .TRUE. + IF(trcdta_bdy(jn,ib)%cn_obc == 'frs' .AND. nn_trcdmp_bdy(ib) /= 0 ) & + & CALL ctl_stop( 'trc_bc_ini: use FRS OR relaxation' ) + IF( .NOT. ( 0 <= nn_trcdmp_bdy(ib) .AND. nn_trcdmp_bdy(ib) <= 2 ) ) & + & CALL ctl_stop( 'trc_bc_ini: not a valid option for nn_trcdmp_bdy (0, 1, or 2)' ) + END DO + END DO + ! + IF(lwp) THEN + WRITE(numout,*) ' #trc NAME Boundary Mult.Fact. OBC Settings' + DO jn = 1, ntrc + IF ( ln_trc_obc(jn) ) WRITE(numout, 9001) jn, TRIM(ctrcnm(jn)), 'OBC', & + & (trcdta_bdy(jn,ib)%cn_obc,ib=1,nb_bdy) + IF ( .NOT. ln_trc_obc(jn) ) WRITE(numout, 9002) jn, TRIM(ctrcnm(jn)), 'Boundary data from IC', & + & (trcdta_bdy(jn,ib)%cn_obc,ib=1,nb_bdy) + END DO + WRITE(numout,*) ' ' + DO ib = 1, nb_bdy + IF(nn_trcdmp_bdy(ib) == 0) WRITE(numout,9003) ' Boundary ', ib, & + & ' -> NO damping of tracers' + IF(nn_trcdmp_bdy(ib) == 1) WRITE(numout,9003) ' Boundary ', ib, & + & ' -> damping ONLY for tracers with external data provided' + IF(nn_trcdmp_bdy(ib) == 2) WRITE(numout,9003) ' Boundary ', ib, & + & ' -> damping of ALL tracers' + IF(nn_trcdmp_bdy(ib) > 0) THEN + WRITE(numout,9003) ' USE damping parameters from nambdy for boundary ', ib,' : ' + WRITE(numout,'(a,f10.2,a)') ' - Inflow damping time scale : ',rn_time_dmp (ib),' days' + WRITE(numout,'(a,f10.2,a)') ' - Outflow damping time scale : ',rn_time_dmp_out(ib),' days' + ENDIF + END DO + ! + WRITE(numout,*) ' ' + WRITE(numout,*) ' Vertical interpolation on segment(s) : ', (ln_zintobc(ib),ib=1,nb_bdy) + END IF +9001 FORMAT(2x, i5, 3x, a15, 3x, a5, 21x, 10a13) +9002 FORMAT(2x, i5, 3x, a15, 3x, a22, 4x, 10a13) +9003 FORMAT(a, i5, a) + END SUBROUTINE trc_bdy_ini + SUBROUTINE trc_bdy( kt, Kbb, Kmm, Krhs ) !!---------------------------------------------------------------------- !! *** SUBROUTINE trc_bdy *** diff --git a/src/TOP/trcini.F90 b/src/TOP/trcini.F90 index f5275ead3833d971aec8e6e656e2d0609e362bb5..d0fc5e01a52dba7a820735cf74bc6913f0c2ca50 100644 --- a/src/TOP/trcini.F90 +++ b/src/TOP/trcini.F90 @@ -26,6 +26,7 @@ MODULE trcini USE trcice ! tracers in sea ice USE trcbc ! generalized Boundary Conditions USE trcais ! tracers from Antartic Ice Sheet + USE trcbdy ! passive-tracer open boundary conditions IMPLICIT NONE PRIVATE @@ -266,7 +267,8 @@ CONTAINS ! ENDIF ! - IF( ln_trcbc .AND. lltrcbc ) THEN + IF( ln_bdy ) CALL trc_bdy_ini( jptra ) + IF( ln_trcbc .AND. lltrcbc ) THEN CALL trc_bc_ini ( jptra, Kmm ) ! set tracers Boundary Conditions CALL trc_bc ( nit000, Kmm, tr, Kaa ) ! tracers: surface and lateral Boundary Conditions ENDIF