[1523] | 1 | MODULE iniphysiq_mod |
---|
| 2 | |
---|
| 3 | CONTAINS |
---|
| 4 | |
---|
[1395] | 5 | subroutine iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep, & |
---|
[1529] | 6 | rlatudyn,rlatvdyn,rlonudyn,rlonvdyn,airedyn,cudyn,cvdyn, & |
---|
[1216] | 7 | prad,pg,pr,pcpp,iflag_phys) |
---|
| 8 | |
---|
| 9 | use dimphy, only : klev ! number of atmospheric levels |
---|
| 10 | use mod_grid_phy_lmdz, only : klon_glo ! number of atmospheric columns |
---|
| 11 | ! (on full grid) |
---|
| 12 | use mod_phys_lmdz_para, only : klon_omp, & ! number of columns (on local omp grid) |
---|
| 13 | klon_omp_begin, & ! start index of local omp subgrid |
---|
| 14 | klon_omp_end, & ! end index of local omp subgrid |
---|
| 15 | klon_mpi_begin ! start indes of columns (on local mpi grid) |
---|
[1525] | 16 | use control_mod, only: nday |
---|
[1395] | 17 | use comgeomphy, only : initcomgeomphy, & |
---|
| 18 | airephy, & ! physics grid area (m2) |
---|
[1216] | 19 | cuphy, & ! cu coeff. (u_covariant = cu * u) |
---|
| 20 | cvphy, & ! cv coeff. (v_covariant = cv * v) |
---|
| 21 | rlond, & ! longitudes |
---|
| 22 | rlatd ! latitudes |
---|
[1529] | 23 | use surf_heat_transp_mod, only: ini_surf_heat_transp |
---|
[1216] | 24 | use infotrac, only : nqtot ! number of advected tracers |
---|
[1308] | 25 | use planete_mod, only: ini_planete_mod |
---|
[1422] | 26 | USE comvert_mod, ONLY: ap,bp,preff |
---|
[1524] | 27 | use inifis_mod, only: inifis |
---|
[1523] | 28 | use regular_lonlat_mod, only: init_regular_lonlat, & |
---|
| 29 | east, west, north, south, & |
---|
| 30 | north_east, north_west, & |
---|
| 31 | south_west, south_east |
---|
[1529] | 32 | use ioipsl_getin_p_mod, only: getin_p |
---|
[1216] | 33 | |
---|
| 34 | implicit none |
---|
[1308] | 35 | include "dimensions.h" |
---|
[1529] | 36 | include "paramet.h" |
---|
| 37 | include "comgeom.h" |
---|
[1395] | 38 | include "iniprint.h" |
---|
[1216] | 39 | |
---|
| 40 | real,intent(in) :: prad ! radius of the planet (m) |
---|
| 41 | real,intent(in) :: pg ! gravitational acceleration (m/s2) |
---|
| 42 | real,intent(in) :: pr ! ! reduced gas constant R/mu |
---|
| 43 | real,intent(in) :: pcpp ! specific heat Cp |
---|
| 44 | real,intent(in) :: punjours ! length (in s) of a standard day |
---|
[1395] | 45 | !integer,intent(in) :: ngrid ! number of horizontal grid points in the physics (full grid) |
---|
[1216] | 46 | integer,intent(in) :: nlayer ! number of atmospheric layers |
---|
[1395] | 47 | integer,intent(in) :: ii ! number of atmospheric coulumns along longitudes |
---|
| 48 | integer,intent(in) :: jj ! number of atompsheric columns along latitudes |
---|
[1529] | 49 | real,intent(in) :: rlatudyn(jj+1) ! latitudes of the physics grid |
---|
| 50 | real,intent(in) :: rlatvdyn(jj) ! latitude boundaries of the physics grid |
---|
| 51 | real,intent(in) :: rlonvdyn(ii+1) ! longitudes of the physics grid |
---|
| 52 | real,intent(in) :: rlonudyn(ii+1) ! longitude boundaries of the physics grid |
---|
| 53 | real,intent(in) :: airedyn(ii+1,jj+1) ! area of the dynamics grid (m2) |
---|
| 54 | real,intent(in) :: cudyn((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u) |
---|
| 55 | real,intent(in) :: cvdyn((ii+1)*jj) ! cv coeff. (v_covariant = cv * v) |
---|
[1216] | 56 | integer,intent(in) :: pdayref ! reference day of for the simulation |
---|
| 57 | real,intent(in) :: ptimestep !physics time step (s) |
---|
| 58 | integer,intent(in) :: iflag_phys ! type of physics to be called |
---|
| 59 | |
---|
| 60 | integer :: ibegin,iend,offset |
---|
[1395] | 61 | integer :: i,j |
---|
[1216] | 62 | character(len=20) :: modname='iniphysiq' |
---|
| 63 | character(len=80) :: abort_message |
---|
[1395] | 64 | real :: total_area_phy, total_area_dyn |
---|
[1523] | 65 | real :: pi |
---|
[1529] | 66 | logical :: ok_slab_ocean |
---|
[1216] | 67 | |
---|
[1523] | 68 | ! boundaries, on global grid |
---|
| 69 | real,allocatable :: boundslon_reg(:,:) |
---|
| 70 | real,allocatable :: boundslat_reg(:,:) |
---|
[1395] | 71 | |
---|
| 72 | ! global array, on full physics grid: |
---|
| 73 | real,allocatable :: latfi(:) |
---|
| 74 | real,allocatable :: lonfi(:) |
---|
| 75 | real,allocatable :: cufi(:) |
---|
| 76 | real,allocatable :: cvfi(:) |
---|
| 77 | real,allocatable :: airefi(:) |
---|
| 78 | |
---|
[1523] | 79 | pi=2.*asin(1.0) |
---|
| 80 | |
---|
[1216] | 81 | IF (nlayer.NE.klev) THEN |
---|
| 82 | write(*,*) 'STOP in ',trim(modname) |
---|
| 83 | write(*,*) 'Problem with dimensions :' |
---|
| 84 | write(*,*) 'nlayer = ',nlayer |
---|
| 85 | write(*,*) 'klev = ',klev |
---|
| 86 | abort_message = '' |
---|
| 87 | CALL abort_gcm (modname,abort_message,1) |
---|
| 88 | ENDIF |
---|
| 89 | |
---|
[1395] | 90 | !IF (ngrid.NE.klon_glo) THEN |
---|
| 91 | ! write(*,*) 'STOP in ',trim(modname) |
---|
| 92 | ! write(*,*) 'Problem with dimensions :' |
---|
| 93 | ! write(*,*) 'ngrid = ',ngrid |
---|
| 94 | ! write(*,*) 'klon = ',klon_glo |
---|
| 95 | ! abort_message = '' |
---|
| 96 | ! CALL abort_gcm (modname,abort_message,1) |
---|
| 97 | !ENDIF |
---|
| 98 | |
---|
| 99 | !call init_phys_lmdz(iim,jjm+1,llm,1,(/(jjm-1)*iim+2/)) |
---|
| 100 | |
---|
[1523] | 101 | ! init regular global longitude-latitude grid points and boundaries |
---|
| 102 | ALLOCATE(boundslon_reg(ii,2)) |
---|
| 103 | ALLOCATE(boundslat_reg(jj+1,2)) |
---|
| 104 | |
---|
| 105 | DO i=1,ii |
---|
[1529] | 106 | boundslon_reg(i,east)=rlonudyn(i) |
---|
| 107 | boundslon_reg(i,west)=rlonudyn(i+1) |
---|
[1523] | 108 | ENDDO |
---|
| 109 | |
---|
| 110 | boundslat_reg(1,north)= PI/2 |
---|
[1529] | 111 | boundslat_reg(1,south)= rlatvdyn(1) |
---|
[1523] | 112 | DO j=2,jj |
---|
[1529] | 113 | boundslat_reg(j,north)=rlatvdyn(j-1) |
---|
| 114 | boundslat_reg(j,south)=rlatvdyn(j) |
---|
[1523] | 115 | ENDDO |
---|
[1529] | 116 | boundslat_reg(jj+1,north)= rlatvdyn(jj) |
---|
[1523] | 117 | boundslat_reg(jj+1,south)= -PI/2 |
---|
| 118 | |
---|
| 119 | ! Write values in module regular_lonlat_mod |
---|
[1529] | 120 | CALL init_regular_lonlat(ii,jj+1, rlonvdyn(1:ii), rlatudyn, & |
---|
[1523] | 121 | boundslon_reg, boundslat_reg) |
---|
| 122 | |
---|
[1395] | 123 | ! Generate global arrays on full physics grid |
---|
| 124 | allocate(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo)) |
---|
[1529] | 125 | latfi(1)=rlatudyn(1) |
---|
[1395] | 126 | lonfi(1)=0. |
---|
[1529] | 127 | cufi(1) = cudyn(1) |
---|
| 128 | cvfi(1) = cvdyn(1) |
---|
[1395] | 129 | DO j=2,jj |
---|
| 130 | DO i=1,ii |
---|
[1529] | 131 | latfi((j-2)*ii+1+i)= rlatudyn(j) |
---|
| 132 | lonfi((j-2)*ii+1+i)= rlonvdyn(i) |
---|
| 133 | cufi((j-2)*ii+1+i) = cudyn((j-1)*(ii+1)+i) |
---|
| 134 | cvfi((j-2)*ii+1+i) = cvdyn((j-1)*(ii+1)+i) |
---|
[1395] | 135 | ENDDO |
---|
| 136 | ENDDO |
---|
[1529] | 137 | latfi(klon_glo)= rlatudyn(jj+1) |
---|
[1395] | 138 | lonfi(klon_glo)= 0. |
---|
[1529] | 139 | cufi(klon_glo) = cudyn((ii+1)*jj+1) |
---|
| 140 | cvfi(klon_glo) = cvdyn((ii+1)*jj-ii) |
---|
[1395] | 141 | |
---|
| 142 | ! build airefi(), mesh area on physics grid |
---|
| 143 | allocate(airefi(klon_glo)) |
---|
[1529] | 144 | CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,airedyn,airefi) |
---|
[1395] | 145 | ! Poles are single points on physics grid |
---|
[1529] | 146 | airefi(1)=sum(airedyn(1:ii,1)) |
---|
| 147 | airefi(klon_glo)=sum(airedyn(1:ii,jj+1)) |
---|
[1395] | 148 | |
---|
| 149 | ! Sanity check: do total planet area match between physics and dynamics? |
---|
[1529] | 150 | total_area_dyn=sum(airedyn(1:ii,1:jj+1)) |
---|
[1395] | 151 | total_area_phy=sum(airefi(1:klon_glo)) |
---|
| 152 | IF (total_area_dyn/=total_area_phy) THEN |
---|
| 153 | WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!' |
---|
| 154 | WRITE (lunout, *) ' in the dynamics total_area_dyn=', total_area_dyn |
---|
| 155 | WRITE (lunout, *) ' but in the physics total_area_phy=', total_area_phy |
---|
| 156 | IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN |
---|
| 157 | ! stop here if the relative difference is more than 0.001% |
---|
| 158 | abort_message = 'planet total surface discrepancy' |
---|
| 159 | CALL abort_gcm(modname, abort_message, 1) |
---|
| 160 | ENDIF |
---|
[1216] | 161 | ENDIF |
---|
| 162 | |
---|
[1395] | 163 | |
---|
| 164 | !$OMP PARALLEL |
---|
| 165 | ! Now generate local lon/lat/cu/cv/area arrays |
---|
| 166 | call initcomgeomphy |
---|
| 167 | |
---|
| 168 | !!!!$OMP PARALLEL PRIVATE(ibegin,iend) & |
---|
| 169 | !!! !$OMP SHARED(airefi,cufi,cvfi,lonfi,latfi) |
---|
| 170 | |
---|
[1216] | 171 | offset=klon_mpi_begin-1 |
---|
[1395] | 172 | airephy(1:klon_omp)=airefi(offset+klon_omp_begin:offset+klon_omp_end) |
---|
| 173 | cuphy(1:klon_omp)=cufi(offset+klon_omp_begin:offset+klon_omp_end) |
---|
| 174 | cvphy(1:klon_omp)=cvfi(offset+klon_omp_begin:offset+klon_omp_end) |
---|
| 175 | rlond(1:klon_omp)=lonfi(offset+klon_omp_begin:offset+klon_omp_end) |
---|
| 176 | rlatd(1:klon_omp)=latfi(offset+klon_omp_begin:offset+klon_omp_end) |
---|
[1216] | 177 | |
---|
[1308] | 178 | ! copy over preff , ap() and bp() |
---|
| 179 | call ini_planete_mod(nlayer,preff,ap,bp) |
---|
| 180 | |
---|
[1529] | 181 | ! for slab ocean, copy over some arrays |
---|
| 182 | ok_slab_ocean=.false. ! default value |
---|
| 183 | call getin_p("ok_slab_ocean",ok_slab_ocean) |
---|
| 184 | if (ok_slab_ocean) then |
---|
| 185 | call ini_surf_heat_transp(ip1jm,ip1jmp1,unsairez,fext,unsaire, & |
---|
| 186 | cu,cuvsurcv,cv,cvusurcu,aire,apoln,apols, & |
---|
| 187 | aireu,airev) |
---|
| 188 | endif |
---|
| 189 | |
---|
[1216] | 190 | ! copy some fundamental parameters to physics |
---|
| 191 | ! and do some initializations |
---|
[1525] | 192 | call inifis(klon_omp,nlayer,nqtot,pdayref,punjours,nday,ptimestep, & |
---|
[1216] | 193 | rlatd,rlond,airephy,prad,pg,pr,pcpp) |
---|
| 194 | |
---|
| 195 | !$OMP END PARALLEL |
---|
| 196 | |
---|
| 197 | |
---|
| 198 | end subroutine iniphysiq |
---|
[1523] | 199 | |
---|
| 200 | |
---|
| 201 | END MODULE iniphysiq_mod |
---|