Changeset 1218
- Timestamp:
- 2008-10-28T10:12:16+01:00 (16 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CONFIG/ORCA2_LIM/EXP00/namelist
r1168 r1218 177 177 &namsbc_cpl ! coupled ocean/atmosphere model ("key_coupled") 178 178 !----------------------------------------------------------------------- 179 ! SEND 180 cn_snd_temperature= 'weighted oce and ice' ! 'oce only' 'weighted oce and ice' 'mixed oce-ice' 181 cn_snd_albedo = 'weighted ice' ! 'none' 'weighted ice' 'mixed oce-ice' 182 cn_snd_thickness = 'none' ! 'none' 'weighted ice and snow' 183 cn_snd_crt_nature = 'none' ! 'none' 'oce only' 'weighted oce and ice' 'mixed oce-ice' 184 cn_snd_crt_refere = 'spherical' ! 'spherical' 'cartesian' 185 cn_snd_crt_orient = 'eastward-northward' ! 'eastward-northward' or 'local grid' 186 cn_snd_crt_grid = 'T' ! 'T' 187 ! RECEIVE 188 cn_rcv_w10m = 'coupled' ! 'none' 'coupled' 189 cn_rcv_tau_nature = 'oce only' ! 'oce only' 'oce and ice' 'mixed oce-ice' 190 cn_rcv_tau_refere = 'cartesian' ! 'spherical' 'cartesian' 191 cn_rcv_tau_orient = 'eastward-northward' ! 'eastward-northward' or 'local grid' 192 cn_rcv_tau_grid = 'U,V' ! 'T' 'U,V' 'U,V,F' 'U,V,I' 'T,F' 'T,I' 'T,U,V' 193 cn_rcv_dqnsdt = 'coupled' ! 'none' 'coupled' 194 cn_rcv_qsr = 'oce and ice' ! 'conservative' 'oce and ice' 'mixed oce-ice' 195 cn_rcv_qns = 'oce and ice' ! 'conservative' 'oce and ice' 'mixed oce-ice' 196 cn_rcv_emp = 'conservative' ! 'conservative' 'oce and ice' 'mixed oce-ice' 197 cn_rcv_rnf = 'coupled' ! 'coupled' 'climato' 'mixed' 198 cn_rcv_cal = 'coupled' ! 'none' 'coupled' 179 199 / 180 200 !----------------------------------------------------------------------- -
trunk/NEMO/LIM_SRC_2/limsbc_2.F90
r1173 r1218 29 29 USE albedo ! albedo parameters 30 30 USE prtctl ! Print control 31 USE cpl_oasis3, ONLY : lk_cpl 31 32 32 33 IMPLICIT NONE … … 85 86 REAL(wp) :: zutau , zvtau ! lead fraction at U- & V-points 86 87 REAL(wp) :: zu_io , zv_io ! 2 components of the ice-ocean velocity 87 #if defined key_coupled 88 REAL(wp), DIMENSION(jpi,jpj) :: zalb ! albedo of ice under overcast sky 89 REAL(wp), DIMENSION(jpi,jpj) :: zalbp ! albedo of ice under clear sky 90 #endif 88 ! interface 2D --> 3D 89 REAL(wp), DIMENSION(jpi,jpj,1) :: zalb ! albedo of ice under overcast sky 90 REAL(wp), DIMENSION(jpi,jpj,1) :: zalbp ! albedo of ice under clear sky 91 REAL(wp), DIMENSION(jpi,jpj,1) :: zsist ! surface ice temperature (K) 92 REAL(wp), DIMENSION(jpi,jpj,1) :: zhicif ! ice thickness 93 REAL(wp), DIMENSION(jpi,jpj,1) :: zhsnif ! snow thickness 91 94 REAL(wp) :: zsang, zmod, zfm 92 95 REAL(wp), DIMENSION(jpi,jpj) :: ztio_u, ztio_v ! ocean stress below sea-ice … … 119 122 ifral = ( 1 - i1mfr * ( 1 - ial ) ) 120 123 ifrdv = ( 1 - ifral * ( 1 - ial ) ) * iadv 124 125 !!$ zinda = 1.0 - AINT( pfrld(ji,jj) ) ! = 0. if pure ocean else 1. (at previous time) 126 !!$ 127 !!$ i1mfr = 1.0 - AINT( frld(ji,jj) ) ! = 0. if pure ocean else 1. (at current time) 128 !!$ 129 !!$ IF( phicif(ji,jj) <= 0. ) THEN ; ifvt = zinda ! = 1. if (snow and no ice at previous time) else 0. ??? 130 !!$ ELSE ; ifvt = 0. 131 !!$ ENDIF 132 !!$ 133 !!$ IF( frld(ji,jj) >= pfrld(ji,jj) ) THEN ; idfr = 0. ! = 0. if lead fraction increases from previous to current 134 !!$ ELSE ; idfr = 1. 135 !!$ ENDIF 136 !!$ 137 !!$ iflt = zinda * (1 - i1mfr) * (1 - ifvt ) ! = 1. if ice (not only snow) at previous and pure ocean at current 138 !!$ 139 !!$ ial = ifvt * i1mfr + ( 1 - ifvt ) * idfr 140 !!$! snow no ice ice ice or nothing lead fraction increases 141 !!$! at previous now at previous 142 !!$! -> ice aera increases ??? -> ice aera decreases ??? 143 !!$ 144 !!$ iadv = ( 1 - i1mfr ) * zinda 145 !!$! pure ocean ice at 146 !!$! at current previous 147 !!$! -> = 1. if ice disapear between previous and current 148 !!$ 149 !!$ ifral = ( 1 - i1mfr * ( 1 - ial ) ) 150 !!$! ice at ??? 151 !!$! current 152 !!$! -> ??? 153 !!$ 154 !!$ ifrdv = ( 1 - ifral * ( 1 - ial ) ) * iadv 155 !!$! ice disapear 156 !!$ 157 !!$ 158 121 159 ! computation the solar flux at ocean surface 122 zqsr = pfrld(ji,jj) * qsr(ji,jj) + ( 1. - pfrld(ji,jj) ) * fstric(ji,jj) 160 #if defined key_coupled 161 zqsr = tqsr(ji,jj) + ( fstric(ji,jj) - qsr_ice(ji,jj) ) * ( 1.0 - pfrld(ji,jj) ) 162 #else 163 zqsr = pfrld(ji,jj) * qsr(ji,jj) + ( 1. - pfrld(ji,jj) ) * fstric(ji,jj) 164 #endif 123 165 ! computation the non solar heat flux at ocean surface 124 166 zqns = - ( 1. - thcm(ji,jj) ) * zqsr & ! part of the solar energy used in leads … … 145 187 DO ji = 1, jpi 146 188 189 #if defined key_coupled 190 zemp = emp_tot(ji,jj) - emp_ice(ji,jj) * ( 1. - pfrld(ji,jj) ) & ! 191 & + rdmsnif(ji,jj) / rdt_ice ! freshwaterflux due to snow melting 192 #else 193 !!$ ! computing freshwater exchanges at the ice/ocean interface 194 !!$ zpme = - evap(ji,jj) * frld(ji,jj) & ! evaporation over oceanic fraction 195 !!$ & + tprecip(ji,jj) & ! total precipitation 196 !!$ & - sprecip(ji,jj) * ( 1. - pfrld(ji,jj) ) & ! remov. snow precip over ice 197 !!$ & - rdmsnif(ji,jj) / rdt_ice ! freshwaterflux due to snow melting 147 198 ! computing freshwater exchanges at the ice/ocean interface 148 199 zemp = + emp(ji,jj) * frld(ji,jj) & ! e-p budget over open ocean fraction … … 151 202 & + rdmsnif(ji,jj) / rdt_ice ! freshwaterflux due to snow melting 152 203 ! ! ice-covered fraction: 204 #endif 153 205 154 206 ! computing salt exchanges at the ice/ocean interface … … 217 269 218 270 fr_i (:,:) = 1.0 - frld(:,:) ! sea-ice fraction 219 tn_ice(:,:) = sist(:,:) ! sea-ice surface temperature 220 221 #if defined key_coupled 222 !------------------------------------------------! 223 ! Computation of snow/ice and ocean albedo ! 224 !------------------------------------------------! 225 zalb (:,:) = 0.e0 226 zalbp (:,:) = 0.e0 227 228 CALL albedo_ice( sist, hicif, hsnif, zalbp, zalb ) 229 230 alb_ice(:,:) = 0.5 * zalbp(:,:) + 0.5 * zalb (:,:) ! Ice albedo (mean clear and overcast skys) 231 #endif 271 272 IF ( lk_cpl ) THEN 273 ! Ice surface temperature 274 tn_ice(:,:) = sist(:,:) ! sea-ice surface temperature 275 ! Computation of snow/ice and ocean albedo 276 ! INTERFACE 3D versus 2D 277 zsist (:,:,1) = sist (:,:) 278 zhicif(:,:,1) = hicif(:,:) ; zhsnif(:,:,1) = hsnif(:,:) 279 CALL albedo_ice( zsist, zhicif, zhsnif, zalbp, zalb ) 280 alb_ice(:,:) = 0.5 * ( zalbp(:,:,1) + zalb (:,:,1) ) ! Ice albedo (mean clear and overcast skys) 281 ENDIF 232 282 233 283 IF(ln_ctl) THEN -
trunk/NEMO/LIM_SRC_2/limthd_2.F90
r1156 r1218 7 7 !! 2.0 ! 02-07 (C. Ethe, G. Madec) F90 8 8 !! 2.0 ! 03-08 (C. Ethe) add lim_thd_init 9 !! - ! 08-2008 (A. Caubel, G. Madec, E. Maisonnave, S. Masson ) generic coupled interface 9 10 !!--------------------------------------------------------------------- 10 11 #if defined key_lim2 … … 15 16 !! lim_thd_init_2 : initialisation of sea-ice thermodynamic 16 17 !!---------------------------------------------------------------------- 17 !! * Modules used18 18 USE phycst ! physical constants 19 19 USE dom_oce ! ocean space and time domain variables … … 31 31 USE limtab_2 32 32 USE prtctl ! Print control 33 USE cpl_oasis3, ONLY : lk_cpl 33 34 34 35 IMPLICIT NONE … … 37 38 PUBLIC lim_thd_2 ! called by lim_step 38 39 39 REAL(wp) :: epsi20 = 1.e-20 , &! constant values40 & epsi16 = 1.e-16 , &41 & epsi04 = 1.e-04 , &42 & zzero = 0.e0 , &43 & zone = 1.e040 REAL(wp) :: epsi20 = 1.e-20 ! constant values 41 REAL(wp) :: epsi16 = 1.e-16 ! 42 REAL(wp) :: epsi04 = 1.e-04 ! 43 REAL(wp) :: rzero = 0.e0 ! 44 REAL(wp) :: rone = 1.e0 ! 44 45 45 46 !! * Substitutions … … 47 48 # include "vectopt_loop_substitute.h90" 48 49 !!-------- ------------------------------------------------------------- 49 !! LIM 2.0, UCL-LOCEAN-IPSL (2005)50 !! NEMO/LIM 2.0, UCL-LOCEAN-IPSL (2008) 50 51 !! $Id$ 51 52 !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) … … 74 75 INTEGER, INTENT(in) :: kt ! number of iteration 75 76 !! 76 INTEGER :: ji, jj , &! dummy loop indices77 nbpb , &! nb of icy pts for thermo. cal.78 nbpac! nb of pts for lateral accretion77 INTEGER :: ji, jj ! dummy loop indices 78 INTEGER :: nbpb ! nb of icy pts for thermo. cal. 79 INTEGER :: nbpac ! nb of pts for lateral accretion 79 80 CHARACTER (len=22) :: charout 80 REAL(wp) :: & 81 zfric_umin = 5e-03 , & ! lower bound for the friction velocity 82 zfric_umax = 2e-02 ! upper bound for the friction velocity 83 REAL(wp) :: & 84 zinda , & ! switch for test. the val. of concen. 85 zindb, zindg , & ! switches for test. the val of arg 86 za , zh, zthsnice , & 87 zfric_u , & ! friction velocity 88 zfnsol , & ! total non solar heat 89 zfontn , & ! heat flux from snow thickness 90 zfntlat, zpareff ! test. the val. of lead heat budget 91 REAL(wp), DIMENSION(jpi,jpj) :: zhicifp, & ! ice thickness for outputs 92 & zqlbsbq ! link with lead energy budget qldif 81 REAL(wp) :: zfric_umin = 5e-03 ! lower bound for the friction velocity 82 REAL(wp) :: zfric_umax = 2e-02 ! upper bound for the friction velocity 83 REAL(wp) :: zinda ! switch for test. the val. of concen. 84 REAL(wp) :: zindb, zindg ! switches for test. the val of arg 85 REAL(wp) :: za , zh, zthsnice ! 86 REAL(wp) :: zfric_u ! friction velocity 87 REAL(wp) :: zfnsol ! total non solar heat 88 REAL(wp) :: zfontn ! heat flux from snow thickness 89 REAL(wp) :: zfntlat, zpareff ! test. the val. of lead heat budget 90 REAL(wp) :: zfi ! temporary scalar 91 REAL(wp), DIMENSION(jpi,jpj) :: zhicifp ! ice thickness for outputs 92 REAL(wp), DIMENSION(jpi,jpj) :: zqlbsbq ! link with lead energy budget qldif 93 93 REAL(wp), DIMENSION(jpi,jpj,jpk) :: zmsk ! working array 94 94 !!------------------------------------------------------------------- … … 100 100 !-------------------------------------------! 101 101 102 ! i est-ce utile? oui au moins en partie102 !!gm needed? yes at least for some of these arrays 103 103 rdvosif(:,:) = 0.e0 ! variation of ice volume at surface 104 104 rdvobif(:,:) = 0.e0 ! variation of ice volume at bottom … … 114 114 zmsk (:,:,:) = 0.e0 115 115 116 DO jj = 1, jpj 117 DO ji = 1, jpi 118 hsnif(ji,jj) = hsnif(ji,jj) * MAX( zzero, SIGN( zone , hsnif(ji,jj) - epsi04 ) ) 119 END DO 120 END DO 121 122 IF(ln_ctl) CALL prt_ctl(tab2d_1=hsnif , clinfo1=' lim_thd: hsnif : ') 116 ! set to zero snow thickness smaller than epsi04 117 DO jj = 1, jpj 118 DO ji = 1, jpi 119 hsnif(ji,jj) = hsnif(ji,jj) * MAX( rzero, SIGN( rone , hsnif(ji,jj) - epsi04 ) ) 120 END DO 121 END DO 122 !!gm better coded (do not use SIGN...) 123 ! WHERE( hsnif(:,:) < epsi04 ) hsnif(:,:) = 0.e0 124 !!gm 125 126 IF(ln_ctl) CALL prt_ctl( tab2d_1=hsnif, clinfo1=' lim_thd: hsnif : ' ) 123 127 124 128 !-----------------------------------! … … 129 133 DO ji = 1, jpi 130 134 ! snow is transformed into ice if the original ice cover disappears. 131 zindg = tms(ji,jj) * MAX( zzero , SIGN( zone , -hicif(ji,jj) ) )135 zindg = tms(ji,jj) * MAX( rzero , SIGN( rone , -hicif(ji,jj) ) ) 132 136 hicif(ji,jj) = hicif(ji,jj) + zindg * rhosn * hsnif(ji,jj) / rau0 133 hsnif(ji,jj) = ( zone - zindg ) * hsnif(ji,jj) + zindg * hicif(ji,jj) * ( rau0 - rhoic ) / rhosn137 hsnif(ji,jj) = ( rone - zindg ) * hsnif(ji,jj) + zindg * hicif(ji,jj) * ( rau0 - rhoic ) / rhosn 134 138 dmgwi(ji,jj) = zindg * (1.0 - frld(ji,jj)) * rhoic * hicif(ji,jj) ! snow/ice mass 135 139 136 140 ! the lead fraction, frld, must be little than or equal to amax (ice ridging). 137 141 zthsnice = hsnif(ji,jj) + hicif(ji,jj) 138 zindb = tms(ji,jj) * ( 1.0 - MAX( zzero , SIGN( zone , - zthsnice ) ) )139 za = zindb * MIN( zone, ( 1.0 - frld(ji,jj) ) * uscomi )142 zindb = tms(ji,jj) * ( 1.0 - MAX( rzero , SIGN( rone , - zthsnice ) ) ) 143 za = zindb * MIN( rone, ( 1.0 - frld(ji,jj) ) * uscomi ) 140 144 hsnif (ji,jj) = hsnif(ji,jj) * za 141 145 hicif (ji,jj) = hicif(ji,jj) * za 142 146 qstoif(ji,jj) = qstoif(ji,jj) * za 143 frld (ji,jj) = 1.0 - zindb * ( 1.0 - frld(ji,jj) ) / MAX( za 147 frld (ji,jj) = 1.0 - zindb * ( 1.0 - frld(ji,jj) ) / MAX( za, epsi20 ) 144 148 145 149 ! the in situ ice thickness, hicif, must be equal to or greater than hiclim. 146 zh = MAX( zone , zindb * hiclim / MAX( hicif(ji,jj), epsi20 ) )150 zh = MAX( rone , zindb * hiclim / MAX( hicif(ji,jj), epsi20 ) ) 147 151 hsnif (ji,jj) = hsnif(ji,jj) * zh 148 152 hicif (ji,jj) = hicif(ji,jj) * zh … … 153 157 154 158 IF(ln_ctl) THEN 155 CALL prt_ctl( tab2d_1=hicif , clinfo1=' lim_thd: hicif : ')156 CALL prt_ctl( tab2d_1=hsnif , clinfo1=' lim_thd: hsnif : ')157 CALL prt_ctl( tab2d_1=dmgwi , clinfo1=' lim_thd: dmgwi : ')158 CALL prt_ctl( tab2d_1=qstoif , clinfo1=' lim_thd: qstoif : ')159 CALL prt_ctl( tab2d_1=frld , clinfo1=' lim_thd: frld : ')159 CALL prt_ctl( tab2d_1=hicif , clinfo1=' lim_thd: hicif : ' ) 160 CALL prt_ctl( tab2d_1=hsnif , clinfo1=' lim_thd: hsnif : ' ) 161 CALL prt_ctl( tab2d_1=dmgwi , clinfo1=' lim_thd: dmgwi : ' ) 162 CALL prt_ctl( tab2d_1=qstoif, clinfo1=' lim_thd: qstoif : ' ) 163 CALL prt_ctl( tab2d_1=frld , clinfo1=' lim_thd: frld : ' ) 160 164 ENDIF 161 165 … … 175 179 DO ji = 1, jpi 176 180 zthsnice = hsnif(ji,jj) + hicif(ji,jj) 177 zindb = tms(ji,jj) * ( 1.0 - MAX( zzero , SIGN( zone , - zthsnice ) ) )181 zindb = tms(ji,jj) * ( 1.0 - MAX( rzero , SIGN( rone , - zthsnice ) ) ) 178 182 pfrld(ji,jj) = frld(ji,jj) 179 zinda = 1.0 - MAX( zzero , SIGN( zone , - ( 1.0 - pfrld(ji,jj) ) ) )183 zinda = 1.0 - MAX( rzero , SIGN( rone , - ( 1.0 - pfrld(ji,jj) ) ) ) 180 184 181 185 ! solar irradiance transmission at the mixed layer bottom and used in the lead heat budget … … 189 193 190 194 ! partial computation of the lead energy budget (qldif) 191 zfontn = ( sprecip(ji,jj) / rhosn ) * xlsn ! energy for melting 195 #if defined key_coupled 196 zfi = 1.0 - pfrld(ji,jj) 197 qldif(ji,jj) = tms(ji,jj) * rdt_ice & 198 & * ( ( qsr_tot(ji,jj) - qsr_ice(ji,jj) * zfi ) * ( 1.0 - thcm(ji,jj) ) & 199 & + ( qns_tot(ji,jj) - qns_ice(ji,jj) * zfi ) & 200 & + frld(ji,jj) * ( fdtcn(ji,jj) + ( 1.0 - zindb ) * fsbbq(ji,jj) ) ) 201 #else 202 zfontn = ( sprecip(ji,jj) / rhosn ) * xlsn ! energy for melting solid precipitation 192 203 zfnsol = qns(ji,jj) ! total non solar flux over the ocean 193 204 qldif(ji,jj) = tms(ji,jj) * ( qsr(ji,jj) * ( 1.0 - thcm(ji,jj) ) & 194 205 & + zfnsol + fdtcn(ji,jj) - zfontn & 195 206 & + ( 1.0 - zindb ) * fsbbq(ji,jj) ) & 196 & * frld(ji,jj) * rdt_ice 207 & * frld(ji,jj) * rdt_ice 208 !!$ qldif(ji,jj) = tms(ji,jj) * rdt_ice * frld(ji,jj) 209 !!$ & * ( qsr(ji,jj) * ( 1.0 - thcm(ji,jj) ) & 210 !!$ & + qns(ji,jj) + fdtcn(ji,jj) - zfontn & 211 !!$ & + ( 1.0 - zindb ) * fsbbq(ji,jj) ) & 212 #endif 197 213 ! parlat : percentage of energy used for lateral ablation (0.0) 198 zfntlat = 1.0 - MAX( zzero , SIGN( zone , - qldif(ji,jj) ) )214 zfntlat = 1.0 - MAX( rzero , SIGN( rone , - qldif(ji,jj) ) ) 199 215 zpareff = 1.0 + ( parlat - 1.0 ) * zinda * zfntlat 200 216 zqlbsbq(ji,jj) = qldif(ji,jj) * ( 1.0 - zpareff ) / MAX( (1.0 - frld(ji,jj)) * rdt_ice , epsi16 ) … … 243 259 !------------------------------------------------------------------------------------ 244 260 245 IF ( nbpb > 0) THEN246 261 IF( nbpb > 0 ) THEN 262 ! 247 263 ! put the variable in a 1-D array for thermodynamics process 248 264 CALL tab_2d_1d_2( nbpb, frld_1d (1:nbpb) , frld , jpi, jpj, npb(1:nbpb) ) … … 257 273 CALL tab_2d_1d_2( nbpb, fr2_i0_1d (1:nbpb) , fr2_i0 , jpi, jpj, npb(1:nbpb) ) 258 274 CALL tab_2d_1d_2( nbpb, qns_ice_1d (1:nbpb) , qns_ice , jpi, jpj, npb(1:nbpb) ) 259 #if ! defined key_coupled 260 CALL tab_2d_1d_2( nbpb, qla_ice_1d (1:nbpb) , qla_ice , jpi, jpj, npb(1:nbpb) )261 CALL tab_2d_1d_2( nbpb, dqla_ice_1d(1:nbpb) , dqla_ice , jpi, jpj, npb(1:nbpb) )262 #endif 275 IF( .NOT. lk_cpl ) THEN 276 CALL tab_2d_1d_2( nbpb, qla_ice_1d (1:nbpb) , qla_ice , jpi, jpj, npb(1:nbpb) ) 277 CALL tab_2d_1d_2( nbpb, dqla_ice_1d(1:nbpb) , dqla_ice , jpi, jpj, npb(1:nbpb) ) 278 ENDIF 263 279 CALL tab_2d_1d_2( nbpb, dqns_ice_1d(1:nbpb) , dqns_ice , jpi, jpj, npb(1:nbpb) ) 264 280 CALL tab_2d_1d_2( nbpb, tfu_1d (1:nbpb) , tfu , jpi, jpj, npb(1:nbpb) ) … … 271 287 CALL tab_2d_1d_2( nbpb, dmgwi_1d (1:nbpb) , dmgwi , jpi, jpj, npb(1:nbpb) ) 272 288 CALL tab_2d_1d_2( nbpb, qlbbq_1d (1:nbpb) , zqlbsbq , jpi, jpj, npb(1:nbpb) ) 273 289 ! 274 290 CALL lim_thd_zdf_2( 1, nbpb ) ! compute ice growth 275 291 ! 276 292 ! back to the geographic grid. 277 293 CALL tab_1d_2d_2( nbpb, frld , npb, frld_1d (1:nbpb) , jpi, jpj ) … … 295 311 CALL tab_1d_2d_2( nbpb, fdvolif , npb, dvlbq_1d (1:nbpb) , jpi, jpj ) 296 312 CALL tab_1d_2d_2( nbpb, rdvonif , npb, dvnbq_1d (1:nbpb) , jpi, jpj ) 297 298 299 ENDIF 300 301 302 ! Up-date sea ice thickness. 303 !--------------------------------- 313 ! 314 ENDIF 315 316 317 ! Up-date sea ice thickness 318 !-------------------------- 304 319 DO jj = 1, jpj 305 320 DO ji = 1, jpi 306 321 phicif(ji,jj) = hicif(ji,jj) 307 hicif(ji,jj) = hicif(ji,jj) * ( zone - MAX( zzero, SIGN( zone, - ( 1.0 - frld(ji,jj) ) ) ) )308 END DO 309 END DO 310 311 312 ! Tricky trick : add 2 to frld in the Southern Hemisphere.313 !-------------------------------------------------------- --322 hicif(ji,jj) = hicif(ji,jj) * ( rone - MAX( rzero, SIGN( rone, - ( 1.0 - frld(ji,jj) ) ) ) ) 323 END DO 324 END DO 325 326 327 ! Tricky trick : add 2 to frld in the Southern Hemisphere 328 !-------------------------------------------------------- 314 329 IF( fcor(1,1) < 0.e0 ) THEN 315 330 DO jj = 1, njeqm1 … … 321 336 322 337 323 ! 324 ! 338 ! Select points for lateral accretion (this occurs when heat exchange 339 ! between ice and ocean is negative; ocean losing heat) 325 340 !----------------------------------------------------------------- 326 341 nbpac = 0 … … 341 356 ENDIF 342 357 343 344 ! 345 ! If ocean gains heat do nothing ; otherwise, one performs lateral accretion 358 359 ! If ocean gains heat do nothing ; otherwise, one performs lateral accretion 346 360 !-------------------------------------------------------------------------------- 347 348 361 IF( nbpac > 0 ) THEN 349 362 ! 350 363 !...Put the variable in a 1-D array for lateral accretion 351 364 CALL tab_2d_1d_2( nbpac, frld_1d (1:nbpac) , frld , jpi, jpj, npac(1:nbpac) ) … … 361 374 CALL tab_2d_1d_2( nbpac, dvlbq_1d (1:nbpac) , fdvolif , jpi, jpj, npac(1:nbpac) ) 362 375 CALL tab_2d_1d_2( nbpac, tfu_1d (1:nbpac) , tfu , jpi, jpj, npac(1:nbpac) ) 363 364 ! call lateral accretion routine. 365 CALL lim_thd_lac_2( 1 , nbpac ) 366 376 ! 377 CALL lim_thd_lac_2( 1 , nbpac ) ! lateral accretion routine. 378 ! 367 379 ! back to the geographic grid 368 380 CALL tab_1d_2d_2( nbpac, frld , npac(1:nbpac), frld_1d (1:nbpac) , jpi, jpj ) … … 375 387 CALL tab_1d_2d_2( nbpac, rdmicif , npac(1:nbpac), rdmicif_1d(1:nbpac) , jpi, jpj ) 376 388 CALL tab_1d_2d_2( nbpac, fdvolif , npac(1:nbpac), dvlbq_1d (1:nbpac) , jpi, jpj ) 377 389 ! 378 390 ENDIF 379 391 380 392 381 ! 382 ! 393 ! Recover frld values between 0 and 1 in the Southern Hemisphere (tricky trick) 394 ! Update daily thermodynamic ice production. 383 395 !------------------------------------------------------------------------------ 384 385 396 DO jj = 1, jpj 386 397 DO ji = 1, jpi … … 392 403 IF(ln_ctl) THEN 393 404 CALL prt_ctl_info(' lim_thd end ') 394 CALL prt_ctl( tab2d_1=hicif , clinfo1=' lim_thd: hicif : ', tab2d_2=hsnif , clinfo2=' hsnif : ')395 CALL prt_ctl( tab2d_1=frld , clinfo1=' lim_thd: frld : ', tab2d_2=hicifp, clinfo2=' hicifp : ')396 CALL prt_ctl( tab2d_1=phicif, clinfo1=' lim_thd: phicif : ', tab2d_2=pfrld , clinfo2=' pfrld : ')397 CALL prt_ctl( tab2d_1=sist , clinfo1=' lim_thd: sist : ')398 CALL prt_ctl( tab2d_1=tbif(:,:,1), clinfo1=' lim_thd: tbif 1 : ')399 CALL prt_ctl( tab2d_1=tbif(:,:,2), clinfo1=' lim_thd: tbif 2 : ')400 CALL prt_ctl( tab2d_1=tbif(:,:,3), clinfo1=' lim_thd: tbif 3 : ')401 CALL prt_ctl( tab2d_1=fdtcn , clinfo1=' lim_thd: fdtcn : ', tab2d_2=qdtcn , clinfo2=' qdtcn : ')402 CALL prt_ctl( tab2d_1=qstoif, clinfo1=' lim_thd: qstoif : ', tab2d_2=fsbbq , clinfo2=' fsbbq : ')405 CALL prt_ctl( tab2d_1=hicif , clinfo1=' lim_thd: hicif : ', tab2d_2=hsnif , clinfo2=' hsnif : ' ) 406 CALL prt_ctl( tab2d_1=frld , clinfo1=' lim_thd: frld : ', tab2d_2=hicifp, clinfo2=' hicifp : ' ) 407 CALL prt_ctl( tab2d_1=phicif , clinfo1=' lim_thd: phicif : ', tab2d_2=pfrld , clinfo2=' pfrld : ' ) 408 CALL prt_ctl( tab2d_1=sist , clinfo1=' lim_thd: sist : ' ) 409 CALL prt_ctl( tab2d_1=tbif(:,:,1), clinfo1=' lim_thd: tbif 1 : ' ) 410 CALL prt_ctl( tab2d_1=tbif(:,:,2), clinfo1=' lim_thd: tbif 2 : ' ) 411 CALL prt_ctl( tab2d_1=tbif(:,:,3), clinfo1=' lim_thd: tbif 3 : ' ) 412 CALL prt_ctl( tab2d_1=fdtcn , clinfo1=' lim_thd: fdtcn : ', tab2d_2=qdtcn , clinfo2=' qdtcn : ' ) 413 CALL prt_ctl( tab2d_1=qstoif , clinfo1=' lim_thd: qstoif : ', tab2d_2=fsbbq , clinfo2=' fsbbq : ' ) 403 414 ENDIF 404 415 ! … … 422 433 & hakdif, hnzst , thth , parsub, alphs 423 434 !!------------------------------------------------------------------- 424 425 426 ! Define the initial parameters 427 ! ------------------------- 428 REWIND( numnam_ice ) 435 ! 436 REWIND( numnam_ice ) ! read namelist 429 437 READ ( numnam_ice , namicethd ) 430 IF(lwp) THEN 438 IF( lk_cpl .AND. parsub /= 0.0 ) CALL ctl_stop( 'In coupled mode, use parsub = 0. or send dqla' ) 439 ! 440 IF(lwp) THEN ! control print 431 441 WRITE(numout,*) 432 442 WRITE(numout,*)'lim_thd_init_2: ice parameters for ice thermodynamic computation ' … … 437 447 WRITE(numout,*)' minimum ice thickness hiclim = ', hiclim 438 448 WRITE(numout,*)' maximum lead fraction amax = ', amax 439 WRITE(numout,*)' energy stored in brine pocket (=1) or not (=0) 449 WRITE(numout,*)' energy stored in brine pocket (=1) or not (=0) swiqst = ', swiqst 440 450 WRITE(numout,*)' numerical carac. of the scheme for diffusion in ice ' 441 451 WRITE(numout,*)' Cranck-Nicholson (=0.5), implicit (=1), explicit (=0) sbeta = ', sbeta … … 450 460 WRITE(numout,*)' coefficient for snow density when snow ice formation alphs = ', alphs 451 461 ENDIF 452 462 ! 453 463 uscomi = 1.0 / ( 1.0 - amax ) ! inverse of minimum lead fraction 454 464 rcdsn = hakdif * rcdsn 455 465 rcdic = hakdif * rcdic 456 457 IF ( ( hsndif > 100.e0 ) .OR. ( hicdif > 100.e0 )) THEN466 ! 467 IF( hsndif > 100.e0 .OR. hicdif > 100.e0 ) THEN 458 468 cnscg = 0.e0 459 469 ELSE 460 470 cnscg = rcpsn / rcpic ! ratio rcpsn/rcpic 461 471 ENDIF 462 472 ! 463 473 END SUBROUTINE lim_thd_init_2 464 474 -
trunk/NEMO/LIM_SRC_2/limthd_zdf_2.F90
r1156 r1218 22 22 USE limistate_2 23 23 USE in_out_manager 24 USE cpl_oasis3, ONLY : lk_cpl 24 25 25 26 IMPLICIT NONE … … 213 214 zghe = ( 1.0 - zihe ) * zheshth * ( 2.0 - zheshth ) & 214 215 & + zihe * 0.5 * ( 1.5 + LOG( 2.0 * zheshth ) ) 215 #if defined key_lim_cp3216 zghe = 1.0217 #endif218 216 219 217 !---effective conductivities … … 297 295 DO ji = kideb, kiut 298 296 !---computation of the derivative of energy balance function 299 #if defined key_coupled300 # if defined key_lim_cp2301 zdfts = zksndh(ji) & ! contribution of the conductive heat flux302 & + zrcpdt(ji) & ! contribution of hsu * rcp / dt303 & - dqns_ice_1d(ji) ! contribution of the total non solar radiation304 # else305 zdfts = zksndh(ji) & ! contribution of the conductive heat flux306 & + zrcpdt(ji) ! contribution of hsu * rcp / dt307 # endif308 309 #else310 297 zdfts = zksndh(ji) & ! contribution of the conductive heat flux 311 298 & + zrcpdt(ji) & ! contribution of hsu * rcp / dt 312 299 & - dqns_ice_1d (ji) ! contribution of the total non solar radiation 313 #endif314 300 !---computation of the energy balance function 315 301 zfts = - z1mi0 (ji) * qsr_ice_1d(ji) & ! net absorbed solar radiation … … 318 304 !---computation of surface temperature increment 319 305 zdts = -zfts / zdfts 320 #if defined key_lim_cp3321 zdts = zdts / 3.0322 #endif323 306 !---computation of the new surface temperature 324 307 sist_1d(ji) = sist_1d(ji) + zdts 325 326 308 END DO 327 309 … … 338 320 !---------------------------------------------------------------------- 339 321 340 DO ji = kideb, kiut 341 sist_1d(ji) = MIN( ztsmlt(ji) , sist_1d(ji) ) 342 #if ! defined key_coupled 343 qns_ice_1d(ji) = qns_ice_1d(ji) + dqns_ice_1d(ji) * ( sist_1d(ji) - zts_old(ji) ) 344 qla_ice_1d (ji) = qla_ice_1d (ji) + dqla_ice_1d(ji) * ( sist_1d(ji) - zts_old(ji) ) 345 #endif 346 zfcsu(ji) = zksndh(ji) * ( ztbif(ji) - sist_1d(ji) ) 347 END DO 322 IF ( .NOT. lk_cpl ) THEN ! duplicate the loop for performances issues 323 DO ji = kideb, kiut 324 sist_1d(ji) = MIN( ztsmlt(ji) , sist_1d(ji) ) 325 qns_ice_1d(ji) = qns_ice_1d(ji) + dqns_ice_1d(ji) * ( sist_1d(ji) - zts_old(ji) ) 326 qla_ice_1d(ji) = qla_ice_1d(ji) + dqla_ice_1d(ji) * ( sist_1d(ji) - zts_old(ji) ) 327 zfcsu(ji) = zksndh(ji) * ( ztbif(ji) - sist_1d(ji) ) 328 END DO 329 ELSE 330 DO ji = kideb, kiut 331 sist_1d(ji) = MIN( ztsmlt(ji) , sist_1d(ji) ) 332 zfcsu(ji) = zksndh(ji) * ( ztbif(ji) - sist_1d(ji) ) 333 END DO 334 ENDIF 348 335 349 336 ! 5.2. Calculate available heat for surface ablation. … … 517 504 518 505 qstbif_1d(ji) = ziqf * ( qstbif_1d(ji) - zqsn_mlt_rem ) & 519 & + ( 1.0 - ziqf ) * ( qstbif_1d(ji) - qstbif_1d(ji) )506 & + ( 1.0 - ziqf ) * ( qstbif_1d(ji) - qstbif_1d(ji) ) 520 507 521 508 !-- The contribution of the energy stored in brine pockets qstbif_1d to melt … … 529 516 530 517 qstbif_1d(ji) = zihq * qstbif_1d(ji) & 531 & + ( 1.0 - zihq ) * zqstbif_old518 & + ( 1.0 - zihq ) * zqstbif_old 532 519 533 520 !--change in ice thickness due to melt at the top surface -
trunk/NEMO/OPA_SRC/SBC/cpl_oasis3.F90
r1146 r1218 21 21 !! cpl_prism_init : initialization of coupled mode communication 22 22 !! cpl_prism_define : definition of grid and fields 23 !! cpl_prism_s end : send out fields in coupled mode24 !! cpl_prism_r ecv : receive fields in coupled mode23 !! cpl_prism_snd : snd out fields in coupled mode 24 !! cpl_prism_rcv : receive fields in coupled mode 25 25 !! cpl_prism_finalize : finalize the coupled mode communication 26 26 !!---------------------------------------------------------------------- 27 !! * Modules used 28 !##################### WARNING coupled mode ############################### 29 !##################### WARNING coupled mode ############################### 30 ! Following lines must be enabled if coupling with OASIS 27 USE mod_prism_proto ! OASIS3 prism module 28 USE mod_prism_def_partition_proto! OASIS3 prism module for partitioning 29 USE mod_prism_grids_writing ! OASIS3 prism module for writing grid files 30 USE mod_prism_put_proto ! OASIS3 prism module for snding 31 USE mod_prism_get_proto ! OASIS3 prism module for receiving 32 USE mod_prism_grids_writing ! OASIS3 prism module for writing grids 33 USE par_oce ! ocean parameters 34 USE dom_oce ! ocean space and time domain 35 USE in_out_manager ! I/O manager 36 USE lib_mpp 37 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 38 IMPLICIT NONE 39 PRIVATE 31 40 ! 32 ! USE mod_prism_proto ! OASIS3 prism module 33 ! USE mod_prism_def_partition_proto! OASIS3 prism module for partitioning 34 ! USE mod_prism_grids_writing ! OASIS3 prism module for writing grid files 35 ! USE mod_prism_put_proto ! OASIS3 prism module for sending 36 ! USE mod_prism_get_proto ! OASIS3 prism module for receiving 37 ! USE mod_prism_grids_writing ! OASIS3 prism module for writing grids 38 !##################### WARNING coupled mode ############################### 39 !##################### WARNING coupled mode ############################### 40 #if defined key_mpp_mpi 41 USE lib_mpp, only : mppsize, mpprank ! message passing 42 USE lib_mpp, only : mppsend ! message passing 43 USE lib_mpp, only : mpprecv ! message passing 44 #endif 45 USE daymod ! date and time info 46 USE dom_oce ! ocean space and time domain 47 USE sbc_ice ! surface boundary condition: ice 48 USE in_out_manager ! I/O manager 49 USE par_oce ! 50 USE phycst, only : rt0 ! freezing point of sea water 51 52 USE oce, only: tn, un, vn 53 #if defined key_lim2 54 USE ice_2, only: frld, hicif, hsnif 55 #endif 56 57 IMPLICIT NONE 58 ! 59 ! Exchange parameters for coupling ORCA-LIM with ECHAM5 60 ! 61 #if defined key_cpl_ocevel 62 INTEGER, PARAMETER :: nsend = 6 63 #else 64 INTEGER, PARAMETER :: nsend = 4 65 #endif 66 67 #if defined key_cpl_discharge 68 INTEGER, PARAMETER :: nrecv = 20 69 #else 70 INTEGER, PARAMETER :: nrecv = 17 71 #endif 72 73 INTEGER, DIMENSION(nsend) :: send_id 74 INTEGER, DIMENSION(nrecv) :: recv_id 75 76 CHARACTER(len=32) :: cpl_send (nsend) 77 CHARACTER(len=32) :: cpl_recv (nrecv) 78 79 PRIVATE 80 81 INTEGER :: localRank ! local MPI rank 82 INTEGER :: comp_id ! id returned by prism_init_comp 83 84 INTEGER :: range(5) 85 86 INTEGER, PARAMETER :: localRoot = 0 87 INTEGER :: localSize ! local MPI size 88 INTEGER :: localComm ! local MPI size 89 LOGICAL :: commRank ! true for ranks doing OASIS communication 90 91 LOGICAL, SAVE :: prism_was_initialized 92 LOGICAL, SAVE :: prism_was_terminated 93 INTEGER, SAVE :: write_grid 94 95 INTEGER :: ierror ! return error code 41 INTEGER, PUBLIC :: nlocalComm 42 LOGICAL, PUBLIC, PARAMETER :: lk_cpl = .TRUE. ! coupled flag 43 INTEGER :: ncomp_id ! id returned by prism_init_comp 44 INTEGER :: nerror ! return error code 45 46 INTEGER, PUBLIC :: nrcv, nsnd ! Number of received and sent coupling fields 47 48 INTEGER, PARAMETER :: nmaxfld=40 ! Maximum number of coupling fields 49 50 TYPE, PUBLIC :: FLD_CPL ! Type for coupling field information 51 LOGICAL :: laction ! To be coupled or not 52 CHARACTER(len = 8) :: clname ! Name of the coupling field 53 CHARACTER(len = 1) :: clgrid ! Grid type 54 REAL(wp) :: nsgn ! Control of the sign change 55 INTEGER :: nid ! Id of the field 56 END TYPE FLD_CPL 57 58 TYPE(FLD_CPL), DIMENSION(nmaxfld), PUBLIC :: srcv, ssnd ! Coupling fields 96 59 97 60 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: exfld ! Temporary buffer for receiving 98 99 #ifdef key_cpl_rootexchg100 LOGICAL :: rootexchg =.true. ! logical switch101 #else102 LOGICAL :: rootexchg =.false. ! logical switch103 #endif104 105 REAL(wp), DIMENSION(:), ALLOCATABLE :: buffer ! Temporary buffer for exchange106 INTEGER, DIMENSION(:,:), ALLOCATABLE :: ranges ! Temporary buffer for exchange107 61 108 62 !! Routine accessibility 109 63 PUBLIC cpl_prism_init 110 64 PUBLIC cpl_prism_define 111 PUBLIC cpl_prism_s end112 PUBLIC cpl_prism_r ecv65 PUBLIC cpl_prism_snd 66 PUBLIC cpl_prism_rcv 113 67 PUBLIC cpl_prism_finalize 114 68 115 PUBLIC send_id, recv_id116 117 69 !!---------------------------------------------------------------------- 118 70 !! OPA 9.0 , LOCEAN-IPSL (2006) 119 !! $ Id$71 !! $Header$ 120 72 !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 121 73 !!---------------------------------------------------------------------- … … 123 75 CONTAINS 124 76 125 SUBROUTINE cpl_prism_init( localCommunicator ) 126 127 IMPLICIT NONE 77 SUBROUTINE cpl_prism_init 128 78 129 79 !!------------------------------------------------------------------- … … 135 85 !! ** Method : OASIS3 MPI communication 136 86 !!-------------------------------------------------------------------- 137 !! * Arguments 138 !! 139 INTEGER, INTENT(OUT) :: localCommunicator 140 !! 141 !! * Local declarations 142 !! 143 CHARACTER(len=4) :: comp_name ! name of this PRISM component 144 !! 145 !!-------------------------------------------------------------------- 146 !! 147 IF(lwp) WRITE(numout,*) 87 !! 88 148 89 IF(lwp) WRITE(numout,*) 'cpl_prism_init : initialization in coupled ocean/atmosphere case' 149 90 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~' 150 91 IF(lwp) WRITE(numout,*) 151 152 #if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_forced_daily153 IF(lwp)WRITE(numout,cform_err)154 IF(lwp)WRITE(numout,*) ' key_coupled and key_flx_bulk_* key_flx_forced_daily are incompatible'155 nstop = nstop + 1156 #endif157 158 comp_name = 'opa9'159 160 92 !------------------------------------------------------------------ 161 93 ! 1st Initialize the PRISM system for the application 162 94 !------------------------------------------------------------------ 163 164 CALL prism_init_comp_proto ( comp_id, comp_name, ierror ) 165 IF ( ierror /= PRISM_Ok ) & 166 CALL prism_abort_proto (comp_id, 'cpl_prism_init', 'Failure in prism_init_comp_proto') 167 prism_was_initialized = .true. 95 CALL prism_init_comp_proto ( ncomp_id, 'oceanx', nerror ) 96 IF ( nerror /= PRISM_Ok ) & 97 CALL prism_abort_proto (ncomp_id, 'cpl_prism_init', 'Failure in prism_init_comp_proto') 168 98 169 99 !------------------------------------------------------------------ … … 171 101 !------------------------------------------------------------------ 172 102 173 CALL prism_get_localcomm_proto ( localComm, ierror ) 174 IF ( ierror /= PRISM_Ok ) & 175 CALL prism_abort_proto (comp_id, 'cpl_prism_init','Failure in prism_get_localcomm_proto' ) 176 177 localCommunicator = localComm 103 CALL prism_get_localcomm_proto ( nlocalComm, nerror ) 104 IF ( nerror /= PRISM_Ok ) & 105 CALL prism_abort_proto (ncomp_id, 'cpl_prism_init','Failure in prism_get_localcomm_proto' ) 178 106 179 107 END SUBROUTINE cpl_prism_init … … 181 109 182 110 SUBROUTINE cpl_prism_define () 183 184 IMPLICIT NONE185 111 186 112 !!------------------------------------------------------------------- … … 196 122 !! * Local declarations 197 123 !! 198 INTEGER :: grid_id(2) ! id returned by prism_def_grid 199 INTEGER :: part_id 200 124 INTEGER :: id_part 201 125 INTEGER :: paral(5) ! OASIS3 box partition 202 203 INTEGER :: shape(2,3) ! shape of arrays passed to PSMILe 204 INTEGER :: nodim(2) 205 INTEGER :: data_type ! data type of transients 206 207 INTEGER :: ji, jj ! local loop indicees 208 INTEGER :: nx, ny, nc ! local variables 209 INTEGER :: im1, ip1 210 INTEGER :: jm1, jp1 211 INTEGER :: i_grid ! loop index 212 INTEGER :: info 213 INTEGER :: maxlen 214 INTEGER :: mask(jpi,jpj) 215 REAL(kind=wp) :: area(jpi,jpj) 216 217 CHARACTER(len=4) :: point_name ! name of the grid points 218 219 REAL(kind=wp) :: rclam(jpi,jpj,4) 220 REAL(kind=wp) :: rcphi(jpi,jpj,4) 221 222 REAL(kind=wp) :: glam_b(jpi,jpj) ! buffer for orca2 grid correction 223 REAL(kind=wp) :: gphi_b(jpi,jpj) ! buffer for orca2 grid correction 224 !! 225 !!-------------------------------------------------------------------- 226 126 INTEGER :: ishape(2,2) ! shape of arrays passed to PSMILe 127 INTEGER :: ji ! local loop indicees 128 !! 129 !!-------------------------------------------------------------------- 130 227 131 IF(lwp) WRITE(numout,*) 228 132 IF(lwp) WRITE(numout,*) 'cpl_prism_define : initialization in coupled ocean/atmosphere case' 229 133 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~~' 230 134 IF(lwp) WRITE(numout,*) 231 232 #if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_forced_daily 233 IF(lwp)WRITE(numout,cform_err) 234 IF(lwp)WRITE(numout,*) ' key_coupled and key_flx_bulk_... are incompatible' 235 nstop = nstop + 1 236 #endif 237 238 ! ----------------------------------------------------------------- 239 ! ... Some initialisation 240 ! ----------------------------------------------------------------- 241 242 send_id = 0 243 recv_id = 0 244 245 #if defined key_mpp_mpi 246 247 ! ----------------------------------------------------------------- 248 ! ... Some MPI stuff relevant for optional exchange via root only 249 ! ----------------------------------------------------------------- 250 251 commRank = .false. 252 253 localRank = mpprank ! from lib_mpp 254 localSize = mppsize ! from lib_mpp 255 256 IF ( rootexchg ) THEN 257 IF ( localRank == localRoot ) commRank = .true. 258 ELSE 259 commRank = .true. 135 136 ! 137 ! ... Define the shape for the area that excludes the halo 138 ! For serial configuration (key_mpp_mpi not being active) 139 ! nl* is set to the global values 1 and jp*glo. 140 ! 141 ishape(:,1) = (/ 1, nlei-nldi+1 /) 142 ishape(:,2) = (/ 1, nlej-nldj+1 /) 143 ! 144 ! ... Allocate memory for data exchange 145 ! 146 ALLOCATE(exfld(nlei-nldi+1, nlej-nldj+1), stat = nerror) 147 IF (nerror > 0) THEN 148 CALL prism_abort_proto ( ncomp_id, 'cpl_prism_define', 'Failure in allocating exfld') 149 RETURN 260 150 ENDIF 261 262 IF ( rootexchg .and. localRank == localRoot ) THEN 263 ALLOCATE(ranges(5,0:localSize-1), stat = ierror) 264 IF (ierror > 0) THEN 265 CALL prism_abort_proto ( comp_id, 'cpl_prism_define', 'Failure in allocating Integer') 266 RETURN 267 ENDIF 268 ENDIF 269 270 #else 271 ! 272 ! For non-parallel configurations the one and only process ("localRoot") 273 ! takes part in the communication 274 ! 275 localRank = localRoot 276 commRank = .true. 277 278 #endif 279 280 ! ----------------------------------------------------------------- 281 ! ... If necessary the root process writes the global grid info 282 ! ----------------------------------------------------------------- 283 284 IF ( localRank == localRoot ) THEN 285 286 WRITE(numout,*)'Opening file SSTOCEAN, unit= 199' 287 288 OPEN (199,STATUS='NEW',FILE="sstocean",FORM='UNFORMATTED',err=310) 289 290 ! In case the sstocean of OASIS3 from a previous run exists 291 ! the programs jumps to the end of the if-block 292 ! 293 !* 2.0 Write exchange fields to OASIS data file. 294 ! ----------------------------------------- 295 296 WHERE (tmask(:,:,1) > 0.5 ) 297 mask(:,:) = 0 298 ELSE WHERE 299 mask(:,:) = 1 300 END WHERE 301 302 ! Initialise ice mask at the very first start only 303 frld = 1. 304 305 WRITE(199) 'SSTOCEAN' 306 WRITE(199) (tn(:,:,1)*mask(:,:))+rt0 307 308 WRITE(199) 'SICOCEAN' 309 WRITE(199) (1.-frld(:,:))*mask(:,:) 310 311 #if defined key_cpl_albedo 312 # if defined key_lim3 313 Must be adapted for LIM3 314 # endif 315 tn_ice = 271.285 316 alb_ice = 0.75 317 318 WRITE(199) 'STIOCEAN' 319 WRITE(199) tn_ice(:,:) 320 321 WRITE(199) 'SAIOCEAN' 322 WRITE(199) alb_ice(:,:) 323 #else 324 hicit = 0. 325 hsnit = 0. 326 WRITE(199) 'SITOCEAN' 327 WRITE(199) hicif(:,:)*mask(:,:) 328 329 WRITE(199) 'SNTOCEAN' 330 WRITE(199) hsnif(:,:)*mask(:,:) 331 #endif 332 333 #if defined key_cpl_ocevel 334 un(:,:,1) = 0. 335 vn(:,:,1) = 0. 336 337 WHERE (umask(:,:,1) > 0.5 ) 338 mask(:,:) = 0 339 ELSE WHERE 340 mask(:,:) = 1 341 END WHERE 342 343 WRITE(199) 'SUNOCEAN' 344 WRITE(199) un(:,:,1)*mask(:,:) 345 346 WHERE (vmask(:,:,1) > 0.5 ) 347 mask(:,:) = 0 348 ELSE WHERE 349 mask(:,:) = 1 350 END WHERE 351 352 WRITE(199) 'SVNOCEAN' 353 WRITE(199) vn(:,:,1)*mask(:,:) 354 #endif 355 356 WRITE(numout,*) 357 WRITE(numout,*)' sstocean written' 358 WRITE(numout,*)' ***************' 359 360 CLOSE(199) 361 362 310 CONTINUE 363 364 CALL prism_start_grids_writing ( write_grid ) 365 366 ENDIF ! localRank == localRoot 367 368 IF ( localRank == localRoot .and. write_grid == 1 ) THEN 369 370 !------------------------------------------------------------------ 371 ! 1st write global grid information (ORCA tripolar) characteristics 372 ! for surface coupling into a OASIS3 specific grid file. For 373 ! surface coupling it is sufficient to specify only one vertical 374 ! z-level. 375 !------------------------------------------------------------------ 376 ! 377 ! ... Treat corners in the horizontal plane 378 ! 379 nx = jpi 380 ny = jpj 381 nc = 4 382 383 DO i_grid = 1, 3 384 385 IF ( i_grid == 1 ) THEN 386 387 ! -------------------------------------------------------- 388 ! ... Write the grid info for T points 389 ! -------------------------------------------------------- 390 391 point_name = 'opat' 392 393 glam_b = glamt 394 gphi_b = gphit 395 396 DO ji = 1, jpi 397 DO jj = 1, jpj 398 399 im1 = ji-1 400 jm1 = jj-1 401 IF (ji == 1) im1 = jpi-2 402 IF (jj == 1) jm1 = jj 403 404 rclam(ji,jj,1) = glamf(ji,jj) 405 rclam(ji,jj,2) = glamf(im1,jj) 406 rclam(ji,jj,3) = glamf(im1,jm1) 407 rclam(ji,jj,4) = glamf(ji,jm1) 408 409 rcphi(ji,jj,1) = gphif(ji,jj) 410 rcphi(ji,jj,2) = gphif(im1,jj) 411 rcphi(ji,jj,3) = gphif(im1,jm1) 412 rcphi(ji,jj,4) = gphif(ji,jm1) 413 414 END DO 415 END DO 416 417 ! Correction of one (land) grid cell of the orca2 grid. 418 ! It was causing problems with the SCRIP interpolation. 419 420 IF (jpiglo == 182 .AND. jpjglo == 149) THEN 421 rclam(145,106,2) = -1.0 422 rcphi(145,106,2) = 41.0 423 ENDIF 424 425 WHERE (tmask(:,:,1) > 0.5 ) 426 mask(:,:) = 0 427 ELSE WHERE 428 mask(:,:) = 1 429 END WHERE 430 431 area = e1t * e2t 432 433 ELSE IF ( i_grid == 2 ) THEN 434 435 ! -------------------------------------------------------- 436 ! ... Write the grid info for u points 437 ! -------------------------------------------------------- 438 439 point_name = 'opau' 440 441 glam_b = glamu 442 gphi_b = gphiu 443 444 DO ji = 1, jpi 445 DO jj = 1, jpj 446 447 ip1 = ji+1 448 jm1 = jj-1 449 450 IF (ji == jpiglo) ip1 = 3 451 IF (jj == 1) jm1 = jj 452 453 rclam(ji,jj,1) = glamv(ip1,jj) 454 rclam(ji,jj,2) = glamv(ji,jj) 455 rclam(ji,jj,3) = glamv(ji,jm1) 456 rclam(ji,jj,4) = glamv(ip1,jm1) 457 458 rcphi(ji,jj,1) = gphiv(ip1,jj) 459 rcphi(ji,jj,2) = gphiv(ji,jj) 460 rcphi(ji,jj,3) = gphiv(ji,jm1) 461 rcphi(ji,jj,4) = gphiv(ip1,jm1) 462 463 END DO 464 END DO 465 466 ! Correction of three (land) grid cell of the orca2 grid. 467 ! It was causing problems with the SCRIP interpolation. 468 469 IF (jpiglo == 182 .AND. jpjglo == 149) THEN 470 glam_b(144,106) = -1.0 471 gphi_b(144,106) = 40.5 472 rclam (144,106,2) = -1.5 473 rcphi (144,106,2) = 41.0 474 475 glam_b(144,107) = -1.0 476 gphi_b(144,107) = 41.5 477 rclam (144,107,2) = -1.5 478 rcphi (144,107,2) = 42.0 479 rclam (144,107,3) = -1.5 480 rcphi (144,107,3) = 41.0 481 482 glam_b(144,108) = -1.0 483 gphi_b(144,108) = 42.5 484 rclam (144,108,2) = -1.5 485 rcphi (144,108,2) = 43.0 486 rclam (144,108,3) = -1.5 487 rcphi (144,108,3) = 42.0 488 ENDIF 489 490 WHERE (umask(:,:,1) > 0.5 ) 491 mask(:,:) = 0 492 ELSE WHERE 493 mask(:,:) = 1 494 END WHERE 495 496 area = e1u * e2u 497 498 ELSE IF ( i_grid == 3 ) THEN 499 500 ! -------------------------------------------------------- 501 ! ... Write the grid info for v points 502 ! -------------------------------------------------------- 503 504 point_name = 'opav' 505 506 glam_b = glamv 507 gphi_b = gphiv 508 509 DO ji = 1, jpi 510 DO jj = 1, jpj 511 512 im1 = ji-1 513 jp1 = jj+1 514 IF (ji == 1) im1 = jpiglo-2 515 IF (jj == jpjglo) jp1 = jj 516 517 rclam(ji,jj,1) = glamu(ji,jp1) 518 rclam(ji,jj,2) = glamu(im1,jp1) 519 rclam(ji,jj,3) = glamu(im1,jj) 520 rclam(ji,jj,4) = glamu(ji,jj) 521 522 rcphi(ji,jj,1) = gphiu(ji,jp1) 523 rcphi(ji,jj,2) = gphiu(im1,jp1) 524 rcphi(ji,jj,3) = gphiu(im1,jj) 525 rcphi(ji,jj,4) = gphiu(ji,jj) 526 527 END DO 528 END DO 529 530 ! Correction of one (land) grid cell of the orca2 grid. 531 ! It was causing problems with the SCRIP interpolation. 532 533 IF (jpiglo == 182 .AND. jpjglo == 149) THEN 534 rclam(145,105,2) = -1.0 535 rcphi(145,105,2) = 40.5 536 ENDIF 537 538 WHERE (vmask(:,:,1) > 0.5 ) 539 mask(:,:) = 0 540 ELSE WHERE 541 mask(:,:) = 1 542 END WHERE 543 544 area = e1v * e2v 545 546 ENDIF ! i_grid 547 548 WHERE (glam_b(:,:) < 0.) 549 glam_b(:,:) = glam_b(:,:) + 360. 550 END WHERE 551 WHERE (glam_b(:,:) > 360.) 552 glam_b(:,:) = glam_b(:,:) - 360. 553 END WHERE 554 555 WHERE (rclam(:,:,:) < 0.) 556 rclam(:,:,:) = rclam(:,:,:) + 360. 557 END WHERE 558 WHERE (rclam(:,:,:) > 360.) 559 rclam(:,:,:) = rclam(:,:,:) - 360. 560 END WHERE 561 562 mask(:,jpjglo)=1 563 564 CALL prism_write_grid ( point_name, nx, ny, glam_b, gphi_b ) 565 CALL prism_write_corner ( point_name, nx, ny, nc, rclam, rcphi ) 566 CALL prism_write_mask ( point_name, nx, ny, mask ) 567 CALL prism_write_area ( point_name, nx, ny, area ) 568 569 END DO ! i_grid 570 571 CALL prism_terminate_grids_writing () 572 573 ENDIF ! localRank == localRoot .and. write_grid == 1 574 151 ! 575 152 ! ----------------------------------------------------------------- 576 153 ! ... Define the partition 577 154 ! ----------------------------------------------------------------- 578 579 IF ( rootexchg ) THEN 580 581 paral(1) = 2 ! box partitioning 582 paral(2) = 0 ! NEMO lower left corner global offset 583 paral(3) = jpiglo ! local extent in i 584 paral(4) = jpjglo ! local extent in j 585 paral(5) = jpiglo ! global extent in x 586 587 range(1) = nimpp-1+nldi ! global start in i 588 range(2) = nlei-nldi+1 ! local size in i of valid region 589 range(3) = njmpp-1+nldj ! global start in j 590 range(4) = nlej-nldj+1 ! local size in j of valid region 591 range(5) = range(2) & 592 * range(4) ! local horizontal size 593 594 IF(ln_ctl) THEN 595 write(numout,*) ' rootexchg: range(1:5)', range 155 156 paral(1) = 2 ! box partitioning 157 paral(2) = jpiglo * (nldj-1+njmpp-1) + (nldi-1+nimpp-1) ! NEMO lower left corner global offset 158 paral(3) = nlei-nldi+1 ! local extent in i 159 paral(4) = nlej-nldj+1 ! local extent in j 160 paral(5) = jpiglo ! global extent in x 161 162 IF( ln_ctl ) THEN 163 WRITE(numout,*) ' multiexchg: paral (1:5)', paral 164 WRITE(numout,*) ' multiexchg: jpi, jpj =', jpi, jpj 165 WRITE(numout,*) ' multiexchg: nldi, nlei, nimpp =', nldi, nlei, nimpp 166 WRITE(numout,*) ' multiexchg: nldj, nlej, njmpp =', nldj, nlej, njmpp 167 ENDIF 168 169 CALL prism_def_partition_proto ( id_part, paral, nerror ) 170 ! 171 ! ... Announce send variables. 172 ! 173 DO ji = 1, nsnd 174 IF ( ssnd(ji)%laction ) THEN 175 CALL prism_def_var_proto (ssnd(ji)%nid, ssnd(ji)%clname, id_part, (/ 2, 0/), & 176 & PRISM_Out , ishape , PRISM_REAL, nerror) 177 IF ( nerror /= PRISM_Ok ) THEN 178 WRITE(numout,*) 'Failed to define transient ', ji, TRIM(ssnd(ji)%clname) 179 CALL prism_abort_proto ( ssnd(ji)%nid, 'cpl_prism_define', 'Failure in prism_def_var') 180 ENDIF 596 181 ENDIF 597 598 ! 599 ! Collect ranges from all NEMO procs on the local root process 600 ! 601 CALL mpi_gather(range, 5, MPI_INTEGER, & 602 ranges, 5, MPI_INTEGER, localRoot, localComm, ierror) 603 604 IF ( localRank == localRoot ) THEN 605 606 maxlen = maxval(ranges(5,:)) 607 608 ALLOCATE(buffer(1:maxlen), stat = ierror) 609 IF (ierror > 0) THEN 610 CALL prism_abort_proto ( comp_id, 'cpl_prism_define', 'Failure in allocating buffer') 611 RETURN 182 END DO 183 ! 184 ! ... Announce received variables. 185 ! 186 DO ji = 1, nrcv 187 IF ( srcv(ji)%laction ) THEN 188 CALL prism_def_var_proto ( srcv(ji)%nid, srcv(ji)%clname, id_part, (/ 2, 0/), & 189 & PRISM_In , ishape , PRISM_REAL, nerror) 190 IF ( nerror /= PRISM_Ok ) THEN 191 WRITE(numout,*) 'Failed to define transient ', ji, TRIM(srcv(ji)%clname) 192 CALL prism_abort_proto ( srcv(ji)%nid, 'cpl_prism_define', 'Failure in prism_def_var') 612 193 ENDIF 613 614 ENDIF615 616 ELSE617 618 paral(1) = 2 ! box partitioning619 !2dtest paral(2) = jpiglo &620 !2dtest * (nldj-1+njmpp-1) &621 !2dtest + (nldi-1+nimpp-1) ! NEMO lower left corner global offset622 paral(2) = jpiglo &623 * (nldj-1+njmpp-1) ! NEMO lower left corner global offset624 paral(3) = nlei-nldi+1 ! local extent in i625 paral(4) = nlej-nldj+1 ! local extent in j626 paral(5) = jpiglo ! global extent in x627 628 IF(ln_ctl) THEN629 print*, ' multiexchg: paral (1:5)', paral630 print*, ' multiexchg: jpi, jpj =', jpi, jpj631 print*, ' multiexchg: nldi, nlei, nimpp =', nldi, nlei, nimpp632 print*, ' multiexchg: nldj, nlej, njmpp =', nldj, nlej, njmpp633 194 ENDIF 634 635 IF ( paral(3) /= nlei-nldi+1 ) THEN 636 print*, 'WARNING!!! in cpl_oasis3 - cpl_prism_define' 637 print*, 'cpl_prism_define: local extend in i is ', paral(3), ' should equal ', nlei-nldi+1 638 ENDIF 639 IF ( paral(4) /= nlej-nldj+1 ) THEN 640 print*, 'WARNING!!! in cpl_oasis3 - cpl_prism_define' 641 print*, 'cpl_prism_define: local extend in j is ', paral(4), ' should equal ', nlej-nldj+1 642 ENDIF 643 644 ENDIF 645 646 IF ( commRank ) & 647 CALL prism_def_partition_proto ( part_id, paral, ierror ) 648 649 grid_id(1)= part_id 650 651 !------------------------------------------------------------------ 652 ! 3rd Declare the transient variables 653 !------------------------------------------------------------------ 654 ! 655 ! ... Define symbolic names for the transient fields send by the ocean 656 ! These must be identical to the names specified in the SMIOC file. 657 ! 658 cpl_send( 1)='SSTOCEAN' ! sea surface temperature -> sst_io 659 cpl_send( 2)='SICOCEAN' ! sea ice area fraction -> 1.-frld 660 #if defined key_cpl_albedo 661 cpl_send( 3)='STIOCEAN' ! surface temperature over sea ice -> tn_ice 662 cpl_send( 4)='SAIOCEAN' ! albedo over sea ice -> alb_ice 663 #else 664 cpl_send( 3)='SITOCEAN' ! sea ice thickness -> hicif (only 1 layer available!) 665 cpl_send( 4)='SNTOCEAN' ! surface snow thickness over sea ice -> hsnif 666 #endif 667 #if defined key_cpl_ocevel 668 cpl_send( 5)='SUNOCEAN' ! U-velocity -> un 669 cpl_send( 6)='SVNOCEAN' ! V-velocity -> vn 670 #endif 671 ! 672 ! ... Define symbolic names for transient fields received by the ocean. 673 ! These must be identical to the names specified in the SMIOC file. 674 ! 675 ! ... a) U-Grid fields 676 ! 677 cpl_recv( 1)='TXWOCEWU' ! weighted surface downward eastward stress 678 cpl_recv( 2)='TYWOCEWU' ! weighted surface downward northward stress 679 cpl_recv( 3)='TXIOCEWU' ! weighted surface downward eastward stress over ice 680 cpl_recv( 4)='TYIOCEWU' ! weighted surface downward northward stress over ice 681 ! 682 ! ... a) V-Grid fields 683 ! 684 cpl_recv( 5)='TXWOCEWV' ! weighted surface downward eastward stress 685 cpl_recv( 6)='TYWOCEWV' ! weighted surface downward northward stress 686 cpl_recv( 7)='TXIOCEWV' ! weighted surface downward eastward stress over ice 687 cpl_recv( 8)='TYIOCEWV' ! weighted surface downward northward stress over ice 688 ! 689 ! ... a) T-Grid fields 690 ! 691 cpl_recv( 9)='FRWOCEPE' ! P-E over water -> zpew 692 cpl_recv(10)='FRIOCEPE' ! P-E over ice -> zpei 693 cpl_recv(11)='FRROCESN' ! surface downward snow fall -> zpsol 694 cpl_recv(12)='FRIOCEEV' ! surface upward snow flux where sea ice -> zevice 695 696 cpl_recv(13)='QSWOCESR' ! surface net downward shortwave flux -> qsr_oce 697 cpl_recv(14)='QSWOCENS' ! surface downward non-solar heat flux in air -> qnsr_oce 698 cpl_recv(15)='QSIOCESR' ! solar heat flux on sea ice -> qsr_ice 699 cpl_recv(16)='QSIOCENS' ! non-solar heat flux on sea ice -> qnsr_ice 700 cpl_recv(17)='QSIOCEDQ' ! non-solar heat flux derivative -> dqns_ice 701 702 #ifdef key_cpl_discharge 703 cpl_recv(18)='FRWOCEIS' ! ice discharge into ocean -> calving 704 cpl_recv(19)='FRWOCERD' ! river discharge into ocean -> zrunriv 705 cpl_recv(20)='FRWOCECD' ! continental discharge into ocean -> zruncot 706 #endif 707 ! 708 ! data_type has to be PRISM_REAL as PRISM_DOUBLE is not supported. 709 ! For exchange of double precision fields the OASIS3 has to be compiled 710 ! with use_realtype_single. (see OASIS3 User Guide prism_2-4, 5th Ed., 711 ! p. 13 and p. 53 for further explanation.) 712 ! 713 data_type = PRISM_REAL 714 715 nodim(1) = 3 ! check 716 nodim(2) = 0 717 718 ! 719 ! ... Define the shape for the area that excludes the halo 720 ! For serial configuration (key_mpp_mpi not being active) 721 ! nl* is set to the global values 1 and jp*glo. 722 ! 723 IF ( rootexchg ) THEN 724 shape(1,1) = 1 725 shape(2,1) = jpiglo 726 shape(1,2) = 1 727 shape(2,2) = jpjglo 728 shape(1,3) = 1 729 shape(2,3) = 1 730 ELSE 731 shape(1,1) = 1 732 shape(2,1) = nlei-nldi+1 ! jpi 733 shape(1,2) = 1 734 shape(2,2) = nlej-nldj+1 ! jpj 735 shape(1,3) = 1 736 shape(2,3) = 1 737 ENDIF 738 ! 739 ! ----------------------------------------------------------------- 740 ! ... Allocate memory for data exchange 741 ! ----------------------------------------------------------------- 742 ! 743 ALLOCATE(exfld(shape(1,1):shape(2,1),shape(1,2):shape(2,2)), stat = ierror) 744 IF (ierror > 0) THEN 745 CALL prism_abort_proto ( comp_id, 'cpl_prism_define', 'Failure in allocating exfld') 746 RETURN 747 ENDIF 748 ! 749 ! ... Announce send variables, all on T points. 750 ! 751 info = PRISM_Out 752 ! 753 754 IF ( commRank ) THEN 755 756 DO ji = 1, nsend 757 ! if ( ji == 2 ) ; then ; nodim(2) = 2 ; else ; nodim(2) = 0 ; endif 758 CALL prism_def_var_proto (send_id(ji), cpl_send(ji), grid_id(1), & 759 nodim, info, shape, data_type, ierror) 760 IF ( ierror /= PRISM_Ok ) THEN 761 PRINT *, 'Failed to define transient ', ji, TRIM(cpl_send(ji)) 762 CALL prism_abort_proto ( comp_id, 'cpl_prism_define', 'Failure in prism_def_var') 763 ENDIF 764 ENDDO 765 ! 766 nodim(1) = 3 ! check 767 nodim(2) = 0 768 ! 769 ! ... Announce recv variables. 770 ! 771 info = PRISM_In 772 ! 773 ! ... a) on U points 774 ! 775 DO ji = 1, 4 776 CALL prism_def_var_proto (recv_id(ji), cpl_recv(ji), grid_id(1), & 777 nodim, info, shape, data_type, ierror) 778 IF ( ierror /= PRISM_Ok ) THEN 779 PRINT *, 'Failed to define transient ', ji, TRIM(cpl_recv(ji)) 780 CALL prism_abort_proto ( comp_id, 'cpl_prism_define', 'Failure in prism_def_var') 781 ENDIF 782 ENDDO 783 ! 784 ! ... b) on V points 785 ! 786 DO ji = 5, 8 787 CALL prism_def_var_proto (recv_id(ji), cpl_recv(ji), grid_id(1), & 788 nodim, info, shape, data_type, ierror) 789 IF ( ierror /= PRISM_Ok ) THEN 790 PRINT *, 'Failed to define transient ', TRIM(cpl_recv(ji)) 791 CALL prism_abort_proto ( comp_id, 'cpl_prism_define', 'Failure in prism_def_var') 792 ENDIF 793 ENDDO 794 ! 795 ! ... c) on T points 796 ! 797 DO ji = 9, nrecv 798 CALL prism_def_var_proto (recv_id(ji), cpl_recv(ji), grid_id(1), & 799 nodim, info, shape, data_type, ierror) 800 IF ( ierror /= PRISM_Ok ) THEN 801 PRINT *, 'Failed to define transient ', TRIM(cpl_recv(ji)) 802 CALL prism_abort_proto ( comp_id, 'cpl_prism_define', 'Failure in prism_def_var') 803 ENDIF 804 ENDDO 805 806 ENDIF ! commRank 807 808 !------------------------------------------------------------------ 809 ! 4th End of definition phase 810 !------------------------------------------------------------------ 811 812 IF ( commRank ) THEN 813 CALL prism_enddef_proto(ierror) 814 IF ( ierror /= PRISM_Ok ) & 815 CALL prism_abort_proto ( comp_id, 'cpl_prism_define', 'Failure in prism_enddef') 816 ENDIF 817 195 END DO 196 197 !------------------------------------------------------------------ 198 ! End of definition phase 199 !------------------------------------------------------------------ 200 201 CALL prism_enddef_proto(nerror) 202 IF ( nerror /= PRISM_Ok ) CALL prism_abort_proto ( ncomp_id, 'cpl_prism_define', 'Failure in prism_enddef') 203 818 204 END SUBROUTINE cpl_prism_define 819 820 821 822 SUBROUTINE cpl_prism_send( var_id, date, data_array, info ) 823 824 IMPLICIT NONE 205 206 207 SUBROUTINE cpl_prism_snd( kid, kstep, pdata, kinfo ) 825 208 826 209 !!--------------------------------------------------------------------- 827 !! *** ROUTINE cpl_prism_s end ***210 !! *** ROUTINE cpl_prism_snd *** 828 211 !! 829 212 !! ** Purpose : - At each coupling time-step,this routine sends fields … … 832 215 !! * Arguments 833 216 !! 834 INTEGER, INTENT( IN ) :: var_id ! variable Id 835 INTEGER, INTENT( OUT ) :: info ! OASIS3 info argument 836 INTEGER, INTENT( IN ) :: date ! ocean time-step in seconds 837 REAL(wp) :: data_array(:,:) 838 !! 839 !! * Local declarations 840 !! 841 #if defined key_mpp_mpi 842 REAL(wp) :: global_array(jpiglo,jpjglo) 843 ! 844 !mpi INTEGER :: status(MPI_STATUS_SIZE) 845 !mpi INTEGER :: type ! MPI data type 846 INTEGER :: request ! MPI isend request 847 INTEGER :: ji, jj, jn ! local loop indicees 848 #else 849 INTEGER :: ji 850 #endif 851 !! 852 !!-------------------------------------------------------------------- 853 !! 854 855 #if defined key_mpp_mpi 856 857 request = 0 858 859 IF ( rootexchg ) THEN 860 ! 861 !mpi IF ( wp == 4 ) type = MPI_REAL 862 !mpi IF ( wp == 8 ) type = MPI_DOUBLE_PRECISION 863 ! 864 ! collect data on the local root process 865 ! 866 867 if ( var_id == 1 .and. localRank == localRoot .and. ln_ctl ) then 868 do ji = 0, localSize-1 869 WRITE(numout,*) ' rootexchg: ranges for rank ', ji, ' are ', ranges(:,ji) 870 enddo 871 endif 872 873 IF ( localRank /= localRoot ) THEN 874 875 DO jj = nldj, nlej 876 DO ji = nldi, nlei 877 exfld(ji-nldi+1,jj-nldj+1)=data_array(ji,jj) 878 ENDDO 879 ENDDO 880 881 !mpi CALL mpi_send(exfld, range(5), type, localRoot, localRank, localComm, ierror) 882 CALL mppsend (localRank, exfld, range(5), localRoot, request) 883 884 if ( var_id == 1 .and. ln_ctl ) then 885 WRITE(numout,*) ' rootexchg: This is process ', localRank 886 WRITE(numout,*) ' rootexchg: We have a range of ', range 887 ! WRITE(numout,*) ' rootexchg: We got SST to process ', data_array 888 endif 889 890 ENDIF 891 892 IF ( localRank == localRoot ) THEN 893 894 DO jj = ranges(3,localRoot), ranges(3,localRoot)+ranges(4,localRoot)-1 895 DO ji = ranges(1,localRoot), ranges(1,localRoot)+ranges(2,localRoot)-1 896 global_array(ji,jj) = data_array(ji,jj) ! workaround 897 ENDDO 898 ENDDO 899 900 DO jn = 1, localSize-1 901 902 !mpi CALL mpi_recv(buffer, ranges(5,jn), type, localRoot, jn, localComm, status, ierror) 903 CALL mpprecv(jn, buffer, ranges(5,jn)) 904 905 if ( var_id == 1 .and. ln_ctl ) then 906 WRITE(numout,*) ' rootexchg: Handling data from process ', jn 907 ! WRITE(numout,*) ' rootexchg: We got SST to process ', buffer 908 endif 909 910 911 DO jj = ranges(3,jn), ranges(3,jn)+ranges(4,jn)-1 912 DO ji = ranges(1,jn), ranges(1,jn)+ranges(2,jn)-1 913 global_array(ji,jj) = buffer((jj-ranges(3,jn))*ranges(2,jn) + ji-ranges(1,jn)+1) 914 ENDDO 915 ENDDO 916 917 ENDDO 918 919 CALL prism_put_proto ( var_id, date, global_array, info ) 920 921 ENDIF 922 923 ELSE 924 925 DO jj = nldj, nlej 926 DO ji = nldi, nlei 927 exfld(ji-nldi+1,jj-nldj+1)=data_array(ji,jj) 928 ENDDO 929 ENDDO 930 931 CALL prism_put_proto ( var_id, date, exfld, info ) 932 217 INTEGER, INTENT( IN ) :: kid ! variable intex in the array 218 INTEGER, INTENT( OUT ) :: kinfo ! OASIS3 info argument 219 INTEGER, INTENT( IN ) :: kstep ! ocean time-step in seconds 220 REAL(wp), DIMENSION(jpi,jpj), INTENT( IN ) :: pdata 221 !! 222 !! 223 !!-------------------------------------------------------------------- 224 ! 225 ! snd data to OASIS3 226 ! 227 IF( lk_mpp ) THEN ; CALL prism_put_proto ( ssnd(kid)%nid, kstep, pdata(nldi:nlei, nldj:nlej), kinfo ) 228 ELSE ; CALL prism_put_proto ( ssnd(kid)%nid, kstep, pdata , kinfo ) 933 229 ENDIF 934 935 #else 936 937 ! 938 ! send local data from every process to OASIS3 939 ! 940 IF ( commRank ) & 941 CALL prism_put_proto ( var_id, date, data_array, info ) 942 943 #endif 944 945 IF ( commRank ) THEN 946 947 IF (ln_ctl .and. lwp) THEN 948 949 IF ( info == PRISM_Sent .OR. & 950 info == PRISM_ToRest .OR. & 951 info == PRISM_SentOut .OR. & 952 info == PRISM_ToRestOut ) THEN 953 WRITE(numout,*) '****************' 954 DO ji = 1, nsend 955 IF (var_id == send_id(ji) ) THEN 956 WRITE(numout,*) 'prism_put_proto: Outgoing ', cpl_send(ji) 957 EXIT 958 ENDIF 959 ENDDO 960 WRITE(numout,*) 'prism_put_proto: var_id ', var_id 961 WRITE(numout,*) 'prism_put_proto: date ', date 962 WRITE(numout,*) 'prism_put_proto: info ', info 963 WRITE(numout,*) ' - Minimum value is ', MINVAL(data_array) 964 WRITE(numout,*) ' - Maximum value is ', MAXVAL(data_array) 965 WRITE(numout,*) ' - Sum value is ', SUM(data_array) 966 WRITE(numout,*) '****************' 967 ENDIF 968 969 ENDIF 970 971 ENDIF 972 973 END SUBROUTINE cpl_prism_send 974 975 976 977 SUBROUTINE cpl_prism_recv( var_id, date, data_array, info ) 978 979 IMPLICIT NONE 230 231 IF ( ln_ctl ) THEN 232 IF ( kinfo == PRISM_Sent .OR. kinfo == PRISM_ToRest .OR. & 233 & kinfo == PRISM_SentOut .OR. kinfo == PRISM_ToRestOut ) THEN 234 WRITE(numout,*) '****************' 235 WRITE(numout,*) 'prism_put_proto: Outgoing ', ssnd(kid)%clname 236 WRITE(numout,*) 'prism_put_proto: ivarid ', ssnd(kid)%nid 237 WRITE(numout,*) 'prism_put_proto: kstep ', kstep 238 WRITE(numout,*) 'prism_put_proto: info ', kinfo 239 WRITE(numout,*) ' - Minimum value is ', MINVAL(pdata) 240 WRITE(numout,*) ' - Maximum value is ', MAXVAL(pdata) 241 WRITE(numout,*) ' - Sum value is ', SUM(pdata) 242 WRITE(numout,*) '****************' 243 ENDIF 244 ENDIF 245 END SUBROUTINE cpl_prism_snd 246 247 248 SUBROUTINE cpl_prism_rcv( kid, kstep, pdata, kinfo ) 980 249 981 250 !!--------------------------------------------------------------------- 982 !! *** ROUTINE cpl_prism_r ecv ***251 !! *** ROUTINE cpl_prism_rcv *** 983 252 !! 984 253 !! ** Purpose : - At each coupling time-step,this routine receives fields 985 254 !! like stresses and fluxes from the coupler or remote application. 986 255 !!---------------------------------------------------------------------- 987 !! * Arguments 988 !! 989 INTEGER, INTENT( IN ) :: var_id ! variable Id 990 INTEGER, INTENT( OUT ) :: info ! variable Id 991 INTEGER, INTENT( IN ) :: date ! ocean time-step in seconds 992 REAL(wp),INTENT( OUT ) :: data_array(:,:) 993 !! 994 !! * Local declarations 995 !! 996 #if defined key_mpp_mpi 997 REAL(wp) :: global_array(jpiglo,jpjglo) 998 ! 999 ! LOGICAL :: action = .false. 1000 LOGICAL :: action 1001 !mpi INTEGER :: status(MPI_STATUS_SIZE) 1002 !mpi INTEGER :: type ! MPI data type 1003 INTEGER :: request ! MPI isend request 1004 INTEGER :: ji, jj, jn ! local loop indices 1005 #else 1006 INTEGER :: ji 1007 #endif 1008 !! 1009 !!-------------------------------------------------------------------- 1010 !! 1011 #ifdef key_mpp_mpi 1012 action = .false. 1013 request = 0 1014 1015 IF ( rootexchg ) THEN 1016 ! 1017 ! receive data from OASIS3 on local root 1018 ! 1019 IF ( commRank ) & 1020 CALL prism_get_proto ( var_id, date, global_array, info ) 1021 1022 CALL MPI_BCAST ( info, 1, MPI_INTEGER, localRoot, localComm, ierror ) 1023 1024 ELSE 1025 ! 1026 ! receive local data from OASIS3 on every process 1027 ! 1028 CALL prism_get_proto ( var_id, date, exfld, info ) 1029 256 INTEGER, INTENT( IN ) :: kid ! variable intex in the array 257 INTEGER, INTENT( IN ) :: kstep ! ocean time-step in seconds 258 REAL(wp), DIMENSION(jpi,jpj), INTENT( INOUT ) :: pdata ! IN to keep the value if nothing is done 259 INTEGER, INTENT( OUT ) :: kinfo ! OASIS3 info argument 260 !! 261 LOGICAL :: llaction 262 !!-------------------------------------------------------------------- 263 ! 264 ! receive local data from OASIS3 on every process 265 ! 266 CALL prism_get_proto ( srcv(kid)%nid, kstep, exfld, kinfo ) 267 268 llaction = .false. 269 IF( kinfo == PRISM_Recvd .OR. kinfo == PRISM_FromRest .OR. & 270 kinfo == PRISM_RecvOut .OR. kinfo == PRISM_FromRestOut ) llaction = .TRUE. 271 272 IF ( ln_ctl ) WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid 273 274 IF ( llaction ) THEN 275 276 IF( lk_mpp ) THEN ; pdata(nldi:nlei, nldj:nlej) = exfld(:,:) 277 ELSE ; pdata( : , : ) = exfld(:,:) 278 ENDIF 279 280 !--- Fill the overlap areas and extra hallows (mpp) 281 !--- check periodicity conditions (all cases) 282 CALL lbc_lnk( pdata, srcv(kid)%clgrid, srcv(kid)%nsgn ) 283 284 IF ( ln_ctl ) THEN 285 WRITE(numout,*) '****************' 286 WRITE(numout,*) 'prism_get_proto: Incoming ', srcv(kid)%clname 287 WRITE(numout,*) 'prism_get_proto: ivarid ' , srcv(kid)%nid 288 WRITE(numout,*) 'prism_get_proto: kstep', kstep 289 WRITE(numout,*) 'prism_get_proto: info ', kinfo 290 WRITE(numout,*) ' - Minimum value is ', MINVAL(pdata) 291 WRITE(numout,*) ' - Maximum value is ', MAXVAL(pdata) 292 WRITE(numout,*) ' - Sum value is ', SUM(pdata) 293 WRITE(numout,*) '****************' 294 call flush(numout) 295 ENDIF 296 1030 297 ENDIF 1031 298 1032 IF ( info == PRISM_Recvd .OR. & 1033 info == PRISM_FromRest .OR. & 1034 info == PRISM_RecvOut .OR. & 1035 info == PRISM_FromRestOut ) action = .true. 1036 1037 IF (ln_ctl .and. lwp) THEN 1038 WRITE(numout,*) "info", info, var_id 1039 WRITE(numout,*) "date", date, var_id 1040 WRITE(numout,*) "action", action, var_id 1041 ENDIF 1042 1043 IF ( rootexchg .and. action ) THEN 1044 ! 1045 !mpi IF ( wp == 4 ) type = MPI_REAL 1046 !mpi IF ( wp == 8 ) type = MPI_DOUBLE_PRECISION 1047 ! 1048 ! distribute data to processes 1049 ! 1050 IF ( localRank == localRoot ) THEN 1051 1052 DO jj = ranges(3,localRoot), ranges(3,localRoot)+ranges(4,localRoot)-1 1053 DO ji = ranges(1,localRoot), ranges(1,localRoot)+ranges(2,localRoot)-1 1054 exfld(ji-ranges(1,localRoot)+1,jj-ranges(3,localRoot)+1) = global_array(ji,jj) 1055 ENDDO 1056 ENDDO 1057 1058 DO jn = 1, localSize-1 1059 1060 DO jj = ranges(3,jn), ranges(3,jn)+ranges(4,jn)-1 1061 DO ji = ranges(1,jn), ranges(1,jn)+ranges(2,jn)-1 1062 buffer((jj-ranges(3,jn))*ranges(2,jn) + ji-ranges(1,jn)+1) = global_array(ji,jj) 1063 ENDDO 1064 ENDDO 1065 1066 !mpi CALL mpi_send(buffer, ranges(5,jn), type, jn, jn, localComm, ierror) 1067 CALL mppsend (jn, buffer, ranges(5,jn), jn, request) 1068 1069 ENDDO 1070 1071 ENDIF 1072 1073 IF ( localRank /= localRoot ) THEN 1074 !mpi CALL mpi_recv(exfld, range(5), type, localRoot, localRank, localComm, status, ierror) 1075 CALL mpprecv(localRank, exfld, range(5)) 1076 ENDIF 1077 1078 ENDIF 1079 1080 IF ( action ) THEN 1081 1082 data_array = 0.0 1083 1084 DO jj = nldj, nlej 1085 DO ji = nldi, nlei 1086 data_array(ji,jj)=exfld(ji-nldi+1,jj-nldj+1) 1087 ENDDO 1088 ENDDO 1089 1090 IF (ln_ctl .and. lwp) THEN 1091 WRITE(numout,*) '****************' 1092 DO ji = 1, nrecv 1093 IF (var_id == recv_id(ji) ) THEN 1094 WRITE(numout,*) 'prism_get_proto: Incoming ', cpl_recv(ji) 1095 EXIT 1096 ENDIF 1097 ENDDO 1098 WRITE(numout,*) 'prism_get_proto: var_id ', var_id 1099 WRITE(numout,*) 'prism_get_proto: date ', date 1100 WRITE(numout,*) 'prism_get_proto: info ', info 1101 WRITE(numout,*) ' - Minimum value is ', MINVAL(data_array) 1102 WRITE(numout,*) ' - Maximum value is ', MAXVAL(data_array) 1103 WRITE(numout,*) ' - Sum value is ', SUM(data_array) 1104 WRITE(numout,*) '****************' 1105 ENDIF 1106 1107 ENDIF 1108 #else 1109 CALL prism_get_proto ( var_id, date, exfld, info) 1110 1111 IF (info == PRISM_Recvd .OR. & 1112 info == PRISM_FromRest .OR. & 1113 info == PRISM_RecvOut .OR. & 1114 info == PRISM_FromRestOut ) THEN 1115 data_array = exfld 1116 1117 IF (ln_ctl .and. lwp ) THEN 1118 WRITE(numout,*) '****************' 1119 DO ji = 1, nrecv 1120 IF (var_id == recv_id(ji) ) THEN 1121 WRITE(numout,*) 'prism_get_proto: Incoming ', cpl_recv(ji) 1122 EXIT 1123 ENDIF 1124 ENDDO 1125 WRITE(numout,*) 'prism_get_proto: var_id ', var_id 1126 WRITE(numout,*) 'prism_get_proto: date ', date 1127 WRITE(numout,*) 'prism_get_proto: info ', info 1128 WRITE(numout,*) ' - Minimum value is ', MINVAL(data_array) 1129 WRITE(numout,*) ' - Maximum value is ', MAXVAL(data_array) 1130 WRITE(numout,*) ' - Sum value is ', SUM(data_array) 1131 WRITE(numout,*) '****************' 1132 ENDIF 1133 1134 ENDIF 1135 #endif 1136 1137 END SUBROUTINE cpl_prism_recv 1138 299 END SUBROUTINE cpl_prism_rcv 1139 300 1140 301 1141 302 SUBROUTINE cpl_prism_finalize 1142 1143 IMPLICIT NONE1144 303 1145 304 !!--------------------------------------------------------------------- … … 1152 311 1153 312 DEALLOCATE(exfld) 1154 1155 if ( prism_was_initialized ) then 1156 1157 if ( prism_was_terminated ) then 1158 print *, 'prism has already been terminated.' 1159 else 1160 call prism_terminate_proto ( ierror ) 1161 prism_was_terminated = .true. 1162 endif 1163 1164 else 1165 1166 print *, 'Initialize prism before terminating it.' 1167 1168 endif 1169 313 CALL prism_terminate_proto ( nerror ) 1170 314 1171 315 END SUBROUTINE cpl_prism_finalize 1172 316 317 #else 318 319 !!---------------------------------------------------------------------- 320 !! Default case Forced Ocean/Atmosphere 321 !!---------------------------------------------------------------------- 322 !! Empty module 323 !!---------------------------------------------------------------------- 324 USE in_out_manager ! I/O manager 325 LOGICAL, PUBLIC, PARAMETER :: lk_cpl = .FALSE. !: coupled flag 326 PUBLIC cpl_prism_init 327 PUBLIC cpl_prism_finalize 328 329 CONTAINS 330 331 SUBROUTINE cpl_prism_init 332 WRITE(numout,*) 'cpl_prism_init: Error you sould not be there...' 333 END SUBROUTINE cpl_prism_init 334 335 SUBROUTINE cpl_prism_finalize 336 WRITE(numout,*) 'cpl_prism_finalize: Error you sould not be there...' 337 END SUBROUTINE cpl_prism_finalize 338 1173 339 #endif 1174 340 -
trunk/NEMO/OPA_SRC/SBC/sbc_ice.F90
r1156 r1218 23 23 REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) :: dqns_ice !: non solar heat flux sensibility over ice (LW+SEN+LA) [W/m2/K] 24 24 REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) :: tn_ice !: ice surface temperature [K] 25 REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) :: alb_ice !: albedo of ice 25 26 #else 26 27 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: qns_ice !: non solar heat flux over ice [W/m2] … … 28 29 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: dqns_ice !: non solar heat flux sensibility over ice (LW+SEN+LA) [W/m2/K] 29 30 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: tn_ice !: ice surface temperature [K] 31 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: alb_ice !: albedo of ice 30 32 #endif 31 33 … … 49 51 #else 50 52 51 # if defined key_lim3 52 REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) :: alb_ice !: albedo of ice 53 # else 54 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: alb_ice !: albedo of ice 55 # endif 56 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: rrunoff !: runoff 57 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: calving !: calving 53 !!$ REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: rrunoff !: runoff 54 !!$ REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: calving !: calving 58 55 59 56 #endif -
trunk/NEMO/OPA_SRC/SBC/sbc_oce.F90
r1156 r1218 4 4 !! Surface module : variables defined in core memory 5 5 !!====================================================================== 6 !! History : 9.0 ! 06-06 (G. Madec) Original code 6 !! History : 3.0 ! 2006-06 (G. Madec) Original code 7 !! - ! 2008-08 (G. Madec) namsbc moved from sbcmod 7 8 !!---------------------------------------------------------------------- 8 9 USE par_oce ! ocean parameters … … 11 12 PRIVATE 12 13 14 !!---------------------------------------------------------------------- 15 !! Namelist for the Ocean Surface Boundary Condition 16 !!---------------------------------------------------------------------- 17 ! !! * namsbc namelist * 18 LOGICAL , PUBLIC :: ln_ana = .FALSE. !: analytical boundary condition flag 19 LOGICAL , PUBLIC :: ln_flx = .FALSE. !: flux formulation 20 LOGICAL , PUBLIC :: ln_blk_clio = .FALSE. !: CLIO bulk formulation 21 LOGICAL , PUBLIC :: ln_blk_core = .FALSE. !: CORE bulk formulation 22 LOGICAL , PUBLIC :: ln_cpl = .FALSE. !: coupled formulation (overwritten by key_sbc_coupled ) 23 LOGICAL , PUBLIC :: ln_dm2dc = .FALSE. !: Daily mean to Diurnal Cycle short wave (qsr) 24 LOGICAL , PUBLIC :: ln_rnf = .FALSE. !: runoffs / runoff mouths 25 LOGICAL , PUBLIC :: ln_ssr = .FALSE. !: Sea Surface restoring on SST and/or SSS 26 INTEGER , PUBLIC :: nn_ice = 0 !: flag on ice in the surface boundary condition (=0/1/2/3) 27 INTEGER , PUBLIC :: nn_fwb = 0 !: type of FreshWater Budget control (=0/1/2) 28 INTEGER , PUBLIC :: nn_ico_cpl = 0 !: ice-ocean coupling indicator 29 ! ! = 0 LIM-3 old case 30 ! ! = 1 stresses computed using now ocean velocity 31 ! ! = 2 combination of 0 and 1 cases 32 13 33 !!---------------------------------------------------------------------- 14 34 !! Ocean Surface Boundary Condition fields … … 34 54 !!---------------------------------------------------------------------- 35 55 !! OPA 9.0 , LOCEAN-IPSL (2006) 36 !! $ Id$56 !! $ Id: $ 37 57 !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 38 58 !!====================================================================== -
trunk/NEMO/OPA_SRC/SBC/sbccpl.F90
r1156 r1218 2 2 !!====================================================================== 3 3 !! *** MODULE sbccpl *** 4 !! Ocean forcing: momentum, heat and freshwater coupled formulation5 !!===================================================================== 6 !! History : 9.0 ! 06-07 (R. Redler, N. Keenlyside, W. Park)7 !! Original code split into flxmod & taumod8 !! 9.0 ! 06-07 (G. Madec) surface module4 !! Surface Boundary Condition : momentum, heat and freshwater fluxes in coupled mode 5 !!====================================================================== 6 !! History : 2.0 ! 06-2007 (R. Redler, N. Keenlyside, W. Park) Original code split into flxmod & taumod 7 !! 3.0 ! 02-2008 (G. Madec, C Talandier) surface module 8 !! - ! 08-2008 (S. Masson, E. .... ) generic coupled interface 9 9 !!---------------------------------------------------------------------- 10 #if defined key_ sbc_cpl10 #if defined key_oasis3 || defined key_oasis4 11 11 !!---------------------------------------------------------------------- 12 !! 'key_ sbc_cpl'Coupled Ocean/Atmosphere formulation12 !! 'key_oasis3' or 'key_oasis4' Coupled Ocean/Atmosphere formulation 13 13 !!---------------------------------------------------------------------- 14 !! namsbc_cpl : coupled formulation namlist 15 !! sbc_cpl_init : initialisation of the coupled exchanges 16 !! sbc_cpl_rcv : receive fields from the atmosphere over the ocean (ocean only) 17 !! receive stress from the atmosphere over the ocean (ocean-ice case) 18 !! sbc_cpl_ice_tau : receive stress from the atmosphere over ice 19 !! sbc_cpl_ice_flx : receive fluxes from the atmosphere over ice 20 !! sbc_cpl_snd : send fields to the atmosphere 14 21 !!---------------------------------------------------------------------- 15 !! namsbc_cpl : coupled formulation namlist16 !! sbc_cpl : coupled formulation for the ocean surface boundary condition17 !!----------------------------------------------------------------------18 USE oce ! ocean dynamics and tracers19 22 USE dom_oce ! ocean space and time domain 20 USE phycst ! physical constants 23 USE sbc_oce ! Surface boundary condition: ocean fields 24 USE sbc_ice ! Surface boundary condition: ice fields 25 USE ice_oce ! Shared variables between ice and ocean 26 #if defined key_lim3 27 USE par_ice ! ice parameters 28 #endif 29 USE cpl_oasis3 ! OASIS3 coupling 30 USE geo2ocean ! 31 USE restart ! 32 USE oce , ONLY : tn, un, vn 33 USE phycst, ONLY : rt0 34 USE albedo ! 21 35 USE in_out_manager ! I/O manager 36 USE iom ! NetCDF library 22 37 USE lib_mpp ! distribued memory computing library 23 38 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 24 USE daymod ! calendar 25 26 USE cpl_oasis3 ! OASIS3 coupling (to ECHAM5) 27 USE cpl_oasis4 ! OASIS4 coupling (to ECHAM5) 28 USE geo2ocean, ONLY : repere, repcmo 29 USE ice_2, only : frld ! : leads fraction = 1-a/totalarea 30 31 USE sbc_oce ! Surface boundary condition: ocean fields 32 33 USE iom ! NetCDF library 34 39 USE mod_prism_proto ! OASIS3 prism module: PRISM_* variables... 35 40 IMPLICIT NONE 36 41 PRIVATE 37 42 38 PUBLIC sbc_cpl ! routine called by step.F90 39 40 LOGICAL, PUBLIC :: lk_sbc_cpl = .TRUE. !: coupled formulation flag 41 42 INTEGER , PARAMETER :: jpfld = 5 ! maximum number of files to read 43 INTEGER , PARAMETER :: jp_taux = 1 ! index of wind stress (i-component) file 44 INTEGER , PARAMETER :: jp_tauy = 2 ! index of wind stress (j-component) file 45 INTEGER , PARAMETER :: jp_qtot = 3 ! index of total (non solar+solar) heat file 46 INTEGER , PARAMETER :: jp_qsr = 4 ! index of solar heat file 47 INTEGER , PARAMETER :: jp_emp = 5 ! index of evaporation-precipation file 43 PUBLIC sbc_cpl_rcv ! routine called by sbc_ice_lim(_2).F90 44 PUBLIC sbc_cpl_snd ! routine called by step.F90 45 PUBLIC sbc_cpl_ice_tau ! routine called by sbc_ice_lim(_2).F90 46 PUBLIC sbc_cpl_ice_flx ! routine called by sbc_ice_lim(_2).F90 48 47 49 !!wonsun 50 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: &51 taux, tauy & !: surface stress components in (i,j) referential52 53 54 USE sbc_ice, only : dqns_ice , & ! : derivative of non solar heat flux on sea ice55 qsr_ice , & ! : solar flux over ice56 qns_ice , & ! : total non solar heat flux (Longwave downward radiation) over ice57 tn_ice , & ! : ice surface temperature58 alb_ice , & ! : albedo of ice59 sprecip , & ! : solid (snow) precipitation over water (!) what about ice?60 tprecip , & ! : total precipitation ( or liquid precip minus evaporation in coupled mode)61 calving , & ! : calving62 rrunoff , & ! : monthly runoff (kg/m2/s)63 fr1_i0 , & ! : 1st part of the fraction of sol.rad. which penetrate inside the ice cover64 fr2_i0 ! : 2nd part of the fraction of sol.rad. which penetrate inside the ice cover65 66 USE ice_2, only : hicif , & ! : ice thickness67 frld , & ! : leads fraction = 1-a/totalarea68 hsnif , & ! : snow thickness69 u_ice , v_ice ! : ice velocity70 71 USE sbc_oce, only : sst_m ! : sea surface temperature72 73 REAL(wp), PUBLIC :: & !!! surface fluxes namelist (namflx)74 q0 = 0.e0, & ! net heat flux75 qsr0 = 0.e0, & ! solar heat flux76 emp0 = 0.e0, & ! net freshwater flux77 dqdt0 = -40., & ! coefficient for SST damping (W/m2/K)78 deds0 = 27.7 ! coefficient for SSS damping (mm/day)48 INTEGER, PARAMETER :: jpr_otx1 = 1 ! 3 atmosphere-ocean stress components on grid 1 49 INTEGER, PARAMETER :: jpr_oty1 = 2 ! 50 INTEGER, PARAMETER :: jpr_otz1 = 3 ! 51 INTEGER, PARAMETER :: jpr_otx2 = 4 ! 3 atmosphere-ocean stress components on grid 2 52 INTEGER, PARAMETER :: jpr_oty2 = 5 ! 53 INTEGER, PARAMETER :: jpr_otz2 = 6 ! 54 INTEGER, PARAMETER :: jpr_itx1 = 7 ! 3 atmosphere-ice stress components on grid 1 55 INTEGER, PARAMETER :: jpr_ity1 = 8 ! 56 INTEGER, PARAMETER :: jpr_itz1 = 9 ! 57 INTEGER, PARAMETER :: jpr_itx2 = 10 ! 3 atmosphere-ice stress components on grid 2 58 INTEGER, PARAMETER :: jpr_ity2 = 11 ! 59 INTEGER, PARAMETER :: jpr_itz2 = 12 ! 60 INTEGER, PARAMETER :: jpr_qsroce = 13 ! Qsr above the ocean 61 INTEGER, PARAMETER :: jpr_qsrice = 14 ! Qsr above the ice 62 INTEGER, PARAMETER :: jpr_qsrmix = jpr_qsroce ! Qsr above ocean+ice 63 INTEGER, PARAMETER :: jpr_qnsoce = 15 ! Qns above the ocean 64 INTEGER, PARAMETER :: jpr_qnsice = 16 ! Qns above the ice 65 INTEGER, PARAMETER :: jpr_qnsmix = jpr_qnsoce ! Qns above ocean+ice 66 INTEGER, PARAMETER :: jpr_rain = 17 ! total liquid precipitation (rain) 67 INTEGER, PARAMETER :: jpr_snow = 18 ! solid precipitation over the ocean (snow) 68 INTEGER, PARAMETER :: jpr_tevp = 19 ! total evaporation 69 INTEGER, PARAMETER :: jpr_ievp = 20 ! solid evaporation (sublimation) 70 INTEGER, PARAMETER :: jpr_prsb = 21 ! total precipitation (liquid + solid) 71 INTEGER, PARAMETER :: jpr_semp = 22 ! solid freshwater budget (sublimation - snow) 72 INTEGER, PARAMETER :: jpr_oemp = 23 ! ocean freshwater budget (evap - precip) 73 INTEGER, PARAMETER :: jpr_w10m = 24 ! 74 INTEGER, PARAMETER :: jpr_dqnsdt = 25 ! 75 INTEGER, PARAMETER :: jpr_rnf = 26 ! 76 INTEGER, PARAMETER :: jpr_cal = 27 ! 77 INTEGER, PARAMETER :: jprcv = 27 ! total number of fields recieved 79 78 80 REAL(wp), DIMENSION(jpi,jpj) :: qsr_oce_recv , qsr_ice_recv 81 REAL(wp), DIMENSION(jpi,jpj) :: qns_oce_recv, qns_ice_recv 82 REAL(wp), DIMENSION(jpi,jpj) :: dqns_ice_recv 83 REAL(wp), DIMENSION(jpi,jpj) :: tprecip_recv , precip_recv 84 REAL(wp), DIMENSION(jpi,jpj) :: fr1_i0_recv , fr2_i0_recv 85 REAL(wp), DIMENSION(jpi,jpj) :: rrunoff_recv , calving_recv 86 #if defined key_cpl_ocevel 87 REAL(wp), DIMENSION(jpi,jpj) :: un_weighted, vn_weighted 88 REAL(wp), DIMENSION(jpi,jpj) :: un_send , vn_send 89 #endif 90 REAL(wp), DIMENSION(jpi,jpj) :: zrunriv ! river discharge into ocean 91 REAL(wp), DIMENSION(jpi,jpj) :: zruncot ! continental discharge into ocean 92 93 REAL(wp), DIMENSION(jpi,jpj) :: zpew ! P-E over water 94 REAL(wp), DIMENSION(jpi,jpj) :: zpei ! P-E over ice 95 REAL(wp), DIMENSION(jpi,jpj) :: zpsol ! surface downward snow fall 96 REAL(wp), DIMENSION(jpi,jpj) :: zevice ! surface upward snow flux where sea ice 97 !!wonsun 98 99 !! * Substitutions 100 # include "domzgr_substitute.h90" 79 INTEGER, PARAMETER :: jps_fice = 1 ! ice fraction 80 INTEGER, PARAMETER :: jps_toce = 2 ! ocean temperature 81 INTEGER, PARAMETER :: jps_tice = 3 ! ice temperature 82 INTEGER, PARAMETER :: jps_tmix = 4 ! mixed temperature (ocean+ice) 83 INTEGER, PARAMETER :: jps_albice = 5 ! ice albedo 84 INTEGER, PARAMETER :: jps_albmix = 6 ! mixed albedo 85 INTEGER, PARAMETER :: jps_hice = 7 ! ice thickness 86 INTEGER, PARAMETER :: jps_hsnw = 8 ! snow thickness 87 INTEGER, PARAMETER :: jps_ocx1 = 9 ! ocean current on grid 1 88 INTEGER, PARAMETER :: jps_ocy1 = 10 ! 89 INTEGER, PARAMETER :: jps_ocz1 = 11 ! 90 INTEGER, PARAMETER :: jps_ivx1 = 12 ! ice current on grid 1 91 INTEGER, PARAMETER :: jps_ivy1 = 13 ! 92 INTEGER, PARAMETER :: jps_ivz1 = 14 ! 93 INTEGER, PARAMETER :: jpsnd = 14 ! total number of fields sended 94 95 ! !!** namelist namsbc_cpl ** 96 ! Send to the atmosphere ! 97 CHARACTER(len=100) :: cn_snd_temperature = 'oce only' ! 'oce only' 'weighted oce and ice' or 'mixed oce-ice' 98 CHARACTER(len=100) :: cn_snd_albedo = 'none' ! 'none' 'weighted ice' or 'mixed oce-ice' 99 CHARACTER(len=100) :: cn_snd_thickness = 'none' ! 'none' or 'weighted ice and snow' 100 CHARACTER(len=100) :: cn_snd_crt_nature = 'none' ! 'none' 'oce only' 'weighted oce and ice' or 'mixed oce-ice' 101 CHARACTER(len=100) :: cn_snd_crt_refere = 'spherical' ! 'spherical' or 'cartesian' 102 CHARACTER(len=100) :: cn_snd_crt_orient = 'local grid' ! 'eastward-northward' or 'local grid' 103 CHARACTER(len=100) :: cn_snd_crt_grid = 'T' ! always at 'T' point 104 105 ! Recieved from the atmosphere ! 106 CHARACTER(len=100) :: cn_rcv_tau_nature = 'oce only' ! 'oce only' 'oce and ice' or 'mixed oce-ice' 107 CHARACTER(len=100) :: cn_rcv_tau_refere = 'spherical' ! 'spherical' or 'cartesian' 108 CHARACTER(len=100) :: cn_rcv_tau_orient = 'local grid' ! 'eastward-northward' or 'local grid' 109 CHARACTER(len=100) :: cn_rcv_tau_grid = 'T' ! 'T', 'U,V', 'U,V,I', 'T,I', or 'T,U,V' 110 CHARACTER(len=100) :: cn_rcv_w10m = 'none' ! 'none' or 'coupled' 111 CHARACTER(len=100) :: cn_rcv_dqnsdt = 'none' ! 'none' or 'coupled' 112 CHARACTER(len=100) :: cn_rcv_qsr = 'oce only' ! 'oce only' 'conservative' 'oce and ice' or 'mixed oce-ice' 113 CHARACTER(len=100) :: cn_rcv_qns = 'oce only' ! 'oce only' 'conservative' 'oce and ice' or 'mixed oce-ice' 114 CHARACTER(len=100) :: cn_rcv_emp = 'oce only' ! 'oce only' 'conservative' 'oce and ice' or 'mixed oce-ice' 115 CHARACTER(len=100) :: cn_rcv_rnf = 'coupled' ! 'coupled' 'climato' or 'mixed' 116 CHARACTER(len=100) :: cn_rcv_cal = 'none' ! 'none' or 'coupled' 117 118 !! CHARACTER(len=100), PUBLIC :: cn_rcv_rnf !: ??? ==>> !!gm treat this case in a different maner 119 120 CHARACTER(len=100), DIMENSION(4) :: cn_snd_crt ! array combining cn_snd_crt_* 121 CHARACTER(len=100), DIMENSION(4) :: cn_rcv_tau ! array combining cn_rcv_tau_* 122 123 REAL(wp), DIMENSION(jpi,jpj) :: albedo_oce_mix ! ocean albedo sent to atmosphere (mix clear/overcast sky) 124 125 REAL(wp), DIMENSION(jpi,jpj,jprcv) :: frcv ! all fields recieved from the atmosphere 126 INTEGER , DIMENSION( jprcv) :: nrcvinfo ! OASIS info argument 127 128 !! Substitution 129 # include "vectopt_loop_substitute.h90" 101 130 !!---------------------------------------------------------------------- 102 !! OPA 9.0 , LOCEAN-IPSL (2006)103 !! $Id $131 !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008) 132 !! $Id:$ 104 133 !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 105 134 !!---------------------------------------------------------------------- 106 135 107 136 CONTAINS 108 109 SUBROUTINE sbc_cpl( kt ) 137 138 SUBROUTINE sbc_cpl_init( k_ice ) 139 !!---------------------------------------------------------------------- 140 !! *** ROUTINE sbc_cpl_init *** 141 !! 142 !! ** Purpose : Initialisation of send and recieved information from 143 !! the atmospheric component 144 !! 145 !! ** Method : * Read namsbc_cpl namelist 146 !! * define the receive interface 147 !! * define the send interface 148 !! * initialise the OASIS coupler 149 !!---------------------------------------------------------------------- 150 INTEGER, INTENT(in) :: k_ice ! ice management in the sbc (=0/1/2/3) 151 !! 152 INTEGER :: jn ! dummy loop index 153 REAL(wp), DIMENSION(jpi,jpj) :: zacs, zaos ! 2D workspace (clear & overcast sky albedos) 154 !! 155 NAMELIST/namsbc_cpl/ cn_snd_temperature, cn_snd_albedo , cn_snd_thickness, & 156 cn_snd_crt_nature, cn_snd_crt_refere , cn_snd_crt_orient, cn_snd_crt_grid , cn_rcv_w10m, & 157 cn_rcv_tau_nature, cn_rcv_tau_refere , cn_rcv_tau_orient, cn_rcv_tau_grid , & 158 cn_rcv_dqnsdt , cn_rcv_qsr , cn_rcv_qns , cn_rcv_emp , cn_rcv_rnf , cn_rcv_cal 110 159 !!--------------------------------------------------------------------- 111 !! *** ROUTINE sbc_cpl *** 112 !! 113 !! ** Purpose : provide at each time step the surface ocean fluxes 114 !! (momentum, heat, freshwater and runoff) in coupled mode 115 !! 116 !! ** Method : - Recieve from a Atmospheric model via OASIS coupler : 117 !! i-component of the stress taux (N/m2) 118 !! j-component of the stress tauy (N/m2) 119 !! net downward heat flux qtot (watt/m2) 120 !! net downward radiative flux qsr (watt/m2) 121 !! net upward freshwater (evapo - precip) emp (kg/m2/s) 122 !! - send to the Atmospheric model via OASIS coupler : 123 !! 124 !! ** Action : update at each time-step the two components of the 125 !! surface stress in both (i,j) and geographical ref. 126 !! 127 !! 128 !! CAUTION : - never mask the surface stress fields 129 !! 130 !! ** Action : update at each time-step 131 !! - taux & tauy : stress components in (i,j) referential 132 !! - qns : non solar heat flux 133 !! - qsr : solar heat flux 134 !! - emp : evap - precip (volume flux) 135 !! - emps : evap - precip (concentration/dillution) 136 !! 137 !! References : The OASIS User Guide, Version 3.0 and 4.0 138 !!---------------------------------------------------------------------- 139 INTEGER, INTENT(in) :: kt ! ocean time step 140 !! 141 INTEGER :: ji, jj ! dummy loop indices 142 #if defined key_cpl_ocevel 143 INTEGER :: ikchoix 144 #endif 145 INTEGER :: var_id, info 146 INTEGER :: date !???? !!gm bug this is a real !!! 147 REAL(wp) :: zfacflx, zfacwat, zfact 148 149 REAL(wp), DIMENSION(jpi,jpj) :: ztaueuw, ztauevw ! eastward wind stress over water at U and V-points 150 REAL(wp), DIMENSION(jpi,jpj) :: ztaunuw, ztaunvw ! northward wind stress over water at U and V-points 151 REAL(wp), DIMENSION(jpi,jpj) :: ztaueui, ztauevi ! eastward wind stress over ice at U and V-points 152 REAL(wp), DIMENSION(jpi,jpj) :: ztaunui, ztaunvi ! northward wind stress over ice at U and V-points 153 REAL(wp), DIMENSION(jpi,jpj) :: ztaueu , ztauev ! eastward wind stress combined 154 REAL(wp), DIMENSION(jpi,jpj) :: ztaunu , ztaunv ! northward wind stress combined 155 !!--------------------------------------------------------------------- 156 157 date = ( kt - nit000 ) * rdttra(1) ! date of exxhanges 158 ! ! Conversion factor (ocean units are W/m2 and Kg/m2/s] 159 zfacflx = 1.e0 ! no conversion [W/m2] ! W/m2 heat fluxes are send by the Atmosphere 160 zfacwat = 1.e3 ! convert [m/s] to [kg/m2/s] ! m/s freshwater fluxes are send by the atmosphere 161 162 163 ! ! =========================== ! 164 ! ! Send Coupling fields ! 165 ! ! =========================== ! 160 161 ! ================================ ! 162 ! Namelist informations ! 163 ! ================================ ! 164 165 REWIND( numnam ) ! ... read namlist namsbc_cpl 166 READ ( numnam, namsbc_cpl ) 167 168 IF(lwp) THEN ! control print 169 WRITE(numout,*) 170 WRITE(numout,*)'sbc_cpl_init : namsbc_cpl namelist ' 171 WRITE(numout,*)'~~~~~~~~~~~~' 172 WRITE(numout,*)' received fields' 173 WRITE(numout,*)' 10m wind module cn_rcv_w10m = ', cn_rcv_w10m 174 WRITE(numout,*)' surface stress - nature cn_rcv_tau_nature = ', cn_rcv_tau_nature 175 WRITE(numout,*)' - referential cn_rcv_tau_refere = ', cn_rcv_tau_refere 176 WRITE(numout,*)' - orientation cn_rcv_tau_orient = ', cn_rcv_tau_orient 177 WRITE(numout,*)' - mesh cn_rcv_tau_grid = ', cn_rcv_tau_grid 178 WRITE(numout,*)' non-solar heat flux sensitivity cn_rcv_dqnsdt = ', cn_rcv_dqnsdt 179 WRITE(numout,*)' solar heat flux cn_rcv_qsr = ', cn_rcv_qsr 180 WRITE(numout,*)' non-solar heat flux cn_rcv_qns = ', cn_rcv_qns 181 WRITE(numout,*)' freshwater budget cn_rcv_emp = ', cn_rcv_emp 182 WRITE(numout,*)' runoffs cn_rcv_rnf = ', cn_rcv_rnf 183 WRITE(numout,*)' calving cn_rcv_cal = ', cn_rcv_cal 184 WRITE(numout,*)' sent fields' 185 WRITE(numout,*)' surface temperature cn_snd_temperature = ', cn_snd_temperature 186 WRITE(numout,*)' albedo cn_snd_albedo = ', cn_snd_albedo 187 WRITE(numout,*)' ice/snow thickness cn_snd_thickness = ', cn_snd_thickness 188 WRITE(numout,*)' surface current - nature cn_snd_crt_nature = ', cn_snd_crt_nature 189 WRITE(numout,*)' - referential cn_snd_crt_refere = ', cn_snd_crt_refere 190 WRITE(numout,*)' - orientation cn_snd_crt_orient = ', cn_snd_crt_orient 191 WRITE(numout,*)' - mesh cn_snd_crt_grid = ', cn_snd_crt_grid 192 ENDIF 193 194 ! save current & stress in an array and suppress possible blank in the name 195 cn_snd_crt(1) = TRIM( cn_snd_crt_nature ) ; cn_snd_crt(2) = TRIM( cn_snd_crt_refere ) 196 cn_snd_crt(3) = TRIM( cn_snd_crt_orient ) ; cn_snd_crt(4) = TRIM( cn_snd_crt_grid ) 197 cn_rcv_tau(1) = TRIM( cn_rcv_tau_nature ) ; cn_rcv_tau(2) = TRIM( cn_rcv_tau_refere ) 198 cn_rcv_tau(3) = TRIM( cn_rcv_tau_orient ) ; cn_rcv_tau(4) = TRIM( cn_rcv_tau_grid ) 199 200 ! ================================ ! 201 ! Define the receive interface ! 202 ! ================================ ! 203 nrcvinfo(:) = PRISM_NotDef ! needed by nrcvinfo(jpr_otx1) if we do not receive ocea stress 204 205 ! for each field: define the OASIS name (srcv(:)%clname) 206 ! define receive or not from the namelist parameters (srcv(:)%laction) 207 ! define the north fold type of lbc (srcv(:)%nsgn) 208 209 ! default definitions of srcv 210 srcv(:)%laction = .FALSE. ; srcv(:)%clgrid = 'T' ; srcv(:)%nsgn = 1 211 212 ! ! ------------------------- ! 213 ! ! ice and ocean wind stress ! 214 ! ! ------------------------- ! 215 ! ! Name 216 srcv(jpr_otx1)%clname = 'O_OTaux1' ! 1st ocean component on grid ONE (T or U) 217 srcv(jpr_oty1)%clname = 'O_OTauy1' ! 2nd - - - - 218 srcv(jpr_otz1)%clname = 'O_OTauz1' ! 3rd - - - - 219 srcv(jpr_otx2)%clname = 'O_OTaux2' ! 1st ocean component on grid TWO (V) 220 srcv(jpr_oty2)%clname = 'O_OTauy2' ! 2nd - - - - 221 srcv(jpr_otz2)%clname = 'O_OTauz2' ! 3rd - - - - 222 ! 223 srcv(jpr_itx1)%clname = 'O_ITaux1' ! 1st ice component on grid ONE (T, F, I or U) 224 srcv(jpr_ity1)%clname = 'O_ITauy1' ! 2nd - - - - 225 srcv(jpr_itz1)%clname = 'O_ITauz1' ! 3rd - - - - 226 srcv(jpr_itx2)%clname = 'O_ITaux2' ! 1st ice component on grid TWO (V) 227 srcv(jpr_ity2)%clname = 'O_ITauy2' ! 2nd - - - - 228 srcv(jpr_itz2)%clname = 'O_ITauz2' ! 3rd - - - - 166 229 ! 167 !!gm bug ? here send instantaneous SST, not mean over the coupling period.... 168 var_id = send_id(1) ; CALL cpl_prism_send( var_id, date, tn(:,:,1)+rt0, info ) ! ocean surface temperature [K] 169 var_id = send_id(2) ; CALL cpl_prism_send( var_id, date, 1.0-frld , info ) ! fraction of ice-cover 170 #if defined key_cpl_albedo 171 DO jj = 1, jpj 172 DO ji = 1, jpi 173 IF( ( tn_ice(ji,jj) < 50 .OR. tn_ice(ji,jj) > 400 ) .AND. frld(ji,jj) < 1. ) THEN 174 WRITE(numout,*) ' tn_ice, ERROR ', ji, jj, ' = ', tn_ice(ji,jj), & 175 & ' qns_ice_recv=', qns_ice_recv(ji,jj), ' dqns_ice_recv=', dqns_ice_recv(ji,jj) 230 srcv(jpr_otx1:jpr_itz2)%nsgn = -1 ! Vectors: change of sign at north fold 231 232 ! ! Set grid and action 233 SELECT CASE( TRIM( cn_rcv_tau(4) ) ) ! 'T', 'U,V', 'U,V,I', 'U,V,F', 'T,I', 'T,F', or 'T,U,V' 234 CASE( 'T' ) 235 srcv(jpr_otx1:jpr_itz2)%clgrid = 'T' ! oce and ice components given at T-point 236 srcv(jpr_otx1:jpr_otz1)%laction = .TRUE. ! receive oce components on grid 1 237 srcv(jpr_itx1:jpr_itz1)%laction = .TRUE. ! receive ice components on grid 1 238 CASE( 'U,V' ) 239 srcv(jpr_otx1:jpr_otz1)%clgrid = 'U' ! oce components given at U-point 240 srcv(jpr_otx2:jpr_otz2)%clgrid = 'V' ! and V-point 241 srcv(jpr_itx1:jpr_itz1)%clgrid = 'U' ! ice components given at U-point 242 srcv(jpr_itx2:jpr_itz2)%clgrid = 'V' ! and V-point 243 srcv(jpr_otx1:jpr_itz2)%laction = .TRUE. ! receive oce and ice components on both grid 1 & 2 244 CASE( 'U,V,T' ) 245 srcv(jpr_otx1:jpr_otz1)%clgrid = 'U' ! oce components given at U-point 246 srcv(jpr_otx2:jpr_otz2)%clgrid = 'V' ! and V-point 247 srcv(jpr_itx1:jpr_itz1)%clgrid = 'T' ! ice components given at T-point 248 srcv(jpr_otx1:jpr_otz2)%laction = .TRUE. ! receive oce components on grid 1 & 2 249 srcv(jpr_itx1:jpr_itz1)%laction = .TRUE. ! receive ice components on grid 1 only 250 CASE( 'U,V,I' ) 251 srcv(jpr_otx1:jpr_otz1)%clgrid = 'U' ! oce components given at U-point 252 srcv(jpr_otx2:jpr_otz2)%clgrid = 'V' ! and V-point 253 srcv(jpr_itx1:jpr_itz1)%clgrid = 'I' ! ice components given at I-point 254 srcv(jpr_otx1:jpr_otz2)%laction = .TRUE. ! receive oce components on grid 1 & 2 255 srcv(jpr_itx1:jpr_itz1)%laction = .TRUE. ! receive ice components on grid 1 only 256 CASE( 'U,V,F' ) 257 srcv(jpr_otx1:jpr_otz1)%clgrid = 'U' ! oce components given at U-point 258 srcv(jpr_otx2:jpr_otz2)%clgrid = 'V' ! and V-point 259 srcv(jpr_itx1:jpr_itz1)%clgrid = 'F' ! ice components given at F-point 260 srcv(jpr_otx1:jpr_otz2)%laction = .TRUE. ! receive oce components on grid 1 & 2 261 srcv(jpr_itx1:jpr_itz1)%laction = .TRUE. ! receive ice components on grid 1 only 262 CASE( 'T,I' ) 263 srcv(jpr_otx1:jpr_itz2)%clgrid = 'T' ! oce and ice components given at T-point 264 srcv(jpr_itx1:jpr_itz1)%clgrid = 'I' ! ice components given at I-point 265 srcv(jpr_otx1:jpr_otz1)%laction = .TRUE. ! receive oce components on grid 1 266 srcv(jpr_itx1:jpr_itz1)%laction = .TRUE. ! receive ice components on grid 1 267 CASE( 'T,F' ) 268 srcv(jpr_otx1:jpr_itz2)%clgrid = 'T' ! oce and ice components given at T-point 269 srcv(jpr_itx1:jpr_itz1)%clgrid = 'F' ! ice components given at F-point 270 srcv(jpr_otx1:jpr_otz1)%laction = .TRUE. ! receive oce components on grid 1 271 srcv(jpr_itx1:jpr_itz1)%laction = .TRUE. ! receive ice components on grid 1 272 CASE( 'T,U,V' ) 273 srcv(jpr_otx1:jpr_otz1)%clgrid = 'T' ! oce components given at T-point 274 srcv(jpr_itx1:jpr_itz1)%clgrid = 'U' ! ice components given at U-point 275 srcv(jpr_itx2:jpr_itz2)%clgrid = 'V' ! and V-point 276 srcv(jpr_otx1:jpr_otz1)%laction = .TRUE. ! receive oce components on grid 1 only 277 srcv(jpr_itx1:jpr_itz2)%laction = .TRUE. ! receive ice components on grid 1 & 2 278 CASE default 279 CALL ctl_stop( 'sbc_cpl_init: wrong definition of cn_rcv_tau(4)' ) 280 END SELECT 281 ! 282 IF( TRIM( cn_rcv_tau(2) ) == 'spherical' ) & ! spherical: 3rd component not received 283 & srcv( (/jpr_otz1, jpr_otz2, jpr_itz1, jpr_itz2/) )%laction = .FALSE. 284 ! 285 IF( TRIM( cn_rcv_tau(1) ) /= 'oce and ice' ) THEN ! 'oce and ice' case ocean stress on ocean mesh used 286 srcv(jpr_itx1:jpr_itz2)%laction = .FALSE. ! ice components not received 287 srcv(jpr_itx1)%clgrid = 'U' ! ocean stress used after its transformation 288 srcv(jpr_ity1)%clgrid = 'V' ! i.e. it is always at U- & V-points for i- & j-comp. resp. 289 ENDIF 290 291 ! ! ------------------------- ! 292 ! ! freshwater budget ! E-P 293 ! ! ------------------------- ! 294 ! we suppose that atmosphere modele do not make the difference between precipiration (liquide or solid) 295 ! over ice of free ocean within the same atmospheric cell.cd 296 srcv(jpr_rain)%clname = 'OTotRain' ! Rain = liquid precipitation 297 srcv(jpr_snow)%clname = 'OTotSnow' ! Snow = solid precipitation 298 srcv(jpr_tevp)%clname = 'OTotEvap' ! total evaporation (over oce + ice sublimation) 299 srcv(jpr_ievp)%clname = 'OIceEvap' ! evaporation over ice = sublimation 300 srcv(jpr_prsb)%clname = 'OPre-Sub' ! liquid precipitation + solid precipitation - sublimation 301 srcv(jpr_semp)%clname = 'OISub-Sn' ! ice solid water budget = sublimation - solid precipitation 302 srcv(jpr_oemp)%clname = 'OOEva-Pr' ! ocean water budget = ocean Evap - ocean precip 303 SELECT CASE( TRIM( cn_rcv_emp ) ) 304 CASE( 'oce only' ) ; srcv( jpr_oemp )%laction = .TRUE. 305 CASE( 'conservative' ) ; srcv( (/jpr_rain, jpr_snow, jpr_ievp, jpr_tevp/) )%laction = .TRUE. 306 CASE( 'oce and ice' ) ; srcv( (/ jpr_prsb, jpr_semp, jpr_oemp/) )%laction = .TRUE. 307 CASE( 'mixed oce-ice' ) ; srcv( (/jpr_rain, jpr_semp, jpr_tevp/) )%laction = .TRUE. 308 CASE default ; CALL ctl_stop( 'sbc_cpl_init: wrong definition of cn_rcv_emp' ) 309 END SELECT 310 311 ! ! ------------------------- ! 312 ! ! Runoffs & Calving ! 313 ! ! ------------------------- ! 314 srcv(jpr_rnf )%clname = 'O_Runoff' ; IF( TRIM( cn_rcv_rnf ) == 'coupled' ) srcv(jpr_rnf)%laction = .TRUE. 315 IF( TRIM( cn_rcv_rnf ) == 'climato' ) THEN ; ln_rnf = .TRUE. 316 ELSE ; ln_rnf = .FALSE. 317 ENDIF 318 srcv(jpr_cal )%clname = 'OCalving' ; IF( TRIM( cn_rcv_cal ) == 'coupled' ) srcv(jpr_cal)%laction = .TRUE. 319 320 ! ! ------------------------- ! 321 ! ! non solar radiation ! Qns 322 ! ! ------------------------- ! 323 srcv(jpr_qnsoce)%clname = 'O_QnsOce' 324 srcv(jpr_qnsice)%clname = 'O_QnsIce' 325 srcv(jpr_qnsmix)%clname = 'O_QnsMix' 326 SELECT CASE( TRIM( cn_rcv_qns ) ) 327 CASE( 'oce only' ) ; srcv( jpr_qnsoce )%laction = .TRUE. 328 CASE( 'conservative' ) ; srcv( (/jpr_qnsice, jpr_qnsmix/) )%laction = .TRUE. 329 CASE( 'oce and ice' ) ; srcv( (/jpr_qnsice, jpr_qnsoce/) )%laction = .TRUE. 330 CASE( 'mixed oce-ice' ) ; srcv( jpr_qnsmix )%laction = .TRUE. 331 CASE default ; CALL ctl_stop( 'sbc_cpl_init: wrong definition of cn_rcv_qns' ) 332 END SELECT 333 334 ! ! ------------------------- ! 335 ! ! solar radiation ! Qsr 336 ! ! ------------------------- ! 337 srcv(jpr_qsroce)%clname = 'O_QsrOce' 338 srcv(jpr_qsrice)%clname = 'O_QsrIce' 339 srcv(jpr_qsrmix)%clname = 'O_QsrMix' 340 SELECT CASE( TRIM( cn_rcv_qsr ) ) 341 CASE( 'oce only' ) ; srcv( jpr_qsroce )%laction = .TRUE. 342 CASE( 'conservative' ) ; srcv( (/jpr_qsrice, jpr_qsrmix/) )%laction = .TRUE. 343 CASE( 'oce and ice' ) ; srcv( (/jpr_qsrice, jpr_qsroce/) )%laction = .TRUE. 344 CASE( 'mixed oce-ice' ) ; srcv( jpr_qsrmix )%laction = .TRUE. 345 CASE default ; CALL ctl_stop( 'sbc_cpl_init: wrong definition of cn_rcv_qsr' ) 346 END SELECT 347 348 ! ! ------------------------- ! 349 ! ! non solar sensitivity ! d(Qns)/d(T) 350 ! ! ------------------------- ! 351 srcv(jpr_dqnsdt)%clname = 'O_dQnsdT' 352 IF( TRIM( cn_rcv_dqnsdt ) == 'coupled' ) srcv(jpr_dqnsdt)%laction = .TRUE. 353 354 ! ! ------------------------- ! 355 ! ! Ice Qsr penetration ! 356 ! ! ------------------------- ! 357 ! fraction of net shortwave radiation which is not absorbed in the thin surface layer 358 ! and penetrates inside the ice cover ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 ) 359 ! Coupled case: since cloud cover is not received from atmosphere 360 ! ===> defined as constant value -> definition done in sbc_cpl_init 361 fr1_i0(:,:) = 0.18 362 fr2_i0(:,:) = 0.82 363 ! ! ------------------------- ! 364 ! ! 10m wind module ! 365 ! ! ------------------------- ! 366 srcv(jpr_w10m )%clname = 'O_Wind10' ; IF( TRIM(cn_rcv_w10m) == 'coupled' ) srcv(jpr_w10m)%laction = .TRUE. 367 ! ! +++ ---> A brancher et a blinder dans tke si cn_rcv_w10m == 'none' 368 369 370 ! ================================ ! 371 ! Define the send interface ! 372 ! ================================ ! 373 ! for each field: define the OASIS name (srcv(:)%clname) 374 ! define send or not from the namelist parameters (srcv(:)%laction) 375 ! define the north fold type of lbc (srcv(:)%nsgn) 376 377 ! default definitions of nsnd 378 ssnd(:)%laction = .FALSE. ; ssnd(:)%clgrid = 'T' ; ssnd(:)%nsgn = 1 379 380 ! ! ------------------------- ! 381 ! ! Surface temperature ! 382 ! ! ------------------------- ! 383 ssnd(jps_toce)%clname = 'O_SSTSST' 384 ssnd(jps_tice)%clname = 'O_TepIce' 385 ssnd(jps_tmix)%clname = 'O_TepMix' 386 SELECT CASE( TRIM( cn_snd_temperature ) ) 387 CASE( 'oce only' ) ; ssnd( jps_toce )%laction = .TRUE. 388 CASE( 'weighted oce and ice' ) ; ssnd( (/jps_toce, jps_tice/) )%laction = .TRUE. 389 CASE( 'mixed oce-ice' ) ; ssnd( jps_tmix )%laction = .TRUE. 390 END SELECT 391 392 ! ! ------------------------- ! 393 ! ! Albedo ! 394 ! ! ------------------------- ! 395 ssnd(jps_albice)%clname = 'O_AlbIce' 396 ssnd(jps_albmix)%clname = 'O_AlbMix' 397 SELECT CASE( TRIM( cn_snd_albedo ) ) 398 CASE( 'none' ) ! nothing to do 399 CASE( 'weighted ice' ) ; ssnd(jps_albice)%laction = .TRUE. 400 CASE( 'mixed oce-ice' ) ; ssnd(jps_albmix)%laction = .TRUE. 401 CALL albedo_oce( zaos, zacs ) 402 ! Due to lack of information on nebulosity : mean clear/overcast sky 403 albedo_oce_mix(:,:) = ( zacs(:,:) + zaos(:,:) ) * 0.5 404 END SELECT 405 406 ! ! ------------------------- ! 407 ! ! Ice fraction & Thickness ! 408 ! ! ------------------------- ! 409 ssnd(jps_fice)%clname = 'OIceFrac' 410 ssnd(jps_hice)%clname = 'O_IceTck' 411 ssnd(jps_hsnw)%clname = 'O_SnwTck' 412 IF( k_ice /= 0 ) ssnd(jps_fice)%laction = .TRUE. ! if ice treated in the ocean (even in climato case) 413 IF( TRIM( cn_snd_thickness ) == 'weighted ice and snow' ) ssnd( (/jps_hice, jps_hsnw/) )%laction = .TRUE. 414 415 ! ! ------------------------- ! 416 ! ! Surface current ! 417 ! ! ------------------------- ! 418 ! ocean currents ! ice velocities 419 ssnd(jps_ocx1)%clname = 'O_OCurx1' ; ssnd(jps_ivx1)%clname = 'O_IVelx1' 420 ssnd(jps_ocy1)%clname = 'O_OCury1' ; ssnd(jps_ivy1)%clname = 'O_IVely1' 421 ssnd(jps_ocz1)%clname = 'O_OCurz1' ; ssnd(jps_ivz1)%clname = 'O_IVelz1' 422 ! 423 ssnd(jps_ocx1:jps_ivz2)%nsgn = -1 ! vectors: change of the sign at the north fold 424 425 IF( cn_snd_crt(4) /= 'T' ) CALL ctl_stop( 'cn_snd_crt(4) must be equal to T' ) 426 ssnd(jps_ocx1:jps_ivz2)%clgrid = 'T' ! all oce and ice components on the same unique grid 427 ssnd(jps_ocx1:jps_ocz1)%laction = .TRUE. ! oce components on 1 grid 428 ssnd(jps_ivx1:jps_ivz1)%laction = .TRUE. ! ice components on 1 grid 429 430 IF( TRIM( cn_snd_crt(2) ) == 'spherical' ) & ! 3rd component not used 431 & srcv( (/jps_otz1, jps_otz2, jps_itz1, jps_itz2/) )%laction = .FALSE. 432 ! 433 IF( TRIM( cn_snd_crt(1) ) /= 'oce only' .OR. 'oce and ice' ) & ! ice components not used 434 & srcv(jps_itx1:jps_itz2)%laction = FALSE. 435 436 SELECT CASE( TRIM( cn_snd_crt(1) ) ) 437 CASE( 'none' ) ; ssnd(jps_ocx1:jps_ivz2)%laction = .FALSE. 438 CASE( 'oce only' ) ; ssnd(jps_ivx1:jps_ivz2)%laction = .FALSE. 439 CASE( 'weighted oce and ice' ) ! nothing to do 440 CASE( 'mixed oce-ice' ) ; ssnd(jps_ivx1:jps_ivz2)%laction = .FALSE. 441 END SELECT 442 443 ! ================================ ! 444 ! initialisation of the coupler ! 445 ! ================================ ! 446 CALL cpl_prism_define 447 ! 448 END SUBROUTINE sbc_cpl_init 449 450 451 SUBROUTINE sbc_cpl_rcv( kt, k_fsbc, k_ice ) 452 !!---------------------------------------------------------------------- 453 !! *** ROUTINE sbc_cpl_rcv *** 454 !! 455 !! ** Purpose : provide the stress over the ocean and, if no sea-ice, 456 !! provide the ocean heat and freshwater fluxes. 457 !! 458 !! ** Method : - Receive all the atmospheric fields (stored in frcv array). called at each time step. 459 !! OASIS controls if there is something do receive or not. nrcvinfo contains the info 460 !! to know if the field was really received or not 461 !! 462 !! --> If ocean stress was really received: 463 !! 464 !! - transform the received ocean stress vector from the received 465 !! referential and grid into an atmosphere-ocean stress in 466 !! the (i,j) ocean referencial and at the ocean velocity point. 467 !! The received stress are : 468 !! - defined by 3 components (if cartesian coordinate) 469 !! or by 2 components (if spherical) 470 !! - oriented along geographical coordinate (if eastward-northward) 471 !! or along the local grid coordinate (if local grid) 472 !! - given at U- and V-point, resp. if received on 2 grids 473 !! or at T-point if received on 1 grid 474 !! Therefore and if necessary, they are successively 475 !! processed in order to obtain them 476 !! first as 2 components on the sphere 477 !! second as 2 components oriented along the local grid 478 !! third as 2 components on the U,V grid 479 !! 480 !! --> 481 !! 482 !! - In 'ocean only' case, non solar and solar ocean heat fluxes 483 !! and total ocean freshwater fluxes 484 !! 485 !! ** Method : receive all fields from the atmosphere and transform 486 !! them into ocean surface boundary condition fields 487 !! 488 !! ** Action : update utau, vtau ocean stress at U,V grid 489 !! qns , qsr non solar and solar ocean heat fluxes ('ocean only case) 490 !! emp = emps evap. - precip. (- runoffs) (- calving) ('ocean only case) 491 !! wind10m 10m wind speed !!!!gm to be checked 492 !!---------------------------------------------------------------------- 493 INTEGER, INTENT(in) :: kt ! ocean model time step index 494 INTEGER, INTENT(in) :: k_fsbc ! frequency of sbc (-> ice model) computation 495 INTEGER, INTENT(in) :: k_ice ! ice management in the sbc (=0/1/2/3) 496 !! 497 INTEGER :: ji, jj, jn ! dummy loop indices 498 INTEGER :: isec ! number of seconds since nit000 (assuming rdttra did not change since nit000) 499 REAL(wp) :: zcumulneg, zcumulpos ! temporary scalars 500 REAL(wp), DIMENSION(jpi,jpj) :: ztx, ztx ! 2D workspace 501 !!---------------------------------------------------------------------- 502 503 IF( kt == nit000 ) CALL sbc_cpl_init( k_ice ) ! initialisation 504 505 ! ! Receive all the atmos. fields (including ice information) 506 isec = ( kt - nit000 ) * NINT( rdttra(1) ) ! date of exchanges 507 DO jn = 1, jprcv ! received fields sent by the atmosphere 508 IF( srcv(jn)%laction ) CALL cpl_prism_rcv( jn, isec, frcv(:,:,jn), nrcvinfo(jn) ) 509 END DO 510 511 ! ! ========================= ! 512 IF( srcv(jpr_otx1)%laction ) THEN ! ocean stress ! 513 ! ! ========================= ! 514 ! define frcv(:,:,jpr_otx1) and frcv(:,:,jpr_oty1): stress at U/V point along model grid 515 ! => need to be done only when we receive the field 516 IF( nrcvinfo(jpr_otx1) == PRISM_Recvd .OR. nrcvinfo(jpr_otx1) == PRISM_FromRest .OR. & 517 & nrcvinfo(jpr_otx1) == PRISM_RecvOut .OR. nrcvinfo(jpr_otx1) == PRISM_FromRestOut ) THEN 518 ! 519 IF( TRIM( cn_rcv_tau(2) ) == 'cartesian' ) THEN ! 2 components on the sphere 520 ! ! (cartesian to spherical -> 3 to 2 components) 521 ! 522 CALL geo2oce( frcv(:,:,jpr_otx1), frcv(:,:,jpr_oty1), frcv(:,:,jpr_otz1), & 523 & srcv(jpr_otx1)%clgrid, ztx, zty ) 524 frcv(:,:,jpr_otx1) = ztx(:,:) ! overwrite 1st comp. on the 1st grid 525 frcv(:,:,jpr_oty1) = zty(:,:) ! overwrite 2nd comp. on the 1st grid 526 ! 527 IF( srcv(jpr_otx2)%laction ) THEN 528 CALL geo2oce( frcv(:,:,jpr_otx2), frcv(:,:,jpr_oty2), frcv(:,:,jpr_otz2), & 529 & srcv(jpr_otx2)%clgrid, ztx, zty ) 530 frcv(:,:,jpr_otx2) = ztx(:,:) ! overwrite 1st comp. on the 2nd grid 531 frcv(:,:,jpr_oty2) = zty(:,:) ! overwrite 2nd comp. on the 2nd grid 532 ENDIF 533 ! 176 534 ENDIF 177 END DO 178 END DO 179 var_id = send_id(3) ; CALL cpl_prism_send( var_id, date, tn_ice , info ) ! ice surface temperature [K] 180 var_id = send_id(4) ; CALL cpl_prism_send( var_id, date, alb_ice , info ) ! ice albedo [%] 181 #else 182 var_id = send_id(3) ; CALL cpl_prism_send( var_id, date, hicif , info ) ! ice thickness [m] 183 var_id = send_id(4) ; CALL cpl_prism_send( var_id, date, hsnif , info ) ! snow thickness [m] 184 #endif 185 #if defined key_cpl_ocevel 186 !!gm bug??? I have to check the grid point position... 187 !! a priori there is a error here as un, vn are not at the same grid point.... 188 !! there should be a averaged to set u and v at T-point.... with caution for sea-ice velocity at I-point.... 189 un_weighted = un(:,:,1) * frld + u_ice * ( 1. - frld ) 190 vn_weighted = vn(:,:,1) * frld + v_ice * ( 1. - frld ) 191 ikchoix = - 1 ! converte from (i,j) to geographic referential 192 CALL repere( un_weighted, vn_weighted, un_send, vn_send, ikchoix ) 193 !!gm bug : at lbc_lnk is to be added on un_send and vn_send 194 var_id = send_id(5) ; CALL cpl_prism_send( var_id, date, un_send , info ) ! surface current [m/s] 195 var_id = send_id(6) ; CALL cpl_prism_send( var_id, date, vn_send , info ) ! surface current [m/s] 196 #endif 197 198 ! ! =========================== ! 199 ! ! Recieve Momentum fluxes ! 200 ! ! =========================== ! 201 ! 202 ! ... Receive wind stress fields in geographic component over water and ice 203 var_id = recv_id(1) ; CALL cpl_prism_recv( var_id, date, ztaueuw, info ) ! ??? 204 var_id = recv_id(2) ; CALL cpl_prism_recv( var_id, date, ztaunuw, info ) 205 var_id = recv_id(3) ; CALL cpl_prism_recv( var_id, date, ztaueui, info ) 206 var_id = recv_id(4) ; CALL cpl_prism_recv( var_id, date, ztaunui, info ) 207 var_id = recv_id(5) ; CALL cpl_prism_recv( var_id, date, ztauevw, info ) 208 var_id = recv_id(6) ; CALL cpl_prism_recv( var_id, date, ztaunvw, info ) 209 var_id = recv_id(7) ; CALL cpl_prism_recv( var_id, date, ztauevi, info ) 210 var_id = recv_id(8) ; CALL cpl_prism_recv( var_id, date, ztaunvi, info ) 211 ! 212 !!gm bug : keep separate ice and ocean stress ! 213 ! ... combine water / ice stresses 214 ztaueu(:,:) = ztaueuw(:,:) * frld(:,:) + ztaueui(:,:) * ( 1.0 - frld(:,:) ) 215 ztaunu(:,:) = ztaunuw(:,:) * frld(:,:) + ztaunui(:,:) * ( 1.0 - frld(:,:) ) 216 ztauev(:,:) = ztauevw(:,:) * frld(:,:) + ztauevi(:,:) * ( 1.0 - frld(:,:) ) 217 ztaunv(:,:) = ztaunvw(:,:) * frld(:,:) + ztaunvi(:,:) * ( 1.0 - frld(:,:) ) 218 ! 219 ! ... rotate vector components from geographic to (i,j) referential 220 CALL repcmo ( ztaueu, ztaunu, ztauev, ztaunv, utau, vtau, kt ) 221 ! 222 !!gm bug?? not sure but put that for security 223 CALL lbc_lnk( utau , 'U', -1. ) 224 CALL lbc_lnk( vtau , 'V', -1. ) 225 !!gm end bug?? 226 ! 227 ! ! =========================== ! 228 ! ! Recieve heat fluxes ! 229 ! ! =========================== ! 230 ! 231 var_id = recv_id(13) ; CALL cpl_prism_recv( var_id, date, qsr_oce_recv , info ) ! ocean surface net downward shortwave flux 232 var_id = recv_id(14) ; CALL cpl_prism_recv( var_id, date, qns_oce_recv , info ) ! ocean surface downward non-solar heat flux 233 var_id = recv_id(15) ; CALL cpl_prism_recv( var_id, date, qsr_ice_recv , info ) ! ice solar heat flux 234 var_id = recv_id(16) ; CALL cpl_prism_recv( var_id, date, qns_ice_recv , info ) ! ice non-solar heat flux 235 var_id = recv_id(17) ; CALL cpl_prism_recv( var_id, date, dqns_ice_recv, info ) ! ice non-solar heat flux sensitivity 236 237 qsr_oce_recv (:,:) = qsr_oce_recv (:,:) * tmask(:,:,1) * zfacflx 238 qns_oce_recv (:,:) = qns_oce_recv (:,:) * tmask(:,:,1) * zfacflx 239 qsr_ice_recv (:,:) = qsr_ice_recv (:,:) * tmask(:,:,1) * zfacflx 240 qns_ice_recv (:,:) = qns_ice_recv (:,:) * tmask(:,:,1) * zfacflx 241 dqns_ice_recv(:,:) = dqns_ice_recv(:,:) * tmask(:,:,1) * zfacflx 242 243 IF( kt == nit000 ) THEN ! set once for all qsr penetration in sea-ice 244 ! ! Since cloud cover catm not transmitted from atmosphere, it is set to 0. 245 ! ! i.e. constant penetration fractions of 0.18 and 0.82 246 ! fraction of net shortwave radiation which is not absorbed in the thin surface layer and penetrates 247 ! inside the ice cover ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 ) 248 fr1_i0_recv(:,:) = 0.18 249 fr2_i0_recv(:,:) = 0.82 535 ! 536 IF( TRIM( cn_rcv_tau(3) ) == 'eastward-northward' ) THEN ! 2 components oriented along the local grid 537 ! ! (geographical to local grid -> rotate the components) 538 CALL rot_rep( frcv(:,:,jpr_otx1), frcv(:,:,jpr_oty1), srcv(jpr_otx1)%clgrid, 'en->i', ztx ) 539 frcv(:,:,jpr_otx1) = ztx(:,:) ! overwrite 1st component on the 1st grid 540 IF( srcv(jpr_otx2)%laction ) THEN 541 CALL rot_rep( frcv(:,:,jpr_otx2), frcv(:,:,jpr_oty2), srcv(jpr_otx2)%clgrid, 'en->j', zty ) 542 ELSE 543 CALL rot_rep( frcv(:,:,jpr_otx1), frcv(:,:,jpr_oty1), srcv(jpr_otx1)%clgrid, 'en->j', zty ) 544 ENDIF 545 frcv(:,:,jpr_oty1) = zty(:,:) ! overwrite 2nd component on the 2nd grid 546 ENDIF 547 ! 548 IF( srcv(jpr_otx1)%clgrid == 'T' ) THEN 549 DO jj = 2, jpjm1 ! T ==> (U,V) 550 DO ji = fs_2, fs_jpim1 ! vector opt. 551 frcv(ji,jj,jpr_otx1) = 0.5 * ( frcv(ji+1,jj ,jpr_otx1) + frcv(ji,jj,jpr_otx1) ) 552 frcv(ji,jj,jpr_oty1) = 0.5 * ( frcv(ji ,jj+1,jpr_oty1) + frcv(ji,jj,jpr_oty1) ) 553 END DO 554 END DO 555 CALL lbc_lnk( frcv(:,:,jpr_otx1), 'U', -1. ) ; CALL lbc_lnk( frcv(:,:,jpr_oty1), 'V', -1. ) 556 ENDIF 557 ENDIF 558 ! ! ========================= ! 559 ELSE ! No dynamical coupling ! 560 ! ! ========================= ! 561 frcv(:,:,jpr_otx1) = 0.e0 ! here simply set to zero 562 frcv(:,:,jpr_oty1) = 0.e0 ! an external read in a file can be added instead 563 ! 250 564 ENDIF 251 !252 ! ! =========================== !253 ! ! Recieve freshwater fluxes !254 ! ! =========================== !255 !256 var_id = recv_id( 9) ; CALL cpl_prism_recv( var_id, date, zpew , info ) ! P-E over water257 var_id = recv_id(10) ; CALL cpl_prism_recv( var_id, date, zpei , info ) ! P-E over ice258 var_id = recv_id(11) ; CALL cpl_prism_recv( var_id, date, zpsol , info ) ! Snow fall over water and ice259 var_id = recv_id(12) ; CALL cpl_prism_recv( var_id, date, zevice, info ) ! Evaporation over ice (sublimination)260 !261 ! ... calculate water flux (P-E over open ocean and ice) and solid precipitation (positive upward)262 tprecip_recv(:,:) = ( zpew (:,:) + zpei (:,:) ) * tmask(:,:,1) * zfacwat263 sprecip_recv(:,:) = ( zpsol(:,:) + zevice(:,:) ) * tmask(:,:,1) * zfacwat264 565 265 ! ... Control print & check 266 IF(ln_ctl) THEN 267 WRITE(numout,*) ' flx:tprecip_recv - Minimum value is ', MINVAL( tprecip_recv ) 268 WRITE(numout,*) ' flx:tprecip_recv - Maximum value is ', MAXVAL( tprecip_recv ) 269 WRITE(numout,*) ' flx:tprecip_recv - Sum value is ', SUM ( tprecip_recv ) 566 ! u(v)tau will be modified by ice model -> need to be reset before each call of the ice/fsbc 567 IF( MOD( kt-1, k_fsbc ) == 0 ) THEN 568 utau(:,:) = frcv(:,:,jpr_otx1) 569 vtau(:,:) = frcv(:,:,jpr_oty1) 270 570 ENDIF 271 !!gm bug in mpp SUM require a mmp_sum call 272 !!gm further more this test is quite expensive ... only needed at the first time-step??? 273 IF( SUM( zpew*e1t*e2t ) /= SUM( zpew*e1t*e2t*tmask(:,:,1) ) ) THEN 274 WRITE(numout,*) ' flx: Forcing values outside Orca mask' 275 WRITE(numout,*) ' flx: Losses in water conservation' 276 WRITE(numout,*) ' flx: Masked ', SUM(zpew*e1t*e2t*tmask(:,:,1)) 277 WRITE(numout,*) ' flx: Unmasked ', SUM(zpew*e1t*e2t) 278 WRITE(numout,*) ' flx: Simulation STOP' 279 CALL FLUSH(numout) 280 STOP 281 END IF 282 ! 283 #if defined key_cpl_discharge 284 ! Runoffs 285 var_id = recv_id(18) ; CALL cpl_prism_recv ( var_id, date, calving_recv, info ) ! ice discharge into ocean 286 var_id = recv_id(19) ; CALL cpl_prism_recv ( var_id, date, zrunriv , info ) ! river discharge into ocean 287 var_id = recv_id(20) ; CALL cpl_prism_recv ( var_id, date, zruncot , info ) ! continental discharge into ocean 288 289 DO jj = 1, jpj 290 DO ji = 1, jpi 291 zfact = zfacwat * tmask(ji,jj,1) 292 calving_recv(ji,jj) = calving_recv(ji,jj) * zfact 293 rrunoff_recv(ji,jj) = ( zrunriv(ji,jj) + zruncot(ji,jj) ) * zfact 294 END DO 295 END DO 296 #else 297 calving_recv(:,:) = 0. 298 rrunoff_recv(:,:) = 0. 299 #endif 300 301 !!gm bug : this is not valid in mpp 302 !!gm and I presum this is not required at all as a lbc_lnk is applied to all the fields at the end of the routine 303 ! Oasis mask shift and update lateral boundary conditions (E. Maisonnave) 304 ! not tested when mpp is used, W. Park 305 !WSPTEST 306 qsr_oce_recv (jpi-1,:) = qsr_oce_recv (1,:) 307 qsr_ice_recv (jpi-1,:) = qsr_ice_recv (1,:) 308 qns_oce_recv (jpi-1,:) = qns_oce_recv (1,:) 309 qns_ice_recv (jpi-1,:) = qns_ice_recv (1,:) 310 dqns_ice_recv(jpi-1,:) = dqns_ice_recv(1,:) 311 tprecip_recv (jpi-1,:) = tprecip_recv (1,:) 312 sprecip_recv (jpi-1,:) = sprecip_recv (1,:) 313 fr1_i0_recv (jpi-1,:) = fr1_i0_recv (1,:) 314 fr2_i0_recv (jpi-1,:) = fr2_i0_recv (1,:) 315 rrunoff_recv (jpi-1,:) = rrunoff_recv (1,:) 316 calving_recv (jpi-1,:) = calving_recv (1,:) 317 !!gm end bug 318 319 qsr (:,:) = qsr_oce_recv (:,:) ! ocean surface boundary condition 320 qns (:,:) = qns_oce_recv (:,:) 321 emp (:,:) = zpew (:,:) 322 emps (:,:) = zpew (:,:) 323 324 qsr_ice (:,:) = qsr_ice_recv (:,:) ! ice forcing fields 325 qns_ice (:,:) = qns_ice_recv (:,:) 326 dqns_ice(:,:) = dqns_ice_recv(:,:) 327 tprecip (:,:) = tprecip_recv (:,:) 328 sprecip (:,:) = sprecip_recv (:,:) 329 fr1_i0 (:,:) = fr1_i0_recv (:,:) 330 fr2_i0 (:,:) = fr2_i0_recv (:,:) 331 332 !WSP rrunoff = rrunoff_recv 333 !WSP calving = calving_recv 334 rrunoff (:,:) = 0.e0 !WSP runoff and calving included in tprecip 335 calving (:,:) = 0.e0 !WSP 336 337 IF(ln_ctl) THEN 338 WRITE(numout,*) 'flx:qsr_oce - Minimum value is ', MINVAL( qsr_oce ) 339 WRITE(numout,*) 'flx:qsr_oce - Maximum value is ', MAXVAL( qsr_oce ) 340 WRITE(numout,*) 'flx:qsr_oce - Sum value is ', SUM ( qsr_oce ) 341 ! 342 WRITE(numout,*) 'flx:tprecip - Minimum value is ', MINVAL( tprecip ) 343 WRITE(numout,*) 'flx:tprecip - Maximum value is ', MAXVAL( tprecip ) 344 WRITE(numout,*) 'flx:tprecip - Sum value is ', SUM ( tprecip ) 571 ! ! ========================= ! 572 IF( k_ice <= 1 ) THEN ! heat & freshwater fluxes ! (Ocean only case) 573 ! ! ========================= ! 574 ! 575 ! ! non solar heat flux over the ocean (qns) 576 IF( srcv(jpr_qnsoce)%laction ) qns(:,:) = frcv(:,:,jpr_qnsoce) 577 IF( srcv(jpr_qnsmix)%laction ) qns(:,:) = frcv(:,:,jpr_qnsmix) 578 ! ! solar flux over the ocean (qsr) 579 IF( srcv(jpr_qsroce)%laction ) qsr(:,:) = frcv(:,:,jpr_qsroce) 580 IF( srcv(jpr_qsrmix)%laction ) qsr(:,:) = frcv(:,:,jpr_qsrmix) 581 ! 582 ! ! total freshwater fluxes over the ocean (emp, emps) 583 SELECT CASE( TRIM( cn_rcv_emp ) ) ! evaporation - precipitation 584 CASE( 'conservative' ) 585 emp(:,:) = frcv(:,:,jpr_tevp) - ( frcv(:,:,jpr_rain) + frcv(:,:,jpr_snow) ) 586 CASE( 'mixed oce-ice' ) 587 emp(:,:) = frcv(:,:,jpr_tevp) - ( frcv(:,:,jpr_rain) + frcv(:,:,jpr_semp) ) 588 CASE( 'ocean only', 'oce and ice' ) 589 emp(:,:) = frcv(:,:,jpr_oemp) 590 END SELECT 591 ! 592 ! ! runoffs and calving (added in emp) 593 IF( srcv(jpr_rnf)%laction ) emp(:,:) = emp(:,:) - frcv(:,:,jpr_rnf) 594 IF( srcv(jpr_cal)%laction ) emp(:,:) = emp(:,:) - ABS( frcv(:,:,jpr_cal) ) 595 ! 596 !!gm : this seems to be internal cooking, not sure to need that in a generic interface 597 !!gm at least should be optional... 598 !! IF( TRIM( cn_rcv_rnf ) == 'coupled' ) THEN ! add to the total freshwater budget 599 !! ! remove negative runoff 600 !! zcumulpos = SUM( MAX( frcv(:,:,jpr_rnf), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) ) 601 !! zcumulneg = SUM( MIN( frcv(:,:,jpr_rnf), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) ) 602 !! IF( lk_mpp ) CALL mpp_sum( zcumulpos ) ! sum over the global domain 603 !! IF( lk_mpp ) CALL mpp_sum( zcumulneg ) 604 !! IF( zcumulpos /= 0. ) THEN ! distribute negative runoff on positive runoff grid points 605 !! zcumulneg = 1.e0 + zcumulneg / zcumulpos 606 !! frcv(:,:,jpr_rnf) = MAX( frcv(:,:,jpr_rnf), 0.e0 ) * zcumulneg 607 !! ENDIF 608 !! ! add runoff to e-p 609 !! emp(:,:) = emp(:,:) - frcv(:,:,jpr_rnf) 610 !! ENDIF 611 !!gm end of internal cooking 612 ! 613 emps(:,:) = emp(:,:) ! concentration/dilution = emp 614 615 ! ! 10 m wind speed 616 IF( srcv(jpr_w10m)%laction ) wind10m(:,:) = frcv(:,:,jpr_w10m) 617 !!gm ---> blinder dans tke si cn_rcv_w10m == 'none' 618 ! 345 619 ENDIF 346 347 CALL lbc_lnk( qsr_oce , 'T', 1. ) 348 CALL lbc_lnk( qsr_ice , 'T', 1. ) 349 CALL lbc_lnk( qns_oce , 'T', 1. ) 350 CALL lbc_lnk( qns_ice , 'T', 1. ) 351 CALL lbc_lnk( tprecip , 'T', 1. ) 352 CALL lbc_lnk( sprecip , 'T', 1. ) 353 CALL lbc_lnk( rrunoff , 'T', 1. ) 354 CALL lbc_lnk( dqns_ice, 'T', 1. ) 355 CALL lbc_lnk( calving , 'T', 1. ) 356 CALL lbc_lnk( fr1_i0 , 'T', 1. ) 357 CALL lbc_lnk( fr2_i0 , 'T', 1. ) 358 359 IF(ln_ctl) THEN 360 WRITE(numout,*) 'flx(af lbc_lnk):qsr_oce - Minimum value is ', MINVAL( qsr_oce ) 361 WRITE(numout,*) 'flx(af lbc_lnk):qsr_oce - Maximum value is ', MAXVAL( qsr_oce ) 362 WRITE(numout,*) 'flx(af lbc_lnk):qsr_oce - Sum value is ', SUM ( qsr_oce ) 363 ! 364 WRITE(numout,*) 'flx(af lbc_lnk):tprecip - Minimum value is ', MINVAL( tprecip ) 365 WRITE(numout,*) 'flx(af lbc_lnk):tprecip - Maximum value is ', MAXVAL( tprecip ) 366 WRITE(numout,*) 'flx(af lbc_lnk):tprecip - Sum value is ', SUM ( tprecip ) 620 ! 621 END SUBROUTINE sbc_cpl_rcv 622 623 624 SUBROUTINE sbc_cpl_ice_tau( p_taui, p_tauj ) 625 !!---------------------------------------------------------------------- 626 !! *** ROUTINE sbc_cpl_ice_tau *** 627 !! 628 !! ** Purpose : provide the stress over sea-ice in coupled mode 629 !! 630 !! ** Method : transform the received stress from the atmosphere into 631 !! an atmosphere-ice stress in the (i,j) ocean referencial 632 !! and at the velocity point of the sea-ice model (cice_grid): 633 !! 'C'-grid : i- (j-) components given at U- (V-) point 634 !! 'B'-grid : both components given at I-point 635 !! 636 !! The received stress are : 637 !! - defined by 3 components (if cartesian coordinate) 638 !! or by 2 components (if spherical) 639 !! - oriented along geographical coordinate (if eastward-northward) 640 !! or along the local grid coordinate (if local grid) 641 !! - given at U- and V-point, resp. if received on 2 grids 642 !! or at a same point (T or I) if received on 1 grid 643 !! Therefore and if necessary, they are successively 644 !! processed in order to obtain them 645 !! first as 2 components on the sphere 646 !! second as 2 components oriented along the local grid 647 !! third as 2 components on the cice_grid point 648 !! 649 !! In 'oce and ice' case, only one vector stress field 650 !! is received. It has already been processed in sbc_cpl_rcv 651 !! so that it is now defined as (i,j) components given at U- 652 !! and V-points, respectively. Therefore, here only the third 653 !! transformation is done and only if the ice-grid is a 'B'-grid. 654 !! 655 !! ** Action : return ptau_i, ptau_j, the stress over the ice at cice_grid point 656 !!---------------------------------------------------------------------- 657 REAL(wp), INTENT(out), DIMENSION(jpi,jpj) :: p_taui ! i- & j-components of atmos-ice stress [N/m2] 658 REAL(wp), INTENT(out), DIMENSION(jpi,jpj) :: p_tauj ! at I-point (B-grid) or U & V-point (C-grid) 659 !! 660 INTEGER :: ji, jj ! dummy loop indices 661 INTEGER :: itx ! index of taux over ice 662 REAL(wp), DIMENSION(jpi,jpj) :: ztx, ztx ! 2D workspace 663 !!---------------------------------------------------------------------- 664 665 IF( srcv(jpr_itx1)%laction ) THEN ; itx = jpr_itx1 666 ELSE ; itx = jpr_otx1 367 667 ENDIF 368 ! 369 END SUBROUTINE sbc_cpl 370 668 669 ! do something only if we just received the stress from atmosphere 670 IF( nrcvinfo(itx) == PRISM_Recvd .OR. nrcvinfo(itx) == PRISM_FromRest .OR. & 671 & nrcvinfo(itx) == PRISM_RecvOut .OR. nrcvinfo(itx) == PRISM_FromRestOut ) THEN 672 673 ! ! ======================= ! 674 IF( srcv(jpr_itx1)%laction ) THEN ! ice stress received ! 675 ! ! ======================= ! 676 ! 677 IF( TRIM( cn_rcv_tau(2) ) == 'cartesian' ) THEN ! 2 components on the sphere 678 ! ! (cartesian to spherical -> 3 to 2 components) 679 CALL geo2oce( frcv(:,:,jpr_itx1), frcv(:,:,jpr_ity1), frcv(:,:,jpr_itz1), & 680 & srcv(jpr_itx1)%clgrid, ztx, zty ) 681 frcv(:,:,jpr_itx1) = ztx(:,:) ! overwrite 1st comp. on the 1st grid 682 frcv(:,:,jpr_itx1) = zty(:,:) ! overwrite 2nd comp. on the 1st grid 683 ! 684 IF( srcv(jpr_itx2)%laction ) THEN 685 CALL geo2oce( frcv(:,:,jpr_itx2), frcv(:,:,jpr_ity2), frcv(:,:,jpr_itz2), & 686 & srcv(jpr_itx2)%clgrid, ztx, zty ) 687 frcv(:,:,jpr_itx2) = ztx(:,:) ! overwrite 1st comp. on the 2nd grid 688 frcv(:,:,jpr_ity2) = zty(:,:) ! overwrite 2nd comp. on the 2nd grid 689 ENDIF 690 ! 691 ENDIF 692 ! 693 IF( TRIM( cn_rcv_tau(3) ) == 'eastward-northward' ) THEN ! 2 components oriented along the local grid 694 ! ! (geographical to local grid -> rotate the components) 695 CALL rot_rep( frcv(:,:,jpr_itx1), frcv(:,:,jpr_ity1), srcv(jpr_itx1)%clgrid, 'en->i', ztx ) 696 frcv(:,:,jpr_itx1) = ztx(:,:) ! overwrite 1st component on the 1st grid 697 IF( srcv(jpr_itx2)%laction ) THEN 698 CALL rot_rep( frcv(:,:,jpr_itx2), frcv(:,:,jpr_ity2), srcv(jpr_itx2)%clgrid, 'en->j', zty ) 699 ELSE 700 CALL rot_rep( frcv(:,:,jpr_itx1), frcv(:,:,jpr_ity1), srcv(jpr_itx1)%clgrid, 'en->j', zty ) 701 ENDIF 702 frcv(:,:,jpr_ity1) = zty(:,:) ! overwrite 2nd component on the 1st grid 703 ENDIF 704 ! ! ======================= ! 705 ELSE ! use ocean stress ! 706 ! ! ======================= ! 707 frcv(:,:,jpr_itx1) = frcv(:,:,jpr_otx1) 708 frcv(:,:,jpr_ity1) = frcv(:,:,jpr_oty1) 709 ! 710 ENDIF 711 712 ! ! ======================= ! 713 ! ! put on ice grid ! 714 ! ! ======================= ! 715 ! 716 ! j+1 j -----V---F 717 ! ice stress on ice velocity point (cice_grid) ! | 718 ! (C-grid ==>(U,V) or B-grid ==> I) j | T U 719 ! | | 720 ! j j-1 -I-------| 721 ! (for I) | | 722 ! i-1 i i 723 ! i i+1 (for I) 724 SELECT CASE ( cice_grid ) 725 ! 726 CASE( 'B' ) ! B-grid ==> I 727 SELECT CASE ( srcv(jpr_itx1)%clgrid ) 728 CASE( 'U' ) 729 DO jj = 2, jpjm1 ! (U,V) ==> I 730 DO ji = fs_2, fs_jpim1 ! vector opt. 731 p_taui(ji,jj) = 0.5 * ( frcv(ji-1,jj ,jpr_itx1) + frcv(ji-1,jj-1,jpr_itx1) ) 732 p_tauj(ji,jj) = 0.5 * ( frcv(ji ,jj-1,jpr_ity1) + frcv(ji-1,jj-1,jpr_ity1) ) 733 END DO 734 END DO 735 CASE( 'F' ) 736 DO jj = 2, jpjm1 ! F ==> I 737 DO ji = fs_2, fs_jpim1 ! vector opt. 738 p_taui(ji,jj) = frcv(ji-1,jj-1,jpr_itx1) 739 p_tauj(ji,jj) = frcv(ji-1,jj-1,jpr_ity1) 740 END DO 741 END DO 742 CASE( 'T' ) 743 DO jj = 2, jpjm1 ! T ==> I 744 DO ji = fs_2, fs_jpim1 ! vector opt. 745 p_taui(ji,jj) = 0.25 * ( frcv(ji,jj ,jpr_itx1) + frcv(ji-1,jj ,jpr_itx1) & 746 & + frcv(ji,jj-1,jpr_itx1) + frcv(ji-1,jj-1,jpr_itx1) ) 747 p_tauj(ji,jj) = 0.25 * ( frcv(ji,jj ,jpr_ity1) + frcv(ji-1,jj ,jpr_ity1) & 748 & + frcv(ji,jj-1,jpr_ity1) + frcv(ji-1,jj-1,jpr_ity1) ) 749 END DO 750 END DO 751 CASE( 'I' ) 752 p_taui(:,:) = frcv(:,:,jpr_itx1) ! I ==> I 753 p_tauj(:,:) = frcv(:,:,jpr_ity1) 754 END SELECT 755 IF( srcv(jpr_itx1)%clgrid /= 'I' ) THEN 756 CALL lbc_lnk( p_taui, 'I', -1. ) ; CALL lbc_lnk( p_tauj, 'I', -1. ) 757 ENDIF 758 ! 759 CASE( 'C' ) ! C-grid ==> U,V 760 SELECT CASE ( srcv(jpr_itx1)%clgrid ) 761 CASE( 'U' ) 762 p_taui(:,:) = frcv(:,:,jpr_itx1) ! (U,V) ==> (U,V) 763 p_tauj(:,:) = frcv(:,:,jpr_ity1) 764 CASE( 'F' ) 765 DO jj = 2, jpjm1 ! F ==> (U,V) 766 DO ji = fs_2, fs_jpim1 ! vector opt. 767 p_taui(ji,jj) = 0.5 * ( frcv(ji,jj,jpr_itx1) + frcv(ji ,jj-1,jpr_itx1) ) 768 p_tauj(ji,jj) = 0.5 * ( frcv(ji,jj,jpr_ity1) + frcv(ji-1,jj ,jpr_ity1) ) 769 END DO 770 END DO 771 CASE( 'T' ) 772 DO jj = 2, jpjm1 ! T ==> (U,V) 773 DO ji = fs_2, fs_jpim1 ! vector opt. 774 p_taui(ji,jj) = 0.5 * ( frcv(ji+1,jj ,jpr_itx1) + frcv(ji,jj,jpr_itx1) ) 775 p_tauj(ji,jj) = 0.5 * ( frcv(ji ,jj+1,jpr_ity1) + frcv(ji,jj,jpr_ity1) ) 776 END DO 777 END DO 778 CASE( 'I' ) 779 DO jj = 2, jpjm1 ! I ==> (U,V) 780 DO ji = fs_2, fs_jpim1 ! vector opt. 781 p_taui(ji,jj) = 0.5 * ( frcv(ji+1,jj+1,jpr_itx1) + frcv(ji+1,jj ,jpr_itx1) ) 782 p_tauj(ji,jj) = 0.5 * ( frcv(ji+1,jj+1,jpr_ity1) + frcv(ji ,jj+1,jpr_ity1) ) 783 END DO 784 END DO 785 END SELECT 786 IF( srcv(jpr_itx1)%clgrid /= 'U' ) THEN 787 CALL lbc_lnk( p_taui, 'U', -1. ) ; CALL lbc_lnk( p_tauj, 'V', -1. ) 788 ENDIF 789 END SELECT 790 791 !!gm Should be useless as sbc_cpl_ice_tau only called at coupled frequency 792 ! The receive stress are transformed such that in all case frcv(:,:,jpr_itx1), frcv(:,:,jpr_ity1) 793 ! become the i-component and j-component of the stress at the right grid point 794 !!gm frcv(:,:,jpr_itx1) = p_taui(:,:) 795 !!gm frcv(:,:,jpr_ity1) = p_tauj(:,:) 796 !!gm 797 ENDIF 798 ! 799 END SUBROUTINE sbc_cpl_ice_tau 800 801 802 SUBROUTINE sbc_cpl_ice_flx( p_frld, palbi , psst , pist, & 803 & pqns_tot, pqns_ice, & 804 & pqsr_tot, pqsr_ice, & 805 & pemp_tot, pemp_ice, psprecip ) 806 !!---------------------------------------------------------------------- 807 !! *** ROUTINE sbc_cpl_ice_flx_rcv *** 808 !! 809 !! ** Purpose : provide the heat and freshwater fluxes of the 810 !! ocean-ice system. 811 !! 812 !! ** Method : transform the fields received from the atmosphere into 813 !! surface heat and fresh water boundary condition for the 814 !! ice-ocean system. The following fields are provided: 815 !! * total non solar, solar and freshwater fluxes (qns_tot, 816 !! qsr_tot and emp_tot) (total means weighted ice-ocean flux) 817 !! NB: emp_tot include runoffs and calving. 818 !! * fluxes over ice (qns_ice, qsr_ice, emp_ice) where 819 !! emp_ice = sublimation - solid precipitation as liquid 820 !! precipitation are re-routed directly to the ocean and 821 !! runoffs and calving directly enter the ocean. 822 !! * solid precipitation (sprecip), used to add to qns_tot 823 !! the heat lost associated to melting solid precipitation 824 !! over the ocean fraction. 825 !! ===>> CAUTION here this changes the net heat flux received from 826 !! the atmosphere 827 !! * 10m wind module (wind10m) 828 !! 829 !! N.B. - fields over sea-ice are passed in argument so that 830 !! the module can be compile without sea-ice. 831 !! - the fluxes have been separated from the stress as 832 !! (a) they are updated at each ice time step compare to 833 !! an update at each coupled time step for the stress, and 834 !! (b) the conservative computation of the fluxes over the 835 !! sea-ice area requires the knowledge of the ice fraction 836 !! after the ice advection and before the ice thermodynamics, 837 !! so that the stress is updated before the ice dynamics 838 !! while the fluxes are updated after it. 839 !! 840 !! ** Action : update at each nf_ice time step: 841 !! pqns_tot, pqsr_tot non-solar and solar total heat fluxes 842 !! pqns_ice, pqsr_ice non-solar and solar heat fluxes over the ice 843 !! pemp_tot total evaporation - precipitation(liquid and solid) (-runoff)(-calving) 844 !! pemp_ice ice sublimation - solid precipitation over the ice 845 !! sprecip solid precipitation over the ocean 846 !! wind10m 10m wind module 847 !!---------------------------------------------------------------------- 848 REAL(wp), INTENT(in ), DIMENSION(jpi,jpj) :: p_frld ! lead fraction [0 to 1] 849 REAL(wp), INTENT(in ), DIMENSION(jpi,jpj) :: palbi ! ice albedo 850 REAL(wp), INTENT(in ), DIMENSION(jpi,jpj) :: psst ! sea surface temperature [Celcius] 851 REAL(wp), INTENT(in ), DIMENSION(jpi,jpj) :: pist ! ice surface temperature [Celcius] 852 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: pqns_tot ! total non solar heat flux [W/m2] 853 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: pqns_ice ! ice non solar heat flux [W/m2] 854 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: pqsr_tot ! total solar heat flux [W/m2] 855 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: pqsr_ice ! ice solar heat flux [W/m2] 856 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: pemp_tot ! total freshwater budget [Kg/m2/s] 857 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: pemp_ice ! ice solid freshwater budget [Kg/m2/s] 858 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: psprecip ! solid precipitation [Kg/m2/s] 859 !! 860 INTEGER :: ji, jj ! dummy loop indices 861 INTEGER :: isec, info ! temporary integer 862 REAL(wp):: zcoef, ztsurf ! temporary scalar 863 REAL(wp), DIMENSION(jpi,jpj) :: ztx, ztx ! 2D workspace 864 !!---------------------------------------------------------------------- 865 ! 866 ! ! ========================= ! 867 ! ! freshwater budget ! (emp) 868 ! ! ========================= ! 869 ! 870 ! ! total Precipitations - total Evaporation (emp_tot) 871 ! ! solid precipitation - sublimation (emp_ice) 872 ! ! solid Precipitation (sprecip) 873 SELECT CASE( TRIM( cn_rcv_emp ) ) 874 CASE( 'conservative' ) ! received fields: jpr_rain, jpr_snow, jpr_ievp, jpr_tevp 875 pemp_tot(:,:) = frcv(:,:,jpr_tevp) - frcv(:,:,jpr_rain) - frcv(:,:,jpr_snow) 876 pemp_ice(:,:) = frcv(:,:,jpr_ievp) - frcv(:,:,jpr_snow) 877 psprecip(:,:) = frcv(:,:,jpr_snow) 878 CASE( 'oce and ice' ) ! received fields: jpr_prsb, jpr_semp, jpr_oemp 879 pemp_tot(:,:) = p_frld(:,:) * frcv(:,:,jpr_oemp) + (1.- p_frld(:,:)) * frcv(:,:,jpr_semp) !!sm: rain over ice is missing?? 880 pemp_ice(:,:) = frcv(:,:,jpr_semp) 881 psprecip(:,:) = frcv(:,:,jpr_semp) !!gm here error due to sublimation 882 CASE( 'mixed oce-ice' ) ! received fields: jpr_rain, jpr_semp, jpr_tevp 883 pemp_tot(:,:) = frcv(:,:,jpr_tevp) - frcv(:,:,jpr_rain) + frcv(:,:,jpr_semp) !!gm here sublimation error ??? 884 pemp_ice(:,:) = frcv(:,:,jpr_semp) 885 psprecip(:,:) = frcv(:,:,jpr_semp) !!gm here error due to sublimation 886 END SELECT 887 ! 888 889 ! ! runoffs and calving (put in emp_tot) 890 IF( srcv(jpr_rnf)%laction ) pemp_tot(:,:) = pemp_tot(:,:) - frcv(:,:,jpr_rnf) 891 IF( srcv(jpr_cal)%laction ) pemp_tot(:,:) = pemp_tot(:,:) - ABS( frcv(:,:,jpr_cal) ) 892 ! 893 !!gm : this seems to be internal cooking, not sure to need that in a generic interface 894 !!gm at least should be optional... 895 !! ! remove negative runoff ! sum over the global domain 896 !! zcumulpos = SUM( MAX( frcv(:,:,jpr_rnf), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) ) 897 !! zcumulneg = SUM( MIN( frcv(:,:,jpr_rnf), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) ) 898 !! IF( lk_mpp ) CALL mpp_sum( zcumulpos ) 899 !! IF( lk_mpp ) CALL mpp_sum( zcumulneg ) 900 !! IF( zcumulpos /= 0. ) THEN ! distribute negative runoff on positive runoff grid points 901 !! zcumulneg = 1.e0 + zcumulneg / zcumulpos 902 !! frcv(:,:,jpr_rnf) = MAX( frcv(:,:,jpr_rnf), 0.e0 ) * zcumulneg 903 !! ENDIF 904 !! pemp_tot(:,:) = pemp_tot(:,:) - frcv(:,:,jpr_rnf) ! add runoff to e-p 905 !! 906 !!gm end of internal cooking 907 908 909 ! ! ========================= ! 910 SELECT CASE( TRIM( cn_rcv_qns ) ) ! non solar heat fluxes ! (qns) 911 ! ! ========================= ! 912 CASE( 'conservative' ) ! the required fields are directly provided 913 pqns_tot(:,:) = frcv(:,:,jpr_qnsmix) 914 pqns_ice(:,:) = frcv(:,:,jpr_qnsice) 915 CASE( 'oce and ice' ) ! the total flux is computed from ocean and ice fluxes 916 pqns_tot(:,:) = p_frld(:,:) * frcv(:,:,jpr_qnsoce) + ( 1.- p_frld(:,:) ) * frcv(:,:,jpr_qnsice) 917 pqns_ice(:,:) = frcv(:,:,jpr_qnsice) 918 CASE( 'mixed oce-ice' ) ! the ice flux is cumputed from the total flux, the SST and ice informations 919 pqns_tot(:,:) = frcv(:,:,jpr_qnsmix) 920 pqns_ice(:,:) = frcv(:,:,jpr_qnsmix) & 921 & + frcv(:,:,jpr_dqnsdt) * ( pist(:,:) - psst(:,:) ) * ( 1. - p_frld(:,:) ) 922 END SELECT 923 ! ! snow melting heat flux .... 924 ! energy for melting solid precipitation over free ocean 925 zcoef = xlsn / rhosn 926 pqns_tot(:,:) = pqns_tot(:,:) - p_frld(:,:) * psprecip(:,:) * zcoef 927 !!gm 928 !! currently it is taken into account in leads budget but not in the qns_tot, and thus not in 929 !! the flux that enter the ocean.... 930 !! moreover 1 - it is not diagnose anywhere.... 931 !! 2 - it is unclear for me whether this heat lost is taken into account in the atmosphere or not... 932 !! 933 !! similar job should be done for snow and precipitation temperature 934 935 ! ! ========================= ! 936 SELECT CASE( TRIM( cn_rcv_qsr ) ) ! solar heat fluxes ! (qsr) 937 ! ! ========================= ! 938 CASE( 'conservative' ) 939 pqsr_tot(:,:) = frcv(:,:,jpr_qsrmix) 940 pqsr_ice(:,:) = frcv(:,:,jpr_qsrice) 941 CASE( 'oce and ice' ) 942 pqsr_tot(:,:) = p_frld(:,:) * frcv(:,:,jpr_qsroce) + ( 1.- p_frld(:,:) ) * frcv(:,:,jpr_qsrice) 943 pqsr_ice(:,:) = frcv(:,:,jpr_qsrice) 944 CASE( 'mixed oce-ice' ) 945 pqsr_tot(:,:) = frcv(:,:,jpr_qsrmix) 946 !!gm cpl_albedo ???? kezako ????? je pige pas grand chose ici.... 947 pqsr_ice(:,:) = qsr_mix(:,:) * ( 1.- palbi(:,:) ) & 948 & / ( 1.- ( cpl_ocean_albedo(ji,jj) * ( 1.- p_frld(ji,jj) ) & 949 & + palbi (ji,jj) * p_frld(ji,jj) ) ) 950 END SELECT 951 952 953 ! ! ========================= ! 954 ! ! 10 m wind speed ! (wind10m) 955 ! ! ========================= ! 956 ! 957 IF( srcv(jpr_w10m )%laction ) wind10m(:,:) = frcv(:,:,jpr_w10m) 958 !!gm ---> blinder dans tke si cn_rcv_w10m == 'none' 959 ! 960 END SUBROUTINE sbc_cpl_ice_flx_rcv 961 962 963 SUBROUTINE sbc_cpl_snd( kt ) 964 !!---------------------------------------------------------------------- 965 !! *** ROUTINE sbc_cpl_snd *** 966 !! 967 !! ** Purpose : provide the ocean-ice informations to the atmosphere 968 !! 969 !! ** Method : send to the atmosphere through a call to cpl_prism_snd 970 !! all the needed fields (as defined in sbc_cpl_init) 971 !!---------------------------------------------------------------------- 972 INTEGER, INTENT(in) :: kt 973 !! 974 INTEGER :: ji, jj ! dummy loop indices 975 INTEGER :: isec, info ! temporary integer 976 REAL(wp), DIMENSION(jpi,jpj) :: zfr_l ! 1. - fr_i(:,:) 977 REAL(wp), DIMENSION(jpi,jpj) :: ztmp1, ztmp2 978 REAL(wp), DIMENSION(jpi,jpj) :: zotx1 , zoty1 , zotz1, zitx1, zity1, zitz1 979 !!---------------------------------------------------------------------- 980 981 isec = ( kt - nit000 ) * NINT(rdttra(1)) ! date of exchanges 982 983 zfr_l(:,:) = 1.- fr_i(:,:) 984 985 ! ! ------------------------- ! 986 ! ! Surface temperature ! in Kelvin 987 ! ! ------------------------- ! 988 SELECT CASE( cn_snd_temperature) 989 CASE( 'oce only' ) ; ztmp1(:,:) = tn(:,:,1) + rt0 990 CASE( 'weighted oce and ice' ) ; ztmp1(:,:) = ( tn(:,:,1) + rt0 ) * zfr_l(:,:) 991 ztmp2(:,:) = tn_ice(:,:) * fr_i(:,:) 992 CASE( 'mixed oce-ice' ) ; ztmp1(:,:) = ( tn(:,:,1) + rt0 ) * zfr_l(:,:) + tn_ice(:,:) * fr_i(:,:) 993 END SELECT 994 IF( ssnd(jps_toce)%laction ) CALL cpl_prism_snd( jps_toce, isec, ztmp1, info ) 995 IF( ssnd(jps_tice)%laction ) CALL cpl_prism_snd( jps_tice, isec, ztmp2, info ) 996 IF( ssnd(jps_tmix)%laction ) CALL cpl_prism_snd( jps_tmix, isec, ztmp1, info ) 997 ! 998 ! ! ------------------------- ! 999 ! ! Albedo ! 1000 ! ! ------------------------- ! 1001 IF( ssnd(jps_albice)%laction ) THEN ! ice 1002 ztmp(:,:) = alb_ice(:,:) * fr_i(:,:) 1003 CALL cpl_prism_snd( jps_albice, isec, ztmp, info ) 1004 ENDIF 1005 IF( ssnd(jps_albmix)%laction ) THEN ! mixed ice-ocean 1006 ztmp(:,:) = albedo_oce_mix(:,:) * zfr_l(:,:) + alb_ice(:,:) * fr_i(:,:) 1007 CALL cpl_prism_snd( jps_albmix, isec, ztmp, info ) 1008 ENDIF 1009 ! ! ------------------------- ! 1010 ! ! Ice fraction & Thickness ! 1011 ! ! ------------------------- ! 1012 IF( ssnd(jps_fice)%laction ) CALL cpl_prism_snd( jps_fice, isec, fr_i , info ) 1013 IF( ssnd(jps_hice)%laction ) CALL cpl_prism_snd( jps_hice, isec, hice(:,:) * fr_i(:,:), info ) 1014 IF( ssnd(jps_hsnw)%laction ) CALL cpl_prism_snd( jps_hsnw, isec, hsnw(:,:) * fr_i(:,:), info ) 1015 ! 1016 ! ! ------------------------- ! 1017 IF( ssnd(jps_ocx1)%laction ) THEN ! Surface current ! 1018 ! ! ------------------------- ! 1019 SELECT CASE( TRIM( cn_snd_crt(1) ) ) 1020 CASE( 'oce only' ) 1021 DO jj = 2, jpjm1 1022 DO ji = fs_2, fs_jpim1 ! vector opt. 1023 zotx1(ji,jj) = 0.5 * ( un(ji,jj,1) + un(ji-1,jj ,1) ) 1024 zoty1(ji,jj) = 0.5 * ( vn(ji,jj,1) + un(ji ,jj-1,1) ) 1025 END DO 1026 END DO 1027 CASE( 'weighted oce and ice' ) 1028 IF( cice_grid = 'C' ) THEN ! 'C'-grid ice velocity 1029 DO jj = 2, jpjm1 1030 DO ji = fs_2, fs_jpim1 ! vector opt. 1031 zotx1(ji,jj) = 0.5 * ( un (ji,jj,1) + un (ji-1,jj ,1) ) * zfr_l(:,:) 1032 zoty1(ji,jj) = 0.5 * ( vn (ji,jj,1) + un (ji ,jj-1,1) ) * zfr_l(:,:) 1033 zitx1(ji,jj) = 0.5 * ( utaui_ice(ji,jj) + utaui_ice(ji-1,jj ) ) * fr_i(:,:) 1034 zity1(ji,jj) = 0.5 * ( vtaui_ice(ji,jj) + vtaui_ice(ji ,jj-1) ) * fr_i(:,:) 1035 END DO 1036 END DO 1037 ELSE ! 'B'-grid ice velocity 1038 DO jj = 2, jpjm1 1039 DO ji = fs_2, fs_jpim1 ! vector opt. 1040 zotx1(ji,jj) = 0.5 * ( un(ji,jj,1) + un(ji-1,jj-1,1) ) * zfr_l(:,:) 1041 zoty1(ji,jj) = 0.5 * ( vn(ji,jj,1) + un(ji ,jj-1,1) ) * zfr_l(:,:) 1042 zitx1(ji,jj) = 0.25 * ( utaui_ice(ji+1,jj+1) + utaui_ice(ji,jj+1) & 1043 & + utaui_ice(ji+1,jj ) + utaui_ice(ji,jj ) ) * fr_i(:,:) 1044 zity1(ji,jj) = 0.25 * ( vtaui_ice(ji+1,jj+1) + vtaui_ice(ji,jj+1) & 1045 & + vtaui_ice(ji+1,jj ) + vtaui_ice(ji,jj ) ) * fr_i(:,:) 1046 END DO 1047 END DO 1048 ENDIF 1049 CALL lbc_lnk( zitx1, 'T', -1. ) ; CALL lbc_lnk( zity1, 'T', -1. ) 1050 CASE( 'mixed oce-ice' ) 1051 IF( cice_grid = 'C' ) THEN ! 'C'-grid ice velocity 1052 DO jj = 2, jpjm1 1053 DO ji = fs_2, fs_jpim1 ! vector opt. 1054 zotx1(ji,jj) = 0.5 * ( un (ji,jj,1) + un (ji-1,jj ,1) ) * zfr_l(:,:) 1055 & + 0.5 * ( utaui_ice(ji,jj) + utaui_ice(ji-1,jj ) ) * fr_i(:,:) 1056 zoty1(ji,jj) = 0.5 * ( vn (ji,jj,1) + un (ji ,jj-1,1) ) * zfr_l(:,:) 1057 & + 0.5 * ( vtaui_ice(ji,jj) + vtaui_ice(ji ,jj-1) ) * fr_i(:,:) 1058 END DO 1059 END DO 1060 ELSE ! 'B'-grid ice velocity 1061 DO jj = 2, jpjm1 1062 DO ji = fs_2, fs_jpim1 ! vector opt. 1063 zotx1(ji,jj) = 0.5 * ( un(ji,jj,1) + un(ji-1,jj-1,1) ) * zfr_l(:,:) 1064 & + 0.25 * ( utaui_ice(ji+1,jj+1) + utaui_ice(ji,jj+1) & 1065 & + utaui_ice(ji+1,jj ) + utaui_ice(ji,jj ) ) * fr_i(:,:) 1066 zoty1(ji,jj) = 0.5 * ( vn(ji,jj,1) + un(ji ,jj-1,1) ) * zfr_l(:,:) 1067 & + 0.25 * ( vtaui_ice(ji+1,jj+1) + vtaui_ice(ji,jj+1) & 1068 & + vtaui_ice(ji+1,jj ) + vtaui_ice(ji,jj ) ) * fr_i(:,:) 1069 END DO 1070 END DO 1071 ENDIF 1072 END SELECT 1073 CALL lbc_lnk( zotx1, 'T', -1. ) ; CALL lbc_lnk( zoty1, 'T', -1. ) 1074 ! 1075 ! 1076 IF( TRIM( cn_snd_crt(3) ) == 'eastward-northward' ) THEN ! Rotation of the components 1077 ! ! Ocean component 1078 CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->e', ztmp1 ) ! 1st component 1079 CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->n', ztmp2 ) ! 2nd component 1080 zotx1(:,:) = ztmp1(:,:) ! overwrite the components 1081 zoty1(:,:) = ztmp2(:,:) 1082 IF( ssnd(jps_ivx1)%laction ) THEN ! Ice component 1083 CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->e', ztmp1 ) ! 1st component 1084 CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->n', ztmp2 ) ! 2nd component 1085 zitx1(:,:) = ztmp1(:,:) ! overwrite the components 1086 zity1(:,:) = ztmp2(:,:) 1087 ENDIF 1088 ENDIF 1089 ! 1090 !!gm Eric : Arnaud, je te laisse coder oce2geo ! 1091 ! spherical coordinates to cartesian -> 2 components to 3 components 1092 IF( TRIM( cn_snd_crt(2) ) == 'cartesian' ) THEN 1093 ztmp1(:,:) = zotx1(:,:) ! ocean currents 1094 ztmp2(:,:) = zoty1(:,:) 1095 CALL oce2geo ( ztmp1, ztmp2, 't', glamt, gphit, zotx1, zoty1, zotz1 ) 1096 ! 1097 IF( ssnd(jps_ivx1)%laction ) THEN ! ice velocities 1098 ztmp1(:,:) = zitx1(:,:) 1099 ztmp1(:,:) = zity1(:,:) 1100 CALL oce2geo ( ztmp1, ztmp2, 't', glamt, gphit, zitx1, zity1, zitz1 ) 1101 ENDIF 1102 ENDIF 1103 ! 1104 IF( ssnd(jps_ocx1)%laction ) CALL cpl_prism_snd( jps_ocx1, isec, zotx1, info ) ! ocean x current 1st grid 1105 IF( ssnd(jps_ocy1)%laction ) CALL cpl_prism_snd( jps_ocy1, isec, zoty1, info ) ! ocean y current 1st grid 1106 IF( ssnd(jps_ocz1)%laction ) CALL cpl_prism_snd( jps_ocz1, isec, zotz1, info ) ! ocean z current 1st grid 1107 ! 1108 IF( ssnd(jps_ivx1)%laction ) CALL cpl_prism_snd( jps_ivx1, isec, zitx1, info ) ! ice x current 1st grid 1109 IF( ssnd(jps_ivy1)%laction ) CALL cpl_prism_snd( jps_ivy1, isec, zity1, info ) ! ice y current 1st grid 1110 IF( ssnd(jps_ivz1)%laction ) CALL cpl_prism_snd( jps_ivz1, isec, zitz1, info ) ! ice z current 1st grid 1111 ! 1112 ENDIF 1113 ! 1114 END SUBROUTINE sbc_cpl_snd 1115 371 1116 #else 372 1117 !!---------------------------------------------------------------------- 373 !! Dummy routine NO sea surface restoring1118 !! Dummy module NO coupling 374 1119 !!---------------------------------------------------------------------- 375 LOGICAL, PUBLIC :: lk_sbc_cpl = .FALSE. !: coupled formulation flag1120 USE par_kind ! kind definition 376 1121 CONTAINS 377 SUBROUTINE sbc_cpl( kt ) ! Dummy routine 378 WRITE(*,*) 'sbc_cpl: you should not have seen that print! error?', kt 379 END SUBROUTINE sbc_cpl 1122 SUBROUTINE sbc_cpl_snd( kt ) 1123 WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', kt 1124 END SUBROUTINE sbc_cpl_snd 1125 ! 1126 SUBROUTINE sbc_cpl_rcv( kt, k_fsbc, k_ice ) 1127 WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', kt, k_fsbc, k_ice 1128 END SUBROUTINE sbc_cpl_rcv 1129 ! 1130 SUBROUTINE sbc_cpl_ice_tau( p_taui, p_tauj ) 1131 REAL(wp), INTENT(out), DIMENSION(:,:) :: p_taui ! i- & j-components of atmos-ice stress [N/m2] 1132 REAL(wp), INTENT(out), DIMENSION(:,:) :: p_tauj ! at I-point (B-grid) or U & V-point (C-grid) 1133 p_taui(:,:) = 0. ; p_tauj(:,:) = 0. ! stupid definition to avoid warning message when compiling... 1134 WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?' 1135 END SUBROUTINE sbc_cpl_ice_tau 1136 ! 1137 SUBROUTINE sbc_cpl_ice_flx( p_frld, palbi , psst , pist, & 1138 & pqns_tot, pqns_ice, & 1139 & pqsr_tot, pqsr_ice, & 1140 & pemp_tot, pemp_ice, psprecip ) 1141 REAL(wp), INTENT(in ), DIMENSION(:,:) :: p_frld ! lead fraction [0 to 1] 1142 REAL(wp), INTENT(in ), DIMENSION(:,:) :: palbi ! ice albedo 1143 REAL(wp), INTENT(in ), DIMENSION(:,:) :: psst ! sea surface temperature [Celcius] 1144 REAL(wp), INTENT(in ), DIMENSION(:,:) :: pist ! ice surface temperature [Celcius] 1145 REAL(wp), INTENT( out), DIMENSION(:,:) :: pqns_tot ! total non solar heat flux [W/m2] 1146 REAL(wp), INTENT( out), DIMENSION(:,:) :: pqns_ice ! ice non solar heat flux [W/m2] 1147 REAL(wp), INTENT( out), DIMENSION(:,:) :: pqsr_tot ! total solar heat flux [W/m2] 1148 REAL(wp), INTENT( out), DIMENSION(:,:) :: pqsr_ice ! ice solar heat flux [W/m2] 1149 REAL(wp), INTENT( out), DIMENSION(:,:) :: pemp_tot ! total freshwater budget [Kg/m2/s] 1150 REAL(wp), INTENT( out), DIMENSION(:,:) :: pemp_ice ! ice solid freshwater budget [Kg/m2/s] 1151 REAL(wp), INTENT( out), DIMENSION(:,:) :: psprecip ! solid precipitation [Kg/m2/s] 1152 WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', p_frld(1,1), palbi(1,1), psst(1,1), pist(1,1) 1153 ! stupid definition to avoid warning message when compiling... 1154 pqns_tot(:,:) = 0. ; pqns_ice(:,:) = 0. 1155 pqsr_tot(:,:) = 0. ; pqsr_ice(:,:) = 0. 1156 pemp_tot(:,:) = 0. ; pemp_ice(:,:) = 0. ; psprecip(:,:) = 0. 1157 END SUBROUTINE sbc_cpl_ice_flx 1158 380 1159 #endif 381 1160 -
trunk/NEMO/OPA_SRC/SBC/sbcfwb.F90
r1168 r1218 16 16 USE dom_oce ! ocean space and time domain 17 17 USE sbc_oce ! surface ocean boundary condition 18 USE cpl_oce ! coupled atmosphere/ocean19 18 USE phycst ! physical constants 20 19 USE sbcrnf ! ocean runoffs -
trunk/NEMO/OPA_SRC/SBC/sbcice_lim.F90
r1146 r1218 27 27 USE ice_oce ! ice variables 28 28 USE dom_ice 29 USE cpl_oce30 29 31 30 USE sbc_oce ! Surface boundary condition: ocean fields -
trunk/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90
r1146 r1218 6 6 !! Sea-Ice model : LIM 2.0 Sea ice model time-stepping 7 7 !!====================================================================== 8 !! History : 9.0 ! 06-06 (G. Madec) from icestp_2.F90 8 !! History : 1.0 ! 06-2006 (G. Madec) from icestp_2.F90 9 !! 3.0 ! 08-2008 (S. Masson, E. .... ) coupled interface 9 10 !!---------------------------------------------------------------------- 10 11 #if defined key_lim2 … … 23 24 USE ice_oce ! ice variables 24 25 USE dom_ice_2 25 USE cpl_oce26 26 27 27 USE sbc_oce ! Surface boundary condition: ocean fields … … 29 29 USE sbcblk_core ! Surface boundary condition: CORE bulk 30 30 USE sbcblk_clio ! Surface boundary condition: CLIO bulk 31 USE sbccpl ! Surface boundary condition: coupled interface 31 32 USE albedo 32 33 … … 66 67 CONTAINS 67 68 68 SUBROUTINE sbc_ice_lim_2( kt, k blk)69 SUBROUTINE sbc_ice_lim_2( kt, ksbc ) 69 70 !!--------------------------------------------------------------------- 70 71 !! *** ROUTINE sbc_ice_lim_2 *** … … 87 88 !!--------------------------------------------------------------------- 88 89 INTEGER, INTENT(in) :: kt ! ocean time step 89 INTEGER, INTENT(in) :: k blk ! type of bulk (=3 CLIO, =4 CORE)90 INTEGER, INTENT(in) :: ksbc ! type of sbc ( =3 CLIO bulk ; =4 CORE bulk ; =5 coupled ) 90 91 !! 91 92 INTEGER :: ji, jj ! dummy loop indices … … 131 132 zhsnif(:,:,1) = hsnif(:,:) 132 133 133 ! ... ice albedo 134 ! ... ice albedo (clear sky and overcast sky) 134 135 CALL albedo_ice( zsist, zhicif, zhsnif, alb_ice_cs, alb_ice_os ) 135 136 … … 147 148 ! - fr2_i0 ! 2nd fraction of qsr penetration in ice [%] 148 149 ! 149 SELECT CASE( k blk)150 SELECT CASE( ksbc ) 150 151 CASE( 3 ) ! CLIO bulk formulation 151 CALL blk_ice_clio( zsist , alb_ice_cs , alb_ice_os ,&152 & utaui_ice , vtaui_ice , zqns_ice, zqsr_ice, &153 & zqla_ice , zdqns_ice , zdqla_ice, &154 & tprecip , sprecip ,&155 & 152 CALL blk_ice_clio( zsist, alb_ice_cs, alb_ice_os , & 153 & utaui_ice , vtaui_ice , zqns_ice , zqsr_ice, & 154 & zqla_ice , zdqns_ice , zdqla_ice , & 155 & tprecip , sprecip , & 156 & fr1_i0 , fr2_i0 , cl_grid ) 156 157 157 158 CASE( 4 ) ! CORE bulk formulation 158 CALL blk_ice_core( zsist , ui_ice , vi_ice , alb_ice_cs , & 159 & utaui_ice , vtaui_ice , zqns_ice , zqsr_ice, & 160 & zqla_ice , zdqns_ice , zdqla_ice , & 161 & tprecip , sprecip , & 162 & fr1_i0 , fr2_i0 , cl_grid) 159 CALL blk_ice_core( zsist, ui_ice , vi_ice , alb_ice_cs, & 160 & utaui_ice , vtaui_ice , zqns_ice , zqsr_ice, & 161 & zqla_ice , zdqns_ice , zdqla_ice , & 162 & tprecip , sprecip , & 163 & fr1_i0 , fr2_i0 , cl_grid ) 164 CASE( 5 ) ! Coupled formulation : atmosphere-ice stress only (fluxes provided after ice dynamics) 165 CALL sbc_cpl_ice_tau( utaui_ice , vtaui_ice ) 163 166 END SELECT 164 167 … … 186 189 IF( ln_limdmp ) CALL lim_dmp_2 ( kt ) ! Ice damping 187 190 ENDIF 191 #if defined key_coupled 192 IF( ksbc == 5 ) CALL sbc_cpl_ice_flx( frld, alb_ice_cs , sst_m, sist, & 193 & qns_tot, qns_ice, & 194 & qsr_tot, qsr_ice, & 195 & emp_tot, emp_ice, sprecip ) 196 #endif 188 197 CALL lim_thd_2 ( kt ) ! Ice thermodynamics 189 198 CALL lim_sbc_2 ( kt ) ! Ice/Ocean Mass & Heat fluxes … … 202 211 !!---------------------------------------------------------------------- 203 212 CONTAINS 204 SUBROUTINE sbc_ice_lim_2 ( kt, k blk) ! Dummy routine205 WRITE(*,*) 'sbc_ice_lim_2: You should not have seen this print! error?', kt, k blk213 SUBROUTINE sbc_ice_lim_2 ( kt, ksbc ) ! Dummy routine 214 WRITE(*,*) 'sbc_ice_lim_2: You should not have seen this print! error?', kt, ksbc 206 215 END SUBROUTINE sbc_ice_lim_2 207 216 #endif -
trunk/NEMO/OPA_SRC/SBC/sbcmod.F90
r1172 r1218 4 4 !! Surface module : provide to the ocean its surface boundary condition 5 5 !!====================================================================== 6 !! History : 3.0 ! 2006-07 (G. Madec) Original code 6 !! History : 3.0 ! 07-2006 (G. Madec) Original code 7 !! - ! 08-2008 (S. Masson, E. .... ) coupled interface 7 8 !!---------------------------------------------------------------------- 8 9 … … 42 43 PUBLIC sbc ! routine called by step.F90 43 44 44 !! * namsbc namelist (public variables)45 LOGICAL , PUBLIC :: ln_ana = .FALSE. !: analytical boundary condition flag46 LOGICAL , PUBLIC :: ln_flx = .FALSE. !: flux formulation47 LOGICAL , PUBLIC :: ln_blk_clio = .FALSE. !: CLIO bulk formulation48 LOGICAL , PUBLIC :: ln_blk_core = .FALSE. !: CORE bulk formulation49 LOGICAL , PUBLIC :: ln_cpl = .FALSE. !: coupled formulation (overwritten by key_sbc_coupled )50 LOGICAL , PUBLIC :: ln_dm2dc = .FALSE. !: Daily mean to Diurnal Cycle short wave (qsr)51 LOGICAL , PUBLIC :: ln_rnf = .FALSE. !: runoffs / runoff mouths52 LOGICAL , PUBLIC :: ln_ssr = .FALSE. !: Sea Surface restoring on SST and/or SSS53 INTEGER , PUBLIC :: nn_ice = 0 !: flag on ice in the surface boundary condition (=0/1/2)54 INTEGER , PUBLIC :: nn_fwb = 0 !: type of FreshWater Budget control (=0/1/2)55 INTEGER :: nn_ico_cpl = 0 !: ice-ocean coupling indicator56 ! ! = 0 LIM-3 old case57 ! ! = 1 stresses computed using now ocean velocity58 ! ! = 2 combination of 0 and 1 cases59 60 45 INTEGER :: nsbc ! type of surface boundary condition (deduced from namsbc informations) 61 INTEGER :: nice ! type of ice in the surface boundary condition (deduced from namsbc informations)62 46 63 47 !! * Substitutions … … 94 78 ENDIF 95 79 96 REWIND 97 READ 80 REWIND( numnam ) ! Read Namelist namsbc 81 READ ( numnam, namsbc ) 98 82 99 83 ! overwrite namelist parameter using CPP key information 100 !!gm here no overwrite, test all option via namelist change: require more incore memory84 !!gm here no overwrite, test all option via namelist change: require more incore memory 101 85 !!gm IF( lk_sbc_cpl ) THEN ; ln_cpl = .TRUE. ; ELSE ; ln_cpl = .FALSE. ; ENDIF 102 86 IF( lk_lim2 ) nn_ice = 2 … … 109 93 ! Control print 110 94 IF(lwp) THEN 111 WRITE(numout,*) ' Namelist namsbc ( overwritten using CPP key defined)'95 WRITE(numout,*) ' Namelist namsbc (partly overwritten with CPP key setting)' 112 96 WRITE(numout,*) ' frequency update of sbc (and ice) nn_fsbc = ', nn_fsbc 113 97 WRITE(numout,*) ' Type of sbc : ' … … 115 99 WRITE(numout,*) ' flux formulation ln_flx = ', ln_flx 116 100 WRITE(numout,*) ' CLIO bulk formulation ln_blk_clio = ', ln_blk_clio 117 WRITE(numout,*) ' C OREbulk formulation ln_blk_core = ', ln_blk_core101 WRITE(numout,*) ' CLIO bulk formulation ln_blk_core = ', ln_blk_core 118 102 WRITE(numout,*) ' coupled formulation (T if key_sbc_cpl) ln_cpl = ', ln_cpl 119 103 WRITE(numout,*) ' Misc. options of sbc : ' … … 127 111 ENDIF 128 112 129 IF( .NOT. ln_rnf ) THEN ! no specific treatment in rivers mouths vicinity 130 ln_rnf_mouth = .false. 131 nkrnf = 0 132 rnfmsk(:,:) = 0.e0 133 rnfmsk_z(:) = 0.e0 134 ENDIF 135 IF( nn_ice == 0 ) fr_i(:,:) = 0.e0 ! no ice in the domain, ice fraction is always zero 136 137 ! Check consistancy !!gm mixture of real and integer : coding to be changed.... 138 139 IF( nn_ice == 2 ) THEN 140 IF( MOD( nitend - nit000 + 1, nn_fsbc) /= 0 ) THEN 141 WRITE(ctmp1,*) 'experiment length (', nitend - nit000 + 1, ') is NOT a multiple of nn_fsbc (', nn_fsbc, ')' 142 CALL ctl_stop( ctmp1, 'Impossible to do proper restart files' ) 143 ENDIF 144 IF( MOD( nstock, nn_fsbc) /= 0 ) THEN 145 WRITE(ctmp1,*) 'nstock (' , nstock , ') is NOT a multiple of nn_fsbc (', nn_fsbc, ')' 146 CALL ctl_stop( ctmp1, 'Impossible to do proper restart files' ) 147 ENDIF 148 ENDIF 149 150 IF( MOD( rday, nn_fsbc*rdt ) /= 0 ) CALL ctl_warn( 'nn_fsbc is NOT a multiple of the number of time steps in a day' ) 151 113 IF( .NOT. ln_rnf ) THEN ! no specific treatment in vicinity of river mouths 114 ln_rnf_mouth = .false. 115 nkrnf = 0 116 rnfmsk (:,:) = 0.e0 117 rnfmsk_z(:) = 0.e0 118 ENDIF 119 IF( nn_ice == 0 ) fr_i(:,:) = 0.e0 ! no ice in the domain, ice fraction is always zero 120 121 ! ! restartability 122 IF( MOD( nitend - nit000 + 1, nn_fsbc) /= 0 .OR. & 123 MOD( nstock , nn_fsbc) /= 0 ) THEN 124 WRITE(ctmp1,*) 'experiment length (', nitend - nit000 + 1, ') or nstock (', nstock, & 125 & ' is NOT a multiple of nn_fsbc (', nn_fsbc, ')' 126 CALL ctl_stop( ctmp1, 'Impossible to properly do model restart' ) 127 ENDIF 128 ! 129 IF( MOD( rday, REAL(nn_fsbc, wp) * rdt ) /= 0 ) & 130 & CALL ctl_warn( 'nn_fsbc is NOT a multiple of the number of time steps in a day' ) 131 ! 152 132 IF( nn_ice == 2 .AND. .NOT.( ln_blk_clio .OR. ln_blk_core ) ) & 153 & CALL ctl_stop( 's bc_init: sea-ice model requires a bulk formulation' )133 & CALL ctl_stop( 'sea-ice model requires a bulk formulation' ) 154 134 155 135 ! Choice of the Surface Boudary Condition (set nsbc) … … 214 194 SELECT CASE( nsbc ) ! Compute ocean surface boundary condition 215 195 ! ! (i.e. utau,vtau, qns, qsr, emp, emps) 216 CASE( 0 ) ; CALL sbc_gyre ( kt ) ! analytical formulation : GYRE configuration217 CASE( 1 ) ; CALL sbc_ana ( kt ) ! analytical formulation : uniform sbc218 CASE( 2 ) ; CALL sbc_flx ( kt ) ! flux formulation219 CASE( 3 ) ; CALL sbc_blk_clio( kt ) ! bulk formulation : CLIO for the ocean220 CASE( 4 ) ; CALL sbc_blk_core( kt ) ! bulk formulation : CORE for the ocean221 CASE( 5 ) ; CALL sbc_cpl ( kt )! coupled formulation196 CASE( 0 ) ; CALL sbc_gyre ( kt ) ! analytical formulation : GYRE configuration 197 CASE( 1 ) ; CALL sbc_ana ( kt ) ! analytical formulation : uniform sbc 198 CASE( 2 ) ; CALL sbc_flx ( kt ) ! flux formulation 199 CASE( 3 ) ; CALL sbc_blk_clio( kt ) ! bulk formulation : CLIO for the ocean 200 CASE( 4 ) ; CALL sbc_blk_core( kt ) ! bulk formulation : CORE for the ocean 201 CASE( 5 ) ; CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice ) ! coupled formulation 222 202 CASE( -1 ) 223 CALL sbc_ana ( kt ) ! ESOPA, test ALL the formulations224 CALL sbc_gyre ( kt ) 225 CALL sbc_flx ( kt ) 226 CALL sbc_blk_clio( kt ) 227 CALL sbc_blk_core( kt ) 228 CALL sbc_cpl ( kt )203 CALL sbc_ana ( kt ) ! ESOPA, test ALL the formulations 204 CALL sbc_gyre ( kt ) ! 205 CALL sbc_flx ( kt ) ! 206 CALL sbc_blk_clio( kt ) ! 207 CALL sbc_blk_core( kt ) ! 208 CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice ) ! 229 209 END SELECT 230 210 … … 234 214 !!gm IF( ln_dm2dc ) CALL sbc_dcy( kt ) ! Daily mean qsr distributed over the Diurnal Cycle 235 215 236 SELECT CASE( nn_ice ) ! Update heat and freshwater fluxes over ice-coveredareas237 CASE( 1 ) ; CALL sbc_ice_if ( kt )! Ice-cover climatology ("Ice-if" model)216 SELECT CASE( nn_ice ) ! Update heat and freshwater fluxes over sea-ice areas 217 CASE( 1 ) ; CALL sbc_ice_if ( kt ) ! Ice-cover climatology ("Ice-if" model) 238 218 ! 239 219 CASE( 2 ) ; CALL sbc_ice_lim_2( kt, nsbc ) ! LIM 2.0 ice model -
trunk/NEMO/OPA_SRC/geo2ocean.F90
r1152 r1218 3 3 !! *** MODULE geo2ocean *** 4 4 !! Ocean mesh : ??? 5 !!===================================================================== 5 !!====================================================================== 6 !! History : OPA ! 07-1996 (O. Marti) Original code 7 !! NEMO 1.0 ! 02-2008 (G. Madec) F90: Free form 8 !! 3.0 ! 9 !!---------------------------------------------------------------------- 6 10 7 11 !!---------------------------------------------------------------------- … … 11 15 !! repere : old routine suppress it ??? 12 16 !!---------------------------------------------------------------------- 13 !! * Modules used14 17 USE dom_oce ! mesh and scale factors 15 18 USE phycst ! physical constants … … 18 21 19 22 IMPLICIT NONE 20 21 !! * Accessibility22 23 PRIVATE 23 PUBLIC rot_rep, repcmo, repere, geo2oce ! only rot_rep should be used 24 25 PUBLIC rot_rep, repcmo, repere, geo2oce, oce2geo ! only rot_rep should be used 24 26 ! repcmo and repere are keep only for compatibility. 25 27 ! they are only a useless overlay of rot_rep 26 28 27 !! * Module variables28 29 REAL(wp), DIMENSION(jpi,jpj) :: & 29 30 gsint, gcost, & ! cos/sin between model grid lines and NP direction at T point … … 34 35 LOGICAL :: lmust_init = .TRUE. !: used to initialize the cos/sin variables (se above) 35 36 36 !! * Substitutions37 !! * Substitutions 37 38 # include "vectopt_loop_substitute.h90" 38 !!---------------------------------------------------------------------- -----------39 !! OPA 9.0 , LOCEAN-IPSL (2005)40 !! $Id $41 !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt42 !!---------------------------------------------------------------------- -----------39 !!---------------------------------------------------------------------- 40 !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008) 41 !! $Id:$ 42 !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 43 !!---------------------------------------------------------------------- 43 44 44 45 CONTAINS … … 54 55 !! ** Method : Initialization of arrays at the first call. 55 56 !! 56 !! ** Action : - px2 : first componante (defined at u point)57 !! ** Action : - px2 : first componante (defined at u point) 57 58 !! - py2 : second componante (defined at v point) 58 !! 59 !! History : 60 !! 7.0 ! 07-96 (O. Marti) Original code 61 !! 8.5 ! 02-08 (G. Madec) F90: Free form 62 !!---------------------------------------------------------------------- 63 !! * Arguments 64 REAL(wp), INTENT( in ), DIMENSION(jpi,jpj) :: & 65 pxu1, pyu1, & ! geographic vector componantes at u-point 66 pxv1, pyv1 ! geographic vector componantes at v-point 67 REAL(wp), INTENT( out ), DIMENSION(jpi,jpj) :: & 68 px2, & ! i-componante (defined at u-point) 69 py2 ! j-componante (defined at v-point) 59 !!---------------------------------------------------------------------- 60 REAL(wp), INTENT(in ), DIMENSION(jpi,jpj) :: pxu1, pyu1 ! geographic vector componantes at u-point 61 REAL(wp), INTENT(in ), DIMENSION(jpi,jpj) :: pxv1, pyv1 ! geographic vector componantes at v-point 62 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: px2 ! i-componante (defined at u-point) 63 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: py2 ! j-componante (defined at v-point) 70 64 !!---------------------------------------------------------------------- 71 65 72 66 ! Change from geographic to stretched coordinate 73 67 ! ---------------------------------------------- 74 75 68 CALL rot_rep( pxu1, pyu1, 'U', 'en->i',px2 ) 76 69 CALL rot_rep( pxv1, pyv1, 'V', 'en->j',py2 ) … … 90 83 !! (O. Marti ) Original code (repere and repcmo) 91 84 !!---------------------------------------------------------------------- 92 !! * Arguments93 85 REAL(wp), DIMENSION(jpi,jpj), INTENT( IN ) :: pxin, pyin ! vector componantes 94 86 CHARACTER(len=1), INTENT( IN ) :: cd_type ! define the nature of pt2d array grid-points … … 172 164 !! 9.2 ! 07-04 (S. Masson) Add T, F points and bugfix in cos lateral boundary 173 165 !!---------------------------------------------------------------------- 174 !! * local declarations175 166 INTEGER :: ji, jj ! dummy loop indices 176 167 !! 177 168 REAL(wp) :: & 178 169 zlam, zphi, & ! temporary scalars … … 328 319 329 320 330 SUBROUTINE geo2oce ( pxx , pyy, pzz, cgrid, &331 p lon, plat, pte, ptn , ptv)321 SUBROUTINE geo2oce ( pxx, pyy, pzz, cgrid, & 322 pte, ptn ) 332 323 !!---------------------------------------------------------------------- 333 324 !! *** ROUTINE geo2oce *** … … 344 335 !! ! 00-08 (D. Ludicone) Reduced section at Bab el Mandeb 345 336 !! 8.5 ! 02-06 (G. Madec) F90: Free form 346 !!---------------------------------------------------------------------- 347 !! * Local declarations 348 REAL(wp), INTENT( in ), DIMENSION(jpi,jpj) :: & 349 pxx, pyy, pzz 350 CHARACTER (len=1), INTENT( in) :: & 351 cgrid 352 REAL(wp), INTENT( in ), DIMENSION(jpi,jpj) :: & 353 plon, plat 354 REAL(wp), INTENT(out), DIMENSION(jpi,jpj) :: & 355 pte, ptn, ptv 337 !! 3.0 ! 07-08 (G. Madec) geo2oce suppress lon/lat agruments 338 !!---------------------------------------------------------------------- 339 REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: pxx, pyy, pzz 340 CHARACTER(len=1) , INTENT(in ) :: cgrid 341 REAL(wp), DIMENSION(jpi,jpj), INTENT( out) :: pte, ptn 342 !! 356 343 REAL(wp), PARAMETER :: rpi = 3.141592653E0 357 344 REAL(wp), PARAMETER :: rad = rpi / 180.e0 358 359 !! * Local variables360 345 INTEGER :: ig ! 361 362 346 !! * Local save 363 REAL(wp), SAVE, DIMENSION(jpi,jpj,4) :: & 364 zsinlon, zcoslon, & 365 zsinlat, zcoslat 366 LOGICAL, SAVE, DIMENSION (4) :: & 367 linit = .FALSE. 347 REAL(wp), SAVE, DIMENSION(jpi,jpj,4) :: zsinlon, zcoslon, zsinlat, zcoslat 348 LOGICAL , SAVE, DIMENSION(4) :: linit = .FALSE. 368 349 !!---------------------------------------------------------------------- 369 350 370 351 SELECT CASE( cgrid) 371 352 CASE ( 't' ) 353 ig = 1 354 IF( .NOT. linit(ig) ) THEN 355 zsinlon (:,:,ig) = SIN (rad * glamt) 356 zcoslon (:,:,ig) = COS (rad * glamt) 357 zsinlat (:,:,ig) = SIN (rad * gphit) 358 zcoslat (:,:,ig) = COS (rad * gphit) 359 linit (ig) = .TRUE. 360 ENDIF 361 CASE ( 'u' ) 362 ig = 2 363 IF( .NOT. linit(ig) ) THEN 364 zsinlon (:,:,ig) = SIN (rad * glamu) 365 zcoslon (:,:,ig) = COS (rad * glamu) 366 zsinlat (:,:,ig) = SIN (rad * gphiu) 367 zcoslat (:,:,ig) = COS (rad * gphiu) 368 linit (ig) = .TRUE. 369 ENDIF 370 CASE ( 'v' ) 371 ig = 3 372 IF( .NOT. linit(ig) ) THEN 373 zsinlon (:,:,ig) = SIN (rad * glamv) 374 zcoslon (:,:,ig) = COS (rad * glamv) 375 zsinlat (:,:,ig) = SIN (rad * gphiv) 376 zcoslat (:,:,ig) = COS (rad * gphiv) 377 linit (ig) = .TRUE. 378 ENDIF 379 CASE ( 'f' ) 380 ig = 4 381 IF( .NOT. linit(ig) ) THEN 382 zsinlon (:,:,ig) = SIN (rad * glamf) 383 zcoslon (:,:,ig) = COS (rad * glamf) 384 zsinlat (:,:,ig) = SIN (rad * gphif) 385 zcoslat (:,:,ig) = COS (rad * gphif) 386 linit (ig) = .TRUE. 387 ENDIF 388 CASE default 389 WRITE(ctmp1,*) 'geo2oce : bad grid argument : ', cgrid 390 CALL ctl_stop( ctmp1 ) 391 END SELECT 392 393 pte = - zsinlon (:,:,ig) * pxx + zcoslon (:,:,ig) * pyy 394 ptn = - zcoslon (:,:,ig) * zsinlat (:,:,ig) * pxx & 395 - zsinlon (:,:,ig) * zsinlat (:,:,ig) * pyy & 396 + zcoslat (:,:,ig) * pzz 397 !!$ ptv = zcoslon (:,:,ig) * zcoslat (:,:,ig) * pxx & 398 !!$ + zsinlon (:,:,ig) * zcoslat (:,:,ig) * pyy & 399 !!$ + zsinlat (:,:,ig) * pzz 400 ! 401 END SUBROUTINE geo2oce 402 403 SUBROUTINE oce2geo ( pte, ptn, cgrid, & 404 plon, plat, pxx , pyy , pzz ) 405 !!---------------------------------------------------------------------- 406 !! *** ROUTINE oce2geo *** 407 !! 408 !! ** Purpose : 409 !! 410 !! ** Method : Change vector from east/north to geocentric 411 !! 412 !! History : 413 !! ! (A. Caubel) oce2geo - Original code 414 !!---------------------------------------------------------------------- 415 REAL(wp), DIMENSION(jpi,jpj), INTENT( IN ) :: pte, ptn 416 CHARACTER(len=1) , INTENT( IN ) :: cgrid 417 REAL(wp), DIMENSION(jpi,jpj), INTENT( IN ) :: plon, plat 418 REAL(wp), DIMENSION(jpi,jpj), INTENT( OUT ) :: pxx , pyy , pzz 419 !! 420 REAL(wp), PARAMETER :: rpi = 3.141592653E0 421 REAL(wp), PARAMETER :: rad = rpi / 180.e0 422 INTEGER :: ig ! 423 !! * Local save 424 REAL(wp), SAVE, DIMENSION(jpi,jpj,4) :: zsinlon, zcoslon, zsinlat, zcoslat 425 LOGICAL , SAVE, DIMENSION(4) :: linit = .FALSE. 426 !!---------------------------------------------------------------------- 427 428 WRITE(ctmp1,*) 'oce2geo : Arnaud, au boulot ' 429 CALL ctl_stop( ctmp1 ) 430 431 SELECT CASE( cgrid) 372 432 CASE ( 't' ) ;; ig = 1 373 433 CASE ( 'u' ) ;; ig = 2 374 434 CASE ( 'v' ) ;; ig = 3 375 435 CASE ( 'f' ) ;; ig = 4 376 377 436 CASE default 378 WRITE(ctmp1,*) ' geo2oce: bad grid argument : ', cgrid437 WRITE(ctmp1,*) 'oce2geo : bad grid argument : ', cgrid 379 438 CALL ctl_stop( ctmp1 ) 380 439 END SELECT 381 382 IF( .NOT. linit(ig) ) THEN 383 zsinlon (:,:,ig) = SIN (rad * plon) 384 zcoslon (:,:,ig) = COS (rad * plon) 385 zsinlat (:,:,ig) = SIN (rad * plat) 386 zcoslat (:,:,ig) = COS (rad * plat) 387 linit (ig) = .TRUE. 388 ENDIF 389 390 pte = - zsinlon (:,:,ig) * pxx + zcoslon (:,:,ig) * pyy 391 ptn = - zcoslon (:,:,ig) * zsinlat (:,:,ig) * pxx & 392 - zsinlon (:,:,ig) * zsinlat (:,:,ig) * pyy & 393 + zcoslat (:,:,ig) * pzz 394 ptv = zcoslon (:,:,ig) * zcoslat (:,:,ig) * pxx & 395 + zsinlon (:,:,ig) * zcoslat (:,:,ig) * pyy & 396 + zsinlat (:,:,ig) * pzz 397 398 END SUBROUTINE geo2oce 440 pxx(:,:) = 0. ; pyy(:,:) = 0. ; pzz(:,:) = 0. ! stupid definition to avoid warning message when compiling... 441 442 END SUBROUTINE oce2geo 399 443 400 444 -
trunk/NEMO/OPA_SRC/ice_oce.F90
r1146 r1218 4 4 !! Ocean - ice : ice variables defined in memory 5 5 !!====================================================================== 6 !! History : 7 !! 8.5 ! 02-11 (G. Madec) F90: Free form and module 8 !!---------------------------------------------------------------------- 9 !! OPA 9.0 , LOCEAN-IPSL (2005) 10 !! $Id$ 11 !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 6 !! History : 1.0 ! 02-11 (G. Madec) F90: Free form and module 12 7 !!---------------------------------------------------------------------- 13 8 #if defined key_lim3 || defined key_lim2 … … 15 10 !! 'key_lim2' or 'key_lim3' : LIM 2.0 or 3.0 ice model 16 11 !!---------------------------------------------------------------------- 17 !! * Modules used18 12 USE par_oce ! ocean parameters 19 13 … … 21 15 PRIVATE 22 16 23 !! Shared module variables24 17 # if defined key_lim2 25 LOGICAL, PUBLIC, PARAMETER :: lk_lim2 = .TRUE. !: LIM2 ice model 26 LOGICAL, PUBLIC, PARAMETER :: lk_lim3 = .FALSE. !: LIM3 ice model 27 # else 28 LOGICAL, PUBLIC, PARAMETER :: lk_lim2 = .FALSE. !: LIM2 ice model 29 LOGICAL, PUBLIC, PARAMETER :: lk_lim3 = .TRUE. !: LIM3 ice model 18 LOGICAL , PUBLIC, PARAMETER :: lk_lim2 = .TRUE. !: LIM-2 ice model 19 LOGICAL , PUBLIC, PARAMETER :: lk_lim3 = .FALSE. !: no LIM-3 20 CHARACTER(len=1), PUBLIC :: cice_grid = 'B' !: 'B'-grid ice-velocity 21 # endif 22 # if defined key_lim3 23 LOGICAL , PUBLIC, PARAMETER :: lk_lim2 = .FALSE. !: no LIM-2 24 LOGICAL , PUBLIC, PARAMETER :: lk_lim3 = .TRUE. !: LIM-3 ice model 25 CHARACTER(len=1), PUBLIC :: cice_grid = 'C' !: 'B'-grid ice-velocity 30 26 # endif 31 27 … … 33 29 !! ice-ocean common variables 34 30 !!---------------------------------------------------------------------- 35 # if defined key_coupled36 REAL(wp), PUBLIC, DIMENSION(jpiglo,jpjglo) :: & !: cumulated fields37 fqsr_oce , & !: Net short wave heat flux on free ocean38 fqsr_ice , & !: Net short wave heat flux on sea ice39 fqnsr_oce, & !: Net longwave heat flux on free ocean40 fqnsr_ice, & !: Net longwave heat flux on sea ice41 fdqns_ice, & !: Derivative of non solar heat flux on sea ice42 ftprecip , & !: Water flux (liquid precipitation - evaporation)43 fsprecip , & !: Solid (snow) precipitation44 frunoff , & !: runoff45 fcalving !: Iceberg calving46 # endif47 31 48 32 # if defined key_lim3 49 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: & !: field exchanges with ice model to ocean50 catm_ice , & !: cloud cover51 tatm_ice , & !: air temperature52 icethi !: icethickness33 ! LIM-3 !!! ice to ocean fields 34 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: catm_ice !: cloud cover !!gm never used 35 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: tatm_ice !: air temperature !!gm nothing to do here... 36 REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: icethi !: ice thickness !!gm never used 53 37 # endif 54 38 55 REAL(wp), PUBLIC :: & !: 56 rdt_ice, & !: ice time step 57 dtsd2 !: ice time step divide by 2 39 REAL(wp), PUBLIC :: rdt_ice !: ice time step 40 REAL(wp), PUBLIC :: dtsd2 !: ice time step divide by 2 58 41 59 42 #else … … 61 44 !! Default option NO LIM 2.0 or 3.0 sea-ice model 62 45 !!---------------------------------------------------------------------- 63 LOGICAL, PUBLIC, PARAMETER :: lk_lim2 = .FALSE. !: No LIM 2.0 ice model 64 LOGICAL, PUBLIC, PARAMETER :: lk_lim3 = .FALSE. !: No LIM 3.0 ice model 46 LOGICAL , PUBLIC, PARAMETER :: lk_lim2 = .FALSE. !: no LIM-2 ice model 47 LOGICAL , PUBLIC, PARAMETER :: lk_lim3 = .FALSE. !: no LIM-3 ice model 48 CHARACTER(len=1), PUBLIC :: cice_grid = 'C' !: 'B'-grid ice-velocity 65 49 #endif 66 50 67 51 !!---------------------------------------------------------------------- 52 !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008) 53 !! $Id$ 54 !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 55 !!---------------------------------------------------------------------- 68 56 END MODULE ice_oce -
trunk/NEMO/OPA_SRC/opa.F90
r1146 r1218 38 38 !! * Modules used 39 39 USE oce ! dynamics and tracers variables 40 USE cpl_oce ! ocean-atmosphere-sea ice coupled exchanges41 40 USE dom_oce ! ocean space domain variables 42 41 USE sbc_oce ! surface boundary condition: ocean -
trunk/NEMO/OPA_SRC/restart.F90
r1146 r1218 18 18 USE oce ! ocean dynamics and tracers 19 19 USE phycst ! physical constants 20 USE cpl_oce, ONLY : lk_cpl !21 20 USE in_out_manager ! I/O manager 22 21 USE iom ! I/O module -
trunk/NEMO/OPA_SRC/step.F90
r1151 r1218 31 31 USE ldftra_oce ! ocean tracer - trends 32 32 USE ldfdyn_oce ! ocean dynamics - trends 33 USE cpl_oce ! coupled ocean-atmosphere variables34 33 USE in_out_manager ! I/O manager 35 34 USE iom ! … … 42 41 USE sbcmod ! surface boundary condition (sbc routine) 43 42 USE sbcrnf ! surface boundary condition: runoff variables 43 USE sbccpl ! surface boundary condition: coupled formulation (call send at end of step) 44 USE cpl_oasis3, ONLY : lk_cpl 44 45 45 46 USE trcstp ! passive tracer time-stepping (trc_stp routine) … … 361 362 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 362 363 363 #if defined key_oasis3 364 IF( lk_cpl ) CALL cpl_stp( kstp ) ! coupled mode : field exchanges 365 #endif 364 IF( lk_cpl ) CALL sbc_cpl_snd( kstp ) ! coupled mode : field exchanges 366 365 ! 367 366 END SUBROUTINE stp
Note: See TracChangeset
for help on using the changeset viewer.