Changeset 1529 for trunk/LMDZ.GENERIC/libf/phystd/iniwrite.F
- Timestamp:
- Apr 5, 2016, 10:51:51 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/phystd/iniwrite.F
r1524 r1529 1 SUBROUTINE iniwrite(nid,idayref,phis )1 SUBROUTINE iniwrite(nid,idayref,phis,area) 2 2 3 3 use comsoil_h, only: mlayer, nsoilmx 4 use comcstfi_mod, only: rad, omeg, g, mugaz, rcp, pi 5 use time_phylmdz_mod, only: daysec, dtphys 4 USE comcstfi_mod, only: g, mugaz, omeg, rad, rcp, pi 6 5 USE comvert_mod, ONLY: ap,bp,aps,bps,pseudoalt 7 6 USE logic_mod, ONLY: fxyhypb,ysinus 8 7 USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy 8 USE time_phylmdz_mod, ONLY: daysec, dtphys 9 9 USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0 10 USE regular_lonlat_mod, ONLY: lon_reg, lat_reg 11 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev 10 12 IMPLICIT NONE 11 13 … … 26 28 c ------------- 27 29 28 #include "dimensions.h" 29 #include "paramet.h" 30 #include "comgeom.h" 31 #include "netcdf.inc" 30 include "netcdf.inc" 32 31 33 32 c Arguments: … … 36 35 integer,intent(in) :: nid ! NetCDF file ID 37 36 INTEGER*4,intent(in) :: idayref ! date (initial date for this run) 38 real,intent(in) :: phis(ip1jmp1) ! surface geopotential 37 real,intent(in) :: phis(nbp_lon+1,nbp_lat) ! surface geopotential 38 real,intent(in) :: area(nbp_lon+1,nbp_lat) ! mesh area (m2) 39 39 40 40 c Local: … … 44 44 REAL tab_cntrl(length) ! run parameters are stored in this array 45 45 INTEGER ierr 46 47 integer :: nvarid,idim_index,idim_rlonu,idim_rlonv 48 integer :: idim_rlatu,idim_rlatv,idim_llmp1,idim_llm 46 REAl :: lon_reg_ext(nbp_lon+1) ! extended longitudes 47 48 integer :: nvarid,idim_index,idim_rlonv 49 integer :: idim_rlatu,idim_llmp1,idim_llm 49 50 integer :: idim_nsoilmx ! "subsurface_layers" dimension ID # 50 51 integer, dimension(2) :: id … … 54 55 tab_cntrl(l)=0. 55 56 ENDDO 56 tab_cntrl(1) = real( iim)57 tab_cntrl(2) = real( jjm)58 tab_cntrl(3) = real( llm)57 tab_cntrl(1) = real(nbp_lon) 58 tab_cntrl(2) = real(nbp_lat-1) 59 tab_cntrl(3) = real(nbp_lev) 59 60 tab_cntrl(4) = real(idayref) 60 61 tab_cntrl(5) = rad … … 99 100 100 101 ierr = NF_DEF_DIM (nid, "index", length, idim_index) 101 ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu)102 ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu)103 ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv)104 ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv)105 ierr = NF_DEF_DIM (nid, "interlayer", ( llm+1), idim_llmp1)106 ierr = NF_DEF_DIM (nid, "altitude", llm, idim_llm)102 ! ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) 103 ierr = NF_DEF_DIM (nid, "latitude", nbp_lat, idim_rlatu) 104 ierr = NF_DEF_DIM (nid, "longitude", nbp_lon+1, idim_rlonv) 105 ! ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) 106 ierr = NF_DEF_DIM (nid, "interlayer", (nbp_lev+1), idim_llmp1) 107 ierr = NF_DEF_DIM (nid, "altitude", nbp_lev, idim_llm) 107 108 ierr = NF_DEF_DIM (nid,"subsurface_layers",nsoilmx,idim_nsoilmx) 108 109 c … … 129 130 c -------------------------- 130 131 c longitudes and latitudes 131 ierr = NF_REDEF (nid) 132 #ifdef NC_DOUBLE 133 ierr = NF_DEF_VAR (nid, "rlonu", NF_DOUBLE, 1, idim_rlonu,nvarid) 134 #else 135 ierr = NF_DEF_VAR (nid, "rlonu", NF_FLOAT, 1, idim_rlonu,nvarid) 136 #endif 137 ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21, 138 . "Longitudes at u nodes") 139 ierr = NF_ENDDEF(nid) 140 #ifdef NC_DOUBLE 141 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu/pi*180) 142 #else 143 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu/pi*180) 144 #endif 132 ! 133 ! ierr = NF_REDEF (nid) 134 !#ifdef NC_DOUBLE 135 ! ierr = NF_DEF_VAR (nid, "rlonu", NF_DOUBLE, 1, idim_rlonu,nvarid) 136 !#else 137 ! ierr = NF_DEF_VAR (nid, "rlonu", NF_FLOAT, 1, idim_rlonu,nvarid) 138 !#endif 139 ! ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21, 140 ! . "Longitudes at u nodes") 141 ! ierr = NF_ENDDEF(nid) 142 !#ifdef NC_DOUBLE 143 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu/pi*180) 144 !#else 145 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu/pi*180) 146 !#endif 145 147 c 146 148 c -------------------------- … … 156 158 ierr = NF_ENDDEF(nid) 157 159 #ifdef NC_DOUBLE 158 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180) 159 #else 160 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180) 161 #endif 162 c 163 c -------------------------- 160 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lat_reg/pi*180) 161 #else 162 ierr = NF_PUT_VAR_REAL (nid,nvarid,lat_reg/pi*180) 163 #endif 164 c 165 c -------------------------- 166 lon_reg_ext(1:nbp_lon)=lon_reg(1:nbp_lon) 167 !add extra redundant point (180 degrees, since lon_reg starts at -180 168 lon_reg_ext(nbp_lon+1)=-lon_reg_ext(1) 169 164 170 ierr = NF_REDEF (nid) 165 171 #ifdef NC_DOUBLE … … 173 179 ierr = NF_ENDDEF(nid) 174 180 #ifdef NC_DOUBLE 175 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid, rlonv/pi*180)176 #else 177 ierr = NF_PUT_VAR_REAL (nid,nvarid, rlonv/pi*180)181 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lon_reg_ext/pi*180) 182 #else 183 ierr = NF_PUT_VAR_REAL (nid,nvarid,lon_reg_ext/pi*180) 178 184 #endif 179 185 c … … 199 205 c 200 206 c -------------------------- 201 ierr = NF_REDEF (nid)202 #ifdef NC_DOUBLE203 ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid)204 #else205 ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid)206 #endif207 ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20,208 . "Latitudes at v nodes")209 ierr = NF_ENDDEF(nid)210 #ifdef NC_DOUBLE211 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180)212 #else213 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180)214 #endif207 ! ierr = NF_REDEF (nid) 208 !#ifdef NC_DOUBLE 209 ! ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid) 210 !#else 211 ! ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid) 212 !#endif 213 ! ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20, 214 ! . "Latitudes at v nodes") 215 ! ierr = NF_ENDDEF(nid) 216 !#ifdef NC_DOUBLE 217 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180) 218 !#else 219 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180) 220 !#endif 215 221 c 216 222 c -------------------------- … … 274 280 c Mesh area and conversion coefficients cov. <-> contra. <--> natural 275 281 276 id(1)=idim_rlonu277 id(2)=idim_rlatu278 c 279 ierr = NF_REDEF (nid)280 #ifdef NC_DOUBLE281 ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid)282 #else283 ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid)284 #endif285 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40,286 . "Conversion coefficients cov <--> natural")287 ierr = NF_ENDDEF(nid)288 #ifdef NC_DOUBLE289 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu)290 #else291 ierr = NF_PUT_VAR_REAL (nid,nvarid,cu)292 #endif293 c 294 id(1)=idim_rlonv295 id(2)=idim_rlatv296 c 297 c -------------------------- 298 ierr = NF_REDEF (nid)299 #ifdef NC_DOUBLE300 ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid)301 #else302 ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid)303 #endif304 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40,305 . "Conversion coefficients cov <--> natural")306 ierr = NF_ENDDEF(nid)307 #ifdef NC_DOUBLE308 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv)309 #else310 ierr = NF_PUT_VAR_REAL (nid,nvarid,cv)311 #endif282 ! id(1)=idim_rlonu 283 ! id(2)=idim_rlatu 284 c 285 ! ierr = NF_REDEF (nid) 286 !#ifdef NC_DOUBLE 287 ! ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid) 288 !#else 289 ! ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid) 290 !#endif 291 ! ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, 292 ! . "Conversion coefficients cov <--> natural") 293 ! ierr = NF_ENDDEF(nid) 294 !#ifdef NC_DOUBLE 295 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) 296 !#else 297 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) 298 !#endif 299 c 300 ! id(1)=idim_rlonv 301 ! id(2)=idim_rlatv 302 c 303 c -------------------------- 304 ! ierr = NF_REDEF (nid) 305 !#ifdef NC_DOUBLE 306 ! ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid) 307 !#else 308 ! ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid) 309 !#endif 310 ! ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, 311 ! . "Conversion coefficients cov <--> natural") 312 ! ierr = NF_ENDDEF(nid) 313 !#ifdef NC_DOUBLE 314 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) 315 !#else 316 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) 317 !#endif 312 318 c 313 319 id(1)=idim_rlonv … … 325 331 ierr = NF_ENDDEF(nid) 326 332 #ifdef NC_DOUBLE 327 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,a ire)328 #else 329 ierr = NF_PUT_VAR_REAL (nid,nvarid,a ire)333 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,area) 334 #else 335 ierr = NF_PUT_VAR_REAL (nid,nvarid,area) 330 336 #endif 331 337 c … … 350 356 c 351 357 352 write(*,*)'iniwrite: iim,jjm,llm,idayref',iim,jjm,llm,idayref 358 write(*,*)'iniwrite: nbp_lon,nbp_lat,nbp_lev,idayref', 359 & nbp_lon,nbp_lat,nbp_lev,idayref 353 360 write(*,*)'iniwrite: rad,omeg,g,mugaz,rcp', 354 srad,omeg,g,mugaz,rcp361 & rad,omeg,g,mugaz,rcp 355 362 write(*,*)'iniwrite: daysec,dtphys',daysec,dtphys 356 363
Note: See TracChangeset
for help on using the changeset viewer.