[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 |
---|
| 19 | USE fldread ! read input fields |
---|
| 20 | USE iom ! IOM library |
---|
| 21 | USE in_out_manager ! I/O manager |
---|
| 22 | USE lib_mpp ! distribued memory computing library |
---|
| 23 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
| 24 | |
---|
| 25 | IMPLICIT NONE |
---|
| 26 | PRIVATE |
---|
| 27 | |
---|
| 28 | PUBLIC sbc_flx ! routine called by step.F90 |
---|
| 29 | |
---|
| 30 | INTEGER , PARAMETER :: jpfld = 5 ! maximum number of files to read |
---|
| 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 |
---|
| 36 | TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf ! structure of input fields (file informations, fields read) |
---|
| 37 | |
---|
| 38 | !! * Substitutions |
---|
| 39 | # include "domzgr_substitute.h90" |
---|
[1029] | 40 | # include "vectopt_loop_substitute.h90" |
---|
[888] | 41 | !!---------------------------------------------------------------------- |
---|
[2528] | 42 | !! NEMO/OPA 3.3 , NEMO-consortium (2010) |
---|
[1156] | 43 | !! $Id$ |
---|
[2715] | 44 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[888] | 45 | !!---------------------------------------------------------------------- |
---|
| 46 | CONTAINS |
---|
| 47 | |
---|
| 48 | SUBROUTINE sbc_flx( kt ) |
---|
| 49 | !!--------------------------------------------------------------------- |
---|
| 50 | !! *** ROUTINE sbc_flx *** |
---|
| 51 | !! |
---|
| 52 | !! ** Purpose : provide at each time step the surface ocean fluxes |
---|
| 53 | !! (momentum, heat, freshwater and runoff) |
---|
| 54 | !! |
---|
| 55 | !! ** Method : - READ each fluxes in NetCDF files: |
---|
| 56 | !! i-component of the stress utau (N/m2) |
---|
| 57 | !! j-component of the stress vtau (N/m2) |
---|
| 58 | !! net downward heat flux qtot (watt/m2) |
---|
| 59 | !! net downward radiative flux qsr (watt/m2) |
---|
| 60 | !! net upward freshwater (evapo - precip) emp (kg/m2/s) |
---|
| 61 | !! |
---|
| 62 | !! CAUTION : - never mask the surface stress fields |
---|
[3625] | 63 | !! - the stress is assumed to be in the (i,j) mesh referential |
---|
[888] | 64 | !! |
---|
| 65 | !! ** Action : update at each time-step |
---|
[1695] | 66 | !! - utau, vtau i- and j-component of the wind stress |
---|
| 67 | !! - taum wind stress module at T-point |
---|
| 68 | !! - wndm 10m wind module at T-point |
---|
[3625] | 69 | !! - qns non solar heat flux including heat flux due to emp |
---|
| 70 | !! - qsr solar heat flux |
---|
| 71 | !! - emp upward mass flux (evap. - precip.) |
---|
| 72 | !! - sfx salt flux; set to zero at nit000 but possibly non-zero |
---|
| 73 | !! if ice is present (computed in limsbc(_2).F90) |
---|
[888] | 74 | !!---------------------------------------------------------------------- |
---|
| 75 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
| 76 | !! |
---|
[1695] | 77 | INTEGER :: ji, jj, jf ! dummy indices |
---|
| 78 | INTEGER :: ierror ! return error code |
---|
| 79 | REAL(wp) :: zfact ! temporary scalar |
---|
| 80 | REAL(wp) :: zrhoa = 1.22 ! Air density kg/m3 |
---|
| 81 | REAL(wp) :: zcdrag = 1.5e-3 ! drag coefficient |
---|
| 82 | REAL(wp) :: ztx, zty, zmod, zcoef ! temporary variables |
---|
[888] | 83 | !! |
---|
| 84 | CHARACTER(len=100) :: cn_dir ! Root directory for location of flx files |
---|
| 85 | TYPE(FLD_N), DIMENSION(jpfld) :: slf_i ! array of namelist information structures |
---|
| 86 | TYPE(FLD_N) :: sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp ! informations about the fields to be read |
---|
| 87 | NAMELIST/namsbc_flx/ cn_dir, sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp |
---|
| 88 | !!--------------------------------------------------------------------- |
---|
[2528] | 89 | ! |
---|
| 90 | IF( kt == nit000 ) THEN ! First call kt=nit000 |
---|
[888] | 91 | ! set file information |
---|
| 92 | cn_dir = './' ! directory in which the model is executed |
---|
| 93 | ! ... default values (NB: frequency positive => hours, negative => months) |
---|
[2528] | 94 | ! ! file ! frequency ! variable ! time intep ! clim ! 'yearly' or ! weights ! rotation ! |
---|
| 95 | ! ! name ! (hours) ! name ! (T/F) ! (T/F) ! 'monthly' ! filename ! pairs ! |
---|
| 96 | sn_utau = FLD_N( 'utau' , 24 , 'utau' , .false. , .false. , 'yearly' , '' , '' ) |
---|
| 97 | sn_vtau = FLD_N( 'vtau' , 24 , 'vtau' , .false. , .false. , 'yearly' , '' , '' ) |
---|
| 98 | sn_qtot = FLD_N( 'qtot' , 24 , 'qtot' , .false. , .false. , 'yearly' , '' , '' ) |
---|
| 99 | sn_qsr = FLD_N( 'qsr' , 24 , 'qsr' , .false. , .false. , 'yearly' , '' , '' ) |
---|
| 100 | sn_emp = FLD_N( 'emp' , 24 , 'emp' , .false. , .false. , 'yearly' , '' , '' ) |
---|
| 101 | ! |
---|
| 102 | REWIND ( numnam ) ! read in namlist namflx |
---|
[888] | 103 | READ ( numnam, namsbc_flx ) |
---|
[2528] | 104 | ! |
---|
| 105 | ! ! check: do we plan to use ln_dm2dc with non-daily forcing? |
---|
| 106 | IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 ) & |
---|
| 107 | & CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' ) |
---|
| 108 | ! |
---|
| 109 | ! ! store namelist information in an array |
---|
[888] | 110 | slf_i(jp_utau) = sn_utau ; slf_i(jp_vtau) = sn_vtau |
---|
| 111 | slf_i(jp_qtot) = sn_qtot ; slf_i(jp_qsr ) = sn_qsr |
---|
| 112 | slf_i(jp_emp ) = sn_emp |
---|
[2528] | 113 | ! |
---|
| 114 | ALLOCATE( sf(jpfld), STAT=ierror ) ! set sf structure |
---|
[1133] | 115 | IF( ierror > 0 ) THEN |
---|
| 116 | CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' ) ; RETURN |
---|
[888] | 117 | ENDIF |
---|
[1200] | 118 | DO ji= 1, jpfld |
---|
[2528] | 119 | ALLOCATE( sf(ji)%fnow(jpi,jpj,1) ) |
---|
| 120 | IF( slf_i(ji)%ln_tint ) ALLOCATE( sf(ji)%fdta(jpi,jpj,1,2) ) |
---|
[1200] | 121 | END DO |
---|
[2528] | 122 | ! ! fill sf with slf_i and control print |
---|
[1133] | 123 | CALL fld_fill( sf, slf_i, cn_dir, 'sbc_flx', 'flux formulation for ocean surface boundary condition', 'namsbc_flx' ) |
---|
[888] | 124 | ! |
---|
[3625] | 125 | sfx(:,:) = 0.0_wp ! salt flux due to freezing/melting (non-zero only if ice is present; set in limsbc(_2).F90) |
---|
| 126 | ! |
---|
[888] | 127 | ENDIF |
---|
| 128 | |
---|
[2528] | 129 | CALL fld_read( kt, nn_fsbc, sf ) ! input fields provided at the current time-step |
---|
| 130 | |
---|
| 131 | IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN ! update ocean fluxes at each SBC frequency |
---|
[888] | 132 | |
---|
[2528] | 133 | IF( ln_dm2dc ) THEN ; qsr(:,:) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) ! modify now Qsr to include the diurnal cycle |
---|
| 134 | ELSE ; qsr(:,:) = sf(jp_qsr)%fnow(:,:,1) |
---|
| 135 | ENDIF |
---|
[888] | 136 | !CDIR COLLAPSE |
---|
[2528] | 137 | DO jj = 1, jpj ! set the ocean fluxes from read fields |
---|
[1274] | 138 | DO ji = 1, jpi |
---|
[2528] | 139 | utau(ji,jj) = sf(jp_utau)%fnow(ji,jj,1) |
---|
| 140 | vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj,1) |
---|
| 141 | qns (ji,jj) = sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsr)%fnow(ji,jj,1) |
---|
| 142 | emp (ji,jj) = sf(jp_emp )%fnow(ji,jj,1) |
---|
[1274] | 143 | END DO |
---|
[888] | 144 | END DO |
---|
[3625] | 145 | ! ! add to qns the heat due to e-p |
---|
| 146 | qns(:,:) = qns(:,:) - emp(:,:) * sst_m(:,:) * rcp ! mass flux is at SST |
---|
| 147 | ! |
---|
[2528] | 148 | ! ! module of wind stress and wind speed at T-point |
---|
| 149 | zcoef = 1. / ( zrhoa * zcdrag ) |
---|
[1695] | 150 | !CDIR NOVERRCHK |
---|
| 151 | DO jj = 2, jpjm1 |
---|
| 152 | !CDIR NOVERRCHK |
---|
| 153 | DO ji = fs_2, fs_jpim1 ! vect. opt. |
---|
| 154 | ztx = utau(ji-1,jj ) + utau(ji,jj) |
---|
| 155 | zty = vtau(ji ,jj-1) + vtau(ji,jj) |
---|
| 156 | zmod = 0.5 * SQRT( ztx * ztx + zty * zty ) |
---|
| 157 | taum(ji,jj) = zmod |
---|
| 158 | wndm(ji,jj) = SQRT( zmod * zcoef ) |
---|
| 159 | END DO |
---|
| 160 | END DO |
---|
| 161 | CALL lbc_lnk( taum(:,:), 'T', 1. ) ; CALL lbc_lnk( wndm(:,:), 'T', 1. ) |
---|
| 162 | |
---|
[2528] | 163 | IF( nitend-nit000 <= 100 .AND. lwp ) THEN ! control print (if less than 100 time-step asked) |
---|
[888] | 164 | WRITE(numout,*) |
---|
[1274] | 165 | WRITE(numout,*) ' read daily momentum, heat and freshwater fluxes OK' |
---|
| 166 | DO jf = 1, jpfld |
---|
| 167 | IF( jf == jp_utau .OR. jf == jp_vtau ) zfact = 1. |
---|
| 168 | IF( jf == jp_qtot .OR. jf == jp_qsr ) zfact = 0.1 |
---|
| 169 | IF( jf == jp_emp ) zfact = 86400. |
---|
| 170 | WRITE(numout,*) |
---|
| 171 | WRITE(numout,*) ' day: ', ndastp , TRIM(sf(jf)%clvar), ' * ', zfact |
---|
| 172 | CALL prihre( sf(jf)%fnow, jpi, jpj, 1, jpi, 20, 1, jpj, 10, zfact, numout ) |
---|
| 173 | END DO |
---|
| 174 | CALL FLUSH(numout) |
---|
| 175 | ENDIF |
---|
| 176 | ! |
---|
[888] | 177 | ENDIF |
---|
| 178 | ! |
---|
| 179 | END SUBROUTINE sbc_flx |
---|
| 180 | |
---|
| 181 | !!====================================================================== |
---|
| 182 | END MODULE sbcflx |
---|