[781] | 1 | ! |
---|
| 2 | MODULE surf_land_orchidee_mod |
---|
[1146] | 3 | #ifndef ORCHIDEE_NOOPENMP |
---|
[2571] | 4 | #ifndef ORCHIDEE_NOZ0H |
---|
[2952] | 5 | #ifndef ORCHIDEE_NOFREIN |
---|
[781] | 6 | ! |
---|
[2410] | 7 | ! This module controles the interface towards the model ORCHIDEE. |
---|
[781] | 8 | ! |
---|
[2410] | 9 | ! Compatibility with ORCHIDIEE : |
---|
[2952] | 10 | ! The current version can be used with ORCHIDEE/trunk from revision 4465. |
---|
| 11 | ! This interface is used if none of the cpp keys ORCHIDEE_NOOPENMP, |
---|
| 12 | ! ORCHIDEE_NOZ0H or ORCHIDEE_NOFREIN is set. |
---|
[2410] | 13 | ! |
---|
[781] | 14 | ! Subroutines in this module : surf_land_orchidee |
---|
| 15 | ! Init_orchidee_index |
---|
| 16 | ! Get_orchidee_communicator |
---|
| 17 | ! Init_neighbours |
---|
| 18 | |
---|
| 19 | USE dimphy |
---|
[1067] | 20 | #ifdef CPP_VEGET |
---|
[781] | 21 | USE intersurf ! module d'ORCHIDEE |
---|
[1067] | 22 | #endif |
---|
[781] | 23 | USE cpl_mod, ONLY : cpl_send_land_fields |
---|
[996] | 24 | USE surface_data, ONLY : type_ocean |
---|
[2351] | 25 | USE geometry_mod, ONLY : dx, dy |
---|
[781] | 26 | USE mod_grid_phy_lmdz |
---|
[2351] | 27 | USE mod_phys_lmdz_para, mpi_root_rank=>mpi_master |
---|
[781] | 28 | |
---|
| 29 | IMPLICIT NONE |
---|
| 30 | |
---|
| 31 | PRIVATE |
---|
| 32 | PUBLIC :: surf_land_orchidee |
---|
| 33 | |
---|
| 34 | CONTAINS |
---|
| 35 | ! |
---|
| 36 | !**************************************************************************************** |
---|
| 37 | ! |
---|
| 38 | SUBROUTINE surf_land_orchidee(itime, dtime, date0, knon, & |
---|
[2410] | 39 | knindex, rlon, rlat, yrmu0, pctsrf, & |
---|
[781] | 40 | debut, lafin, & |
---|
[2240] | 41 | plev, u1_lay, v1_lay, gustiness, temp_air, spechum, epot_air, ccanopy, & |
---|
[781] | 42 | tq_cdrag, petAcoef, peqAcoef, petBcoef, peqBcoef, & |
---|
| 43 | precip_rain, precip_snow, lwdown, swnet, swdown, & |
---|
[1146] | 44 | ps, q2m, t2m, & |
---|
[781] | 45 | evap, fluxsens, fluxlat, & |
---|
[888] | 46 | tsol_rad, tsurf_new, alb1_new, alb2_new, & |
---|
[2952] | 47 | emis_new, z0m_new, z0h_new, qsurf, & |
---|
| 48 | veget, lai, height ) |
---|
[1279] | 49 | |
---|
[2952] | 50 | |
---|
[1279] | 51 | USE mod_surf_para |
---|
| 52 | USE mod_synchro_omp |
---|
[1454] | 53 | USE carbon_cycle_mod, ONLY : carbon_cycle_cpl |
---|
[1785] | 54 | USE indice_sol_mod |
---|
[2311] | 55 | USE print_control_mod, ONLY: lunout |
---|
[2344] | 56 | USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat |
---|
[2348] | 57 | #ifdef CPP_VEGET |
---|
| 58 | USE time_phylmdz_mod, ONLY: itau_phy |
---|
| 59 | #endif |
---|
[781] | 60 | ! |
---|
| 61 | ! Cette routine sert d'interface entre le modele atmospherique et le |
---|
| 62 | ! modele de sol continental. Appel a sechiba |
---|
| 63 | ! |
---|
| 64 | ! L. Fairhead 02/2000 |
---|
| 65 | ! |
---|
| 66 | ! input: |
---|
| 67 | ! itime numero du pas de temps |
---|
| 68 | ! dtime pas de temps de la physique (en s) |
---|
| 69 | ! nisurf index de la surface a traiter (1 = sol continental) |
---|
| 70 | ! knon nombre de points de la surface a traiter |
---|
| 71 | ! knindex index des points de la surface a traiter |
---|
| 72 | ! rlon longitudes de la grille entiere |
---|
| 73 | ! rlat latitudes de la grille entiere |
---|
| 74 | ! pctsrf tableau des fractions de surface de chaque maille |
---|
| 75 | ! debut logical: 1er appel a la physique (lire les restart) |
---|
| 76 | ! lafin logical: dernier appel a la physique (ecrire les restart) |
---|
| 77 | ! (si false calcul simplifie des fluxs sur les continents) |
---|
| 78 | ! plev hauteur de la premiere couche (Pa) |
---|
| 79 | ! u1_lay vitesse u 1ere couche |
---|
| 80 | ! v1_lay vitesse v 1ere couche |
---|
| 81 | ! temp_air temperature de l'air 1ere couche |
---|
| 82 | ! spechum humidite specifique 1ere couche |
---|
| 83 | ! epot_air temp pot de l'air |
---|
[1279] | 84 | ! ccanopy concentration CO2 canopee, correspond au co2_send de |
---|
| 85 | ! carbon_cycle_mod ou valeur constant co2_ppm |
---|
[781] | 86 | ! tq_cdrag cdrag |
---|
| 87 | ! petAcoef coeff. A de la resolution de la CL pour t |
---|
| 88 | ! peqAcoef coeff. A de la resolution de la CL pour q |
---|
| 89 | ! petBcoef coeff. B de la resolution de la CL pour t |
---|
| 90 | ! peqBcoef coeff. B de la resolution de la CL pour q |
---|
| 91 | ! precip_rain precipitation liquide |
---|
| 92 | ! precip_snow precipitation solide |
---|
| 93 | ! lwdown flux IR descendant a la surface |
---|
| 94 | ! swnet flux solaire net |
---|
| 95 | ! swdown flux solaire entrant a la surface |
---|
| 96 | ! ps pression au sol |
---|
| 97 | ! radsol rayonnement net aus sol (LW + SW) |
---|
| 98 | ! |
---|
| 99 | ! |
---|
| 100 | ! output: |
---|
| 101 | ! evap evaporation totale |
---|
| 102 | ! fluxsens flux de chaleur sensible |
---|
| 103 | ! fluxlat flux de chaleur latente |
---|
| 104 | ! tsol_rad |
---|
| 105 | ! tsurf_new temperature au sol |
---|
[888] | 106 | ! alb1_new albedo in visible SW interval |
---|
| 107 | ! alb2_new albedo in near IR interval |
---|
[781] | 108 | ! emis_new emissivite |
---|
[2571] | 109 | ! z0m_new surface roughness for momentum |
---|
| 110 | ! z0h_new surface roughness for heat |
---|
[781] | 111 | ! qsurf air moisture at surface |
---|
| 112 | ! |
---|
[793] | 113 | INCLUDE "YOMCST.h" |
---|
[2952] | 114 | INCLUDE "dimpft.h" |
---|
| 115 | |
---|
| 116 | |
---|
[781] | 117 | |
---|
| 118 | ! |
---|
| 119 | ! Parametres d'entree |
---|
| 120 | !**************************************************************************************** |
---|
| 121 | INTEGER, INTENT(IN) :: itime |
---|
| 122 | REAL, INTENT(IN) :: dtime |
---|
| 123 | REAL, INTENT(IN) :: date0 |
---|
| 124 | INTEGER, INTENT(IN) :: knon |
---|
| 125 | INTEGER, DIMENSION(klon), INTENT(IN) :: knindex |
---|
| 126 | LOGICAL, INTENT(IN) :: debut, lafin |
---|
| 127 | REAL, DIMENSION(klon,nbsrf), INTENT(IN) :: pctsrf |
---|
| 128 | REAL, DIMENSION(klon), INTENT(IN) :: rlon, rlat |
---|
[2410] | 129 | REAL, DIMENSION(klon), INTENT(IN) :: yrmu0 ! cosine of solar zenith angle |
---|
[781] | 130 | REAL, DIMENSION(klon), INTENT(IN) :: plev |
---|
[2240] | 131 | REAL, DIMENSION(klon), INTENT(IN) :: u1_lay, v1_lay, gustiness |
---|
[781] | 132 | REAL, DIMENSION(klon), INTENT(IN) :: temp_air, spechum |
---|
| 133 | REAL, DIMENSION(klon), INTENT(IN) :: epot_air, ccanopy |
---|
| 134 | REAL, DIMENSION(klon), INTENT(IN) :: tq_cdrag |
---|
| 135 | REAL, DIMENSION(klon), INTENT(IN) :: petAcoef, peqAcoef |
---|
| 136 | REAL, DIMENSION(klon), INTENT(IN) :: petBcoef, peqBcoef |
---|
| 137 | REAL, DIMENSION(klon), INTENT(IN) :: precip_rain, precip_snow |
---|
| 138 | REAL, DIMENSION(klon), INTENT(IN) :: lwdown, swnet, swdown, ps |
---|
[1146] | 139 | REAL, DIMENSION(klon), INTENT(IN) :: q2m, t2m |
---|
[781] | 140 | |
---|
| 141 | ! Parametres de sortie |
---|
| 142 | !**************************************************************************************** |
---|
| 143 | REAL, DIMENSION(klon), INTENT(OUT) :: evap, fluxsens, fluxlat, qsurf |
---|
[888] | 144 | REAL, DIMENSION(klon), INTENT(OUT) :: tsol_rad, tsurf_new |
---|
| 145 | REAL, DIMENSION(klon), INTENT(OUT) :: alb1_new, alb2_new |
---|
[2571] | 146 | REAL, DIMENSION(klon), INTENT(OUT) :: emis_new, z0m_new, z0h_new |
---|
[2952] | 147 | REAL, DIMENSION(klon,nvm_lmdz), INTENT(OUT) :: veget |
---|
| 148 | REAL, DIMENSION(klon,nvm_lmdz), INTENT(OUT) :: lai |
---|
| 149 | REAL, DIMENSION(klon,nvm_lmdz), INTENT(OUT) :: height |
---|
[781] | 150 | |
---|
[2952] | 151 | |
---|
[781] | 152 | ! Local |
---|
| 153 | !**************************************************************************************** |
---|
| 154 | INTEGER :: ij, jj, igrid, ireal, index |
---|
| 155 | INTEGER :: error |
---|
[1146] | 156 | REAL, DIMENSION(klon) :: swdown_vrai |
---|
[781] | 157 | CHARACTER (len = 20) :: modname = 'surf_land_orchidee' |
---|
| 158 | CHARACTER (len = 80) :: abort_message |
---|
| 159 | LOGICAL,SAVE :: check = .FALSE. |
---|
| 160 | !$OMP THREADPRIVATE(check) |
---|
| 161 | |
---|
| 162 | ! type de couplage dans sechiba |
---|
| 163 | ! character (len=10) :: coupling = 'implicit' |
---|
| 164 | ! drapeaux controlant les appels dans SECHIBA |
---|
| 165 | ! type(control_type), save :: control_in |
---|
| 166 | ! Preserved albedo |
---|
| 167 | REAL, ALLOCATABLE, DIMENSION(:), SAVE :: albedo_keep, zlev |
---|
| 168 | !$OMP THREADPRIVATE(albedo_keep,zlev) |
---|
| 169 | ! coordonnees geographiques |
---|
| 170 | REAL, ALLOCATABLE, DIMENSION(:,:), SAVE :: lalo |
---|
| 171 | !$OMP THREADPRIVATE(lalo) |
---|
| 172 | ! pts voisins |
---|
| 173 | INTEGER,ALLOCATABLE, DIMENSION(:,:), SAVE :: neighbours |
---|
| 174 | !$OMP THREADPRIVATE(neighbours) |
---|
| 175 | ! fractions continents |
---|
| 176 | REAL,ALLOCATABLE, DIMENSION(:), SAVE :: contfrac |
---|
| 177 | !$OMP THREADPRIVATE(contfrac) |
---|
| 178 | ! resolution de la grille |
---|
| 179 | REAL, ALLOCATABLE, DIMENSION (:,:), SAVE :: resolution |
---|
| 180 | !$OMP THREADPRIVATE(resolution) |
---|
| 181 | |
---|
| 182 | REAL, ALLOCATABLE, DIMENSION (:,:), SAVE :: lon_scat, lat_scat |
---|
| 183 | !$OMP THREADPRIVATE(lon_scat,lat_scat) |
---|
| 184 | |
---|
| 185 | LOGICAL, SAVE :: lrestart_read = .TRUE. |
---|
| 186 | !$OMP THREADPRIVATE(lrestart_read) |
---|
| 187 | LOGICAL, SAVE :: lrestart_write = .FALSE. |
---|
| 188 | !$OMP THREADPRIVATE(lrestart_write) |
---|
| 189 | |
---|
| 190 | REAL, DIMENSION(knon,2) :: albedo_out |
---|
| 191 | |
---|
| 192 | ! Pb de nomenclature |
---|
| 193 | REAL, DIMENSION(klon) :: petA_orc, peqA_orc |
---|
| 194 | REAL, DIMENSION(klon) :: petB_orc, peqB_orc |
---|
| 195 | ! Pb de correspondances de grilles |
---|
| 196 | INTEGER, DIMENSION(:), SAVE, ALLOCATABLE :: ig, jg |
---|
| 197 | !$OMP THREADPRIVATE(ig,jg) |
---|
| 198 | INTEGER :: indi, indj |
---|
| 199 | INTEGER, SAVE, ALLOCATABLE,DIMENSION(:) :: ktindex |
---|
| 200 | !$OMP THREADPRIVATE(ktindex) |
---|
| 201 | |
---|
| 202 | ! Essai cdrag |
---|
| 203 | REAL, DIMENSION(klon) :: cdrag |
---|
| 204 | INTEGER,SAVE :: offset |
---|
| 205 | !$OMP THREADPRIVATE(offset) |
---|
| 206 | |
---|
| 207 | REAL, DIMENSION(klon_glo) :: rlon_g,rlat_g |
---|
| 208 | INTEGER, SAVE :: orch_comm |
---|
| 209 | !$OMP THREADPRIVATE(orch_comm) |
---|
| 210 | |
---|
| 211 | REAL, ALLOCATABLE, DIMENSION(:), SAVE :: coastalflow |
---|
| 212 | !$OMP THREADPRIVATE(coastalflow) |
---|
| 213 | REAL, ALLOCATABLE, DIMENSION(:), SAVE :: riverflow |
---|
| 214 | !$OMP THREADPRIVATE(riverflow) |
---|
[987] | 215 | |
---|
| 216 | INTEGER :: orch_omp_rank |
---|
| 217 | INTEGER :: orch_omp_size |
---|
[781] | 218 | ! |
---|
| 219 | ! Fin definition |
---|
| 220 | !**************************************************************************************** |
---|
| 221 | |
---|
| 222 | IF (check) WRITE(lunout,*)'Entree ', modname |
---|
| 223 | |
---|
| 224 | ! Initialisation |
---|
| 225 | |
---|
| 226 | IF (debut) THEN |
---|
[1067] | 227 | ! Test of coherence between variable ok_veget and cpp key CPP_VEGET |
---|
| 228 | #ifndef CPP_VEGET |
---|
| 229 | abort_message='Pb de coherence: ok_veget = .true. mais CPP_VEGET = .false.' |
---|
[2311] | 230 | CALL abort_physic(modname,abort_message,1) |
---|
[1067] | 231 | #endif |
---|
| 232 | |
---|
[987] | 233 | CALL Init_surf_para(knon) |
---|
[781] | 234 | ALLOCATE(ktindex(knon)) |
---|
| 235 | IF ( .NOT. ALLOCATED(albedo_keep)) THEN |
---|
[987] | 236 | !ym ALLOCATE(albedo_keep(klon)) |
---|
| 237 | !ym bizarre que non alloué en knon precedement |
---|
| 238 | ALLOCATE(albedo_keep(knon)) |
---|
[781] | 239 | ALLOCATE(zlev(knon)) |
---|
| 240 | ENDIF |
---|
| 241 | ! Pb de correspondances de grilles |
---|
| 242 | ALLOCATE(ig(klon)) |
---|
| 243 | ALLOCATE(jg(klon)) |
---|
| 244 | ig(1) = 1 |
---|
| 245 | jg(1) = 1 |
---|
| 246 | indi = 0 |
---|
| 247 | indj = 2 |
---|
| 248 | DO igrid = 2, klon - 1 |
---|
| 249 | indi = indi + 1 |
---|
[2344] | 250 | IF ( indi > nbp_lon) THEN |
---|
[781] | 251 | indi = 1 |
---|
| 252 | indj = indj + 1 |
---|
| 253 | ENDIF |
---|
| 254 | ig(igrid) = indi |
---|
| 255 | jg(igrid) = indj |
---|
| 256 | ENDDO |
---|
| 257 | ig(klon) = 1 |
---|
[2344] | 258 | jg(klon) = nbp_lat |
---|
[781] | 259 | |
---|
| 260 | IF ((.NOT. ALLOCATED(lalo))) THEN |
---|
| 261 | ALLOCATE(lalo(knon,2), stat = error) |
---|
| 262 | IF (error /= 0) THEN |
---|
| 263 | abort_message='Pb allocation lalo' |
---|
[2311] | 264 | CALL abort_physic(modname,abort_message,1) |
---|
[781] | 265 | ENDIF |
---|
| 266 | ENDIF |
---|
| 267 | IF ((.NOT. ALLOCATED(lon_scat))) THEN |
---|
[2344] | 268 | ALLOCATE(lon_scat(nbp_lon,nbp_lat), stat = error) |
---|
[781] | 269 | IF (error /= 0) THEN |
---|
| 270 | abort_message='Pb allocation lon_scat' |
---|
[2311] | 271 | CALL abort_physic(modname,abort_message,1) |
---|
[781] | 272 | ENDIF |
---|
| 273 | ENDIF |
---|
| 274 | IF ((.NOT. ALLOCATED(lat_scat))) THEN |
---|
[2344] | 275 | ALLOCATE(lat_scat(nbp_lon,nbp_lat), stat = error) |
---|
[781] | 276 | IF (error /= 0) THEN |
---|
| 277 | abort_message='Pb allocation lat_scat' |
---|
[2311] | 278 | CALL abort_physic(modname,abort_message,1) |
---|
[781] | 279 | ENDIF |
---|
| 280 | ENDIF |
---|
| 281 | lon_scat = 0. |
---|
| 282 | lat_scat = 0. |
---|
| 283 | DO igrid = 1, knon |
---|
| 284 | index = knindex(igrid) |
---|
| 285 | lalo(igrid,2) = rlon(index) |
---|
| 286 | lalo(igrid,1) = rlat(index) |
---|
| 287 | ENDDO |
---|
| 288 | |
---|
| 289 | |
---|
| 290 | |
---|
| 291 | CALL Gather(rlon,rlon_g) |
---|
| 292 | CALL Gather(rlat,rlat_g) |
---|
| 293 | |
---|
| 294 | IF (is_mpi_root) THEN |
---|
| 295 | index = 1 |
---|
[2344] | 296 | DO jj = 2, nbp_lat-1 |
---|
| 297 | DO ij = 1, nbp_lon |
---|
[781] | 298 | index = index + 1 |
---|
| 299 | lon_scat(ij,jj) = rlon_g(index) |
---|
| 300 | lat_scat(ij,jj) = rlat_g(index) |
---|
| 301 | ENDDO |
---|
| 302 | ENDDO |
---|
| 303 | lon_scat(:,1) = lon_scat(:,2) |
---|
| 304 | lat_scat(:,1) = rlat_g(1) |
---|
[2344] | 305 | lon_scat(:,nbp_lat) = lon_scat(:,2) |
---|
| 306 | lat_scat(:,nbp_lat) = rlat_g(klon_glo) |
---|
[781] | 307 | ENDIF |
---|
| 308 | |
---|
[1023] | 309 | CALL bcast(lon_scat) |
---|
| 310 | CALL bcast(lat_scat) |
---|
[781] | 311 | ! |
---|
| 312 | ! Allouer et initialiser le tableau des voisins et des fraction de continents |
---|
| 313 | ! |
---|
| 314 | IF ( (.NOT.ALLOCATED(neighbours))) THEN |
---|
| 315 | ALLOCATE(neighbours(knon,8), stat = error) |
---|
| 316 | IF (error /= 0) THEN |
---|
| 317 | abort_message='Pb allocation neighbours' |
---|
[2311] | 318 | CALL abort_physic(modname,abort_message,1) |
---|
[781] | 319 | ENDIF |
---|
| 320 | ENDIF |
---|
| 321 | neighbours = -1. |
---|
| 322 | IF (( .NOT. ALLOCATED(contfrac))) THEN |
---|
| 323 | ALLOCATE(contfrac(knon), stat = error) |
---|
| 324 | IF (error /= 0) THEN |
---|
| 325 | abort_message='Pb allocation contfrac' |
---|
[2311] | 326 | CALL abort_physic(modname,abort_message,1) |
---|
[781] | 327 | ENDIF |
---|
| 328 | ENDIF |
---|
| 329 | |
---|
| 330 | DO igrid = 1, knon |
---|
| 331 | ireal = knindex(igrid) |
---|
| 332 | contfrac(igrid) = pctsrf(ireal,is_ter) |
---|
| 333 | ENDDO |
---|
| 334 | |
---|
| 335 | |
---|
| 336 | CALL Init_neighbours(knon,neighbours,knindex,pctsrf(:,is_ter)) |
---|
| 337 | |
---|
| 338 | ! |
---|
| 339 | ! Allocation et calcul resolutions |
---|
| 340 | IF ( (.NOT.ALLOCATED(resolution))) THEN |
---|
| 341 | ALLOCATE(resolution(knon,2), stat = error) |
---|
| 342 | IF (error /= 0) THEN |
---|
| 343 | abort_message='Pb allocation resolution' |
---|
[2311] | 344 | CALL abort_physic(modname,abort_message,1) |
---|
[781] | 345 | ENDIF |
---|
| 346 | ENDIF |
---|
| 347 | DO igrid = 1, knon |
---|
| 348 | ij = knindex(igrid) |
---|
[2351] | 349 | resolution(igrid,1) = dx(ij) |
---|
| 350 | resolution(igrid,2) = dy(ij) |
---|
[781] | 351 | ENDDO |
---|
| 352 | |
---|
| 353 | ALLOCATE(coastalflow(klon), stat = error) |
---|
| 354 | IF (error /= 0) THEN |
---|
| 355 | abort_message='Pb allocation coastalflow' |
---|
[2311] | 356 | CALL abort_physic(modname,abort_message,1) |
---|
[781] | 357 | ENDIF |
---|
| 358 | |
---|
| 359 | ALLOCATE(riverflow(klon), stat = error) |
---|
| 360 | IF (error /= 0) THEN |
---|
| 361 | abort_message='Pb allocation riverflow' |
---|
[2311] | 362 | CALL abort_physic(modname,abort_message,1) |
---|
[781] | 363 | ENDIF |
---|
[1279] | 364 | ! |
---|
[1454] | 365 | ! carbon_cycle_cpl not possible with this interface and version of ORHCHIDEE |
---|
[1279] | 366 | ! |
---|
| 367 | IF (carbon_cycle_cpl) THEN |
---|
[1454] | 368 | abort_message='carbon_cycle_cpl not yet possible with this interface of ORCHIDEE' |
---|
[2311] | 369 | CALL abort_physic(modname,abort_message,1) |
---|
[1279] | 370 | END IF |
---|
| 371 | |
---|
[781] | 372 | ENDIF ! (fin debut) |
---|
[1279] | 373 | |
---|
[781] | 374 | |
---|
| 375 | ! |
---|
| 376 | ! Appel a la routine sols continentaux |
---|
| 377 | ! |
---|
| 378 | IF (lafin) lrestart_write = .TRUE. |
---|
| 379 | IF (check) WRITE(lunout,*)'lafin ',lafin,lrestart_write |
---|
[987] | 380 | |
---|
[781] | 381 | petA_orc(1:knon) = petBcoef(1:knon) * dtime |
---|
| 382 | petB_orc(1:knon) = petAcoef(1:knon) |
---|
| 383 | peqA_orc(1:knon) = peqBcoef(1:knon) * dtime |
---|
| 384 | peqB_orc(1:knon) = peqAcoef(1:knon) |
---|
| 385 | |
---|
| 386 | cdrag = 0. |
---|
| 387 | cdrag(1:knon) = tq_cdrag(1:knon) |
---|
| 388 | |
---|
| 389 | ! zlev(1:knon) = (100.*plev(1:knon))/((ps(1:knon)/287.05*temp_air(1:knon))*9.80665) |
---|
[2011] | 390 | ! zlev(1:knon) = (100.*plev(1:knon))/((ps(1:knon)/RD*temp_air(1:knon))*RG) |
---|
| 391 | zlev(1:knon) = plev(1:knon)*RD*temp_air(1:knon)/((ps(1:knon)*100.0)*RG) |
---|
[781] | 392 | |
---|
| 393 | |
---|
| 394 | ! PF et PASB |
---|
| 395 | ! where(cdrag > 0.01) |
---|
| 396 | ! cdrag = 0.01 |
---|
| 397 | ! endwhere |
---|
| 398 | ! write(*,*)'Cdrag = ',minval(cdrag),maxval(cdrag) |
---|
| 399 | |
---|
| 400 | |
---|
| 401 | IF (debut) THEN |
---|
[987] | 402 | CALL Init_orchidee_index(knon,knindex,offset,ktindex) |
---|
| 403 | CALL Get_orchidee_communicator(orch_comm,orch_omp_size,orch_omp_rank) |
---|
| 404 | CALL Init_synchro_omp |
---|
| 405 | |
---|
[1023] | 406 | IF (knon > 0) THEN |
---|
[1067] | 407 | #ifdef CPP_VEGET |
---|
[987] | 408 | CALL Init_intersurf(nbp_lon,nbp_lat,knon,ktindex,offset,orch_omp_size,orch_omp_rank,orch_comm) |
---|
[1067] | 409 | #endif |
---|
[987] | 410 | ENDIF |
---|
[802] | 411 | |
---|
[987] | 412 | |
---|
| 413 | IF (knon > 0) THEN |
---|
| 414 | |
---|
[1067] | 415 | #ifdef CPP_VEGET |
---|
[2571] | 416 | CALL intersurf_initialize_gathered (itime+itau_phy-1, nbp_lon, nbp_lat, knon, ktindex, dtime, & |
---|
| 417 | lrestart_read, lrestart_write, lalo, contfrac, neighbours, resolution, date0, & |
---|
| 418 | zlev, u1_lay, v1_lay, spechum, temp_air, epot_air, & |
---|
[802] | 419 | cdrag, petA_orc, peqA_orc, petB_orc, peqB_orc, & |
---|
| 420 | precip_rain, precip_snow, lwdown, swnet, swdown, ps, & |
---|
| 421 | evap, fluxsens, fluxlat, coastalflow, riverflow, & |
---|
[2952] | 422 | tsol_rad, tsurf_new, qsurf, albedo_out, emis_new, z0m_new, & |
---|
| 423 | lon_scat, lat_scat, q2m, t2m, z0h_new, nvm_orch) |
---|
[1067] | 424 | #endif |
---|
[781] | 425 | ENDIF |
---|
| 426 | |
---|
[987] | 427 | CALL Synchro_omp |
---|
| 428 | |
---|
[781] | 429 | albedo_keep(1:knon) = (albedo_out(1:knon,1)+albedo_out(1:knon,2))/2. |
---|
| 430 | |
---|
| 431 | ENDIF |
---|
| 432 | |
---|
[987] | 433 | |
---|
[781] | 434 | ! swdown_vrai(1:knon) = swnet(1:knon)/(1. - albedo_keep(1:knon)) |
---|
| 435 | swdown_vrai(1:knon) = swdown(1:knon) |
---|
| 436 | |
---|
[987] | 437 | IF (knon > 0) THEN |
---|
[1067] | 438 | #ifdef CPP_VEGET |
---|
[2952] | 439 | IF (nvm_orch .NE. nvm_lmdz ) THEN |
---|
| 440 | abort_message='Pb de dimensiosn PFT: nvm_orch et nvm_lmdz differents.' |
---|
| 441 | CALL abort_physic(modname,abort_message,1) |
---|
| 442 | ENDIF |
---|
| 443 | |
---|
[2571] | 444 | CALL intersurf_main_gathered (itime+itau_phy, nbp_lon, nbp_lat, knon, ktindex, dtime, & |
---|
[802] | 445 | lrestart_read, lrestart_write, lalo, & |
---|
| 446 | contfrac, neighbours, resolution, date0, & |
---|
[781] | 447 | zlev, u1_lay(1:knon), v1_lay(1:knon), spechum(1:knon), temp_air(1:knon), epot_air(1:knon), ccanopy(1:knon), & |
---|
| 448 | cdrag(1:knon), petA_orc(1:knon), peqA_orc(1:knon), petB_orc(1:knon), peqB_orc(1:knon), & |
---|
| 449 | precip_rain(1:knon), precip_snow(1:knon), lwdown(1:knon), swnet(1:knon), swdown_vrai(1:knon), ps(1:knon), & |
---|
| 450 | evap(1:knon), fluxsens(1:knon), fluxlat(1:knon), coastalflow(1:knon), riverflow(1:knon), & |
---|
[2571] | 451 | tsol_rad(1:knon), tsurf_new(1:knon), qsurf(1:knon), albedo_out(1:knon,:), emis_new(1:knon), z0m_new(1:knon), & |
---|
[2952] | 452 | lon_scat, lat_scat, q2m, t2m, z0h_new(1:knon),& |
---|
| 453 | veget(1:knon,:),lai(1:knon,:),height(1:knon,:),& |
---|
| 454 | coszang=yrmu0(1:knon)) |
---|
[1067] | 455 | #endif |
---|
[781] | 456 | ENDIF |
---|
| 457 | |
---|
[987] | 458 | CALL Synchro_omp |
---|
| 459 | |
---|
[781] | 460 | albedo_keep(1:knon) = (albedo_out(1:knon,1)+albedo_out(1:knon,2))/2. |
---|
| 461 | |
---|
| 462 | !* Send to coupler |
---|
| 463 | ! |
---|
[996] | 464 | IF (type_ocean=='couple') THEN |
---|
[781] | 465 | CALL cpl_send_land_fields(itime, knon, knindex, & |
---|
| 466 | riverflow, coastalflow) |
---|
| 467 | ENDIF |
---|
| 468 | |
---|
[888] | 469 | alb1_new(1:knon) = albedo_out(1:knon,1) |
---|
| 470 | alb2_new(1:knon) = albedo_out(1:knon,2) |
---|
[781] | 471 | |
---|
| 472 | ! Convention orchidee: positif vers le haut |
---|
| 473 | fluxsens(1:knon) = -1. * fluxsens(1:knon) |
---|
| 474 | fluxlat(1:knon) = -1. * fluxlat(1:knon) |
---|
| 475 | |
---|
| 476 | ! evap = -1. * evap |
---|
| 477 | |
---|
| 478 | IF (debut) lrestart_read = .FALSE. |
---|
| 479 | |
---|
[987] | 480 | IF (debut) CALL Finalize_surf_para |
---|
[1279] | 481 | |
---|
[987] | 482 | |
---|
[781] | 483 | END SUBROUTINE surf_land_orchidee |
---|
| 484 | ! |
---|
| 485 | !**************************************************************************************** |
---|
| 486 | ! |
---|
[987] | 487 | SUBROUTINE Init_orchidee_index(knon,knindex,offset,ktindex) |
---|
| 488 | USE mod_surf_para |
---|
| 489 | USE mod_grid_phy_lmdz |
---|
| 490 | |
---|
| 491 | INTEGER,INTENT(IN) :: knon |
---|
| 492 | INTEGER,INTENT(IN) :: knindex(klon) |
---|
| 493 | INTEGER,INTENT(OUT) :: offset |
---|
| 494 | INTEGER,INTENT(OUT) :: ktindex(klon) |
---|
[781] | 495 | |
---|
[987] | 496 | INTEGER :: ktindex_glo(knon_glo) |
---|
| 497 | INTEGER :: offset_para(0:omp_size*mpi_size-1) |
---|
| 498 | INTEGER :: LastPoint |
---|
| 499 | INTEGER :: task |
---|
[781] | 500 | |
---|
[987] | 501 | ktindex(1:knon)=knindex(1:knon)+(klon_mpi_begin-1)+(klon_omp_begin-1)+nbp_lon-1 |
---|
[781] | 502 | |
---|
[987] | 503 | CALL gather_surf(ktindex(1:knon),ktindex_glo) |
---|
| 504 | |
---|
| 505 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 506 | LastPoint=0 |
---|
| 507 | DO Task=0,mpi_size*omp_size-1 |
---|
| 508 | IF (knon_glo_para(Task)>0) THEN |
---|
| 509 | offset_para(task)= LastPoint-MOD(LastPoint,nbp_lon) |
---|
| 510 | LastPoint=ktindex_glo(knon_glo_end_para(task)) |
---|
| 511 | ENDIF |
---|
| 512 | ENDDO |
---|
[781] | 513 | ENDIF |
---|
| 514 | |
---|
[987] | 515 | CALL bcast(offset_para) |
---|
[781] | 516 | |
---|
[987] | 517 | offset=offset_para(omp_size*mpi_rank+omp_rank) |
---|
| 518 | |
---|
| 519 | ktindex(1:knon)=ktindex(1:knon)-offset |
---|
[781] | 520 | |
---|
[987] | 521 | END SUBROUTINE Init_orchidee_index |
---|
| 522 | |
---|
[781] | 523 | ! |
---|
[987] | 524 | !************************* *************************************************************** |
---|
[781] | 525 | ! |
---|
[987] | 526 | |
---|
| 527 | SUBROUTINE Get_orchidee_communicator(orch_comm,orch_omp_size,orch_omp_rank) |
---|
| 528 | USE mod_surf_para |
---|
| 529 | |
---|
[1001] | 530 | #ifdef CPP_MPI |
---|
[781] | 531 | INCLUDE 'mpif.h' |
---|
| 532 | #endif |
---|
| 533 | |
---|
| 534 | INTEGER,INTENT(OUT) :: orch_comm |
---|
[987] | 535 | INTEGER,INTENT(OUT) :: orch_omp_size |
---|
| 536 | INTEGER,INTENT(OUT) :: orch_omp_rank |
---|
[781] | 537 | INTEGER :: color |
---|
[987] | 538 | INTEGER :: i,ierr |
---|
[802] | 539 | ! |
---|
| 540 | ! End definition |
---|
| 541 | !**************************************************************************************** |
---|
[781] | 542 | |
---|
[987] | 543 | |
---|
| 544 | IF (is_omp_root) THEN |
---|
| 545 | |
---|
| 546 | IF (knon_mpi==0) THEN |
---|
| 547 | color = 0 |
---|
| 548 | ELSE |
---|
| 549 | color = 1 |
---|
| 550 | ENDIF |
---|
| 551 | |
---|
[1001] | 552 | #ifdef CPP_MPI |
---|
[987] | 553 | CALL MPI_COMM_SPLIT(COMM_LMDZ_PHY,color,mpi_rank,orch_comm,ierr) |
---|
[781] | 554 | #endif |
---|
[1023] | 555 | |
---|
| 556 | ENDIF |
---|
| 557 | CALL bcast_omp(orch_comm) |
---|
| 558 | |
---|
| 559 | IF (knon_mpi /= 0) THEN |
---|
| 560 | orch_omp_size=0 |
---|
| 561 | DO i=0,omp_size-1 |
---|
| 562 | IF (knon_omp_para(i) /=0) THEN |
---|
| 563 | orch_omp_size=orch_omp_size+1 |
---|
| 564 | IF (i==omp_rank) orch_omp_rank=orch_omp_size-1 |
---|
| 565 | ENDIF |
---|
| 566 | ENDDO |
---|
| 567 | ENDIF |
---|
[987] | 568 | |
---|
[781] | 569 | |
---|
| 570 | END SUBROUTINE Get_orchidee_communicator |
---|
| 571 | ! |
---|
| 572 | !**************************************************************************************** |
---|
| 573 | ! |
---|
[987] | 574 | |
---|
| 575 | SUBROUTINE Init_neighbours(knon,neighbours,knindex,pctsrf) |
---|
| 576 | USE mod_grid_phy_lmdz |
---|
| 577 | USE mod_surf_para |
---|
[1785] | 578 | USE indice_sol_mod |
---|
[987] | 579 | |
---|
[1001] | 580 | #ifdef CPP_MPI |
---|
[781] | 581 | INCLUDE 'mpif.h' |
---|
| 582 | #endif |
---|
| 583 | |
---|
[802] | 584 | ! Input arguments |
---|
| 585 | !**************************************************************************************** |
---|
[781] | 586 | INTEGER, INTENT(IN) :: knon |
---|
[987] | 587 | INTEGER, DIMENSION(klon), INTENT(IN) :: knindex |
---|
[781] | 588 | REAL, DIMENSION(klon), INTENT(IN) :: pctsrf |
---|
| 589 | |
---|
[802] | 590 | ! Output arguments |
---|
| 591 | !**************************************************************************************** |
---|
| 592 | INTEGER, DIMENSION(knon,8), INTENT(OUT) :: neighbours |
---|
| 593 | |
---|
| 594 | ! Local variables |
---|
| 595 | !**************************************************************************************** |
---|
| 596 | INTEGER :: i, igrid, jj, ij, iglob |
---|
| 597 | INTEGER :: ierr, ireal, index |
---|
| 598 | INTEGER, DIMENSION(8,3) :: off_ini |
---|
| 599 | INTEGER, DIMENSION(8) :: offset |
---|
[987] | 600 | INTEGER, DIMENSION(nbp_lon,nbp_lat) :: correspond |
---|
| 601 | INTEGER, DIMENSION(knon_glo) :: ktindex_glo |
---|
| 602 | INTEGER, DIMENSION(knon_glo,8) :: neighbours_glo |
---|
| 603 | REAL, DIMENSION(klon_glo) :: pctsrf_glo |
---|
| 604 | INTEGER :: ktindex(klon) |
---|
[802] | 605 | ! |
---|
| 606 | ! End definition |
---|
| 607 | !**************************************************************************************** |
---|
| 608 | |
---|
[987] | 609 | ktindex(1:knon)=knindex(1:knon)+(klon_mpi_begin-1)+(klon_omp_begin-1)+nbp_lon-1 |
---|
[781] | 610 | |
---|
[987] | 611 | CALL gather_surf(ktindex(1:knon),ktindex_glo) |
---|
| 612 | CALL gather(pctsrf,pctsrf_glo) |
---|
[781] | 613 | |
---|
[987] | 614 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 615 | neighbours_glo(:,:)=-1 |
---|
[781] | 616 | ! Initialisation des offset |
---|
| 617 | ! |
---|
| 618 | ! offset bord ouest |
---|
[987] | 619 | off_ini(1,1) = - nbp_lon ; off_ini(2,1) = - nbp_lon + 1 ; off_ini(3,1) = 1 |
---|
| 620 | off_ini(4,1) = nbp_lon + 1 ; off_ini(5,1) = nbp_lon ; off_ini(6,1) = 2 * nbp_lon - 1 |
---|
| 621 | off_ini(7,1) = nbp_lon -1 ; off_ini(8,1) = - 1 |
---|
[781] | 622 | ! offset point normal |
---|
[987] | 623 | off_ini(1,2) = - nbp_lon ; off_ini(2,2) = - nbp_lon + 1 ; off_ini(3,2) = 1 |
---|
| 624 | off_ini(4,2) = nbp_lon + 1 ; off_ini(5,2) = nbp_lon ; off_ini(6,2) = nbp_lon - 1 |
---|
| 625 | off_ini(7,2) = -1 ; off_ini(8,2) = - nbp_lon - 1 |
---|
[781] | 626 | ! offset bord est |
---|
[987] | 627 | off_ini(1,3) = - nbp_lon ; off_ini(2,3) = - 2 * nbp_lon + 1 ; off_ini(3,3) = - nbp_lon + 1 |
---|
| 628 | off_ini(4,3) = 1 ; off_ini(5,3) = nbp_lon ; off_ini(6,3) = nbp_lon - 1 |
---|
| 629 | off_ini(7,3) = -1 ; off_ini(8,3) = - nbp_lon - 1 |
---|
[781] | 630 | ! |
---|
| 631 | ! |
---|
| 632 | ! Attention aux poles |
---|
| 633 | ! |
---|
[987] | 634 | DO igrid = 1, knon_glo |
---|
| 635 | index = ktindex_glo(igrid) |
---|
| 636 | jj = INT((index - 1)/nbp_lon) + 1 |
---|
| 637 | ij = index - (jj - 1) * nbp_lon |
---|
[781] | 638 | correspond(ij,jj) = igrid |
---|
| 639 | ENDDO |
---|
[2126] | 640 | !sonia : Les mailles des voisines doivent etre toutes egales (pour couplage orchidee) |
---|
| 641 | IF (knon_glo == 1) THEN |
---|
| 642 | igrid = 1 |
---|
| 643 | DO i = 1,8 |
---|
| 644 | neighbours_glo(igrid, i) = igrid |
---|
| 645 | ENDDO |
---|
| 646 | ELSE |
---|
| 647 | print*,'sonia : knon_glo,ij,jj', knon_glo, ij,jj |
---|
[781] | 648 | |
---|
[987] | 649 | DO igrid = 1, knon_glo |
---|
| 650 | iglob = ktindex_glo(igrid) |
---|
| 651 | |
---|
| 652 | IF (MOD(iglob, nbp_lon) == 1) THEN |
---|
[781] | 653 | offset = off_ini(:,1) |
---|
[987] | 654 | ELSE IF(MOD(iglob, nbp_lon) == 0) THEN |
---|
[781] | 655 | offset = off_ini(:,3) |
---|
| 656 | ELSE |
---|
| 657 | offset = off_ini(:,2) |
---|
| 658 | ENDIF |
---|
[987] | 659 | |
---|
[781] | 660 | DO i = 1, 8 |
---|
| 661 | index = iglob + offset(i) |
---|
[987] | 662 | ireal = (MIN(MAX(1, index - nbp_lon + 1), klon_glo)) |
---|
| 663 | IF (pctsrf_glo(ireal) > EPSFRA) THEN |
---|
| 664 | jj = INT((index - 1)/nbp_lon) + 1 |
---|
| 665 | ij = index - (jj - 1) * nbp_lon |
---|
| 666 | neighbours_glo(igrid, i) = correspond(ij, jj) |
---|
[781] | 667 | ENDIF |
---|
| 668 | ENDDO |
---|
| 669 | ENDDO |
---|
[2126] | 670 | ENDIF !fin knon_glo == 1 |
---|
[781] | 671 | |
---|
| 672 | ENDIF |
---|
| 673 | |
---|
[987] | 674 | DO i = 1, 8 |
---|
| 675 | CALL scatter_surf(neighbours_glo(:,i),neighbours(1:knon,i)) |
---|
[781] | 676 | ENDDO |
---|
| 677 | END SUBROUTINE Init_neighbours |
---|
[987] | 678 | |
---|
[781] | 679 | ! |
---|
| 680 | !**************************************************************************************** |
---|
| 681 | ! |
---|
[1146] | 682 | #endif |
---|
[2571] | 683 | #endif |
---|
[2952] | 684 | #endif |
---|
[781] | 685 | END MODULE surf_land_orchidee_mod |
---|