Changeset 2112
- Timestamp:
- 2010-09-22T16:14:55+02:00 (14 years ago)
- Location:
- branches/DEV_r1837_MLF/NEMO/OPA_SRC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DEV_r1837_MLF/NEMO/OPA_SRC/DIA/diahsb.F90
r2109 r2112 23 23 24 24 !! * Routine accessibility 25 PUBLIC dia_hsb ! routine called by step.F9026 25 PUBLIC dia_hsb ! routine called by step.F90 26 PUBLIC dia_hsb_init ! routine called by opa.F90 27 27 28 28 !! * Module variables 29 29 INTEGER :: num ! 30 30 REAL(dp) :: surf_tot , vol_tot ! 31 REAL(dp) :: frc_t , frc_s , frc_v! global forcing trends31 REAL(dp) :: frc_t , frc_s , frc_v ! global forcing trends 32 32 REAL(dp) :: fact1 ! conversion factors 33 REAL(dp) :: fact21 , fact22 ! - -34 REAL(dp) :: fact31 , fact32 ! - -35 REAL(dp), DIMENSION(:,:) , ALLOCATABLE :: surf , ssh_ini !33 REAL(dp) :: fact21 , fact22 ! - - 34 REAL(dp) :: fact31 , fact32 ! - - 35 REAL(dp), DIMENSION(:,:) , ALLOCATABLE :: surf , ssh_ini ! 36 36 REAL(dp), DIMENSION(:,:,:), ALLOCATABLE :: hc_loc_ini, sc_loc_ini, e3t_ini ! 37 37 … … 63 63 INTEGER, INTENT(in) :: kt ! ocean time-step index 64 64 !! 65 CHARACTER (len=32) :: s_name ! output file name 66 INTEGER :: jk ! dummy loop indice 67 INTEGER :: ierror ! local integer 65 INTEGER :: jk ! dummy loop indice 68 66 REAL(dp) :: zdiff_hc , zdiff_sc ! heat and salt content variations 69 67 REAL(dp) :: zdiff_v1 , zdiff_v2 ! volume variation … … 74 72 !!--------------------------------------------------------------------------- 75 73 76 ! ! =================== ! 77 IF( kt == nit000 ) THEN ! 1 - Initialisations ! 78 ! ! =================== ! 79 80 ! 1.0 - Allocate memory 81 ! --------------------- 82 ALLOCATE( hc_loc_ini(jpi,jpj,jpk), STAT=ierror ) 83 IF( ierror > 0 ) THEN 84 CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' ) ; RETURN 85 ENDIF 86 ALLOCATE( sc_loc_ini(jpi,jpj,jpk), STAT=ierror ) 87 IF( ierror > 0 ) THEN 88 CALL ctl_stop( 'dia_hsb: unable to allocate sc_loc_ini' ) ; RETURN 89 ENDIF 90 ALLOCATE( e3t_ini(jpi,jpj,jpk) , STAT=ierror ) 91 IF( ierror > 0 ) THEN 92 CALL ctl_stop( 'dia_hsb: unable to allocate e3t_ini' ) ; RETURN 93 ENDIF 94 ALLOCATE( surf(jpi,jpj) , STAT=ierror ) 95 IF( ierror > 0 ) THEN 96 CALL ctl_stop( 'dia_hsb: unable to allocate surf' ) ; RETURN 97 ENDIF 98 ALLOCATE( ssh_ini(jpi,jpj) , STAT=ierror ) 99 IF( ierror > 0 ) THEN 100 CALL ctl_stop( 'dia_hsb: unable to allocate ssh_ini' ) ; RETURN 101 ENDIF 102 103 ! 1.1 - Time independant variables and file opening 104 ! ------------------------------------------------- 105 WRITE(numout,*) "dia_hsb: heat salt volume budgets activated" 106 WRITE(numout,*) "~~~~~~~ output written in the 'heat_salt_volume_budgets.txt' ASCII file" 107 IF( lk_obc .OR. lk_bdy) THEN 108 CALL ctl_warn( 'dia_hsb does not take open boundary fluxes into account' ) 109 ENDIF 110 s_name = 'heat_salt_volume_budgets.txt' ! name of output file 111 surf(:,:) = e1t(:,:) * e2t(:,:) * tmask(:,:,1) * tmask_i(:,:) ! masked surface grid cell area 112 surf_tot = SUM( surf(:,:) ) ! total ocean surface area 113 vol_tot = 0.d0 ! total ocean volume 114 DO jk = 1, jpkm1 115 vol_tot = vol_tot + SUM( surf(:,:) * tmask(:,:,jk) & 116 & * fse3t_n(:,:,jk) ) 117 ENDDO 118 IF( lk_mpp ) THEN 119 CALL mpp_sum( vol_tot ) 120 CALL mpp_sum( surf_tot ) 121 ENDIF 122 123 CALL ctl_opn( num , s_name , 'UNKNOWN' , 'FORMATTED' , 'SEQUENTIAL' , 1 , numout , lwp , 1 ) 124 ! 12345678901234567890123456789012345678901234567890123456789012345678901234567890 -> 80 125 WRITE( num, 9010 ) "kt | heat content budget | salt content budget ", & 126 ! 123456789012345678901234567890123456789012345 -> 45 127 & "| volume budget (ssh) ", & 128 ! 678901234567890123456789012345678901234567890 -> 45 129 & "| volume budget (e3t) " 130 WRITE( num, 9010 ) " | [C] [W/m2] | [psu] [mmm/s] [SV] ", & 131 & "| [m3] [mmm/s] [SV] ", & 132 & "| [m3] [mmm/s] [SV] " 133 134 ! 1.2 - Conversions (factors will be multiplied by duration afterwards) 135 ! ----------------- 136 ! heat content variation => equivalent heat flux: 137 fact1 = rau0 * rcp / surf_tot ! [C*m3] -> [W/m2] 138 ! salt content variation => equivalent EMP and equivalent "flow": 139 fact21 = 1.e3 / ( soce * surf_tot ) ! [psu*m3] -> [mm/s] 140 fact22 = 1.e-6 / soce ! [psu*m3] -> [Sv] 141 ! volume variation => equivalent EMP and equivalent "flow": 142 fact31 = 1.e3 / surf_tot ! [m3] -> [mm/s] 143 fact32 = 1.e-6 ! [m3] -> [SV] 144 145 ! 1.3 - initial conservation variables 146 ! ------------------------------------ 147 ssh_ini(:,:) = sshn(:,:) ! initial ssh 148 DO jk = 1, jpk 149 e3t_ini (:,:,jk) = fse3t_n(:,:,jk) ! initial vertical scale factors 150 hc_loc_ini(:,:,jk) = tn(:,:,jk) * fse3t_n(:,:,jk) ! initial heat content 151 sc_loc_ini(:,:,jk) = sn(:,:,jk) * fse3t_n(:,:,jk) ! initial salt content 152 END DO 153 frc_v = 0.d0 ! volume trend due to forcing 154 frc_t = 0.d0 ! heat content " " " " 155 frc_s = 0.d0 ! salt content " " " " 156 157 ! ! ====================================================================== ! 158 ELSE ! 2 - Heat content, salt content and volume variations: curent - initial ! 159 ! ! ====================================================================== ! 160 161 ! 2.1 - Trends due to forcing 162 ! --------------------------- 163 z1_rau0 = 1.e0 / rau0 164 z_frc_trd_v = z1_rau0 * SUM( - emp(:,:) * surf(:,:) ) ! volume fluxes 165 z_frc_trd_t = SUM( sbc_hc_n(:,:) * surf(:,:) ) ! heat fluxes 166 z_frc_trd_s = SUM( sbc_sc_n(:,:) * surf(:,:) ) ! salt fluxes 167 ! Add penetrative solar radiation 168 IF( ln_traqsr ) z_frc_trd_t = z_frc_trd_t + ro0cpr * SUM( qsr (:,:) * surf(:,:) ) 169 ! Add geothermal heat flux 170 IF( lk_trabbc ) z_frc_trd_t = z_frc_trd_t + ro0cpr * SUM( qgh_trd0(:,:) * surf(:,:) ) 171 IF( lk_mpp ) THEN 172 CALL mpp_sum( z_frc_trd_v ) 173 CALL mpp_sum( z_frc_trd_t ) 174 ENDIF 175 frc_v = frc_v + z_frc_trd_v * rdt 176 frc_t = frc_t + z_frc_trd_t * rdt 177 frc_s = frc_s + z_frc_trd_s * rdt 178 179 ! 2.2 - Content variations 180 ! ------------------------- 181 zdiff_v2 = 0.d0 182 zdiff_hc = 0.d0 183 zdiff_sc = 0.d0 184 ! volume variation (calculated with ssh) 185 zdiff_v1 = SUM( surf(:,:) * tmask(:,:,1) * ( sshn(:,:) - ssh_ini(:,:) ) ) 186 DO jk = 1, jpkm1 187 ! volume variation (calculated with scale factors) 188 zdiff_v2 = zdiff_v2 + SUM( surf(:,:) * tmask(:,:,jk) & 189 & * ( fse3t_n(:,:,jk) & 190 & - e3t_ini(:,:,jk) ) ) 191 ! heat content variation 192 zdiff_hc = zdiff_hc + SUM( surf(:,:) * tmask(:,:,jk) & 193 & * ( fse3t_n(:,:,jk) * tn(:,:,jk) & 194 & - hc_loc_ini(:,:,jk) ) ) 195 ! salt content variation 196 zdiff_sc = zdiff_sc + SUM( surf(:,:) * tmask(:,:,jk) & 197 & * ( fse3t_n(:,:,jk) * sn(:,:,jk) & 198 & - sc_loc_ini(:,:,jk) ) ) 199 ENDDO 200 201 IF( lk_mpp ) THEN 202 CALL mpp_sum( zdiff_hc ) 203 CALL mpp_sum( zdiff_sc ) 204 CALL mpp_sum( zdiff_v1 ) 205 CALL mpp_sum( zdiff_v2 ) 206 ENDIF 207 208 ! Substract sbc fluxes from heat content, salt content and volume variations 209 zdiff_v1 = zdiff_v1 - frc_v 210 zdiff_v2 = zdiff_v2 - frc_v 211 zdiff_hc = zdiff_hc - frc_t 212 zdiff_sc = zdiff_sc - frc_s 213 214 ! 2.3 - Diagnostics writing 215 ! ------------------------- 216 ! heat salt and volume budgets 217 zdeltat = 1.e0 / ( ( kt - nit000 + 1 ) * rdt ) 218 WRITE(num , 9020) kt , zdiff_hc / vol_tot , zdiff_hc * fact1 * zdeltat, & 219 & zdiff_sc / vol_tot , zdiff_sc * fact21 * zdeltat, zdiff_sc * fact22 * zdeltat, & 220 & zdiff_v1 , zdiff_v1 * fact31 * zdeltat, zdiff_v1 * fact32 * zdeltat, & 221 & zdiff_v2 , zdiff_v2 * fact31 * zdeltat, zdiff_v2 * fact32 * zdeltat 222 ENDIF 74 ! ------------------------- ! 75 ! 1 - Trends due to forcing ! 76 ! ------------------------- ! 77 z1_rau0 = 1.e0 / rau0 78 z_frc_trd_v = z1_rau0 * SUM( - emp(:,:) * surf(:,:) ) ! volume fluxes 79 z_frc_trd_t = SUM( sbc_hc_n(:,:) * surf(:,:) ) ! heat fluxes 80 z_frc_trd_s = SUM( sbc_sc_n(:,:) * surf(:,:) ) ! salt fluxes 81 ! Add penetrative solar radiation 82 IF( ln_traqsr ) z_frc_trd_t = z_frc_trd_t + ro0cpr * SUM( qsr (:,:) * surf(:,:) ) 83 ! Add geothermal heat flux 84 IF( lk_trabbc ) z_frc_trd_t = z_frc_trd_t + ro0cpr * SUM( qgh_trd0(:,:) * surf(:,:) ) 85 IF( lk_mpp ) THEN 86 CALL mpp_sum( z_frc_trd_v ) 87 CALL mpp_sum( z_frc_trd_t ) 88 ENDIF 89 frc_v = frc_v + z_frc_trd_v * rdt 90 frc_t = frc_t + z_frc_trd_t * rdt 91 frc_s = frc_s + z_frc_trd_s * rdt 92 93 ! ----------------------- ! 94 ! 2 - Content variations ! 95 ! ----------------------- ! 96 zdiff_v2 = 0.d0 97 zdiff_hc = 0.d0 98 zdiff_sc = 0.d0 99 ! volume variation (calculated with ssh) 100 zdiff_v1 = SUM( surf(:,:) * tmask(:,:,1) * ( sshn(:,:) - ssh_ini(:,:) ) ) 101 DO jk = 1, jpkm1 102 ! volume variation (calculated with scale factors) 103 zdiff_v2 = zdiff_v2 + SUM( surf(:,:) * tmask(:,:,jk) & 104 & * ( fse3t_n(:,:,jk) & 105 & - e3t_ini(:,:,jk) ) ) 106 ! heat content variation 107 zdiff_hc = zdiff_hc + SUM( surf(:,:) * tmask(:,:,jk) & 108 & * ( fse3t_n(:,:,jk) * tn(:,:,jk) & 109 & - hc_loc_ini(:,:,jk) ) ) 110 ! salt content variation 111 zdiff_sc = zdiff_sc + SUM( surf(:,:) * tmask(:,:,jk) & 112 & * ( fse3t_n(:,:,jk) * sn(:,:,jk) & 113 & - sc_loc_ini(:,:,jk) ) ) 114 ENDDO 115 116 IF( lk_mpp ) THEN 117 CALL mpp_sum( zdiff_hc ) 118 CALL mpp_sum( zdiff_sc ) 119 CALL mpp_sum( zdiff_v1 ) 120 CALL mpp_sum( zdiff_v2 ) 121 ENDIF 122 123 ! Substract forcing from heat content, salt content and volume variations 124 zdiff_v1 = zdiff_v1 - frc_v 125 zdiff_v2 = zdiff_v2 - frc_v 126 zdiff_hc = zdiff_hc - frc_t 127 zdiff_sc = zdiff_sc - frc_s 128 129 ! ----------------------- ! 130 ! 3 - Diagnostics writing ! 131 ! ----------------------- ! 132 zdeltat = 1.e0 / ( ( kt - nit000 + 1 ) * rdt ) 133 WRITE(num , 9020) kt , zdiff_hc / vol_tot , zdiff_hc * fact1 * zdeltat, & 134 & zdiff_sc / vol_tot , zdiff_sc * fact21 * zdeltat, zdiff_sc * fact22 * zdeltat, & 135 & zdiff_v1 , zdiff_v1 * fact31 * zdeltat, zdiff_v1 * fact32 * zdeltat, & 136 & zdiff_v2 , zdiff_v2 * fact31 * zdeltat, zdiff_v2 * fact32 * zdeltat 223 137 224 138 IF ( kt == nitend ) CLOSE( num ) 225 139 140 9020 FORMAT(I5,11D15.7) 141 142 END SUBROUTINE dia_hsb 143 144 145 SUBROUTINE dia_hsb_init 146 !!--------------------------------------------------------------------------- 147 !! *** ROUTINE dia_hsb *** 148 !! 149 !! ** Purpose: Initialization for the heat salt volume budgets 150 !! 151 !! ** Method : Compute initial heat content, salt content and volume 152 !! 153 !! ** Action : - Compute initial heat content, salt content and volume 154 !! - Initialize forcing trends 155 !! - Compute coefficients for conversion 156 !!--------------------------------------------------------------------------- 157 CHARACTER (len=32) :: s_name ! output file name 158 INTEGER :: jk ! dummy loop indice 159 INTEGER :: ierror ! local integer 160 !!--------------------------------------------------------------------------- 161 162 ! ------------------- ! 163 ! 1 - Allocate memory ! 164 ! ------------------- ! 165 ALLOCATE( hc_loc_ini(jpi,jpj,jpk), STAT=ierror ) 166 IF( ierror > 0 ) THEN 167 CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' ) ; RETURN 168 ENDIF 169 ALLOCATE( sc_loc_ini(jpi,jpj,jpk), STAT=ierror ) 170 IF( ierror > 0 ) THEN 171 CALL ctl_stop( 'dia_hsb: unable to allocate sc_loc_ini' ) ; RETURN 172 ENDIF 173 ALLOCATE( e3t_ini(jpi,jpj,jpk) , STAT=ierror ) 174 IF( ierror > 0 ) THEN 175 CALL ctl_stop( 'dia_hsb: unable to allocate e3t_ini' ) ; RETURN 176 ENDIF 177 ALLOCATE( surf(jpi,jpj) , STAT=ierror ) 178 IF( ierror > 0 ) THEN 179 CALL ctl_stop( 'dia_hsb: unable to allocate surf' ) ; RETURN 180 ENDIF 181 ALLOCATE( ssh_ini(jpi,jpj) , STAT=ierror ) 182 IF( ierror > 0 ) THEN 183 CALL ctl_stop( 'dia_hsb: unable to allocate ssh_ini' ) ; RETURN 184 ENDIF 185 186 ! ----------------------------------------------- ! 187 ! 2 - Time independant variables and file opening ! 188 ! ----------------------------------------------- ! 189 WRITE(numout,*) "dia_hsb: heat salt volume budgets activated" 190 WRITE(numout,*) "~~~~~~~ output written in the 'heat_salt_volume_budgets.txt' ASCII file" 191 IF( lk_obc .OR. lk_bdy) THEN 192 CALL ctl_warn( 'dia_hsb does not take open boundary fluxes into account' ) 193 ENDIF 194 s_name = 'heat_salt_volume_budgets.txt' ! name of output file 195 surf(:,:) = e1t(:,:) * e2t(:,:) * tmask(:,:,1) * tmask_i(:,:) ! masked surface grid cell area 196 surf_tot = SUM( surf(:,:) ) ! total ocean surface area 197 vol_tot = 0.d0 ! total ocean volume 198 DO jk = 1, jpkm1 199 vol_tot = vol_tot + SUM( surf(:,:) * tmask(:,:,jk) & 200 & * fse3t_n(:,:,jk) ) 201 ENDDO 202 IF( lk_mpp ) THEN 203 CALL mpp_sum( vol_tot ) 204 CALL mpp_sum( surf_tot ) 205 ENDIF 206 207 CALL ctl_opn( num , s_name , 'UNKNOWN' , 'FORMATTED' , 'SEQUENTIAL' , 1 , numout , lwp , 1 ) 208 ! 12345678901234567890123456789012345678901234567890123456789012345678901234567890 -> 80 209 WRITE( num, 9010 ) "kt | heat content budget | salt content budget ", & 210 ! 123456789012345678901234567890123456789012345 -> 45 211 & "| volume budget (ssh) ", & 212 ! 678901234567890123456789012345678901234567890 -> 45 213 & "| volume budget (e3t) " 214 WRITE( num, 9010 ) " | [C] [W/m2] | [psu] [mmm/s] [SV] ", & 215 & "| [m3] [mmm/s] [SV] ", & 216 & "| [m3] [mmm/s] [SV] " 217 218 ! --------------- ! 219 ! 3 - Conversions ! (factors will be multiplied by duration afterwards) 220 ! --------------- ! 221 222 ! heat content variation => equivalent heat flux: 223 fact1 = rau0 * rcp / surf_tot ! [C*m3] -> [W/m2] 224 ! salt content variation => equivalent EMP and equivalent "flow": 225 fact21 = 1.e3 / ( soce * surf_tot ) ! [psu*m3] -> [mm/s] 226 fact22 = 1.e-6 / soce ! [psu*m3] -> [Sv] 227 ! volume variation => equivalent EMP and equivalent "flow": 228 fact31 = 1.e3 / surf_tot ! [m3] -> [mm/s] 229 fact32 = 1.e-6 ! [m3] -> [SV] 230 231 ! ---------------------------------- ! 232 ! 4 - initial conservation variables ! 233 ! ---------------------------------- ! 234 ssh_ini(:,:) = sshn(:,:) ! initial ssh 235 DO jk = 1, jpk 236 e3t_ini (:,:,jk) = fse3t_n(:,:,jk) ! initial vertical scale factors 237 hc_loc_ini(:,:,jk) = tn(:,:,jk) * fse3t_n(:,:,jk) ! initial heat content 238 sc_loc_ini(:,:,jk) = sn(:,:,jk) * fse3t_n(:,:,jk) ! initial salt content 239 END DO 240 frc_v = 0.d0 ! volume trend due to forcing 241 frc_t = 0.d0 ! heat content - - - - 242 frc_s = 0.d0 ! salt content - - - - 243 ! 226 244 9010 FORMAT(A80,A45,A45) 227 9020 FORMAT(I5,11D15.7) 228 229 END SUBROUTINE dia_hsb 245 ! 246 END SUBROUTINE dia_hsb_init 230 247 231 248 !!====================================================================== -
branches/DEV_r1837_MLF/NEMO/OPA_SRC/opa.F90
r2108 r2112 54 54 USE trdmod ! momentum/tracers trends (trd_mod_init routine) 55 55 USE diaptr ! poleward transports (dia_ptr_init routine) 56 USE diahsb ! heat, salt and volume budgets (dia_hsb_init routine) 56 57 USE step ! OPA time-stepping (stp routine) 57 58 #if defined key_oasis3 … … 279 280 CALL dia_ptr_init ! Poleward TRansports initialization 280 281 CALL trd_mod_init ! Mixed-layer/Vorticity/Integral constraints trends 282 IF(ln_hsb) CALL dia_hsb_init ! heat content, salt content and volume budgets 281 283 ! 282 284 END SUBROUTINE opa_init
Note: See TracChangeset
for help on using the changeset viewer.