Changeset 2588 for LMDZ5/trunk/libf
- Timestamp:
- Jul 13, 2016, 8:54:39 AM (8 years ago)
- Location:
- LMDZ5/trunk/libf
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/dynphy_lonlat/phydev/iniphysiq_mod.F90
r2396 r2588 12 12 prad,pg,pr,pcpp,iflag_phys) 13 13 USE dimphy, ONLY: init_dimphy 14 USE mod_grid_phy_lmdz, ONLY: klon_glo, & ! number of atmospheric columns (on full grid) 15 regular_lonlat ! regular longitude-latitude grid type 16 USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid) 17 klon_omp_begin, & ! start index of local omp subgrid 18 klon_omp_end, & ! end index of local omp subgrid 19 klon_mpi_begin ! start indes of columns (on local mpi grid) 20 USE geometry_mod, ONLY : init_geometry 14 USE inigeomphy_mod, ONLY: inigeomphy 15 USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid) 21 16 USE infotrac, ONLY: nqtot, type_trac 22 17 USE infotrac_phy, ONLY: init_infotrac_phy 23 ! USE comcstphy, ONLY: rradius, & ! planet radius (m)24 ! rr, & ! recuced gas constant: R/molar mass of atm25 ! rg, & ! gravity26 ! rcpp ! specific heat of the atmosphere27 18 USE inifis_mod, ONLY: inifis 28 19 USE phyaqua_mod, ONLY: iniaqua 29 USE physics_distribution_mod, ONLY : init_physics_distribution30 USE regular_lonlat_mod, ONLY : init_regular_lonlat, &31 east, west, north, south, &32 north_east, north_west, &33 south_west, south_east34 USE mod_interface_dyn_phys, ONLY : init_interface_dyn_phys35 20 USE nrtype, ONLY: pi 36 21 IMPLICIT NONE … … 69 54 CHARACTER (LEN=20) :: modname='iniphysiq' 70 55 CHARACTER (LEN=80) :: abort_message 71 REAL :: total_area_phy, total_area_dyn72 56 73 ! boundaries, on global grid74 REAL,ALLOCATABLE :: boundslon_reg(:,:)75 REAL,ALLOCATABLE :: boundslat_reg(:,:)76 57 77 ! global array, on full physics grid: 78 REAL,ALLOCATABLE :: latfi_glo(:) 79 REAL,ALLOCATABLE :: lonfi_glo(:) 80 REAL,ALLOCATABLE :: cufi_glo(:) 81 REAL,ALLOCATABLE :: cvfi_glo(:) 82 REAL,ALLOCATABLE :: airefi_glo(:) 83 REAL,ALLOCATABLE :: boundslonfi_glo(:,:) 84 REAL,ALLOCATABLE :: boundslatfi_glo(:,:) 58 ! --> initialize physics distribution, global fields and geometry 59 ! (i.e. things in phy_common or dynphy_lonlat) 60 CALL inigeomphy(iim,jjm,nlayer, & 61 nbp, communicator, & 62 rlatu,rlatv, & 63 rlonu,rlonv, & 64 aire,cu,cv) 85 65 86 ! local arrays, on given MPI/OpenMP domain: 87 REAL,ALLOCATABLE,SAVE :: latfi(:) 88 REAL,ALLOCATABLE,SAVE :: lonfi(:) 89 REAL,ALLOCATABLE,SAVE :: cufi(:) 90 REAL,ALLOCATABLE,SAVE :: cvfi(:) 91 REAL,ALLOCATABLE,SAVE :: airefi(:) 92 REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:) 93 REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:) 94 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi) 95 96 ! Initialize Physics distibution and parameters and interface with dynamics 97 CALL init_physics_distribution(regular_lonlat,4, & 98 nbp,iim,jjm+1,nlayer,communicator) 99 CALL init_interface_dyn_phys 100 101 ! init regular global longitude-latitude grid points and boundaries 102 ALLOCATE(boundslon_reg(iim,2)) 103 ALLOCATE(boundslat_reg(jjm+1,2)) 104 105 DO i=1,iim 106 boundslon_reg(i,east)=rlonu(i) 107 boundslon_reg(i,west)=rlonu(i+1) 108 ENDDO 109 110 boundslat_reg(1,north)= PI/2 111 boundslat_reg(1,south)= rlatv(1) 112 DO j=2,jjm 113 boundslat_reg(j,north)=rlatv(j-1) 114 boundslat_reg(j,south)=rlatv(j) 115 ENDDO 116 boundslat_reg(jjm+1,north)= rlatv(jjm) 117 boundslat_reg(jjm+1,south)= -PI/2 118 119 ! Write values in module regular_lonlat_mod 120 CALL init_regular_lonlat(iim,jjm+1, rlonv(1:iim), rlatu, & 121 boundslon_reg, boundslat_reg) 122 123 ! Generate global arrays on full physics grid 124 ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo)) 125 ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo)) 126 ALLOCATE(airefi_glo(klon_glo)) 127 ALLOCATE(boundslonfi_glo(klon_glo,4)) 128 ALLOCATE(boundslatfi_glo(klon_glo,4)) 129 130 ! North pole 131 latfi_glo(1)=rlatu(1) 132 lonfi_glo(1)=0. 133 cufi_glo(1) = cu(1) 134 cvfi_glo(1) = cv(1) 135 boundslonfi_glo(1,north_east)=0 136 boundslatfi_glo(1,north_east)=PI/2 137 boundslonfi_glo(1,north_west)=2*PI 138 boundslatfi_glo(1,north_west)=PI/2 139 boundslonfi_glo(1,south_west)=2*PI 140 boundslatfi_glo(1,south_west)=rlatv(1) 141 boundslonfi_glo(1,south_east)=0 142 boundslatfi_glo(1,south_east)=rlatv(1) 143 DO j=2,jjm 144 DO i=1,iim 145 k=(j-2)*iim+1+i 146 latfi_glo(k)= rlatu(j) 147 lonfi_glo(k)= rlonv(i) 148 cufi_glo(k) = cu((j-1)*(iim+1)+i) 149 cvfi_glo(k) = cv((j-1)*(iim+1)+i) 150 boundslonfi_glo(k,north_east)=rlonu(i) 151 boundslatfi_glo(k,north_east)=rlatv(j-1) 152 boundslonfi_glo(k,north_west)=rlonu(i+1) 153 boundslatfi_glo(k,north_west)=rlatv(j-1) 154 boundslonfi_glo(k,south_west)=rlonu(i+1) 155 boundslatfi_glo(k,south_west)=rlatv(j) 156 boundslonfi_glo(k,south_east)=rlonu(i) 157 boundslatfi_glo(k,south_east)=rlatv(j) 158 ENDDO 159 ENDDO 160 ! South pole 161 latfi_glo(klon_glo)= rlatu(jjm+1) 162 lonfi_glo(klon_glo)= 0. 163 cufi_glo(klon_glo) = cu((iim+1)*jjm+1) 164 cvfi_glo(klon_glo) = cv((iim+1)*jjm-iim) 165 boundslonfi_glo(klon_glo,north_east)= 0 166 boundslatfi_glo(klon_glo,north_east)= rlatv(jjm) 167 boundslonfi_glo(klon_glo,north_west)= 2*PI 168 boundslatfi_glo(klon_glo,north_west)= rlatv(jjm) 169 boundslonfi_glo(klon_glo,south_west)= 2*PI 170 boundslatfi_glo(klon_glo,south_west)= -PI/2 171 boundslonfi_glo(klon_glo,south_east)= 0 172 boundslatfi_glo(klon_glo,south_east)= -Pi/2 173 174 ! build airefi(), mesh area on physics grid 175 CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi_glo) 176 ! Poles are single points on physics grid 177 airefi_glo(1)=sum(aire(1:iim,1)) 178 airefi_glo(klon_glo)=sum(aire(1:iim,jjm+1)) 179 180 ! Sanity check: do total planet area match between physics and dynamics? 181 total_area_dyn=sum(aire(1:iim,1:jjm+1)) 182 total_area_phy=sum(airefi_glo(1:klon_glo)) 183 IF (total_area_dyn/=total_area_phy) THEN 184 WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!' 185 WRITE (lunout, *) ' in the dynamics total_area_dyn=', total_area_dyn 186 WRITE (lunout, *) ' but in the physics total_area_phy=', total_area_phy 187 IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN 188 ! stop here if the relative difference is more than 0.001% 189 abort_message = 'planet total surface discrepancy' 190 CALL abort_gcm(modname, abort_message, 1) 191 ENDIF 192 ENDIF 66 ! --> now initialize things specific to the phydev physics package 193 67 194 68 !$OMP PARALLEL 195 ! Now generate local lon/lat/cu/cv/area/bounds arrays196 ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))197 ALLOCATE(airefi(klon_omp))198 ALLOCATE(boundslonfi(klon_omp,4))199 ALLOCATE(boundslatfi(klon_omp,4))200 201 202 offset = klon_mpi_begin - 1203 airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)204 cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)205 cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)206 lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)207 latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)208 boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)209 boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)210 211 ! copy over local grid longitudes and latitudes212 CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &213 airefi,cufi,cvfi)214 69 215 70 ! Initialize physical constants in physics: -
LMDZ5/trunk/libf/dynphy_lonlat/phylmd/iniphysiq_mod.F90
r2457 r2588 12 12 prad,pg,pr,pcpp,iflag_phys) 13 13 USE dimphy, ONLY: init_dimphy 14 USE mod_grid_phy_lmdz, ONLY: klon_glo, & ! number of atmospheric columns (on full grid) 15 regular_lonlat, & ! regular longitude-latitude grid type 16 nbp_lon, nbp_lat, nbp_lev 17 USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid) 18 klon_omp_begin, & ! start index of local omp subgrid 19 klon_omp_end, & ! end index of local omp subgrid 20 klon_mpi_begin ! start indes of columns (on local mpi grid) 21 USE geometry_mod, ONLY : init_geometry 14 USE inigeomphy_mod, ONLY: inigeomphy 15 USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of atmospheric columns (on full grid) 16 USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid) 22 17 USE vertical_layers_mod, ONLY : init_vertical_layers 23 18 USE infotrac, ONLY: nqtot,nqo,nbtr,tname,ttext,type_trac,& … … 39 34 USE phystokenc_mod, ONLY: init_phystokenc 40 35 USE phyaqua_mod, ONLY: iniaqua 41 USE physics_distribution_mod, ONLY : init_physics_distribution42 USE regular_lonlat_mod, ONLY : init_regular_lonlat, &43 east, west, north, south, &44 north_east, north_west, &45 south_west, south_east46 USE mod_interface_dyn_phys, ONLY : init_interface_dyn_phys47 36 #ifdef INCA 48 37 USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic … … 92 81 CHARACTER (LEN=20) :: modname = 'iniphysiq' 93 82 CHARACTER (LEN=80) :: abort_message 94 REAL :: total_area_phy, total_area_dyn95 83 96 ! boundaries, on global grid97 REAL,ALLOCATABLE :: boundslon_reg(:,:)98 REAL,ALLOCATABLE :: boundslat_reg(:,:)99 100 ! global array, on full physics grid:101 REAL,ALLOCATABLE :: latfi_glo(:)102 REAL,ALLOCATABLE :: lonfi_glo(:)103 REAL,ALLOCATABLE :: cufi_glo(:)104 REAL,ALLOCATABLE :: cvfi_glo(:)105 REAL,ALLOCATABLE :: airefi_glo(:)106 REAL,ALLOCATABLE :: boundslonfi_glo(:,:)107 REAL,ALLOCATABLE :: boundslatfi_glo(:,:)108 109 ! local arrays, on given MPI/OpenMP domain:110 REAL,ALLOCATABLE,SAVE :: latfi(:)111 REAL,ALLOCATABLE,SAVE :: lonfi(:)112 REAL,ALLOCATABLE,SAVE :: cufi(:)113 REAL,ALLOCATABLE,SAVE :: cvfi(:)114 REAL,ALLOCATABLE,SAVE :: airefi(:)115 REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)116 REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)117 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)118 84 119 85 #ifndef CPP_PARA … … 123 89 #endif 124 90 125 ! Initialize Physics distibution and parameters and interface with dynamics126 IF (ii*jj>1) THEN ! general 3D case127 CALL init_physics_distribution(regular_lonlat,4, &128 nbp,ii,jj+1,nlayer,communicator)129 ELSE ! For 1D model130 CALL init_physics_distribution(regular_lonlat,4, &131 1,1,1,nlayer,communicator)132 ENDIF 133 CALL init_interface_dyn_phys91 ! --> initialize physics distribution, global fields and geometry 92 ! (i.e. things in phy_common or dynphy_lonlat) 93 CALL inigeomphy(ii,jj,nlayer, & 94 nbp, communicator, & 95 rlatu,rlatv, & 96 rlonu,rlonv, & 97 aire,cu,cv) 98 99 ! --> now initialize things specific to the phylmd physics package 134 100 135 ! init regular global longitude-latitude grid points and boundaries136 ALLOCATE(boundslon_reg(ii,2))137 ALLOCATE(boundslat_reg(jj+1,2))138 139 DO i=1,ii140 boundslon_reg(i,east)=rlonu(i)141 boundslon_reg(i,west)=rlonu(i+1)142 ENDDO143 144 boundslat_reg(1,north)= PI/2145 boundslat_reg(1,south)= rlatv(1)146 DO j=2,jj147 boundslat_reg(j,north)=rlatv(j-1)148 boundslat_reg(j,south)=rlatv(j)149 ENDDO150 boundslat_reg(jj+1,north)= rlatv(jj)151 boundslat_reg(jj+1,south)= -PI/2152 153 ! Write values in module regular_lonlat_mod154 CALL init_regular_lonlat(ii,jj+1, rlonv(1:ii), rlatu, &155 boundslon_reg, boundslat_reg)156 157 ! Generate global arrays on full physics grid158 ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo))159 ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo))160 ALLOCATE(airefi_glo(klon_glo))161 ALLOCATE(boundslonfi_glo(klon_glo,4))162 ALLOCATE(boundslatfi_glo(klon_glo,4))163 164 165 IF (klon_glo>1) THEN ! general case166 ! North pole167 latfi_glo(1)=rlatu(1)168 lonfi_glo(1)=0.169 cufi_glo(1) = cu(1)170 cvfi_glo(1) = cv(1)171 boundslonfi_glo(1,north_east)=0172 boundslatfi_glo(1,north_east)=PI/2173 boundslonfi_glo(1,north_west)=2*PI174 boundslatfi_glo(1,north_west)=PI/2175 boundslonfi_glo(1,south_west)=2*PI176 boundslatfi_glo(1,south_west)=rlatv(1)177 boundslonfi_glo(1,south_east)=0178 boundslatfi_glo(1,south_east)=rlatv(1)179 DO j=2,jj180 DO i=1,ii181 k=(j-2)*ii+1+i182 latfi_glo(k)= rlatu(j)183 lonfi_glo(k)= rlonv(i)184 cufi_glo(k) = cu((j-1)*(ii+1)+i)185 cvfi_glo(k) = cv((j-1)*(ii+1)+i)186 boundslonfi_glo(k,north_east)=rlonu(i)187 boundslatfi_glo(k,north_east)=rlatv(j-1)188 boundslonfi_glo(k,north_west)=rlonu(i+1)189 boundslatfi_glo(k,north_west)=rlatv(j-1)190 boundslonfi_glo(k,south_west)=rlonu(i+1)191 boundslatfi_glo(k,south_west)=rlatv(j)192 boundslonfi_glo(k,south_east)=rlonu(i)193 boundslatfi_glo(k,south_east)=rlatv(j)194 ENDDO195 ENDDO196 ! South pole197 latfi_glo(klon_glo)= rlatu(jj+1)198 lonfi_glo(klon_glo)= 0.199 cufi_glo(klon_glo) = cu((ii+1)*jj+1)200 cvfi_glo(klon_glo) = cv((ii+1)*jj-ii)201 boundslonfi_glo(klon_glo,north_east)= 0202 boundslatfi_glo(klon_glo,north_east)= rlatv(jj)203 boundslonfi_glo(klon_glo,north_west)= 2*PI204 boundslatfi_glo(klon_glo,north_west)= rlatv(jj)205 boundslonfi_glo(klon_glo,south_west)= 2*PI206 boundslatfi_glo(klon_glo,south_west)= -PI/2207 boundslonfi_glo(klon_glo,south_east)= 0208 boundslatfi_glo(klon_glo,south_east)= -Pi/2209 210 ! build airefi_glo(), mesh area on physics grid211 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi_glo)212 ! Poles are single points on physics grid213 airefi_glo(1)=sum(aire(1:ii,1))214 airefi_glo(klon_glo)=sum(aire(1:ii,jj+1))215 216 ! Sanity check: do total planet area match between physics and dynamics?217 total_area_dyn=sum(aire(1:ii,1:jj+1))218 total_area_phy=sum(airefi_glo(1:klon_glo))219 IF (total_area_dyn/=total_area_phy) THEN220 WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'221 WRITE (lunout, *) ' in the dynamics total_area_dyn=', total_area_dyn222 WRITE (lunout, *) ' but in the physics total_area_phy=', total_area_phy223 IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN224 ! stop here if the relative difference is more than 0.001%225 abort_message = 'planet total surface discrepancy'226 CALL abort_gcm(modname, abort_message, 1)227 ENDIF228 ENDIF229 ELSE ! klon_glo==1, running the 1D model230 ! just copy over input values231 latfi_glo(1)=rlatu(1)232 lonfi_glo(1)=rlonv(1)233 cufi_glo(1)=cu(1)234 cvfi_glo(1)=cv(1)235 airefi_glo(1)=aire(1,1)236 boundslonfi_glo(1,north_east)=rlonu(1)237 boundslatfi_glo(1,north_east)=PI/2238 boundslonfi_glo(1,north_west)=rlonu(2)239 boundslatfi_glo(1,north_west)=PI/2240 boundslonfi_glo(1,south_west)=rlonu(2)241 boundslatfi_glo(1,south_west)=rlatv(1)242 boundslonfi_glo(1,south_east)=rlonu(1)243 boundslatfi_glo(1,south_east)=rlatv(1)244 ENDIF ! of IF (klon_glo>1)245 246 101 !$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/) 247 ! Now generate local lon/lat/cu/cv/area/bounds arrays248 ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))249 ALLOCATE(airefi(klon_omp))250 ALLOCATE(boundslonfi(klon_omp,4))251 ALLOCATE(boundslatfi(klon_omp,4))252 253 254 offset = klon_mpi_begin - 1255 airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)256 cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)257 cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)258 lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)259 latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)260 boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)261 boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)262 263 ! copy over local grid longitudes and latitudes264 CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &265 airefi,cufi,cvfi)266 102 267 103 ! copy over preff , ap(), bp(), etc -
LMDZ5/trunk/libf/dynphy_lonlat/phymar/iniphysiq_mod.F90
r2396 r2588 12 12 prad,pg,pr,pcpp,iflag_phys) 13 13 USE dimphy, ONLY: init_dimphy 14 USE mod_grid_phy_lmdz, ONLY: klon_glo, & ! number of atmospheric columns (on full grid) 15 regular_lonlat ! regular longitude-latitude grid type 16 USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid) 17 klon_omp_begin, & ! start index of local omp subgrid 18 klon_omp_end, & ! end index of local omp subgrid 19 klon_mpi_begin ! start indes of columns (on local mpi grid) 20 USE geometry_mod, ONLY : init_geometry 14 USE inigeomphy_mod, ONLY: inigeomphy 21 15 USE infotrac, ONLY: nqtot 22 16 USE comcstphy, ONLY: rradius, & ! planet radius (m) … … 24 18 rg, & ! gravity 25 19 rcpp ! specific heat of the atmosphere 26 ! USE phyaqua_mod, ONLY: iniaqua27 USE physics_distribution_mod, ONLY : init_physics_distribution28 USE regular_lonlat_mod, ONLY : init_regular_lonlat, &29 east, west, north, south, &30 north_east, north_west, &31 south_west, south_east32 USE mod_interface_dyn_phys, ONLY : init_interface_dyn_phys33 20 USE infotrac_phy, ONLY: init_infotrac_phy 34 21 USE nrtype, ONLY: pi … … 68 55 CHARACTER (LEN=20) :: modname='iniphysiq' 69 56 CHARACTER (LEN=80) :: abort_message 70 REAL :: total_area_phy, total_area_dyn71 72 ! boundaries, on global grid73 REAL,ALLOCATABLE :: boundslon_reg(:,:)74 REAL,ALLOCATABLE :: boundslat_reg(:,:)75 76 ! global array, on full physics grid:77 REAL,ALLOCATABLE :: latfi_glo(:)78 REAL,ALLOCATABLE :: lonfi_glo(:)79 REAL,ALLOCATABLE :: cufi_glo(:)80 REAL,ALLOCATABLE :: cvfi_glo(:)81 REAL,ALLOCATABLE :: airefi_glo(:)82 REAL,ALLOCATABLE :: boundslonfi_glo(:,:)83 REAL,ALLOCATABLE :: boundslatfi_glo(:,:)84 85 ! local arrays, on given MPI/OpenMP domain:86 REAL,ALLOCATABLE,SAVE :: latfi(:)87 REAL,ALLOCATABLE,SAVE :: lonfi(:)88 REAL,ALLOCATABLE,SAVE :: cufi(:)89 REAL,ALLOCATABLE,SAVE :: cvfi(:)90 REAL,ALLOCATABLE,SAVE :: airefi(:)91 REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)92 REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)93 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)94 95 ! Initialize Physics distibution and parameters and interface with dynamics96 CALL init_physics_distribution(regular_lonlat,4, &97 nbp,ii,jj+1,nlayer,communicator)98 CALL init_interface_dyn_phys99 100 ! init regular global longitude-latitude grid points and boundaries101 ALLOCATE(boundslon_reg(ii,2))102 ALLOCATE(boundslat_reg(jj+1,2))103 104 DO i=1,ii105 boundslon_reg(i,east)=rlonu(i)106 boundslon_reg(i,west)=rlonu(i+1)107 ENDDO108 109 boundslat_reg(1,north)= PI/2110 boundslat_reg(1,south)= rlatv(1)111 DO j=2,jj112 boundslat_reg(j,north)=rlatv(j-1)113 boundslat_reg(j,south)=rlatv(j)114 ENDDO115 boundslat_reg(jj+1,north)= rlatv(jj)116 boundslat_reg(jj+1,south)= -PI/2117 118 ! Write values in module regular_lonlat_mod119 CALL init_regular_lonlat(ii,jj+1, rlonv(1:ii), rlatu, &120 boundslon_reg, boundslat_reg)121 122 ! Generate global arrays on full physics grid123 ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo))124 ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo))125 ALLOCATE(airefi_glo(klon_glo))126 ALLOCATE(boundslonfi_glo(klon_glo,4))127 ALLOCATE(boundslatfi_glo(klon_glo,4))128 129 IF (klon_glo>1) THEN ! general case130 ! North pole131 latfi_glo(1)=rlatu(1)132 lonfi_glo(1)=0.133 cufi_glo(1) = cu(1)134 cvfi_glo(1) = cv(1)135 boundslonfi_glo(1,north_east)=0136 boundslatfi_glo(1,north_east)=PI/2137 boundslonfi_glo(1,north_west)=2*PI138 boundslatfi_glo(1,north_west)=PI/2139 boundslonfi_glo(1,south_west)=2*PI140 boundslatfi_glo(1,south_west)=rlatv(1)141 boundslonfi_glo(1,south_east)=0142 boundslatfi_glo(1,south_east)=rlatv(1)143 DO j=2,jj144 DO i=1,ii145 k=(j-2)*ii+1+i146 latfi_glo((j-2)*ii+1+i)= rlatu(j)147 lonfi_glo((j-2)*ii+1+i)= rlonv(i)148 cufi_glo((j-2)*ii+1+i) = cu((j-1)*(ii+1)+i)149 cvfi_glo((j-2)*ii+1+i) = cv((j-1)*(ii+1)+i)150 boundslonfi_glo(k,north_east)=rlonu(i)151 boundslatfi_glo(k,north_east)=rlatv(j-1)152 boundslonfi_glo(k,north_west)=rlonu(i+1)153 boundslatfi_glo(k,north_west)=rlatv(j-1)154 boundslonfi_glo(k,south_west)=rlonu(i+1)155 boundslatfi_glo(k,south_west)=rlatv(j)156 boundslonfi_glo(k,south_east)=rlonu(i)157 boundslatfi_glo(k,south_east)=rlatv(j)158 ENDDO159 ENDDO160 ! South pole161 latfi_glo(klon_glo)= rlatu(jj+1)162 lonfi_glo(klon_glo)= 0.163 cufi_glo(klon_glo) = cu((ii+1)*jj+1)164 cvfi_glo(klon_glo) = cv((ii+1)*jj-ii)165 boundslonfi_glo(klon_glo,north_east)= 0166 boundslatfi_glo(klon_glo,north_east)= rlatv(jj)167 boundslonfi_glo(klon_glo,north_west)= 2*PI168 boundslatfi_glo(klon_glo,north_west)= rlatv(jj)169 boundslonfi_glo(klon_glo,south_west)= 2*PI170 boundslatfi_glo(klon_glo,south_west)= -PI/2171 boundslonfi_glo(klon_glo,south_east)= 0172 boundslatfi_glo(klon_glo,south_east)= -Pi/2173 174 ! build airefi(), mesh area on physics grid175 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi_glo)176 ! Poles are single points on physics grid177 airefi_glo(1)=sum(aire(1:ii,1))178 airefi_glo(klon_glo)=sum(aire(1:ii,jj+1))179 180 ! Sanity check: do total planet area match between physics and dynamics?181 total_area_dyn=sum(aire(1:ii,1:jj+1))182 total_area_phy=sum(airefi_glo(1:klon_glo))183 IF (total_area_dyn/=total_area_phy) THEN184 WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'185 WRITE (lunout, *) ' in the dynamics total_area_dyn=', total_area_dyn186 WRITE (lunout, *) ' but in the physics total_area_phy=', total_area_phy187 IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN188 ! stop here if the relative difference is more than 0.001%189 abort_message = 'planet total surface discrepancy'190 CALL abort_gcm(modname, abort_message, 1)191 ENDIF192 ENDIF193 ELSE ! klon_glo==1, running the 1D model194 ! just copy over input values195 latfi_glo(1)=rlatu(1)196 lonfi_glo(1)=rlonv(1)197 cufi_glo(1)=cu(1)198 cvfi_glo(1)=cv(1)199 airefi_glo(1)=aire(1,1)200 boundslonfi_glo(1,north_east)=rlonu(1)201 boundslatfi_glo(1,north_east)=PI/2202 boundslonfi_glo(1,north_west)=rlonu(2)203 boundslatfi_glo(1,north_west)=PI/2204 boundslonfi_glo(1,south_west)=rlonu(2)205 boundslatfi_glo(1,south_west)=rlatv(1)206 boundslonfi_glo(1,south_east)=rlonu(1)207 boundslatfi_glo(1,south_east)=rlatv(1)208 ENDIF ! of IF (klon_glo>1)209 210 !$OMP PARALLEL211 ! Now generate local lon/lat/cu/cv/area/bounds arrays212 ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))213 ALLOCATE(airefi(klon_omp))214 ALLOCATE(boundslonfi(klon_omp,4))215 ALLOCATE(boundslatfi(klon_omp,4))216 57 217 58 218 offset = klon_mpi_begin - 1 219 airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end) 220 cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end) 221 cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end) 222 lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end) 223 latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end) 224 boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:) 225 boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:) 59 ! --> initialize physics distribution, global fields and geometry 60 ! (i.e. things in phy_common or dynphy_lonlat) 61 CALL inigeomphy(ii,jj,nlayer, & 62 nbp, communicator, & 63 rlatu,rlatv, & 64 rlonu,rlonv, & 65 aire,cu,cv) 226 66 227 ! copy over local grid longitudes and latitudes 228 CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, & 229 airefi,cufi,cvfi) 230 67 ! --> now initialize things specific to the phymar physics package 68 69 !$OMP PARALLEL 231 70 232 71 ! Initialize tracer names, numbers, etc. for physics -
LMDZ5/trunk/libf/phydev/iophy.F90
r2326 r2588 44 44 jj_nb, jj_begin, jj_end, ii_begin, ii_end, & 45 45 mpi_size, mpi_rank, klon_mpi, & 46 is_sequential, is_south_pole 46 is_sequential, is_south_pole_dyn 47 47 USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, klon_glo 48 48 USE print_control_mod, ONLY: lunout, prt_level … … 141 141 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend 142 142 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend 143 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole=",is_south_pole 143 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn 144 144 endif 145 145 … … 148 148 1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end, & 149 149 klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend, & 150 io_lat, io_lon,is_south_pole ,mpi_rank)150 io_lat, io_lon,is_south_pole_dyn,mpi_rank) 151 151 #endif 152 152 !$OMP END MASTER
Note: See TracChangeset
for help on using the changeset viewer.