Changeset 1528 for trunk/LMDZ.MARS/libf/phymars/iniwrite.F
- Timestamp:
- Apr 2, 2016, 4:09:43 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/iniwrite.F
r1524 r1528 1 SUBROUTINE iniwrite(nid,idayref,phis )1 SUBROUTINE iniwrite(nid,idayref,phis,area) 2 2 3 3 use comsoil_h, only: mlayer, nsoilmx … … 8 8 USE time_phylmdz_mod, ONLY: hour_ini, 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 … … 101 102 102 103 ierr = NF_DEF_DIM (nid, "index", length, idim_index) 103 ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu)104 ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu)105 ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv)106 ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv)107 ierr = NF_DEF_DIM (nid, "interlayer", ( llm+1), idim_llmp1)108 ierr = NF_DEF_DIM (nid, "altitude", llm, idim_llm)104 ! ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) 105 ierr = NF_DEF_DIM (nid, "latitude", nbp_lat, idim_rlatu) 106 ierr = NF_DEF_DIM (nid, "longitude", nbp_lon+1, idim_rlonv) 107 ! ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) 108 ierr = NF_DEF_DIM (nid, "interlayer", (nbp_lev+1), idim_llmp1) 109 ierr = NF_DEF_DIM (nid, "altitude", nbp_lev, idim_llm) 109 110 ierr = NF_DEF_DIM (nid,"subsurface_layers",nsoilmx,idim_nsoilmx) 110 111 c … … 131 132 c -------------------------- 132 133 c longitudes and latitudes 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 134 ! 135 ! ierr = NF_REDEF (nid) 136 !#ifdef NC_DOUBLE 137 ! ierr = NF_DEF_VAR (nid, "rlonu", NF_DOUBLE, 1, idim_rlonu,nvarid) 138 !#else 139 ! ierr = NF_DEF_VAR (nid, "rlonu", NF_FLOAT, 1, idim_rlonu,nvarid) 140 !#endif 141 ! ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21, 142 ! . "Longitudes at u nodes") 143 ! ierr = NF_ENDDEF(nid) 144 !#ifdef NC_DOUBLE 145 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu/pi*180) 146 !#else 147 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu/pi*180) 148 !#endif 147 149 c 148 150 c -------------------------- … … 158 160 ierr = NF_ENDDEF(nid) 159 161 #ifdef NC_DOUBLE 160 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180) 161 #else 162 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180) 163 #endif 164 c 165 c -------------------------- 162 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lat_reg/pi*180) 163 #else 164 ierr = NF_PUT_VAR_REAL (nid,nvarid,lat_reg/pi*180) 165 #endif 166 c 167 c -------------------------- 168 lon_reg_ext(1:nbp_lon)=lon_reg(1:nbp_lon) 169 !add extra redundant point (180 degrees, since lon_reg starts at -180 170 lon_reg_ext(nbp_lon+1)=-lon_reg_ext(1) 171 166 172 ierr = NF_REDEF (nid) 167 173 #ifdef NC_DOUBLE … … 175 181 ierr = NF_ENDDEF(nid) 176 182 #ifdef NC_DOUBLE 177 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid, rlonv/pi*180)178 #else 179 ierr = NF_PUT_VAR_REAL (nid,nvarid, rlonv/pi*180)183 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lon_reg_ext/pi*180) 184 #else 185 ierr = NF_PUT_VAR_REAL (nid,nvarid,lon_reg_ext/pi*180) 180 186 #endif 181 187 c … … 201 207 c 202 208 c -------------------------- 203 ierr = NF_REDEF (nid)204 #ifdef NC_DOUBLE205 ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid)206 #else207 ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid)208 #endif209 ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20,210 . "Latitudes at v nodes")211 ierr = NF_ENDDEF(nid)212 #ifdef NC_DOUBLE213 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180)214 #else215 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180)216 #endif209 ! ierr = NF_REDEF (nid) 210 !#ifdef NC_DOUBLE 211 ! ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid) 212 !#else 213 ! ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid) 214 !#endif 215 ! ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20, 216 ! . "Latitudes at v nodes") 217 ! ierr = NF_ENDDEF(nid) 218 !#ifdef NC_DOUBLE 219 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180) 220 !#else 221 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180) 222 !#endif 217 223 c 218 224 c -------------------------- … … 276 282 c Mesh area and conversion coefficients cov. <-> contra. <--> natural 277 283 278 id(1)=idim_rlonu279 id(2)=idim_rlatu280 c 281 ierr = NF_REDEF (nid)282 #ifdef NC_DOUBLE283 ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid)284 #else285 ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid)286 #endif287 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40,288 . "Conversion coefficients cov <--> natural")289 ierr = NF_ENDDEF(nid)290 #ifdef NC_DOUBLE291 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu)292 #else293 ierr = NF_PUT_VAR_REAL (nid,nvarid,cu)294 #endif295 c 296 id(1)=idim_rlonv297 id(2)=idim_rlatv298 c 299 c -------------------------- 300 ierr = NF_REDEF (nid)301 #ifdef NC_DOUBLE302 ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid)303 #else304 ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid)305 #endif306 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40,307 . "Conversion coefficients cov <--> natural")308 ierr = NF_ENDDEF(nid)309 #ifdef NC_DOUBLE310 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv)311 #else312 ierr = NF_PUT_VAR_REAL (nid,nvarid,cv)313 #endif284 ! id(1)=idim_rlonu 285 ! id(2)=idim_rlatu 286 c 287 ! ierr = NF_REDEF (nid) 288 !#ifdef NC_DOUBLE 289 ! ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid) 290 !#else 291 ! ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid) 292 !#endif 293 ! ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, 294 ! . "Conversion coefficients cov <--> natural") 295 ! ierr = NF_ENDDEF(nid) 296 !#ifdef NC_DOUBLE 297 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) 298 !#else 299 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) 300 !#endif 301 c 302 ! id(1)=idim_rlonv 303 ! id(2)=idim_rlatv 304 c 305 c -------------------------- 306 ! ierr = NF_REDEF (nid) 307 !#ifdef NC_DOUBLE 308 ! ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid) 309 !#else 310 ! ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid) 311 !#endif 312 ! ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, 313 ! . "Conversion coefficients cov <--> natural") 314 ! ierr = NF_ENDDEF(nid) 315 !#ifdef NC_DOUBLE 316 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) 317 !#else 318 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) 319 !#endif 314 320 c 315 321 id(1)=idim_rlonv … … 327 333 ierr = NF_ENDDEF(nid) 328 334 #ifdef NC_DOUBLE 329 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,a ire)330 #else 331 ierr = NF_PUT_VAR_REAL (nid,nvarid,a ire)335 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,area) 336 #else 337 ierr = NF_PUT_VAR_REAL (nid,nvarid,area) 332 338 #endif 333 339 c … … 352 358 c 353 359 354 write(*,*)'iniwrite: iim,jjm,llm,idayref',iim,jjm,llm,idayref 360 write(*,*)'iniwrite: nbp_lon,nbp_lat,nbp_lev,idayref', 361 & nbp_lon,nbp_lat,nbp_lev,idayref 355 362 write(*,*)'iniwrite: rad,omeg,g,mugaz,rcp', 356 srad,omeg,g,mugaz,rcp363 & rad,omeg,g,mugaz,rcp 357 364 write(*,*)'iniwrite: daysec,dtphys',daysec,dtphys 358 365
Note: See TracChangeset
for help on using the changeset viewer.