- Timestamp:
- 2019-09-20T17:28:02+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2019/dev_r11265_ASINTER-01_Guillaume_ABL1D/src/ICE/icectl.F90
r11413 r11586 12 12 !! 'key_si3' SI3 sea-ice model 13 13 !!---------------------------------------------------------------------- 14 !! ice_cons_hsm : conservation tests on heat, salt and mass 15 !! ice_cons_final : conservation tests on heat, salt and mass at end of time step 14 !! ice_cons_hsm : conservation tests on heat, salt and mass during a time step (global) 15 !! ice_cons_final : conservation tests on heat, salt and mass at end of time step (global) 16 !! ice_cons2D : conservation tests on heat, salt and mass at each gridcell 16 17 !! ice_ctl : control prints in case of crash 17 18 !! ice_prt : control prints at a given grid point … … 27 28 ! 28 29 USE in_out_manager ! I/O manager 30 USE iom ! I/O manager library 29 31 USE lib_mpp ! MPP library 30 32 USE lib_fortran ! fortran utilities (glob_sum + no signed zero) … … 37 39 PUBLIC ice_cons_hsm 38 40 PUBLIC ice_cons_final 41 PUBLIC ice_cons2D 39 42 PUBLIC ice_ctl 40 43 PUBLIC ice_prt 41 44 PUBLIC ice_prt3D 42 45 46 ! thresold values for conservation 47 ! these values are changed by the namelist parameter rn_icechk, so that threshold = zchk * rn_icechk 48 REAL(wp), PARAMETER :: zchk_m = 1.e-5 ! kg/m2/s <=> 1mm of ice per year spuriously gained/lost 49 REAL(wp), PARAMETER :: zchk_s = 1.e-4 ! g/m2/s <=> 1mm of ice per year spuriously gained/lost (considering s=10g/kg) 50 REAL(wp), PARAMETER :: zchk_t = 3. ! W/m2 <=> 1mm of ice per year spuriously gained/lost (considering Lf=3e5J/kg) 51 43 52 !! * Substitutions 44 53 # include "vectopt_loop_substitute.h90" … … 59 68 !! ** Method : This is an online diagnostics which can be activated with ln_icediachk=true 60 69 !! It prints in ocean.output if there is a violation of conservation at each time-step 61 !! The thresholds (z v_sill, zs_sill, zt_sill) which determine violations are set to70 !! The thresholds (zchk_m, zchk_s, zchk_t) which determine violations are set to 62 71 !! a minimum of 1 mm of ice (over the ice area) that is lost/gained spuriously during 100 years. 63 72 !! For salt and heat thresholds, ice is considered to have a salinity of 10 … … 68 77 REAL(wp) , INTENT(inout) :: pdiag_v, pdiag_s, pdiag_t, pdiag_fv, pdiag_fs, pdiag_ft 69 78 !! 70 REAL(wp) :: z v, zs, zt, zfs, zfv, zft71 REAL(wp) :: zvmin, zamin, zamax, zeimin, zesmin, zsmin79 REAL(wp) :: zdiag_mass, zdiag_salt, zdiag_heat, & 80 & zdiag_vmin, zdiag_amin, zdiag_amax, zdiag_eimin, zdiag_esmin, zdiag_smin 72 81 REAL(wp) :: zvtrp, zetrp 73 REAL(wp) :: zarea, zv_sill, zs_sill, zt_sill 74 REAL(wp), PARAMETER :: zconv = 1.e-9 ! convert W to GW and kg to Mt 82 REAL(wp) :: zarea 75 83 !!------------------------------------------------------------------- 76 84 ! 77 85 IF( icount == 0 ) THEN 78 ! ! water flux 79 pdiag_fv = glob_sum( 'icectl', & 80 & -( wfx_bog(:,:) + wfx_bom(:,:) + wfx_sum(:,:) + wfx_sni(:,:) + & 81 & wfx_opw(:,:) + wfx_res(:,:) + wfx_dyn(:,:) + wfx_lam(:,:) + wfx_pnd(:,:) + & 82 & wfx_snw_sni(:,:) + wfx_snw_sum(:,:) + wfx_snw_dyn(:,:) + wfx_snw_sub(:,:) + & 83 & wfx_ice_sub(:,:) + wfx_spr(:,:) & 84 & ) * e1e2t(:,:) ) * zconv 86 87 pdiag_v = glob_sum( 'icectl', SUM( v_i * rhoi + v_s * rhos, dim=3 ) * e1e2t ) 88 pdiag_s = glob_sum( 'icectl', SUM( sv_i * rhoi , dim=3 ) * e1e2t ) 89 pdiag_t = glob_sum( 'icectl', ( SUM( SUM( e_i, dim=4 ), dim=3 ) + SUM( SUM( e_s, dim=4 ), dim=3 ) ) * e1e2t ) 90 91 ! mass flux 92 pdiag_fv = glob_sum( 'icectl', & 93 & ( wfx_bog + wfx_bom + wfx_sum + wfx_sni + wfx_opw + wfx_res + wfx_dyn + wfx_lam + wfx_pnd + & 94 & wfx_snw_sni + wfx_snw_sum + wfx_snw_dyn + wfx_snw_sub + wfx_ice_sub + wfx_spr ) * e1e2t ) 95 ! salt flux 96 pdiag_fs = glob_sum( 'icectl', & 97 & ( sfx_bri + sfx_bog + sfx_bom + sfx_sum + sfx_sni + & 98 & sfx_opw + sfx_res + sfx_dyn + sfx_sub + sfx_lam ) * e1e2t ) 99 ! heat flux 100 pdiag_ft = glob_sum( 'icectl', & 101 & ( hfx_sum + hfx_bom + hfx_bog + hfx_dif + hfx_opw + hfx_snw & 102 & - hfx_thd - hfx_dyn - hfx_res - hfx_sub - hfx_spr ) * e1e2t ) 103 104 ELSEIF( icount == 1 ) THEN 105 106 ! -- mass diag -- ! 107 zdiag_mass = ( glob_sum( 'icectl', SUM( v_i * rhoi + v_s * rhos, dim=3 ) * e1e2t ) - pdiag_v ) * r1_rdtice & 108 & + glob_sum( 'icectl', ( wfx_bog + wfx_bom + wfx_sum + wfx_sni + wfx_opw + wfx_res + wfx_dyn + & 109 & wfx_lam + wfx_pnd + wfx_snw_sni + wfx_snw_sum + wfx_snw_dyn + wfx_snw_sub + & 110 & wfx_ice_sub + wfx_spr ) * e1e2t ) & 111 & - pdiag_fv 85 112 ! 86 ! ! salt flux87 pdiag_fs = glob_sum( 'icectl',&88 & ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) +&89 & sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:) + sfx_sub(:,:) + sfx_lam(:,:)&90 & ) * e1e2t(:,:) ) * zconv113 ! -- salt diag -- ! 114 zdiag_salt = ( glob_sum( 'icectl', SUM( sv_i * rhoi , dim=3 ) * e1e2t ) - pdiag_s ) * r1_rdtice & 115 & + glob_sum( 'icectl', ( sfx_bri + sfx_bog + sfx_bom + sfx_sum + sfx_sni + & 116 & sfx_opw + sfx_res + sfx_dyn + sfx_sub + sfx_lam ) * e1e2t ) & 117 & - pdiag_fs 91 118 ! 92 ! ! heat flux 93 pdiag_ft = glob_sum( 'icectl', & 94 & ( hfx_sum(:,:) + hfx_bom(:,:) + hfx_bog(:,:) + hfx_dif(:,:) + hfx_opw(:,:) + hfx_snw(:,:) & 95 & - hfx_thd(:,:) - hfx_dyn(:,:) - hfx_res(:,:) - hfx_sub(:,:) - hfx_spr(:,:) & 96 & ) * e1e2t(:,:) ) * zconv 97 98 pdiag_v = glob_sum( 'icectl', SUM( v_i * rhoi + v_s * rhos, dim=3 ) * e1e2t * zconv ) 99 100 pdiag_s = glob_sum( 'icectl', SUM( sv_i * rhoi , dim=3 ) * e1e2t * zconv ) 101 102 pdiag_t = glob_sum( 'icectl', ( SUM( SUM( e_i(:,:,1:nlay_i,:), dim=4 ), dim=3 ) & 103 & + SUM( SUM( e_s(:,:,1:nlay_s,:), dim=4 ), dim=3 ) ) * e1e2t ) * zconv 104 105 ELSEIF( icount == 1 ) THEN 106 107 ! water flux 108 zfv = glob_sum( 'icectl', & 109 & -( wfx_bog(:,:) + wfx_bom(:,:) + wfx_sum(:,:) + wfx_sni(:,:) + & 110 & wfx_opw(:,:) + wfx_res(:,:) + wfx_dyn(:,:) + wfx_lam(:,:) + wfx_pnd(:,:) + & 111 & wfx_snw_sni(:,:) + wfx_snw_sum(:,:) + wfx_snw_dyn(:,:) + wfx_snw_sub(:,:) + & 112 & wfx_ice_sub(:,:) + wfx_spr(:,:) & 113 & ) * e1e2t(:,:) ) * zconv - pdiag_fv 114 115 ! salt flux 116 zfs = glob_sum( 'icectl', & 117 & ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) + & 118 & sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:) + sfx_sub(:,:) + sfx_lam(:,:) & 119 & ) * e1e2t(:,:) ) * zconv - pdiag_fs 120 121 ! heat flux 122 zft = glob_sum( 'icectl', & 123 & ( hfx_sum(:,:) + hfx_bom(:,:) + hfx_bog(:,:) + hfx_dif(:,:) + hfx_opw(:,:) + hfx_snw(:,:) & 124 & - hfx_thd(:,:) - hfx_dyn(:,:) - hfx_res(:,:) - hfx_sub(:,:) - hfx_spr(:,:) & 125 & ) * e1e2t(:,:) ) * zconv - pdiag_ft 126 127 ! outputs 128 zv = ( ( glob_sum( 'icectl', SUM( v_i * rhoi + v_s * rhos, dim=3 ) * e1e2t ) * zconv & 129 & - pdiag_v ) * r1_rdtice - zfv ) * rday 130 131 zs = ( ( glob_sum( 'icectl', SUM( sv_i * rhoi , dim=3 ) * e1e2t ) * zconv & 132 & - pdiag_s ) * r1_rdtice + zfs ) * rday 133 134 zt = ( glob_sum( 'icectl', & 135 & ( SUM( SUM( e_i(:,:,1:nlay_i,:), dim=4 ), dim=3 ) & 136 & + SUM( SUM( e_s(:,:,1:nlay_s,:), dim=4 ), dim=3 ) ) * e1e2t ) * zconv & 137 & - pdiag_t ) * r1_rdtice + zft 138 139 ! zvtrp and zetrp must be close to 0 if the advection scheme is conservative 140 zvtrp = glob_sum( 'icectl', ( diag_trp_vi * rhoi + diag_trp_vs * rhos ) * e1e2t ) * zconv * rday 141 zetrp = glob_sum( 'icectl', ( diag_trp_ei + diag_trp_es ) * e1e2t ) * zconv 142 143 zamax = glob_max( 'icectl', SUM( a_i, dim=3 ) ) 144 zvmin = glob_min( 'icectl', v_i ) 145 zamin = glob_min( 'icectl', a_i ) 146 zsmin = glob_min( 'icectl', sv_i ) 147 zeimin = glob_min( 'icectl', SUM( e_i, dim=3 ) ) 148 zesmin = glob_min( 'icectl', SUM( e_s, dim=3 ) ) 149 150 ! set threshold values and calculate the ice area (+epsi10 to set a threshold > 0 when there is no ice) 151 zarea = glob_sum( 'icectl', SUM( a_i + epsi10, dim=3 ) * e1e2t ) * zconv ! in 1.e9 m2 152 zv_sill = zarea * 2.5e-5 153 zs_sill = zarea * 25.e-5 154 zt_sill = zarea * 10.e-5 155 156 IF(lwp) THEN 119 ! -- heat diag -- ! 120 zdiag_heat = ( glob_sum( 'icectl', ( SUM(SUM(e_i, dim=4), dim=3) + SUM(SUM(e_s, dim=4), dim=3) ) * e1e2t ) - pdiag_t & 121 & ) * r1_rdtice & 122 & + glob_sum( 'icectl', ( hfx_sum + hfx_bom + hfx_bog + hfx_dif + hfx_opw + hfx_snw & 123 & - hfx_thd - hfx_dyn - hfx_res - hfx_sub - hfx_spr ) * e1e2t ) & 124 & - pdiag_ft 125 126 ! -- min/max diag -- ! 127 zdiag_amax = glob_max( 'icectl', SUM( a_i, dim=3 ) ) 128 zdiag_vmin = glob_min( 'icectl', v_i ) 129 zdiag_amin = glob_min( 'icectl', a_i ) 130 zdiag_smin = glob_min( 'icectl', sv_i ) 131 zdiag_eimin = glob_min( 'icectl', SUM( e_i, dim=3 ) ) 132 zdiag_esmin = glob_min( 'icectl', SUM( e_s, dim=3 ) ) 133 134 ! -- advection scheme is conservative? -- ! 135 zvtrp = glob_sum( 'icectl', ( diag_trp_vi * rhoi + diag_trp_vs * rhos ) * e1e2t ) ! must be close to 0 136 zetrp = glob_sum( 'icectl', ( diag_trp_ei + diag_trp_es ) * e1e2t ) ! must be close to 0 137 138 ! ice area (+epsi10 to set a threshold > 0 when there is no ice) 139 zarea = glob_sum( 'icectl', SUM( a_i + epsi10, dim=3 ) * e1e2t ) 140 141 IF( lwp ) THEN 157 142 ! check conservation issues 158 IF ( ABS( zv ) > zv_sill ) WRITE(numout,*) 'violation volume [Mt/day] (',cd_routine,') = ',zv 159 IF ( ABS( zs ) > zs_sill ) WRITE(numout,*) 'violation saline [Mkg/day] (',cd_routine,') = ',zs 160 IF ( ABS( zt ) > zt_sill ) WRITE(numout,*) 'violation enthalpy [GW] (',cd_routine,') = ',zt 143 IF( ABS(zdiag_mass) > zchk_m * rn_icechk_glo * zarea ) & 144 & WRITE(numout,*) cd_routine,' : violation mass cons. [kg] = ',zdiag_mass * rdt_ice 145 IF( ABS(zdiag_salt) > zchk_s * rn_icechk_glo * zarea ) & 146 & WRITE(numout,*) cd_routine,' : violation salt cons. [g] = ',zdiag_salt * rdt_ice 147 IF( ABS(zdiag_heat) > zchk_t * rn_icechk_glo * zarea ) & 148 & WRITE(numout,*) cd_routine,' : violation heat cons. [J] = ',zdiag_heat * rdt_ice 149 ! check negative values 150 IF( zdiag_vmin < 0. ) WRITE(numout,*) cd_routine,' : violation v_i < 0 = ',zdiag_vmin 151 IF( zdiag_amin < 0. ) WRITE(numout,*) cd_routine,' : violation a_i < 0 = ',zdiag_amin 152 IF( zdiag_smin < 0. ) WRITE(numout,*) cd_routine,' : violation s_i < 0 = ',zdiag_smin 153 IF( zdiag_eimin < 0. ) WRITE(numout,*) cd_routine,' : violation e_i < 0 = ',zdiag_eimin 154 IF( zdiag_esmin < 0. ) WRITE(numout,*) cd_routine,' : violation e_s < 0 = ',zdiag_esmin 161 155 ! check maximum ice concentration 162 IF ( zamax > MAX( rn_amax_n,rn_amax_s)+epsi10 .AND. cd_routine /= 'icedyn_adv' .AND. cd_routine /= 'icedyn_rdgrft' ) & 163 & WRITE(numout,*) 'violation a_i>amax (',cd_routine,') = ',zamax 164 ! check negative values 165 IF ( zvmin < 0. ) WRITE(numout,*) 'violation v_i<0 [m] (',cd_routine,') = ',zvmin 166 IF ( zamin < 0. ) WRITE(numout,*) 'violation a_i<0 (',cd_routine,') = ',zamin 167 IF ( zsmin < 0. ) WRITE(numout,*) 'violation s_i<0 (',cd_routine,') = ',zsmin 168 IF ( zeimin < 0. ) WRITE(numout,*) 'violation e_i<0 (',cd_routine,') = ',zeimin 169 IF ( zesmin < 0. ) WRITE(numout,*) 'violation e_s<0 (',cd_routine,') = ',zesmin 170 !clem: the following check fails (I think...) 171 ! IF ( ABS(zvtrp ) > zv_sill .AND. cd_routine == 'icedyn_adv' ) THEN 172 ! WRITE(numout,*) 'violation vtrp [Mt/day] (',cd_routine,') = ',zvtrp 173 ! WRITE(numout,*) 'violation etrp [GW] (',cd_routine,') = ',zetrp 174 ! ENDIF 156 IF( zdiag_amax > MAX(rn_amax_n,rn_amax_s)+epsi10 .AND. cd_routine /= 'icedyn_adv' .AND. cd_routine /= 'icedyn_rdgrft' ) & 157 & WRITE(numout,*) cd_routine,' : violation a_i > amax = ',zdiag_amax 158 ! check if advection scheme is conservative 159 IF( ABS(zvtrp) > zchk_m * rn_icechk_glo * zarea .AND. cd_routine == 'icedyn_adv' ) & 160 & WRITE(numout,*) cd_routine,' : violation adv scheme [kg] = ',zvtrp * rdt_ice 175 161 ENDIF 176 162 ! … … 179 165 END SUBROUTINE ice_cons_hsm 180 166 181 182 167 SUBROUTINE ice_cons_final( cd_routine ) 183 168 !!------------------------------------------------------------------- … … 188 173 !! ** Method : This is an online diagnostics which can be activated with ln_icediachk=true 189 174 !! It prints in ocean.output if there is a violation of conservation at each time-step 190 !! The thresholds (z v_sill, zs_sill, zt_sill) which determine the violation are set to175 !! The thresholds (zchk_m, zchk_s, zchk_t) which determine the violation are set to 191 176 !! a minimum of 1 mm of ice (over the ice area) that is lost/gained spuriously during 100 years. 192 177 !! For salt and heat thresholds, ice is considered to have a salinity of 10 193 178 !! and a heat content of 3e5 J/kg (=latent heat of fusion) 194 179 !!------------------------------------------------------------------- 195 CHARACTER(len=*), INTENT(in) :: cd_routine ! name of the routine 196 REAL(wp) :: zqmass, zhfx, zsfx, zvfx 197 REAL(wp) :: zarea, zv_sill, zs_sill, zt_sill 198 REAL(wp), PARAMETER :: zconv = 1.e-9 ! convert W to GW and kg to Mt 180 CHARACTER(len=*), INTENT(in) :: cd_routine ! name of the routine 181 REAL(wp) :: zdiag_mass, zdiag_salt, zdiag_heat 182 REAL(wp) :: zarea 199 183 !!------------------------------------------------------------------- 200 184 201 185 ! water flux 202 zvfx = glob_sum( 'icectl', ( wfx_ice + wfx_snw + wfx_spr + wfx_sub + diag_vice + diag_vsnw ) * e1e2t ) * zconv * rday 203 204 ! salt flux 205 zsfx = glob_sum( 'icectl', ( sfx + diag_sice ) * e1e2t ) * zconv * rday 206 207 ! heat flux 186 ! -- mass diag -- ! 187 zdiag_mass = glob_sum( 'icectl', ( wfx_ice + wfx_snw + wfx_spr + wfx_sub + diag_vice + diag_vsnw ) * e1e2t ) 188 189 ! -- salt diag -- ! 190 zdiag_salt = glob_sum( 'icectl', ( sfx + diag_sice ) * e1e2t ) 191 192 ! -- heat diag -- ! 208 193 ! clem: not the good formulation 209 !!zhfx = glob_sum( 'icectl', ( qt_oce_ai - qt_atm_oi + diag_heat + hfx_thd + hfx_dyn + hfx_res + hfx_sub + hfx_spr & 210 !! & ) * e1e2t ) * zconv 211 212 ! set threshold values and calculate the ice area (+epsi10 to set a threshold > 0 when there is no ice) 213 zarea = glob_sum( 'icectl', SUM( a_i + epsi10, dim=3 ) * e1e2t ) * zconv ! in 1.e9 m2 214 zv_sill = zarea * 2.5e-5 215 zs_sill = zarea * 25.e-5 216 zt_sill = zarea * 10.e-5 217 218 IF(lwp) THEN 219 IF( ABS( zvfx ) > zv_sill ) WRITE(numout,*) 'violation vfx [Mt/day] (',cd_routine,') = ',zvfx 220 IF( ABS( zsfx ) > zs_sill ) WRITE(numout,*) 'violation sfx [Mkg/day] (',cd_routine,') = ',zsfx 221 !!IF( ABS( zhfx ) > zt_sill ) WRITE(numout,*) 'violation hfx [GW] (',cd_routine,') = ',zhfx 194 !!zdiag_heat = glob_sum( 'icectl', ( qt_oce_ai - qt_atm_oi + diag_heat + hfx_thd + hfx_dyn + hfx_res + hfx_sub + hfx_spr & 195 !! & ) * e1e2t ) 196 197 ! ice area (+epsi10 to set a threshold > 0 when there is no ice) 198 zarea = glob_sum( 'icectl', SUM( a_i + epsi10, dim=3 ) * e1e2t ) 199 200 IF( lwp ) THEN 201 IF( ABS(zdiag_mass) > zchk_m * rn_icechk_glo * zarea ) & 202 & WRITE(numout,*) cd_routine,' : violation mass cons. [kg] = ',zdiag_mass * rdt_ice 203 IF( ABS(zdiag_salt) > zchk_s * rn_icechk_glo * zarea ) & 204 & WRITE(numout,*) cd_routine,' : violation salt cons. [g] = ',zdiag_salt * rdt_ice 205 !!IF( ABS(zdiag_heat) > zchk_t * rn_icechk_glo * zarea ) WRITE(numout,*) cd_routine,' : violation heat cons. [J] = ',zdiag_heat * rdt_ice 222 206 ENDIF 223 207 ! 224 208 END SUBROUTINE ice_cons_final 225 209 210 SUBROUTINE ice_cons2D( icount, cd_routine, pdiag_v, pdiag_s, pdiag_t, pdiag_fv, pdiag_fs, pdiag_ft ) 211 !!------------------------------------------------------------------- 212 !! *** ROUTINE ice_cons2D *** 213 !! 214 !! ** Purpose : Test the conservation of heat, salt and mass for each ice routine 215 !! + test if ice concentration and volume are > 0 216 !! 217 !! ** Method : This is an online diagnostics which can be activated with ln_icediachk=true 218 !! It stops the code if there is a violation of conservation at any gridcell 219 !!------------------------------------------------------------------- 220 INTEGER , INTENT(in) :: icount ! called at: =0 the begining of the routine, =1 the end 221 CHARACTER(len=*), INTENT(in) :: cd_routine ! name of the routine 222 REAL(wp) , DIMENSION(jpi,jpj), INTENT(inout) :: pdiag_v, pdiag_s, pdiag_t, pdiag_fv, pdiag_fs, pdiag_ft 223 !! 224 REAL(wp), DIMENSION(jpi,jpj) :: zdiag_mass, zdiag_salt, zdiag_heat, & 225 & zdiag_amin, zdiag_vmin, zdiag_smin, zdiag_emin !!, zdiag_amax 226 INTEGER :: jl, jk 227 LOGICAL :: ll_stop_m = .FALSE. 228 LOGICAL :: ll_stop_s = .FALSE. 229 LOGICAL :: ll_stop_t = .FALSE. 230 CHARACTER(len=120) :: clnam ! filename for the output 231 !!------------------------------------------------------------------- 232 ! 233 IF( icount == 0 ) THEN 234 235 pdiag_v = SUM( v_i * rhoi + v_s * rhos, dim=3 ) 236 pdiag_s = SUM( sv_i * rhoi , dim=3 ) 237 pdiag_t = SUM( SUM( e_i, dim=4 ), dim=3 ) + SUM( SUM( e_s, dim=4 ), dim=3 ) 238 239 ! mass flux 240 pdiag_fv = wfx_bog + wfx_bom + wfx_sum + wfx_sni + wfx_opw + wfx_res + wfx_dyn + wfx_lam + wfx_pnd + & 241 & wfx_snw_sni + wfx_snw_sum + wfx_snw_dyn + wfx_snw_sub + wfx_ice_sub + wfx_spr 242 ! salt flux 243 pdiag_fs = sfx_bri + sfx_bog + sfx_bom + sfx_sum + sfx_sni + sfx_opw + sfx_res + sfx_dyn + sfx_sub + sfx_lam 244 ! heat flux 245 pdiag_ft = hfx_sum + hfx_bom + hfx_bog + hfx_dif + hfx_opw + hfx_snw & 246 & - hfx_thd - hfx_dyn - hfx_res - hfx_sub - hfx_spr 247 248 ELSEIF( icount == 1 ) THEN 249 250 ! -- mass diag -- ! 251 zdiag_mass = ( SUM( v_i * rhoi + v_s * rhos, dim=3 ) - pdiag_v ) * r1_rdtice & 252 & + ( wfx_bog + wfx_bom + wfx_sum + wfx_sni + wfx_opw + wfx_res + wfx_dyn + wfx_lam + wfx_pnd + & 253 & wfx_snw_sni + wfx_snw_sum + wfx_snw_dyn + wfx_snw_sub + wfx_ice_sub + wfx_spr ) & 254 & - pdiag_fv 255 IF( MAXVAL( ABS(zdiag_mass) ) > zchk_m * rn_icechk_cel ) ll_stop_m = .TRUE. 256 ! 257 ! -- salt diag -- ! 258 zdiag_salt = ( SUM( sv_i * rhoi , dim=3 ) - pdiag_s ) * r1_rdtice & 259 & + ( sfx_bri + sfx_bog + sfx_bom + sfx_sum + sfx_sni + sfx_opw + sfx_res + sfx_dyn + sfx_sub + sfx_lam ) & 260 & - pdiag_fs 261 IF( MAXVAL( ABS(zdiag_salt) ) > zchk_s * rn_icechk_cel ) ll_stop_s = .TRUE. 262 ! 263 ! -- heat diag -- ! 264 zdiag_heat = ( SUM( SUM( e_i, dim=4 ), dim=3 ) + SUM( SUM( e_s, dim=4 ), dim=3 ) - pdiag_t ) * r1_rdtice & 265 & + ( hfx_sum + hfx_bom + hfx_bog + hfx_dif + hfx_opw + hfx_snw & 266 & - hfx_thd - hfx_dyn - hfx_res - hfx_sub - hfx_spr ) & 267 & - pdiag_ft 268 IF( MAXVAL( ABS(zdiag_heat) ) > zchk_t * rn_icechk_cel ) ll_stop_t = .TRUE. 269 ! 270 ! -- other diags -- ! 271 ! a_i < 0 272 zdiag_amin(:,:) = 0._wp 273 DO jl = 1, jpl 274 WHERE( a_i(:,:,jl) < 0._wp ) zdiag_amin(:,:) = 1._wp 275 ENDDO 276 ! v_i < 0 277 zdiag_vmin(:,:) = 0._wp 278 DO jl = 1, jpl 279 WHERE( v_i(:,:,jl) < 0._wp ) zdiag_vmin(:,:) = 1._wp 280 ENDDO 281 ! s_i < 0 282 zdiag_smin(:,:) = 0._wp 283 DO jl = 1, jpl 284 WHERE( s_i(:,:,jl) < 0._wp ) zdiag_smin(:,:) = 1._wp 285 ENDDO 286 ! e_i < 0 287 zdiag_emin(:,:) = 0._wp 288 DO jl = 1, jpl 289 DO jk = 1, nlay_i 290 WHERE( e_i(:,:,jk,jl) < 0._wp ) zdiag_emin(:,:) = 1._wp 291 ENDDO 292 ENDDO 293 ! a_i > amax 294 !WHERE( SUM( a_i, dim=3 ) > ( MAX( rn_amax_n, rn_amax_s ) + epsi10 ) ; zdiag_amax(:,:) = 1._wp 295 !ELSEWHERE ; zdiag_amax(:,:) = 0._wp 296 !END WHERE 297 298 IF( ll_stop_m .OR. ll_stop_s .OR. ll_stop_t ) THEN 299 clnam = 'diag_ice_conservation_'//cd_routine 300 CALL ice_cons_wri( clnam, zdiag_mass, zdiag_salt, zdiag_heat, zdiag_amin, zdiag_vmin, zdiag_smin, zdiag_emin ) 301 ENDIF 302 303 IF( ll_stop_m ) CALL ctl_stop( 'STOP', cd_routine//': ice mass conservation issue' ) 304 IF( ll_stop_s ) CALL ctl_stop( 'STOP', cd_routine//': ice salt conservation issue' ) 305 IF( ll_stop_t ) CALL ctl_stop( 'STOP', cd_routine//': ice heat conservation issue' ) 306 307 ENDIF 308 309 END SUBROUTINE ice_cons2D 310 311 SUBROUTINE ice_cons_wri( cdfile_name, pdiag_mass, pdiag_salt, pdiag_heat, pdiag_amin, pdiag_vmin, pdiag_smin, pdiag_emin ) 312 !!--------------------------------------------------------------------- 313 !! *** ROUTINE ice_cons_wri *** 314 !! 315 !! ** Purpose : create a NetCDF file named cdfile_name which contains 316 !! the instantaneous fields when conservation issue occurs 317 !! 318 !! ** Method : NetCDF files using ioipsl 319 !!---------------------------------------------------------------------- 320 CHARACTER(len=*), INTENT( in ) :: cdfile_name ! name of the file created 321 REAL(wp), DIMENSION(:,:), INTENT( in ) :: pdiag_mass, pdiag_salt, pdiag_heat, & 322 & pdiag_amin, pdiag_vmin, pdiag_smin, pdiag_emin !!, pdiag_amax 323 !! 324 INTEGER :: inum 325 !!---------------------------------------------------------------------- 326 ! 327 IF(lwp) WRITE(numout,*) 328 IF(lwp) WRITE(numout,*) 'ice_cons_wri : single instantaneous ice state' 329 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~ named :', cdfile_name, '...nc' 330 IF(lwp) WRITE(numout,*) 331 332 CALL iom_open( TRIM(cdfile_name), inum, ldwrt = .TRUE., kdlev = jpl ) 333 334 CALL iom_rstput( 0, 0, inum, 'cons_mass', pdiag_mass(:,:) , ktype = jp_r8 ) ! ice mass spurious lost/gain 335 CALL iom_rstput( 0, 0, inum, 'cons_salt', pdiag_salt(:,:) , ktype = jp_r8 ) ! ice salt spurious lost/gain 336 CALL iom_rstput( 0, 0, inum, 'cons_heat', pdiag_heat(:,:) , ktype = jp_r8 ) ! ice heat spurious lost/gain 337 ! other diags 338 CALL iom_rstput( 0, 0, inum, 'aneg_count', pdiag_amin(:,:) , ktype = jp_r8 ) ! 339 CALL iom_rstput( 0, 0, inum, 'vneg_count', pdiag_vmin(:,:) , ktype = jp_r8 ) ! 340 CALL iom_rstput( 0, 0, inum, 'sneg_count', pdiag_smin(:,:) , ktype = jp_r8 ) ! 341 CALL iom_rstput( 0, 0, inum, 'eneg_count', pdiag_emin(:,:) , ktype = jp_r8 ) ! 342 343 CALL iom_close( inum ) 344 345 END SUBROUTINE ice_cons_wri 226 346 227 347 SUBROUTINE ice_ctl( kt ) … … 246 366 ialert_id = 2 ! reference number of this alert 247 367 cl_alname(ialert_id) = ' Incompat vol and con ' ! name of the alert 248 249 368 DO jl = 1, jpl 250 369 DO jj = 1, jpj 251 370 DO ji = 1, jpi 252 371 IF( v_i(ji,jj,jl) /= 0._wp .AND. a_i(ji,jj,jl) == 0._wp ) THEN 253 !WRITE(numout,*) ' ALERTE 2 : Incompatible volume and concentration ' 254 !WRITE(numout,*) ' at_i ', at_i(ji,jj) 255 !WRITE(numout,*) ' Point - category', ji, jj, jl 256 !WRITE(numout,*) ' a_i *** a_i_b ', a_i (ji,jj,jl), a_i_b (ji,jj,jl) 257 !WRITE(numout,*) ' v_i *** v_i_b ', v_i (ji,jj,jl), v_i_b (ji,jj,jl) 372 WRITE(numout,*) ' ALERTE 2 : Incompatible volume and concentration ' 258 373 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 259 374 ENDIF … … 269 384 DO ji = 1, jpi 270 385 IF( h_i(ji,jj,jl) > 50._wp ) THEN 386 WRITE(numout,*) ' ALERTE 3 : Very thick ice' 271 387 !CALL ice_prt( kt, ji, jj, 2, ' ALERTE 3 : Very thick ice ' ) 272 388 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 … … 280 396 DO jj = 1, jpj 281 397 DO ji = 1, jpi 282 IF( MAX( ABS( u_ice(ji,jj) ), ABS( v_ice(ji,jj) ) ) > 1.5.AND. &398 IF( MAX( ABS( u_ice(ji,jj) ), ABS( v_ice(ji,jj) ) ) > 2. .AND. & 283 399 & at_i(ji,jj) > 0._wp ) THEN 400 WRITE(numout,*) ' ALERTE 4 : Very fast ice' 284 401 !CALL ice_prt( kt, ji, jj, 1, ' ALERTE 4 : Very fast ice ' ) 285 !WRITE(numout,*) ' ice strength : ', strength(ji,jj) 286 !WRITE(numout,*) ' oceanic stress utau : ', utau(ji,jj) 287 !WRITE(numout,*) ' oceanic stress vtau : ', vtau(ji,jj) 288 !WRITE(numout,*) ' sea-ice stress utau_ice : ', utau_ice(ji,jj) 289 !WRITE(numout,*) ' sea-ice stress vtau_ice : ', vtau_ice(ji,jj) 290 !WRITE(numout,*) ' sst : ', sst_m(ji,jj) 291 !WRITE(numout,*) ' sss : ', sss_m(ji,jj) 292 !WRITE(numout,*) 402 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 403 ENDIF 404 END DO 405 END DO 406 407 ! Alert on salt flux 408 ialert_id = 5 ! reference number of this alert 409 cl_alname(ialert_id) = ' High salt flux ' ! name of the alert 410 DO jj = 1, jpj 411 DO ji = 1, jpi 412 IF( ABS( sfx (ji,jj) ) > 1.0e-2 ) THEN ! = 1 psu/day for 1m ocean depth 413 WRITE(numout,*) ' ALERTE 5 : High salt flux' 414 !CALL ice_prt( kt, ji, jj, 3, ' ALERTE 5 : High salt flux ' ) 293 415 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 294 416 ENDIF … … 302 424 DO ji = 1, jpi 303 425 IF( tmask(ji,jj,1) <= 0._wp .AND. at_i(ji,jj) > 0._wp ) THEN 426 WRITE(numout,*) ' ALERTE 6 : Ice on continents' 304 427 !CALL ice_prt( kt, ji, jj, 1, ' ALERTE 6 : Ice on continents ' ) 305 !WRITE(numout,*) ' masks s, u, v : ', tmask(ji,jj,1), umask(ji,jj,1), vmask(ji,jj,1)306 !WRITE(numout,*) ' sst : ', sst_m(ji,jj)307 !WRITE(numout,*) ' sss : ', sss_m(ji,jj)308 !WRITE(numout,*) ' at_i(ji,jj) : ', at_i(ji,jj)309 !WRITE(numout,*) ' v_ice(ji,jj) : ', v_ice(ji,jj)310 !WRITE(numout,*) ' v_ice(ji,jj-1) : ', v_ice(ji,jj-1)311 !WRITE(numout,*) ' u_ice(ji-1,jj) : ', u_ice(ji-1,jj)312 !WRITE(numout,*) ' u_ice(ji,jj) : ', v_ice(ji,jj)313 !314 428 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 315 429 ENDIF … … 325 439 DO ji = 1, jpi 326 440 IF( s_i(ji,jj,jl) < 0.1 .AND. a_i(ji,jj,jl) > 0._wp ) THEN 441 WRITE(numout,*) ' ALERTE 7 : Very fresh ice' 327 442 ! CALL ice_prt(kt,ji,jj,1, ' ALERTE 7 : Very fresh ice ' ) 328 ! WRITE(numout,*) ' sst : ', sst_m(ji,jj)329 ! WRITE(numout,*) ' sss : ', sss_m(ji,jj)330 ! WRITE(numout,*)331 443 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 332 444 ENDIF … … 335 447 END DO 336 448 ! 449 ! Alert if qns very big 450 ialert_id = 8 ! reference number of this alert 451 cl_alname(ialert_id) = ' fnsolar very big ' ! name of the alert 452 DO jj = 1, jpj 453 DO ji = 1, jpi 454 IF( ABS( qns(ji,jj) ) > 1500._wp .AND. at_i(ji,jj) > 0._wp ) THEN 455 ! 456 WRITE(numout,*) ' ALERTE 8 : Very high non-solar heat flux' 457 !CALL ice_prt( kt, ji, jj, 2, ' ') 458 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 459 ! 460 ENDIF 461 END DO 462 END DO 463 !+++++ 337 464 338 465 ! ! Alert if too old ice … … 345 472 ( ABS( o_i(ji,jj,jl) ) < 0._wp) ) .AND. & 346 473 ( a_i(ji,jj,jl) > 0._wp ) ) THEN 474 WRITE(numout,*) ' ALERTE 9 : Wrong ice age' 347 475 !CALL ice_prt( kt, ji, jj, 1, ' ALERTE 9 : Wrong ice age ') 348 476 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 … … 351 479 END DO 352 480 END DO 353 354 ! Alert on salt flux 355 ialert_id = 5 ! reference number of this alert 356 cl_alname(ialert_id) = ' High salt flux ' ! name of the alert 357 DO jj = 1, jpj 358 DO ji = 1, jpi 359 IF( ABS( sfx (ji,jj) ) > 1.0e-2 ) THEN ! = 1 psu/day for 1m ocean depth 360 !CALL ice_prt( kt, ji, jj, 3, ' ALERTE 5 : High salt flux ' ) 361 !DO jl = 1, jpl 362 !WRITE(numout,*) ' Category no: ', jl 363 !WRITE(numout,*) ' a_i : ', a_i (ji,jj,jl) , ' a_i_b : ', a_i_b (ji,jj,jl) 364 !WRITE(numout,*) ' v_i : ', v_i (ji,jj,jl) , ' v_i_b : ', v_i_b (ji,jj,jl) 365 !WRITE(numout,*) ' ' 366 !END DO 367 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 368 ENDIF 369 END DO 370 END DO 371 372 ! Alert if qns very big 373 ialert_id = 8 ! reference number of this alert 374 cl_alname(ialert_id) = ' fnsolar very big ' ! name of the alert 375 DO jj = 1, jpj 376 DO ji = 1, jpi 377 IF( ABS( qns(ji,jj) ) > 1500._wp .AND. at_i(ji,jj) > 0._wp ) THEN 378 ! 379 !WRITE(numout,*) ' ALERTE 8 : Very high non-solar heat flux' 380 !WRITE(numout,*) ' ji, jj : ', ji, jj 381 !WRITE(numout,*) ' qns : ', qns(ji,jj) 382 !WRITE(numout,*) ' sst : ', sst_m(ji,jj) 383 !WRITE(numout,*) ' sss : ', sss_m(ji,jj) 384 ! 385 !CALL ice_prt( kt, ji, jj, 2, ' ') 386 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 387 ! 388 ENDIF 389 END DO 390 END DO 391 !+++++ 392 481 393 482 ! Alert if very warm ice 394 483 ialert_id = 10 ! reference number of this alert … … 400 489 DO ji = 1, jpi 401 490 ztmelts = -rTmlt * sz_i(ji,jj,jk,jl) + rt0 402 IF( t_i(ji,jj,jk,jl) >= ztmelts .AND. v_i(ji,jj,jl) > 1.e-10 & 403 & .AND. a_i(ji,jj,jl) > 0._wp ) THEN 404 !WRITE(numout,*) ' ALERTE 10 : Very warm ice' 405 !WRITE(numout,*) ' ji, jj, jk, jl : ', ji, jj, jk, jl 406 !WRITE(numout,*) ' t_i : ', t_i(ji,jj,jk,jl) 407 !WRITE(numout,*) ' e_i : ', e_i(ji,jj,jk,jl) 408 !WRITE(numout,*) ' sz_i: ', sz_i(ji,jj,jk,jl) 409 !WRITE(numout,*) ' ztmelts : ', ztmelts 410 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 491 IF( t_i(ji,jj,jk,jl) > ztmelts .AND. v_i(ji,jj,jl) > 1.e-10 & 492 & .AND. a_i(ji,jj,jl) > 0._wp ) THEN 493 WRITE(numout,*) ' ALERTE 10 : Very warm ice' 494 inb_alp(ialert_id) = inb_alp(ialert_id) + 1 411 495 ENDIF 412 496 END DO … … 435 519 END SUBROUTINE ice_ctl 436 520 437 438 521 SUBROUTINE ice_prt( kt, ki, kj, kn, cd1 ) 439 522 !!------------------------------------------------------------------- … … 443 526 !! in ocean.ouput 444 527 !! 3 possibilities exist 445 !! n = 1/-1 -> simple ice state (plus Mechanical Check if -1)528 !! n = 1/-1 -> simple ice state 446 529 !! n = 2 -> exhaustive state 447 530 !! n = 3 -> ice/ocean salt fluxes … … 482 565 WRITE(numout,*) ' - Cell values ' 483 566 WRITE(numout,*) ' ~~~~~~~~~~~ ' 484 WRITE(numout,*) ' cell area : ', e1e2t(ji,jj)485 567 WRITE(numout,*) ' at_i : ', at_i(ji,jj) 568 WRITE(numout,*) ' ato_i : ', ato_i(ji,jj) 486 569 WRITE(numout,*) ' vt_i : ', vt_i(ji,jj) 487 570 WRITE(numout,*) ' vt_s : ', vt_s(ji,jj) … … 503 586 END DO 504 587 ENDIF 505 IF( kn == -1 ) THEN506 WRITE(numout,*) ' Mechanical Check ************** '507 WRITE(numout,*) ' Check what means ice divergence '508 WRITE(numout,*) ' Total ice concentration ', at_i (ji,jj)509 WRITE(numout,*) ' Total lead fraction ', ato_i(ji,jj)510 WRITE(numout,*) ' Sum of both ', ato_i(ji,jj) + at_i(ji,jj)511 WRITE(numout,*) ' Sum of both minus 1 ', ato_i(ji,jj) + at_i(ji,jj) - 1.00512 ENDIF513 514 588 515 589 !-------------------- … … 525 599 WRITE(numout,*) ' - Cell values ' 526 600 WRITE(numout,*) ' ~~~~~~~~~~~ ' 527 WRITE(numout,*) ' cell area : ', e1e2t(ji,jj)528 601 WRITE(numout,*) ' at_i : ', at_i(ji,jj) 529 602 WRITE(numout,*) ' vt_i : ', vt_i(ji,jj) … … 624 697 !! 625 698 !!------------------------------------------------------------------- 626 CHARACTER(len=*), INTENT(in) ::cd_routine ! name of the routine627 INTEGER ::jk, jl ! dummy loop indices699 CHARACTER(len=*), INTENT(in) :: cd_routine ! name of the routine 700 INTEGER :: jk, jl ! dummy loop indices 628 701 629 702 CALL prt_ctl_info(' ========== ') … … 684 757 685 758 END SUBROUTINE ice_prt3D 686 759 687 760 #else 688 761 !!----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.