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.
sbcflx_adj.F90 in branches/UKMO/dev_r5518_fa_am_dt_deltadelta_toa/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/UKMO/dev_r5518_fa_am_dt_deltadelta_toa/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx_adj.F90 @ 7054

Last change on this file since 7054 was 7054, checked in by kuniko, 8 years ago

Cleared svn keywords

File size: 15.9 KB
Line 
1MODULE sbcflx_adj
2   !!======================================================================
3   !!                       ***  MODULE  sbcflx_adj  ***
4   !! Surface module :  flux adjustment of heat/freshwater. Add qrp/erp obtained from sbcssr
5   !!======================================================================
6   !! History :  0.0  !  2015-10-14  (K. Yamazaki)  Original code
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   sbc_flx_adj       : add qrp/erp to sbc to perform flux adjustment
11   !!   sbc_flx_adj_init  : initialisation of flux adjustment
12   !!----------------------------------------------------------------------
13   USE oce            ! ocean dynamics and tracers
14   USE dom_oce        ! ocean space and time domain
15   USE sbc_oce        ! surface boundary condition
16   USE phycst         ! physical constants
17   USE sbcrnf         ! surface boundary condition : runoffs
18   USE sbc_arcmsk     ! surface boundary condition : runoffs & Arctic mask
19   !
20   USE fldread        ! read input fields
21   USE iom            ! I/O manager
22   USE in_out_manager ! I/O manager
23   USE lib_mpp        ! distribued memory computing library
24   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
25   USE timing         ! Timing
26   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
27
28   IMPLICIT NONE
29   PRIVATE
30
31   PUBLIC   sbc_flx_adj        ! routine called in sbcmod
32   PUBLIC   sbc_flx_adj_init   ! routine called in sbcmod
33
34   !ky 16/10/2016 commented out below two lines
35   !ky 06/09/2016 uncommented below two lines for FA test
36   !ky 11/12/2015 recommented below two lines
37   !!ky 3/12/2015 uncommented below two lines for FA test!
38   !REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   erp   !: evaporation damping   [kg/m2/s]
39   !REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qrp   !: heat flux damping        [w/m2]
40
41   !                                   !!* Namelist namsbc_flx_adj *
42   INTEGER, PUBLIC ::   nn_flxadjht     ! Heat/freshwater flux adjustment indicator
43   INTEGER, PUBLIC ::   nn_flxadjfw     ! Heat/freshwater flux adjustment indicator
44   LOGICAL         ::   ln_sssr_bnd     ! flag to bound erp term
45   REAL(wp)        ::   rn_sssr_bnd     ! ABS(Max./Min.) value of erp term [mm/day]
46   REAL(wp)        ::   delta_toa       ! global mean annual mean TOA for FA to perturbed ensemble [W/m2]
47   REAL(wp)        ::   delta_delta_toa ! perturbation to delta_toa [W/m2]
48
49   REAL(wp) , ALLOCATABLE, DIMENSION(:) ::   buffer   ! Temporary buffer for exchange
50   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_erp   ! structure of input erp (file informations, fields read)
51   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_qrp   ! structure of input qrp (file informations, fields read)
52
53   !! * Substitutions
54#  include "domzgr_substitute.h90"
55   !!----------------------------------------------------------------------
56   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
57   !! $Id$
58   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
59   !!----------------------------------------------------------------------
60CONTAINS
61
62   SUBROUTINE sbc_flx_adj( kt )
63      !!---------------------------------------------------------------------
64      !!                     ***  ROUTINE sbc_flx_adj  ***
65      !!
66      !! ** Purpose :   Add to heat and/or freshwater fluxes a qrp and/or erp
67      !!                to flux adjust temperature/salinity
68      !!
69      !! ** Method  : - Read namelist namsbc_flx_adj
70      !!              - Read calculated qrp and/or erp
71      !!              - at each nscb time step
72      !!                   add qrp on qns    (nn_flxadjht = 1)
73      !!                   add erp on sfx        (nn_flxadjfw = 1)
74      !!                   add erp on emp        (nn_flxadjfw = 2)
75      !!---------------------------------------------------------------------
76      INTEGER, INTENT(in   ) ::   kt   ! ocean time step
77      !!
78      INTEGER  ::   ji, jj   ! dummy loop indices
79      REAL(wp) ::   zerp     ! local scalar for evaporation damping
80      REAL(wp) ::   zqrp     ! local scalar for heat flux damping
81      REAL(wp) ::   zerp_bnd ! local scalar for unit conversion of rn_epr_max factor
82      INTEGER  ::   ierror   ! return error code
83      !!
84      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
85      TYPE(FLD_N) ::   sn_qrp, sn_erp        ! informations about the fields to be read
86      !!----------------------------------------------------------------------
87      !
88      ! ky 17/10/2016 commented out below two lines
89      !write(numout,*) '*** In sbcflx_adj *** delta_toa, delta_delta_toa=', &
90      !   & delta_toa, delta_delta_toa
91
92      IF( nn_timing == 1 )  CALL timing_start('sbc_flx_adj')
93      !
94      IF( nn_flxadjht + nn_flxadjfw /= 0 ) THEN
95         !
96         IF( nn_flxadjht == 1)   CALL fld_read( kt, nn_fsbc, sf_qrp )   ! Read qrp data and provides it at kt
97         IF( nn_flxadjfw >= 1)   CALL fld_read( kt, nn_fsbc, sf_erp )   ! Read erp data and provides it at kt
98         !
99         !                                         ! ========================= !
100         IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN      !    Add restoring term     !
101            !                                      ! ========================= !
102            !
103            IF( nn_flxadjht == 1 ) THEN                                   !* Anomalous heat flux term (qrp)
104               DO jj = 1, jpj
105                  DO ji = 1, jpi
106                     ! K.Y. 16/03/2016 Apply Arctic mask to heat flux adjustment
107                     zqrp = ( 1. - 2.*only_arcmsk(ji,jj) )  &
108                        &        * sf_qrp(1)%fnow(ji,jj,1)  &
109                        &        + delta_toa + delta_delta_toa
110                     ! K.Y. 16/10/2016 added "&" to 2 lines above and
111                     !   delta_toa, delta_delta_toa to above line
112                     !zqrp = sf_qrp(1)%fnow(ji,jj,1)
113                     !ky 07/09/2016 copied 1 line below for FA test
114                     !ky 11/12/2015 commented out 1 line below
115                     !!ky 3/12/2015 1 line below for FA test!
116                     !qrp(ji,jj) = sf_qrp(1)%fnow(ji,jj,1)
117                     !ky 07/09/2016 copied 1 line above and modified as below for FA test
118                     !ky 16/10/2016 commented out 1 line below
119                     !qrp(ji,jj) = zqrp
120                     qns(ji,jj) = qns(ji,jj) + zqrp
121                  END DO
122               END DO
123               !ky 16/10/2016 commented out below 1 line below
124               !ky 06/09/2016 uncommented below 1 line below for FA test!
125               !ky 11/12/2015 recommented out below 1 line below
126               !!ky 3/12/2015 uncommented below 1 line below for FA test!
127               !CALL iom_put( "qrp", qrp )                             ! heat flux damping
128            ENDIF
129            !
130            IF( nn_flxadjfw == 1 ) THEN                               !* Anomalous freshwater term !(salt flux only (sfx))
131!CDIR COLLAPSE
132               DO jj = 1, jpj
133                  !!write(numout,*) 'sf_qrp(1)%fnow(30,',jj,',1)=',sf_qrp(1)%fnow(30,jj,1), &
134                  !!  &            'sf_erp(1)%fnow(30,',jj,',1)=',sf_erp(1)%fnow(30,jj,1), &
135                  !!  &            'sst_m(30,',jj,')=',sst_m(30,jj),'sss_m(30,',jj,')=',sss_m(30,jj)
136                  DO ji = 1, jpi
137                     zerp = ( 1. - 2.*rnfmsk_arcmsk(ji,jj) )  &        ! No damping in vicinity of river mouths
138                        &        * sf_erp(1)%fnow(ji,jj,1)  &
139                        &        * MAX( sss_m(ji,jj), 1.e-20 )! reconverted into salinity flux
140                     !ky 22/07/2016 inserted 1 line above to reflect Dave Storkey's code review
141                     !ky 11/12/2015 recommented out 1 line below
142                     !!ky 3/12/2015 1 line below for FA test!
143                     !erp(ji,jj) = sf_erp(1)%fnow(ji,jj,1)
144                     !ky 16/10/2016 commented out below two lines
145                     !ky 06/09/2016 copied line above and changed to below two lines for FA test!
146                     !erp(ji,jj) = ( 1. - 2.*rnfmsk_arcmsk(ji,jj) )  &        ! No damping in vicinity of river mouths
147                     !   &        * sf_erp(1)%fnow(ji,jj,1)
148                     sfx(ji,jj) = sfx(ji,jj) + zerp                 ! salt flux
149                  END DO
150               END DO
151               !ky 16/10/2016 commented out below one line
152               !ky 06/09/2016 uncommented below one line for FA test!
153               !ky 11/12/2015 recommented out below one line
154               !!ky 3/12/2015 uncommented below one line for FA test!
155               !CALL iom_put( "erp", erp )                             ! freshwater flux damping
156               !
157            ELSEIF( nn_flxadjfw == 2 ) THEN                               !* Salinity damping term (volume flux (emp) and associated heat flux (qns)
158               zerp_bnd = rn_sssr_bnd / rday                          !       -              -   
159!CDIR COLLAPSE
160               DO jj = 1, jpj
161                  DO ji = 1, jpi                           
162                     zerp = ( 1. - 2.*rnfmsk_arcmsk(ji,jj) )  &        ! No damping in vicinity of river mouths
163                        &        * sf_erp(1)%fnow(ji,jj,1)
164                     IF( ln_sssr_bnd )   zerp = SIGN( 1., zerp ) * MIN( zerp_bnd, ABS(zerp) )
165                     !ky 11/12/2015 recommented out 1 line below
166                     !!ky 3/12/2015 1 line below for FA test!
167                     !erp(ji,jj) = sf_erp(1)%fnow(ji,jj,1)
168                     !ky 06/09/2016 copied line above and changed to below line for FA test!
169                     !ky 16/10/2016 commented out below line
170                     !erp(ji,jj) = zerp
171                     emp(ji,jj) = emp (ji,jj) + zerp
172                     qns(ji,jj) = qns(ji,jj) - zerp * rcp * sst_m(ji,jj)
173                  END DO
174               END DO
175               !ky 16/10/2016 commented out below 1 line
176               !ky 06/09/2016 uncommented below 1 line for FA test!
177               !ky 11/12/2015 recommented out below 1 line
178               !!ky 3/12/2015 uncommented below 1 line for FA test!
179               !CALL iom_put( "erp", erp )                             ! freshwater flux damping
180            ENDIF
181            !
182         ENDIF
183         !
184      ENDIF
185      !
186      IF( nn_timing == 1 )  CALL timing_stop('sbc_flx_adj')
187      !
188   END SUBROUTINE sbc_flx_adj
189
190 
191   SUBROUTINE sbc_flx_adj_init
192      !!---------------------------------------------------------------------
193      !!                  ***  ROUTINE sbc_flx_adj_init  ***
194      !!
195      !! ** Purpose :   initialisation of surface damping term
196      !!
197      !! ** Method  : - Read namelist namsbc_flx_adj
198      !ky!!!              - Read observed SST and/or SSS if required
199      !!---------------------------------------------------------------------
200      INTEGER  ::   ji, jj   ! dummy loop indices
201      REAL(wp) ::   zerp     ! local scalar for evaporation damping
202      REAL(wp) ::   zqrp     ! local scalar for heat flux damping
203      REAL(wp) ::   zerp_bnd ! local scalar for unit conversion of rn_epr_max factor
204      INTEGER  ::   ierror   ! return error code
205      !!
206      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
207      TYPE(FLD_N) ::   sn_qrp, sn_erp        ! informations about the fields to be read
208      NAMELIST/namsbc_flx_adj/ cn_dir, nn_flxadjht, nn_flxadjfw, sn_qrp, sn_erp,   &
209         &                     ln_sssr_bnd, rn_sssr_bnd, delta_toa, delta_delta_toa
210      INTEGER     ::  ios
211      !!----------------------------------------------------------------------
212      !
213 
214      !!write(numout,*) '*** in sbcflx_adj_init ***'
215
216      REWIND( numnam_ref )              ! Namelist namsbc_flx_adj in reference namelist :
217      READ  ( numnam_ref, namsbc_flx_adj, IOSTAT = ios, ERR = 901)
218901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_flx_adj in reference namelist', lwp )
219
220      REWIND( numnam_cfg )              ! Namelist namsbc_flx_adj in configuration namelist :
221      READ  ( numnam_cfg, namsbc_flx_adj, IOSTAT = ios, ERR = 902 )
222902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_flx_adj in configuration namelist', lwp )
223      IF(lwm) WRITE ( numond, namsbc_flx_adj )
224
225      IF(lwp) THEN                 !* control print
226         WRITE(numout,*)
227         WRITE(numout,*) 'sbc_flx_adj : Heat and/or freshwater flux adjustment term '
228         WRITE(numout,*) '~~~~~~~ '
229         WRITE(numout,*) '   Namelist namsbc_flx_adj :'
230         WRITE(numout,*) '      Anom. heat flux (qrp) term (Yes=1)             nn_flxadjht     = ', nn_flxadjht
231         WRITE(numout,*) '      Anom. fw flux (erp) term (Yes=1, salt flux)    nn_flxadjfw     = ', nn_flxadjfw
232         WRITE(numout,*) '                                           (Yes=2, volume flux) '
233         WRITE(numout,*) '      flag to bound erp term                 ln_sssr_bnd = ', ln_sssr_bnd
234         WRITE(numout,*) '      ABS(Max./Min.) erp threshold           rn_sssr_bnd = ', rn_sssr_bnd, ' mm/day'
235         WRITE(numout,*) '      global mean, annual mean TOA to supplement FA delta_toa = ', delta_toa, ' W/m2'
236         WRITE(numout,*) '      perturbation to delta_toa = ', delta_delta_toa, ' W/m2'
237      ENDIF
238      !
239      !                            !* Allocate erp and qrp array
240      !ky 16/10/2016 commented out below two lines
241      !ky 06/09/2016 uncommented below two lines for FA test!
242      !ky 11/12/2015 recommented out below two lines
243      !!ky 3/12/2015 uncommented below two lines for FA test!
244      !ALLOCATE( qrp(jpi,jpj), erp(jpi,jpj), STAT=ierror )
245      !IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_ssr: unable to allocate erp and qrp array' )
246      !
247      IF( nn_flxadjht == 1 ) THEN      !* set sf_qrp structure & allocate arrays
248         !
249         ALLOCATE( sf_qrp(1), STAT=ierror )
250         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_flx_adj: unable to allocate sf_qrp structure' )
251         ALLOCATE( sf_qrp(1)%fnow(jpi,jpj,1), STAT=ierror )
252         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_flx_adj: unable to allocate sf_qrp now array' )
253         !
254         ! fill sf_qrp with sn_qrp and control print
255         CALL fld_fill( sf_qrp, (/ sn_qrp /), cn_dir, 'sbc_qrp', 'Heat flux adjustment', 'namsbc_flx_adj' )
256         IF( sf_qrp(1)%ln_tint )   ALLOCATE( sf_qrp(1)%fdta(jpi,jpj,1,2), STAT=ierror )
257         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_flx_adj: unable to allocate sf_qrp data array' )
258         !
259      ENDIF
260      !
261      IF( nn_flxadjfw >= 1 ) THEN      !* set sf_erp structure & allocate arrays
262         !
263         ALLOCATE( sf_erp(1), STAT=ierror )
264         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_flx_adj: unable to allocate sf_erp structure' )
265         ALLOCATE( sf_erp(1)%fnow(jpi,jpj,1), STAT=ierror )
266         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_flx_adj: unable to allocate sf_erp now array' )
267         !
268         ! fill sf_erp with sn_erp and control print
269         CALL fld_fill( sf_erp, (/ sn_erp /), cn_dir, 'sbc_erp', 'Freshwater flux adjustment term', 'namsbc_flx_adj' )
270         IF( sf_erp(1)%ln_tint )   ALLOCATE( sf_erp(1)%fdta(jpi,jpj,1,2), STAT=ierror )
271         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_flx_adj: unable to allocate sf_erp data array' )
272         !
273      ENDIF
274      !
275      !ky!!                            !* Initialize qrp and erp if no restoring
276      !ky 16/10/2016 commented out below two lines
277      !ky 06/09/2016 below two lines for FA test!
278      !ky 11/12/2015 commented out below two lines
279      !!ky 3/12/2015 below two lines for FA test!
280      !IF( nn_flxadjht /= 1                   )   qrp(:,:) = 0._wp
281      !IF( nn_flxadjfw /= 1 .OR. nn_flxadjfw /= 2 )   erp(:,:) = 0._wp
282      !!ky!!IF( nn_sstr /= 1                   )   qrp(:,:) = 0._wp
283      !!ky!!IF( nn_sssr /= 1 .OR. nn_sssr /= 2 )   erp(:,:) = 0._wp
284      !
285   END SUBROUTINE sbc_flx_adj_init
286     
287   !!======================================================================
288END MODULE sbcflx_adj
Note: See TracBrowser for help on using the repository browser.