Changeset 1528 for trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90
- Timestamp:
- Apr 2, 2016, 4:09:43 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90
r1525 r1528 12 12 ! Modifs: Aug.2010 Ehouarn: enforce outputs to be real*4 13 13 14 use comsoil_h, only: nsoilmx 14 use comsoil_h, only: nsoilmx, inertiedat 15 use comgeomphy, only: airephy 15 16 use time_phylmdz_mod, only: ecritphy, day_step, iphysiq 16 17 use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather 17 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo 18 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, & 19 nbp_lon, nbp_lat 18 20 19 21 implicit none 20 22 21 #include"dimensions.h" 22 #include"paramet.h" 23 !#include"control.h" 24 !#include"comsoil.h" 25 #include"netcdf.inc" 23 include"netcdf.inc" 26 24 27 25 ! Arguments: … … 33 31 integer,intent(in) :: dimpx ! dimension of the variable (3,2 or 0) 34 32 real,dimension(ngrid,nsoilmx),intent(in) :: px ! variable 35 ! Note: nsoilmx is a parameter set in 'comsoil_h'36 33 37 34 ! Local variables: 38 real*4,dimension(iip1,jjp1,nsoilmx) :: data3 ! to store 3D data 39 ! Note iip1,jjp1 known from paramet.h; nsoilmx known from comsoil_h 40 real*4,dimension(iip1,jjp1) :: data2 ! to store 2D data 35 real*4,dimension(nbp_lon+1,nbp_lat,nsoilmx) :: data3 ! to store 3D data 36 real*4,dimension(nbp_lon+1,nbp_lat) :: data2 ! to store 2D data 41 37 real*4 :: data0 ! to store 0D data 42 38 integer :: i,j,l ! for loops … … 44 40 45 41 real*4,save :: date ! time counter (in elapsed days) 42 43 real :: inertia((nbp_lon+1),nbp_lat,nsoilmx) 44 real :: area((nbp_lon+1),nbp_lat) 45 46 real :: inertiafi_glo(klon_glo,nsoilmx) 47 real :: areafi_glo(klon_glo) 48 46 49 integer,save :: isample ! sample rate at which data is to be written to output 47 50 integer,save :: ntime=0 ! counter to internally store time steps … … 61 64 ! Added to work in parallel mode 62 65 real dx3_glop(klon_glo,nsoilmx) 63 real dx3_glo( iim,jjp1,nsoilmx) ! to store a global 3D data set66 real dx3_glo(nbp_lon,nbp_lat,nsoilmx) ! to store a global 3D data set 64 67 real dx2_glop(klon_glo) 65 real dx2_glo( iim,jjp1) ! to store a global 2D (surface) data set68 real dx2_glo(nbp_lon,nbp_lat) ! to store a global 2D (surface) data set 66 69 real px2(ngrid) 67 70 #endif … … 92 95 stop 93 96 endif 97 98 #ifdef CPP_PARA 99 ! Gather inertiedat() soil thermal inertia on physics grid 100 call Gather(inertiedat,inertiafi_glo) 101 ! Gather airephy() mesh area on physics grid 102 call Gather(airephy,areafi_glo) 103 #else 104 inertiafi_glo(:,:)=inertiedat(:,:) 105 areafi_glo(:)=airephy(:) 106 #endif 107 108 ! build inertia() and area() 109 do i=1,nbp_lon+1 ! poles 110 inertia(i,1,1:nsoilmx)=inertiafi_glo(1,1:nsoilmx) 111 inertia(i,nbp_lat,1:nsoilmx)=inertiafi_glo(klon_glo,1:nsoilmx) 112 ! for area, divide at the poles by nbp_lon 113 area(i,1)=areafi_glo(1)/nbp_lon 114 area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon 115 enddo 116 do j=2,nbp_lat-1 117 ig0= 1+(j-2)*nbp_lon 118 do i=1,nbp_lon 119 inertia(i,j,1:nsoilmx)=inertiafi_glo(ig0+i,1:nsoilmx) 120 area(i,j)=areafi_glo(ig0+i) 121 enddo 122 ! handle redundant point in longitude 123 inertia(nbp_lon+1,j,1:nsoilmx)=inertia(1,j,1:nsoilmx) 124 area(nbp_lon+1,j)=area(1,j) 125 enddo 126 127 ! write "header" of file (longitudes, latitudes, geopotential, ...) 128 call iniwritesoil(nid,ngrid,inertia,area) 129 94 130 endif ! of if (is_master) 95 96 ! Define dimensions and axis attributes97 call iniwritesoil(nid,ngrid)98 131 99 132 ! set zitau to -1 to be compatible with zitau incrementation step below … … 149 182 call Grid1Dto2D_glo(dx3_glop,dx3_glo) 150 183 ! copy dx3_glo() to dx3(:) and add redundant longitude 151 data3(1: iim,:,:)=dx3_glo(1:iim,:,:)152 data3( iip1,:,:)=data3(1,:,:)184 data3(1:nbp_lon,:,:)=dx3_glo(1:nbp_lon,:,:) 185 data3(nbp_lon+1,:,:)=data3(1,:,:) 153 186 endif 154 187 !$OMP END MASTER … … 157 190 do l=1,nsoilmx 158 191 ! handle the poles 159 do i=1, iip1192 do i=1,nbp_lon+1 160 193 data3(i,1,l)=px(1,l) 161 data3(i, jjp1,l)=px(ngrid,l)194 data3(i,nbp_lat,l)=px(ngrid,l) 162 195 enddo 163 196 ! rest of the grid 164 do j=2, jjm165 ig0=1+(j-2)* iim166 do i=1, iim197 do j=2,nbp_lat-1 198 ig0=1+(j-2)*nbp_lon 199 do i=1,nbp_lon 167 200 data3(i,j,l)=px(ig0+i,l) 168 201 enddo 169 data3( iip1,j,l)=data3(1,j,l) ! extra (modulo) longitude202 data3(nbp_lon+1,j,l)=data3(1,j,l) ! extra (modulo) longitude 170 203 enddo 171 204 enddo … … 196 229 corners(4)=ntime 197 230 198 edges(1)= iip1199 edges(2)= jjp1231 edges(1)=nbp_lon+1 232 edges(2)=nbp_lat 200 233 edges(3)=nsoilmx 201 234 edges(4)=1 … … 224 257 call Grid1Dto2D_glo(dx2_glop,dx2_glo) 225 258 ! copy dx3_glo() to dx3(:) and add redundant longitude 226 data2(1: iim,:)=dx2_glo(1:iim,:)227 data2( iip1,:)=data2(1,:)259 data2(1:nbp_lon,:)=dx2_glo(1:nbp_lon,:) 260 data2(nbp_lon+1,:)=data2(1,:) 228 261 endif 229 262 !$OMP END MASTER … … 231 264 #else 232 265 ! handle the poles 233 do i=1, iip1266 do i=1,nbp_lon+1 234 267 data2(i,1)=px(1,1) 235 data2(i, jjp1)=px(ngrid,1)268 data2(i,nbp_lat)=px(ngrid,1) 236 269 enddo 237 270 ! rest of the grid 238 do j=2, jjm239 ig0=1+(j-2)* iim240 do i=1, iim271 do j=2,nbp_lat-1 272 ig0=1+(j-2)*nbp_lon 273 do i=1,nbp_lon 241 274 data2(i,j)=px(ig0+i,1) 242 275 enddo 243 data2( iip1,j)=data2(1,j) ! extra (modulo) longitude276 data2(nbp_lon+1,j)=data2(1,j) ! extra (modulo) longitude 244 277 enddo 245 278 #endif … … 267 300 corners(3)=ntime 268 301 269 edges(1)= iip1270 edges(2)= jjp1302 edges(1)=nbp_lon+1 303 edges(2)=nbp_lat 271 304 edges(3)=1 272 305
Note: See TracChangeset
for help on using the changeset viewer.