[1000] | 1 | ! |
---|
[1319] | 2 | ! $Id: etat0_netcdf.F90 1425 2010-09-02 13:45:23Z oboucher $ |
---|
[1000] | 3 | ! |
---|
[1319] | 4 | !------------------------------------------------------------------------------- |
---|
| 5 | ! |
---|
| 6 | SUBROUTINE etat0_netcdf(ib, masque, letat0) |
---|
| 7 | ! |
---|
| 8 | !------------------------------------------------------------------------------- |
---|
| 9 | ! Purpose: Creates initial states |
---|
| 10 | !------------------------------------------------------------------------------- |
---|
| 11 | ! Note: This routine is designed to work for Earth |
---|
| 12 | !------------------------------------------------------------------------------- |
---|
[1425] | 13 | USE control_mod |
---|
[1319] | 14 | #ifdef CPP_EARTH |
---|
| 15 | USE startvar |
---|
| 16 | USE ioipsl |
---|
| 17 | USE dimphy |
---|
| 18 | USE infotrac |
---|
| 19 | USE fonte_neige_mod |
---|
| 20 | USE pbl_surface_mod |
---|
| 21 | USE phys_state_var_mod |
---|
| 22 | USE filtreg_mod |
---|
| 23 | USE regr_lat_time_climoz_m, ONLY: regr_lat_time_climoz |
---|
| 24 | USE conf_phys_m, ONLY: conf_phys |
---|
[1406] | 25 | ! For parameterization of ozone chemistry: |
---|
| 26 | use regr_lat_time_coefoz_m, only: regr_lat_time_coefoz |
---|
| 27 | use press_coefoz_m, only: press_coefoz |
---|
| 28 | use regr_pr_o3_m, only: regr_pr_o3 |
---|
[1319] | 29 | USE netcdf, ONLY : NF90_OPEN, NF90_NOWRITE, NF90_CLOSE, NF90_NOERR |
---|
[1146] | 30 | #endif |
---|
[1319] | 31 | IMPLICIT NONE |
---|
| 32 | !------------------------------------------------------------------------------- |
---|
| 33 | ! Arguments: |
---|
[1000] | 34 | #include "dimensions.h" |
---|
| 35 | #include "paramet.h" |
---|
[1319] | 36 | #include "iniprint.h" |
---|
| 37 | LOGICAL, INTENT(IN) :: ib ! barycentric interpolat. |
---|
| 38 | REAL, DIMENSION(iip1,jjp1), INTENT(INOUT) :: masque ! land mask |
---|
| 39 | LOGICAL, INTENT(IN) :: letat0 ! F: masque only required |
---|
| 40 | #ifndef CPP_EARTH |
---|
| 41 | WRITE(lunout,*)'limit_netcdf: Earth-specific routine, needs Earth physics' |
---|
| 42 | #else |
---|
| 43 | !------------------------------------------------------------------------------- |
---|
| 44 | ! Local variables: |
---|
[1000] | 45 | #include "comgeom2.h" |
---|
| 46 | #include "comvert.h" |
---|
| 47 | #include "comconst.h" |
---|
| 48 | #include "indicesol.h" |
---|
| 49 | #include "dimsoil.h" |
---|
| 50 | #include "temps.h" |
---|
[1319] | 51 | REAL, DIMENSION(klon) :: tsol, qsol |
---|
| 52 | REAL, DIMENSION(klon) :: sn, rugmer, run_off_lic_0 |
---|
| 53 | REAL, DIMENSION(iip1,jjp1) :: orog, rugo, psol, phis |
---|
| 54 | REAL, DIMENSION(iip1,jjp1,llm+1) :: p3d |
---|
| 55 | REAL, DIMENSION(iip1,jjp1,llm) :: uvent, t3d, tpot, qsat, qd |
---|
| 56 | REAL, DIMENSION(iip1,jjm ,llm) :: vvent |
---|
| 57 | REAL, DIMENSION(:,:,:,:), ALLOCATABLE :: q3d |
---|
| 58 | REAL, DIMENSION(klon,nbsrf) :: qsolsrf, snsrf, evap |
---|
| 59 | REAL, DIMENSION(klon,nbsrf) :: frugs, agesno |
---|
| 60 | REAL, DIMENSION(klon,nsoilmx,nbsrf) :: tsoil |
---|
[1146] | 61 | |
---|
[1319] | 62 | !--- Local variables for sea-ice reading: |
---|
| 63 | INTEGER :: iml_lic, jml_lic, llm_tmp |
---|
| 64 | INTEGER :: ttm_tmp, iret, fid |
---|
| 65 | INTEGER, DIMENSION(1) :: itaul |
---|
| 66 | REAL, DIMENSION(1) :: lev |
---|
| 67 | REAL :: date |
---|
| 68 | REAL, DIMENSION(:,:), ALLOCATABLE :: lon_lic, lat_lic, fraclic |
---|
| 69 | REAL, DIMENSION(:), ALLOCATABLE :: dlon_lic, dlat_lic |
---|
| 70 | REAL, DIMENSION(iip1,jjp1) :: flic_tmp |
---|
[1000] | 71 | |
---|
[1319] | 72 | !--- Misc |
---|
| 73 | CHARACTER(LEN=80) :: x, fmt |
---|
| 74 | INTEGER :: i, j, l, ji |
---|
| 75 | REAL, DIMENSION(iip1,jjp1,llm) :: alpha, beta, pk, pls, y |
---|
| 76 | REAL, DIMENSION(ip1jmp1) :: pks |
---|
[1000] | 77 | |
---|
| 78 | #include "comdissnew.h" |
---|
| 79 | #include "serre.h" |
---|
| 80 | #include "clesphys.h" |
---|
| 81 | |
---|
[1319] | 82 | REAL, DIMENSION(iip1,jjp1,llm) :: masse |
---|
| 83 | INTEGER :: itau, iday |
---|
| 84 | REAL :: xpn, xps, time, phystep |
---|
| 85 | REAL, DIMENSION(iim) :: xppn, xpps |
---|
| 86 | REAL, DIMENSION(ip1jmp1,llm) :: pbaru, phi, w |
---|
| 87 | REAL, DIMENSION(ip1jm ,llm) :: pbarv |
---|
| 88 | REAL, DIMENSION(klon) :: fder |
---|
[1000] | 89 | |
---|
[1319] | 90 | !--- Local variables for ocean mask reading: |
---|
| 91 | INTEGER :: nid_o2a, iml_omask, jml_omask |
---|
| 92 | LOGICAL :: couple=.FALSE. |
---|
| 93 | REAL, DIMENSION(:,:), ALLOCATABLE :: lon_omask, lat_omask, ocemask, ocetmp |
---|
| 94 | REAL, DIMENSION(:), ALLOCATABLE :: dlon_omask,dlat_omask |
---|
| 95 | REAL, DIMENSION(klon) :: ocemask_fi |
---|
| 96 | INTEGER, DIMENSION(klon-2) :: isst |
---|
| 97 | REAL, DIMENSION(iim,jjp1) :: zx_tmp_2d |
---|
| 98 | REAL :: dummy |
---|
| 99 | LOGICAL :: ok_newmicro, ok_journe, ok_mensuel, ok_instan, ok_hf |
---|
| 100 | LOGICAL :: ok_LES, ok_ade, ok_aie, aerosol_couple, new_aod |
---|
| 101 | INTEGER :: iflag_radia, flag_aerosol |
---|
| 102 | REAL :: bl95_b0, bl95_b1, fact_cldcon, facttemps, ratqsbas, ratqshaut |
---|
| 103 | REAL :: tau_ratqs |
---|
| 104 | INTEGER :: iflag_cldcon, iflag_ratqs, iflag_coupl, iflag_clos, iflag_wake |
---|
| 105 | INTEGER :: iflag_thermals, nsplit_thermals |
---|
| 106 | INTEGER :: iflag_thermals_ed, iflag_thermals_optflux |
---|
| 107 | REAL :: tau_thermals, solarlong0, seuil_inversion |
---|
| 108 | INTEGER :: read_climoz ! read ozone climatology |
---|
| 109 | ! Allowed values are 0, 1 and 2 |
---|
| 110 | ! 0: do not read an ozone climatology |
---|
| 111 | ! 1: read a single ozone climatology that will be used day and night |
---|
| 112 | ! 2: read two ozone climatologies, the average day and night |
---|
| 113 | ! climatology and the daylight climatology |
---|
| 114 | !------------------------------------------------------------------------------- |
---|
[1406] | 115 | REAL :: alp_offset |
---|
[1425] | 116 | logical found |
---|
[1406] | 117 | |
---|
[1319] | 118 | !--- Constants |
---|
| 119 | pi = 4. * ATAN(1.) |
---|
| 120 | rad = 6371229. |
---|
| 121 | daysec = 86400. |
---|
| 122 | omeg = 2.*pi/daysec |
---|
| 123 | g = 9.8 |
---|
| 124 | kappa = 0.2857143 |
---|
| 125 | cpp = 1004.70885 |
---|
| 126 | preff = 101325. |
---|
| 127 | pa = 50000. |
---|
| 128 | jmp1 = jjm + 1 |
---|
[1000] | 129 | |
---|
[1319] | 130 | !--- CONSTRUCT A GRID |
---|
| 131 | CALL conf_phys( ok_journe, ok_mensuel, ok_instan, ok_hf, ok_LES, & |
---|
| 132 | solarlong0,seuil_inversion, & |
---|
| 133 | fact_cldcon, facttemps,ok_newmicro,iflag_radia, & |
---|
| 134 | iflag_cldcon, & |
---|
| 135 | iflag_ratqs,ratqsbas,ratqshaut,tau_ratqs, & |
---|
| 136 | ok_ade, ok_aie, aerosol_couple, & |
---|
| 137 | flag_aerosol, new_aod, & |
---|
| 138 | bl95_b0, bl95_b1, & |
---|
| 139 | iflag_thermals,nsplit_thermals,tau_thermals, & |
---|
| 140 | iflag_thermals_ed,iflag_thermals_optflux, & |
---|
[1403] | 141 | iflag_coupl,iflag_clos,iflag_wake, read_climoz, & |
---|
| 142 | alp_offset) |
---|
[1000] | 143 | |
---|
[1319] | 144 | ! co2_ppm0 : initial value of atmospheric CO2 from .def file (co2_ppm value) |
---|
| 145 | co2_ppm0 = co2_ppm |
---|
[1000] | 146 | |
---|
[1319] | 147 | dtvr = daysec/FLOAT(day_step) |
---|
| 148 | WRITE(lunout,*)'dtvr',dtvr |
---|
[1000] | 149 | |
---|
[1319] | 150 | CALL iniconst() |
---|
| 151 | CALL inigeom() |
---|
[1279] | 152 | |
---|
[1319] | 153 | !--- Initializations for tracers |
---|
| 154 | CALL infotrac_init |
---|
| 155 | ALLOCATE(q3d(iip1,jjp1,llm,nqtot)) |
---|
[1000] | 156 | |
---|
[1319] | 157 | CALL inifilr() |
---|
| 158 | CALL phys_state_var_init(read_climoz) |
---|
[1000] | 159 | |
---|
[1319] | 160 | rlat(1) = ASIN(1.0) |
---|
| 161 | DO j=2,jjm; rlat((j-2)*iim+2:(j-1)*iim+1)=rlatu(j); END DO |
---|
| 162 | rlat(klon) = - ASIN(1.0) |
---|
| 163 | rlat(:)=rlat(:)*(180.0/pi) |
---|
[1279] | 164 | |
---|
[1319] | 165 | rlon(1) = 0.0 |
---|
| 166 | DO j=2,jjm; rlon((j-2)*iim+2:(j-1)*iim+1)=rlonv(1:iim); END DO |
---|
| 167 | rlon(klon) = 0.0 |
---|
| 168 | rlon(:)=rlon(:)*(180.0/pi) |
---|
[1000] | 169 | |
---|
[1319] | 170 | ! For a coupled simulation, the ocean mask from ocean model is used to compute |
---|
| 171 | ! the weights an to insure ocean fractions are the same for atmosphere and ocean |
---|
| 172 | ! Otherwise, mask is created using Relief file. |
---|
[1279] | 173 | |
---|
[1319] | 174 | WRITE(lunout,*)'Essai de lecture masque ocean' |
---|
| 175 | iret = NF90_OPEN("o2a.nc", NF90_NOWRITE, nid_o2a) |
---|
| 176 | IF(iret/=NF90_NOERR) THEN |
---|
| 177 | WRITE(lunout,*)'ATTENTION!! pas de fichier o2a.nc trouve' |
---|
| 178 | WRITE(lunout,*)'Run force' |
---|
| 179 | x='masque' |
---|
| 180 | masque(:,:)=0.0 |
---|
[1323] | 181 | CALL startget_phys2d(x, iip1, jjp1, rlonv, rlatu, masque, 0.0, jjm, & |
---|
| 182 | & rlonu, rlatv, ib) |
---|
[1319] | 183 | WRITE(lunout,*)'MASQUE construit : Masque' |
---|
| 184 | WRITE(lunout,'(97I1)') nINT(masque) |
---|
| 185 | CALL gr_dyn_fi(1, iip1, jjp1, klon, masque, zmasq) |
---|
| 186 | WHERE( zmasq(:)<EPSFRA) zmasq(:)=0. |
---|
| 187 | WHERE(1.-zmasq(:)<EPSFRA) zmasq(:)=1. |
---|
| 188 | ELSE |
---|
[1323] | 189 | WRITE(lunout,*)'ATTENTION!! fichier o2a.nc trouve' |
---|
| 190 | WRITE(lunout,*)'Run couple' |
---|
[1319] | 191 | couple=.true. |
---|
| 192 | iret=NF90_CLOSE(nid_o2a) |
---|
| 193 | CALL flininfo("o2a.nc", iml_omask, jml_omask, llm_tmp, ttm_tmp, nid_o2a) |
---|
| 194 | IF(iml_omask/=iim .OR.jml_omask/=jjp1) THEN |
---|
| 195 | WRITE(lunout,*)'Dimensions non compatibles pour masque ocean' |
---|
| 196 | WRITE(lunout,*)'iim = ',iim,' iml_omask = ',iml_omask |
---|
| 197 | WRITE(lunout,*)'jjp1 = ',jjp1,' jml_omask = ',jml_omask |
---|
| 198 | CALL abort_gcm('etat0_netcdf','Dimensions non compatibles pour masque oc& |
---|
| 199 | &ean',1) |
---|
| 200 | END IF |
---|
| 201 | ALLOCATE( ocemask(iml_omask,jml_omask), ocetmp(iml_omask,jml_omask)) |
---|
| 202 | ALLOCATE( lon_omask(iml_omask,jml_omask),lat_omask(iml_omask,jml_omask)) |
---|
| 203 | ALLOCATE(dlon_omask(iml_omask), dlat_omask(jml_omask)) |
---|
[1323] | 204 | CALL flinopen("o2a.nc", .FALSE., iml_omask, jml_omask, llm_tmp, lon_omask,& |
---|
| 205 | & lat_omask, lev, ttm_tmp, itaul, date, dt, fid) |
---|
| 206 | CALL flinget(fid, 'OceMask', iml_omask, jml_omask, llm_tmp, ttm_tmp, & |
---|
| 207 | & 1, 1, ocetmp) |
---|
[1319] | 208 | CALL flinclo(fid) |
---|
| 209 | dlon_omask(1:iml_omask) = lon_omask(1:iml_omask,1) |
---|
| 210 | dlat_omask(1:jml_omask) = lat_omask(1,1:jml_omask) |
---|
| 211 | ocemask = ocetmp |
---|
| 212 | IF(dlat_omask(1)<dlat_omask(jml_omask)) THEN |
---|
| 213 | DO j=1,jml_omask |
---|
| 214 | ocemask(:,j) = ocetmp(:,jml_omask-j+1) |
---|
| 215 | END DO |
---|
| 216 | END IF |
---|
| 217 | ! |
---|
| 218 | ! Ocean mask to physical grid |
---|
| 219 | !******************************************************************************* |
---|
| 220 | WRITE(lunout,*)'ocemask ' |
---|
| 221 | WRITE(fmt,"(i4,'i1)')")iml_omask ; fmt='('//ADJUSTL(fmt) |
---|
| 222 | WRITE(lunout,fmt)int(ocemask) |
---|
| 223 | ocemask_fi(1)=ocemask(1,1) |
---|
[1328] | 224 | DO j=2,jjm; ocemask_fi((j-2)*iim+2:(j-1)*iim+1)=ocemask(1:iim,j); END DO |
---|
[1319] | 225 | ocemask_fi(klon)=ocemask(1,jjp1) |
---|
| 226 | zmasq=1.-ocemask_fi |
---|
| 227 | END IF |
---|
[1279] | 228 | |
---|
[1319] | 229 | CALL gr_fi_dyn(1,klon,iip1,jjp1,zmasq,masque) |
---|
[1000] | 230 | |
---|
[1319] | 231 | ! The startget calls need to be replaced by a call to restget to get the |
---|
| 232 | ! values in the restart file |
---|
| 233 | x = 'relief'; orog(:,:) = 0.0 |
---|
[1323] | 234 | CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu, orog, 0.0,jjm,rlonu,rlatv,ib,& |
---|
| 235 | & masque) |
---|
[1000] | 236 | |
---|
[1319] | 237 | x = 'rugosite'; rugo(:,:) = 0.0 |
---|
[1323] | 238 | CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu, rugo, 0.0,jjm, rlonu,rlatv,ib) |
---|
[1319] | 239 | ! WRITE(lunout,'(49I1)') INT(orog(:,:)*10) |
---|
| 240 | ! WRITE(lunout,'(49I1)') INT(rugo(:,:)*10) |
---|
[1000] | 241 | |
---|
[1319] | 242 | ! Sub-surfaces initialization |
---|
| 243 | !******************************************************************************* |
---|
| 244 | pctsrf=0. |
---|
| 245 | x = 'psol'; psol(:,:) = 0.0 |
---|
[1323] | 246 | CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu,psol,0.0,jjm,rlonu,rlatv,ib) |
---|
[1319] | 247 | ! WRITE(lunout,*) 'PSOL :', psol(10,20) |
---|
| 248 | ! WRITE(lunout,*) ap(:), bp(:) |
---|
[1000] | 249 | |
---|
[1319] | 250 | ! Mid-levels pressure computation |
---|
| 251 | !******************************************************************************* |
---|
| 252 | CALL pression(ip1jmp1, ap, bp, psol, p3d) |
---|
| 253 | CALL exner_hyb(ip1jmp1, psol, p3d, alpha, beta, pks, pk, y) |
---|
| 254 | pls(:,:,:)=preff*(pk(:,:,:)/cpp)**(1./kappa) |
---|
| 255 | ! WRITE(lunout,*) 'P3D :', p3d(10,20,:) |
---|
| 256 | ! WRITE(lunout,*) 'PK:', pk(10,20,:) |
---|
| 257 | ! WRITE(lunout,*) 'PLS :', pls(10,20,:) |
---|
[1000] | 258 | |
---|
[1319] | 259 | x = 'surfgeo'; phis(:,:) = 0.0 |
---|
[1323] | 260 | CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu,phis, 0.0,jjm, rlonu,rlatv,ib) |
---|
[1000] | 261 | |
---|
[1319] | 262 | x = 'u'; uvent(:,:,:) = 0.0 |
---|
[1323] | 263 | CALL startget_dyn(x,rlonu,rlatu,pls,y,uvent,0.0, & |
---|
| 264 | & rlonv,rlatv,ib) |
---|
[1000] | 265 | |
---|
[1319] | 266 | x = 'v'; vvent(:,:,:) = 0.0 |
---|
[1323] | 267 | CALL startget_dyn(x, rlonv,rlatv,pls(:, :jjm, :),y(:, :jjm, :),vvent,0.0, & |
---|
| 268 | & rlonu,rlatu(:jjm),ib) |
---|
[1279] | 269 | |
---|
[1319] | 270 | x = 't'; t3d(:,:,:) = 0.0 |
---|
[1323] | 271 | CALL startget_dyn(x,rlonv,rlatu,pls,y,t3d,0.0, & |
---|
| 272 | & rlonu,rlatv,ib) |
---|
[1279] | 273 | |
---|
[1319] | 274 | x = 'tpot'; tpot(:,:,:) = 0.0 |
---|
[1323] | 275 | CALL startget_dyn(x,rlonv,rlatu,pls,pk,tpot,0.0, & |
---|
| 276 | & rlonu,rlatv,ib) |
---|
[1000] | 277 | |
---|
[1319] | 278 | WRITE(lunout,*) 'T3D min,max:',minval(t3d(:,:,:)),maxval(t3d(:,:,:)) |
---|
| 279 | WRITE(lunout,*) 'PLS min,max:',minval(pls(:,:,:)),maxval(pls(:,:,:)) |
---|
[1000] | 280 | |
---|
[1319] | 281 | ! Humidity at saturation computation |
---|
| 282 | !******************************************************************************* |
---|
| 283 | WRITE(lunout,*) 'avant q_sat' |
---|
| 284 | CALL q_sat(llm*jjp1*iip1, t3d, pls, qsat) |
---|
| 285 | WRITE(lunout,*) 'apres q_sat' |
---|
| 286 | WRITE(lunout,*) 'QSAT min,max:',minval(qsat(:,:,:)),maxval(qsat(:,:,:)) |
---|
| 287 | ! WRITE(lunout,*) 'QSAT :',qsat(10,20,:) |
---|
[1000] | 288 | |
---|
[1319] | 289 | x = 'q'; qd (:,:,:) = 0.0 |
---|
[1323] | 290 | CALL startget_dyn(x,rlonv,rlatu,pls,qsat,qd,0.0, rlonu,rlatv,ib) |
---|
[1319] | 291 | q3d(:,:,:,:) = 0.0 ; q3d(:,:,:,1) = qd(:,:,:) |
---|
[1000] | 292 | |
---|
[1406] | 293 | ! Parameterization of ozone chemistry: |
---|
| 294 | ! Look for ozone tracer: |
---|
| 295 | i = 1 |
---|
| 296 | DO |
---|
| 297 | found = tname(i)=="O3" .OR. tname(i)=="o3" |
---|
| 298 | if (found .or. i == nqtot) exit |
---|
| 299 | i = i + 1 |
---|
| 300 | end do |
---|
| 301 | if (found) then |
---|
| 302 | call regr_lat_time_coefoz |
---|
| 303 | call press_coefoz |
---|
| 304 | call regr_pr_o3(p3d, q3d(:, :, :, i)) |
---|
| 305 | ! Convert from mole fraction to mass fraction: |
---|
| 306 | q3d(:, :, :, i) = q3d(:, :, :, i) * 48. / 29. |
---|
| 307 | end if |
---|
| 308 | |
---|
[1319] | 309 | !--- OZONE CLIMATOLOGY |
---|
| 310 | IF(read_climoz>=1) CALL regr_lat_time_climoz(read_climoz) |
---|
[1000] | 311 | |
---|
[1319] | 312 | x = 'tsol'; tsol(:) = 0.0 |
---|
[1323] | 313 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,tsol,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 314 | |
---|
[1319] | 315 | x = 'qsol'; qsol(:) = 0.0 |
---|
[1323] | 316 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,qsol,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 317 | |
---|
[1319] | 318 | x = 'snow'; sn(:) = 0.0 |
---|
[1323] | 319 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,sn,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 320 | |
---|
[1319] | 321 | x = 'rads'; radsol(:) = 0.0 |
---|
[1323] | 322 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,radsol,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 323 | |
---|
[1319] | 324 | x = 'rugmer'; rugmer(:) = 0.0 |
---|
[1323] | 325 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,rugmer,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 326 | |
---|
[1319] | 327 | x = 'zmea'; zmea(:) = 0.0 |
---|
[1323] | 328 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zmea,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 329 | |
---|
[1319] | 330 | x = 'zstd'; zstd(:) = 0.0 |
---|
[1323] | 331 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zstd,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 332 | |
---|
[1319] | 333 | x = 'zsig'; zsig(:) = 0.0 |
---|
[1323] | 334 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zsig,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 335 | |
---|
[1319] | 336 | x = 'zgam'; zgam(:) = 0.0 |
---|
[1323] | 337 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zgam,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 338 | |
---|
[1319] | 339 | x = 'zthe'; zthe(:) = 0.0 |
---|
[1323] | 340 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zthe,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 341 | |
---|
[1319] | 342 | x = 'zpic'; zpic(:) = 0.0 |
---|
[1323] | 343 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zpic,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 344 | |
---|
[1319] | 345 | x = 'zval'; zval(:) = 0.0 |
---|
[1323] | 346 | CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zval,0.0,jjm,rlonu,rlatv,ib) |
---|
[1000] | 347 | |
---|
[1319] | 348 | ! WRITE(lunout,'(48I3)') 'TSOL :', INT(tsol(2:klon)-273) |
---|
[1000] | 349 | |
---|
[1319] | 350 | ! Soil ice file reading for soil fraction and soil ice fraction |
---|
| 351 | !******************************************************************************* |
---|
| 352 | CALL flininfo("landiceref.nc", iml_lic, jml_lic, llm_tmp, ttm_tmp, fid) |
---|
| 353 | ALLOCATE( lat_lic(iml_lic,jml_lic),lon_lic(iml_lic, jml_lic)) |
---|
| 354 | ALLOCATE(dlat_lic(jml_lic), dlon_lic(iml_lic)) |
---|
| 355 | ALLOCATE( fraclic(iml_lic,jml_lic)) |
---|
[1323] | 356 | CALL flinopen("landiceref.nc", .FALSE., iml_lic, jml_lic, llm_tmp, & |
---|
| 357 | & lon_lic, lat_lic, lev, ttm_tmp, itaul, date, dt, fid) |
---|
[1319] | 358 | CALL flinget(fid, 'landice', iml_lic, jml_lic, llm_tmp, ttm_tmp, 1,1, fraclic) |
---|
| 359 | CALL flinclo(fid) |
---|
[1000] | 360 | |
---|
[1319] | 361 | ! Interpolation on model T-grid |
---|
| 362 | !******************************************************************************* |
---|
| 363 | WRITE(lunout,*)'dimensions de landice iml_lic, jml_lic : ',iml_lic,jml_lic |
---|
| 364 | ! conversion if coordinates are in degrees |
---|
| 365 | IF(MAXVAL(lon_lic)>pi) lon_lic=lon_lic*pi/180. |
---|
| 366 | IF(MAXVAL(lat_lic)>pi) lat_lic=lat_lic*pi/180. |
---|
| 367 | dlon_lic(:)=lon_lic(:,1) |
---|
| 368 | dlat_lic(:)=lat_lic(1,:) |
---|
[1323] | 369 | CALL grille_m( iml_lic, jml_lic, dlon_lic, dlat_lic, fraclic, iim,jjp1, & |
---|
| 370 | & rlonv, rlatu, flic_tmp(1:iim,:) ) |
---|
[1319] | 371 | flic_tmp(iip1,:)=flic_tmp(1,:) |
---|
[1000] | 372 | |
---|
[1319] | 373 | !--- To the physical grid |
---|
| 374 | CALL gr_dyn_fi(1, iip1, jjp1, klon, flic_tmp, pctsrf(:,is_lic)) |
---|
[1000] | 375 | |
---|
[1319] | 376 | !--- Adequation with soil/sea mask |
---|
| 377 | WHERE(pctsrf(:,is_lic)<EPSFRA) pctsrf(:,is_lic)=0. |
---|
| 378 | WHERE(zmasq(:)<EPSFRA) pctsrf(:,is_lic)=0. |
---|
| 379 | pctsrf(:,is_ter)=zmasq(:) |
---|
| 380 | DO ji=1,klon |
---|
| 381 | IF(zmasq(ji)>EPSFRA) THEN |
---|
| 382 | IF(pctsrf(ji,is_lic)>=zmasq(ji)) THEN |
---|
| 383 | pctsrf(ji,is_lic)=zmasq(ji) |
---|
| 384 | pctsrf(ji,is_ter)=0. |
---|
| 385 | ELSE |
---|
| 386 | pctsrf(ji,is_ter)=zmasq(ji)-pctsrf(ji,is_lic) |
---|
| 387 | IF(pctsrf(ji,is_ter)<EPSFRA) THEN |
---|
| 388 | pctsrf(ji,is_ter)=0. |
---|
| 389 | pctsrf(ji,is_lic)=zmasq(ji) |
---|
| 390 | END IF |
---|
| 391 | END IF |
---|
| 392 | END IF |
---|
| 393 | END DO |
---|
[1000] | 394 | |
---|
[1319] | 395 | ! sub-surface ocean and sea ice (sea ice set to zero for start) |
---|
| 396 | !******************************************************************************* |
---|
| 397 | pctsrf(:,is_oce)=(1.-zmasq(:)) |
---|
| 398 | WHERE(pctsrf(:,is_oce)<EPSFRA) pctsrf(:,is_oce)=0. |
---|
| 399 | IF(couple) pctsrf(:,is_oce)=ocemask_fi(:) |
---|
| 400 | isst=0 |
---|
| 401 | WHERE(pctsrf(2:klon-1,is_oce)>0.) isst=1 |
---|
[1000] | 402 | |
---|
[1319] | 403 | ! It is checked that the sub-surfaces sum is equal to 1 |
---|
| 404 | !******************************************************************************* |
---|
| 405 | ji=COUNT((ABS(SUM(pctsrf(:,:),dim=2))-1.0)>EPSFRA) |
---|
| 406 | IF(ji/=0) WRITE(lunout,*) 'pb repartition sous maille pour ',ji,' points' |
---|
| 407 | CALL gr_fi_ecrit(1, klon, iim, jjp1, zmasq, zx_tmp_2d) |
---|
| 408 | ! WRITE(fmt,"(i3,')')")iim; fmt='(i'//ADJUSTL(fmt) |
---|
| 409 | ! WRITE(lunout,*)'zmasq = ' |
---|
| 410 | ! WRITE(lunout,TRIM(fmt))NINT(zx_tmp_2d) |
---|
| 411 | CALL gr_fi_dyn(1, klon, iip1, jjp1, zmasq, masque) |
---|
| 412 | WRITE(fmt,"(i4,'i1)')")iip1 ; fmt='('//ADJUSTL(fmt) |
---|
| 413 | WRITE(lunout,*) 'MASQUE construit : Masque' |
---|
| 414 | WRITE(lunout,TRIM(fmt))NINT(masque(:,:)) |
---|
[1000] | 415 | |
---|
[1319] | 416 | ! Intermediate computation |
---|
| 417 | !******************************************************************************* |
---|
| 418 | CALL massdair(p3d,masse) |
---|
| 419 | WRITE(lunout,*)' ALPHAX ',alphax |
---|
| 420 | DO l=1,llm |
---|
| 421 | xppn(:)=aire(1:iim,1 )*masse(1:iim,1 ,l) |
---|
| 422 | xpps(:)=aire(1:iim,jjp1)*masse(1:iim,jjp1,l) |
---|
| 423 | xpn=SUM(xppn)/apoln |
---|
| 424 | xps=SUM(xpps)/apols |
---|
| 425 | masse(:,1 ,l)=xpn |
---|
| 426 | masse(:,jjp1,l)=xps |
---|
| 427 | END DO |
---|
| 428 | q3d(iip1,:,:,:)=q3d(1,:,:,:) |
---|
| 429 | phis(iip1,:) = phis(1,:) |
---|
[1000] | 430 | |
---|
[1319] | 431 | IF(.NOT.letat0) RETURN |
---|
[1146] | 432 | |
---|
[1319] | 433 | ! Writing |
---|
| 434 | !******************************************************************************* |
---|
| 435 | CALL inidissip(lstardis,nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,tetatemp) |
---|
| 436 | WRITE(lunout,*)'sortie inidissip' |
---|
| 437 | itau=0 |
---|
| 438 | itau_dyn=0 |
---|
| 439 | itau_phy=0 |
---|
| 440 | iday=dayref+itau/day_step |
---|
| 441 | time=FLOAT(itau-(iday-dayref)*day_step)/day_step |
---|
| 442 | IF(time>1.) THEN |
---|
| 443 | time=time-1 |
---|
| 444 | iday=iday+1 |
---|
| 445 | END IF |
---|
| 446 | day_ref=dayref |
---|
| 447 | annee_ref=anneeref |
---|
| 448 | |
---|
| 449 | CALL geopot( ip1jmp1, tpot, pk, pks, phis, phi ) |
---|
| 450 | WRITE(lunout,*)'sortie geopot' |
---|
| 451 | |
---|
| 452 | CALL caldyn0( itau, uvent, vvent, tpot, psol, masse, pk, phis, & |
---|
| 453 | phi, w, pbaru, pbarv, time+iday-dayref) |
---|
| 454 | WRITE(lunout,*)'sortie caldyn0' |
---|
| 455 | CALL dynredem0( "start.nc", dayref, phis) |
---|
| 456 | WRITE(lunout,*)'sortie dynredem0' |
---|
| 457 | CALL dynredem1( "start.nc", 0.0, vvent, uvent, tpot, q3d, masse, psol) |
---|
| 458 | WRITE(lunout,*)'sortie dynredem1' |
---|
| 459 | |
---|
| 460 | ! Physical initial state writting |
---|
| 461 | !******************************************************************************* |
---|
| 462 | WRITE(lunout,*)'phystep ',dtvr,iphysiq,nbapp_rad |
---|
| 463 | phystep = dtvr * FLOAT(iphysiq) |
---|
| 464 | radpas = NINT (86400./phystep/ FLOAT(nbapp_rad) ) |
---|
| 465 | WRITE(lunout,*)'phystep =', phystep, radpas |
---|
| 466 | |
---|
| 467 | ! Init: tsol, qsol, sn, evap, tsoil, rain_fall, snow_fall, solsw, sollw, frugs |
---|
| 468 | !******************************************************************************* |
---|
| 469 | DO i=1,nbsrf; ftsol(:,i) = tsol; END DO |
---|
| 470 | DO i=1,nbsrf; snsrf(:,i) = sn; END DO |
---|
| 471 | falb1(:,is_ter) = 0.08; falb1(:,is_lic) = 0.6 |
---|
| 472 | falb1(:,is_oce) = 0.5; falb1(:,is_sic) = 0.6 |
---|
| 473 | falb2 = falb1 |
---|
| 474 | evap(:,:) = 0. |
---|
| 475 | DO i=1,nbsrf; qsolsrf(:,i)=150.; END DO |
---|
| 476 | DO i=1,nbsrf; DO j=1,nsoilmx; tsoil(:,j,i) = tsol; END DO; END DO |
---|
| 477 | rain_fall = 0.; snow_fall = 0. |
---|
| 478 | solsw = 165.; sollw = -53. |
---|
| 479 | t_ancien = 273.15 |
---|
| 480 | q_ancien = 0. |
---|
| 481 | agesno = 0. |
---|
| 482 | frugs(:,is_oce) = rugmer(:) |
---|
| 483 | frugs(:,is_ter) = MAX(1.0e-05,zstd(:)*zsig(:)/2.0) |
---|
| 484 | frugs(:,is_lic) = MAX(1.0e-05,zstd(:)*zsig(:)/2.0) |
---|
| 485 | frugs(:,is_sic) = 0.001 |
---|
| 486 | fder = 0.0 |
---|
| 487 | clwcon = 0.0 |
---|
| 488 | rnebcon = 0.0 |
---|
| 489 | ratqs = 0.0 |
---|
| 490 | run_off_lic_0 = 0.0 |
---|
| 491 | rugoro = 0.0 |
---|
| 492 | |
---|
| 493 | ! Before phyredem calling, surface modules and values to be saved in startphy.nc |
---|
| 494 | ! are initialized |
---|
| 495 | !******************************************************************************* |
---|
| 496 | dummy = 1.0 |
---|
| 497 | pbl_tke(:,:,:) = 1.e-8 |
---|
| 498 | zmax0(:) = 40. |
---|
| 499 | f0(:) = 1.e-5 |
---|
| 500 | ema_work1(:,:) = 0. |
---|
| 501 | ema_work2(:,:) = 0. |
---|
| 502 | wake_deltat(:,:) = 0. |
---|
| 503 | wake_deltaq(:,:) = 0. |
---|
| 504 | wake_s(:) = 0. |
---|
| 505 | wake_cstar(:) = 0. |
---|
| 506 | wake_fip(:) = 0. |
---|
[1425] | 507 | wake_pe = 0. |
---|
| 508 | fm_therm = 0. |
---|
| 509 | entr_therm = 0. |
---|
| 510 | detr_therm = 0. |
---|
| 511 | |
---|
[1319] | 512 | CALL fonte_neige_init(run_off_lic_0) |
---|
| 513 | CALL pbl_surface_init( qsol, fder, snsrf, qsolsrf, evap, frugs, agesno, tsoil ) |
---|
| 514 | CALL phyredem( "startphy.nc" ) |
---|
| 515 | |
---|
[1323] | 516 | ! WRITE(lunout,*)'CCCCCCCCCCCCCCCCCC REACTIVER SORTIE VISU DANS ETAT0' |
---|
| 517 | ! WRITE(lunout,*)'entree histclo' |
---|
[1319] | 518 | CALL histclo() |
---|
| 519 | |
---|
[1146] | 520 | #endif |
---|
| 521 | !#endif of #ifdef CPP_EARTH |
---|
[1319] | 522 | RETURN |
---|
| 523 | |
---|
| 524 | END SUBROUTINE etat0_netcdf |
---|
| 525 | ! |
---|
| 526 | !------------------------------------------------------------------------------- |
---|