[888] | 1 | MODULE sbcflx |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE sbcflx *** |
---|
| 4 | !! Ocean forcing: momentum, heat and freshwater flux formulation |
---|
| 5 | !!===================================================================== |
---|
[2528] | 6 | !! History : 1.0 ! 2006-06 (G. Madec) Original code |
---|
| 7 | !! 3.3 ! 2010-10 (S. Masson) add diurnal cycle |
---|
[888] | 8 | !!---------------------------------------------------------------------- |
---|
| 9 | |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
| 11 | !! namflx : flux formulation namlist |
---|
[2528] | 12 | !! sbc_flx : flux formulation as ocean surface boundary condition (forced mode, fluxes read in NetCDF files) |
---|
[888] | 13 | !!---------------------------------------------------------------------- |
---|
| 14 | USE oce ! ocean dynamics and tracers |
---|
| 15 | USE dom_oce ! ocean space and time domain |
---|
[2528] | 16 | USE sbc_oce ! surface boundary condition: ocean fields |
---|
| 17 | USE sbcdcy ! surface boundary condition: diurnal cycle on qsr |
---|
[888] | 18 | USE phycst ! physical constants |
---|
[6140] | 19 | ! |
---|
[888] | 20 | USE fldread ! read input fields |
---|
| 21 | USE iom ! IOM library |
---|
| 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 | |
---|
| 26 | IMPLICIT NONE |
---|
| 27 | PRIVATE |
---|
| 28 | |
---|
| 29 | PUBLIC sbc_flx ! routine called by step.F90 |
---|
| 30 | |
---|
| 31 | INTEGER , PARAMETER :: jp_utau = 1 ! index of wind stress (i-component) file |
---|
| 32 | INTEGER , PARAMETER :: jp_vtau = 2 ! index of wind stress (j-component) file |
---|
| 33 | INTEGER , PARAMETER :: jp_qtot = 3 ! index of total (non solar+solar) heat file |
---|
| 34 | INTEGER , PARAMETER :: jp_qsr = 4 ! index of solar heat file |
---|
| 35 | INTEGER , PARAMETER :: jp_emp = 5 ! index of evaporation-precipation file |
---|
[13485] | 36 | !!INTEGER , PARAMETER :: jp_sfx = 6 ! index of salt flux flux |
---|
| 37 | INTEGER , PARAMETER :: jpfld = 5 !! 6 ! maximum number of files to read |
---|
[888] | 38 | TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf ! structure of input fields (file informations, fields read) |
---|
| 39 | |
---|
| 40 | !! * Substitutions |
---|
[12377] | 41 | # include "do_loop_substitute.h90" |
---|
[888] | 42 | !!---------------------------------------------------------------------- |
---|
[10068] | 43 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[1156] | 44 | !! $Id$ |
---|
[10068] | 45 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[888] | 46 | !!---------------------------------------------------------------------- |
---|
| 47 | CONTAINS |
---|
| 48 | |
---|
| 49 | SUBROUTINE sbc_flx( kt ) |
---|
| 50 | !!--------------------------------------------------------------------- |
---|
| 51 | !! *** ROUTINE sbc_flx *** |
---|
| 52 | !! |
---|
| 53 | !! ** Purpose : provide at each time step the surface ocean fluxes |
---|
| 54 | !! (momentum, heat, freshwater and runoff) |
---|
| 55 | !! |
---|
| 56 | !! ** Method : - READ each fluxes in NetCDF files: |
---|
| 57 | !! i-component of the stress utau (N/m2) |
---|
| 58 | !! j-component of the stress vtau (N/m2) |
---|
| 59 | !! net downward heat flux qtot (watt/m2) |
---|
| 60 | !! net downward radiative flux qsr (watt/m2) |
---|
| 61 | !! net upward freshwater (evapo - precip) emp (kg/m2/s) |
---|
[13485] | 62 | !! salt flux sfx (pss*dh*rho/dt => g/m2/s) |
---|
[888] | 63 | !! |
---|
| 64 | !! CAUTION : - never mask the surface stress fields |
---|
[3625] | 65 | !! - the stress is assumed to be in the (i,j) mesh referential |
---|
[888] | 66 | !! |
---|
| 67 | !! ** Action : update at each time-step |
---|
[1695] | 68 | !! - utau, vtau i- and j-component of the wind stress |
---|
| 69 | !! - taum wind stress module at T-point |
---|
| 70 | !! - wndm 10m wind module at T-point |
---|
[3625] | 71 | !! - qns non solar heat flux including heat flux due to emp |
---|
| 72 | !! - qsr solar heat flux |
---|
| 73 | !! - emp upward mass flux (evap. - precip.) |
---|
| 74 | !! - sfx salt flux; set to zero at nit000 but possibly non-zero |
---|
[13485] | 75 | !! if ice |
---|
[888] | 76 | !!---------------------------------------------------------------------- |
---|
| 77 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
| 78 | !! |
---|
[1695] | 79 | INTEGER :: ji, jj, jf ! dummy indices |
---|
| 80 | INTEGER :: ierror ! return error code |
---|
[4147] | 81 | INTEGER :: ios ! Local integer output status for namelist read |
---|
[1695] | 82 | REAL(wp) :: zfact ! temporary scalar |
---|
| 83 | REAL(wp) :: zrhoa = 1.22 ! Air density kg/m3 |
---|
| 84 | REAL(wp) :: zcdrag = 1.5e-3 ! drag coefficient |
---|
| 85 | REAL(wp) :: ztx, zty, zmod, zcoef ! temporary variables |
---|
[888] | 86 | !! |
---|
| 87 | CHARACTER(len=100) :: cn_dir ! Root directory for location of flx files |
---|
| 88 | TYPE(FLD_N), DIMENSION(jpfld) :: slf_i ! array of namelist information structures |
---|
[13485] | 89 | TYPE(FLD_N) :: sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp !!, sn_sfx ! informations about the fields to be read |
---|
| 90 | NAMELIST/namsbc_flx/ cn_dir, sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp !!, sn_sfx |
---|
[888] | 91 | !!--------------------------------------------------------------------- |
---|
[2528] | 92 | ! |
---|
| 93 | IF( kt == nit000 ) THEN ! First call kt=nit000 |
---|
[888] | 94 | ! set file information |
---|
[4147] | 95 | READ ( numnam_ref, namsbc_flx, IOSTAT = ios, ERR = 901) |
---|
[11536] | 96 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_flx in reference namelist' ) |
---|
[4147] | 97 | |
---|
| 98 | READ ( numnam_cfg, namsbc_flx, IOSTAT = ios, ERR = 902 ) |
---|
[11536] | 99 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namsbc_flx in configuration namelist' ) |
---|
[4624] | 100 | IF(lwm) WRITE ( numond, namsbc_flx ) |
---|
[2528] | 101 | ! |
---|
| 102 | ! ! check: do we plan to use ln_dm2dc with non-daily forcing? |
---|
[11536] | 103 | IF( ln_dm2dc .AND. sn_qsr%freqh /= 24. ) & |
---|
[2528] | 104 | & CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' ) |
---|
| 105 | ! |
---|
| 106 | ! ! store namelist information in an array |
---|
[888] | 107 | slf_i(jp_utau) = sn_utau ; slf_i(jp_vtau) = sn_vtau |
---|
| 108 | slf_i(jp_qtot) = sn_qtot ; slf_i(jp_qsr ) = sn_qsr |
---|
[13485] | 109 | slf_i(jp_emp ) = sn_emp !! ; slf_i(jp_sfx ) = sn_sfx |
---|
[2528] | 110 | ! |
---|
| 111 | ALLOCATE( sf(jpfld), STAT=ierror ) ! set sf structure |
---|
[1133] | 112 | IF( ierror > 0 ) THEN |
---|
| 113 | CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' ) ; RETURN |
---|
[888] | 114 | ENDIF |
---|
[1200] | 115 | DO ji= 1, jpfld |
---|
[2528] | 116 | ALLOCATE( sf(ji)%fnow(jpi,jpj,1) ) |
---|
| 117 | IF( slf_i(ji)%ln_tint ) ALLOCATE( sf(ji)%fdta(jpi,jpj,1,2) ) |
---|
[1200] | 118 | END DO |
---|
[2528] | 119 | ! ! fill sf with slf_i and control print |
---|
[1133] | 120 | CALL fld_fill( sf, slf_i, cn_dir, 'sbc_flx', 'flux formulation for ocean surface boundary condition', 'namsbc_flx' ) |
---|
[888] | 121 | ! |
---|
| 122 | ENDIF |
---|
| 123 | |
---|
[2528] | 124 | CALL fld_read( kt, nn_fsbc, sf ) ! input fields provided at the current time-step |
---|
| 125 | |
---|
| 126 | IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN ! update ocean fluxes at each SBC frequency |
---|
[888] | 127 | |
---|
[13485] | 128 | IF( ln_dm2dc ) THEN ! modify now Qsr to include the diurnal cycle |
---|
[13491] | 129 | qsr(:,:) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(ji,jj,1) |
---|
[13485] | 130 | ELSE |
---|
| 131 | DO_2D( 0, 0, 0, 0 ) |
---|
| 132 | qsr(ji,jj) = sf(jp_qsr)%fnow(ji,jj,1) * tmask(ji,jj,1) |
---|
| 133 | END_2D |
---|
[2528] | 134 | ENDIF |
---|
[13497] | 135 | DO_2D( 0, 0, 0, 0 ) ! set the ocean fluxes from read fields |
---|
[13485] | 136 | utau(ji,jj) = sf(jp_utau)%fnow(ji,jj,1) * umask(ji,jj,1) |
---|
| 137 | vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj,1) * vmask(ji,jj,1) |
---|
| 138 | qns (ji,jj) = ( sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsr)%fnow(ji,jj,1) ) * tmask(ji,jj,1) |
---|
| 139 | emp (ji,jj) = sf(jp_emp )%fnow(ji,jj,1) * tmask(ji,jj,1) |
---|
| 140 | !!sfx (ji,jj) = sf(jp_sfx )%fnow(ji,jj,1) * tmask(ji,jj,1) |
---|
[12377] | 141 | END_2D |
---|
[3625] | 142 | ! ! add to qns the heat due to e-p |
---|
[13485] | 143 | !!clem: I do not think it is needed |
---|
| 144 | !!qns(:,:) = qns(:,:) - emp(:,:) * sst_m(:,:) * rcp ! mass flux is at SST |
---|
[3625] | 145 | ! |
---|
[13485] | 146 | ! clem: without these lbc calls, it seems that the northfold is not ok (true in 3.6, not sure in 4.x) |
---|
| 147 | CALL lbc_lnk_multi( 'sbcflx', utau, 'U', -1._wp, vtau, 'V', -1._wp, & |
---|
| 148 | & qns, 'T', 1._wp, emp , 'T', 1._wp, qsr, 'T', 1._wp ) !! sfx, 'T', 1._wp ) |
---|
[9727] | 149 | ! |
---|
[2528] | 150 | IF( nitend-nit000 <= 100 .AND. lwp ) THEN ! control print (if less than 100 time-step asked) |
---|
[888] | 151 | WRITE(numout,*) |
---|
[1274] | 152 | WRITE(numout,*) ' read daily momentum, heat and freshwater fluxes OK' |
---|
| 153 | DO jf = 1, jpfld |
---|
| 154 | IF( jf == jp_utau .OR. jf == jp_vtau ) zfact = 1. |
---|
| 155 | IF( jf == jp_qtot .OR. jf == jp_qsr ) zfact = 0.1 |
---|
| 156 | IF( jf == jp_emp ) zfact = 86400. |
---|
| 157 | WRITE(numout,*) |
---|
| 158 | WRITE(numout,*) ' day: ', ndastp , TRIM(sf(jf)%clvar), ' * ', zfact |
---|
| 159 | END DO |
---|
| 160 | ENDIF |
---|
| 161 | ! |
---|
[888] | 162 | ENDIF |
---|
[13485] | 163 | ! ! module of wind stress and wind speed at T-point |
---|
| 164 | ! Note the use of 0.5*(2-umask) in order to unmask the stress along coastlines |
---|
| 165 | zcoef = 1. / ( zrhoa * zcdrag ) |
---|
| 166 | DO_2D( 0, 0, 0, 0 ) |
---|
| 167 | ztx = ( utau(ji-1,jj ) + utau(ji,jj) ) * 0.5_wp * ( 2._wp - MIN( umask(ji-1,jj ,1), umask(ji,jj,1) ) ) |
---|
| 168 | zty = ( vtau(ji ,jj-1) + vtau(ji,jj) ) * 0.5_wp * ( 2._wp - MIN( vmask(ji ,jj-1,1), vmask(ji,jj,1) ) ) |
---|
| 169 | zmod = 0.5_wp * SQRT( ztx * ztx + zty * zty ) * tmask(ji,jj,1) |
---|
| 170 | taum(ji,jj) = zmod |
---|
| 171 | wndm(ji,jj) = SQRT( zmod * zcoef ) !!clem: not used? |
---|
| 172 | END_2D |
---|
[888] | 173 | ! |
---|
[13485] | 174 | CALL lbc_lnk_multi( 'sbcflx', taum, 'T', 1._wp, wndm, 'T', 1._wp ) |
---|
| 175 | ! |
---|
[888] | 176 | END SUBROUTINE sbc_flx |
---|
| 177 | |
---|
| 178 | !!====================================================================== |
---|
| 179 | END MODULE sbcflx |
---|