[135] | 1 | SUBROUTINE iniwrite(nid,idayref,phis) |
---|
[787] | 2 | |
---|
| 3 | USE comsoil_h |
---|
| 4 | |
---|
[135] | 5 | IMPLICIT NONE |
---|
| 6 | |
---|
| 7 | c======================================================================= |
---|
| 8 | c |
---|
| 9 | c Auteur: L. Fairhead , P. Le Van, Y. Wanherdrick, F. Forget |
---|
| 10 | c ------- |
---|
| 11 | c |
---|
| 12 | c Objet: |
---|
| 13 | c ------ |
---|
| 14 | c |
---|
| 15 | c 'Initialize' the diagfi.nc file: write down dimensions as well |
---|
| 16 | c as time-independent fields (e.g: geopotential, mesh area, ...) |
---|
| 17 | c |
---|
| 18 | c======================================================================= |
---|
| 19 | c----------------------------------------------------------------------- |
---|
| 20 | c Declarations: |
---|
| 21 | c ------------- |
---|
| 22 | |
---|
| 23 | #include "dimensions.h" |
---|
| 24 | #include "paramet.h" |
---|
| 25 | !include "comconst.h" |
---|
| 26 | #include "comcstfi.h" |
---|
| 27 | #include "comvert.h" |
---|
| 28 | #include "comgeom.h" |
---|
| 29 | #include "temps.h" |
---|
| 30 | #include "ener.h" |
---|
| 31 | #include "logic.h" |
---|
| 32 | #include "netcdf.inc" |
---|
| 33 | #include "serre.h" |
---|
| 34 | #include"dimphys.h" |
---|
| 35 | |
---|
| 36 | c Arguments: |
---|
| 37 | c ---------- |
---|
| 38 | |
---|
| 39 | integer nid ! NetCDF file ID |
---|
| 40 | INTEGER*4 idayref ! date (initial date for this run) |
---|
| 41 | REAL phis(ip1jmp1) ! surface geopotential |
---|
| 42 | |
---|
| 43 | c Local: |
---|
| 44 | c ------ |
---|
| 45 | INTEGER length,l |
---|
| 46 | parameter (length = 100) |
---|
| 47 | REAL tab_cntrl(length) ! run parameters are stored in this array |
---|
| 48 | INTEGER ierr |
---|
| 49 | |
---|
| 50 | integer :: nvarid,idim_index,idim_rlonu,idim_rlonv |
---|
| 51 | integer :: idim_rlatu,idim_rlatv,idim_llmp1,idim_llm |
---|
| 52 | integer :: idim_nsoilmx ! "subsurface_layers" dimension ID # |
---|
| 53 | integer, dimension(2) :: id |
---|
| 54 | c----------------------------------------------------------------------- |
---|
| 55 | |
---|
| 56 | DO l=1,length |
---|
| 57 | tab_cntrl(l)=0. |
---|
| 58 | ENDDO |
---|
| 59 | tab_cntrl(1) = FLOAT(iim) |
---|
| 60 | tab_cntrl(2) = FLOAT(jjm) |
---|
| 61 | tab_cntrl(3) = FLOAT(llm) |
---|
| 62 | tab_cntrl(4) = FLOAT(idayref) |
---|
| 63 | tab_cntrl(5) = rad |
---|
| 64 | tab_cntrl(6) = omeg |
---|
| 65 | tab_cntrl(7) = g |
---|
| 66 | tab_cntrl(8) = mugaz |
---|
| 67 | tab_cntrl(9) = rcp |
---|
| 68 | tab_cntrl(10) = daysec |
---|
| 69 | tab_cntrl(11) = dtphys |
---|
| 70 | tab_cntrl(12) = etot0 |
---|
| 71 | tab_cntrl(13) = ptot0 |
---|
| 72 | tab_cntrl(14) = ztot0 |
---|
| 73 | tab_cntrl(15) = stot0 |
---|
| 74 | tab_cntrl(16) = ang0 |
---|
| 75 | c |
---|
| 76 | c .......... P.Le Van ( ajout le 8/04/96 ) ......... |
---|
| 77 | c ..... parametres pour le zoom ...... |
---|
| 78 | tab_cntrl(17) = clon |
---|
| 79 | tab_cntrl(18) = clat |
---|
| 80 | tab_cntrl(19) = grossismx |
---|
| 81 | tab_cntrl(20) = grossismy |
---|
| 82 | c |
---|
| 83 | c ..... ajout le 6/05/97 et le 15/10/97 ....... |
---|
| 84 | c |
---|
| 85 | IF ( fxyhypb ) THEN |
---|
| 86 | tab_cntrl(21) = 1. |
---|
| 87 | tab_cntrl(22) = dzoomx |
---|
| 88 | tab_cntrl(23) = dzoomy |
---|
| 89 | ELSE |
---|
| 90 | tab_cntrl(21) = 0. |
---|
| 91 | tab_cntrl(22) = dzoomx |
---|
| 92 | tab_cntrl(23) = dzoomy |
---|
| 93 | tab_cntrl(24) = 0. |
---|
| 94 | IF( ysinus ) tab_cntrl(24) = 1. |
---|
| 95 | ENDIF |
---|
| 96 | |
---|
| 97 | c ......................................................... |
---|
| 98 | |
---|
| 99 | ! Define dimensions |
---|
| 100 | |
---|
| 101 | ierr = NF_REDEF (nid) |
---|
| 102 | |
---|
| 103 | ierr = NF_DEF_DIM (nid, "index", length, idim_index) |
---|
| 104 | ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) |
---|
| 105 | ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu) |
---|
| 106 | ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv) |
---|
| 107 | ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) |
---|
| 108 | ierr = NF_DEF_DIM (nid, "interlayer", (llm+1), idim_llmp1) |
---|
| 109 | ierr = NF_DEF_DIM (nid, "altitude", llm, idim_llm) |
---|
| 110 | ierr = NF_DEF_DIM (nid,"subsurface_layers",nsoilmx,idim_nsoilmx) |
---|
| 111 | c |
---|
| 112 | ierr = NF_ENDDEF(nid) |
---|
| 113 | |
---|
| 114 | c Contol parameters for this run |
---|
| 115 | ierr = NF_REDEF (nid) |
---|
| 116 | #ifdef NC_DOUBLE |
---|
| 117 | ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, |
---|
| 118 | . idim_index,nvarid) |
---|
| 119 | #else |
---|
| 120 | ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, |
---|
| 121 | . idim_index,nvarid) |
---|
| 122 | #endif |
---|
| 123 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18, |
---|
| 124 | . "Control parameters") |
---|
| 125 | ierr = NF_ENDDEF(nid) |
---|
| 126 | #ifdef NC_DOUBLE |
---|
| 127 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
| 128 | #else |
---|
| 129 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
| 130 | #endif |
---|
| 131 | |
---|
| 132 | c -------------------------- |
---|
| 133 | c longitudes and latitudes |
---|
| 134 | ierr = NF_REDEF (nid) |
---|
| 135 | #ifdef NC_DOUBLE |
---|
| 136 | ierr = NF_DEF_VAR (nid, "rlonu", NF_DOUBLE, 1, idim_rlonu,nvarid) |
---|
| 137 | #else |
---|
| 138 | ierr = NF_DEF_VAR (nid, "rlonu", NF_FLOAT, 1, idim_rlonu,nvarid) |
---|
| 139 | #endif |
---|
| 140 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21, |
---|
| 141 | . "Longitudes at u nodes") |
---|
| 142 | ierr = NF_ENDDEF(nid) |
---|
| 143 | #ifdef NC_DOUBLE |
---|
| 144 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu/pi*180) |
---|
| 145 | #else |
---|
| 146 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu/pi*180) |
---|
| 147 | #endif |
---|
| 148 | c |
---|
| 149 | c -------------------------- |
---|
| 150 | ierr = NF_REDEF (nid) |
---|
| 151 | #ifdef NC_DOUBLE |
---|
| 152 | ierr =NF_DEF_VAR(nid, "latitude", NF_DOUBLE, 1, idim_rlatu,nvarid) |
---|
| 153 | #else |
---|
| 154 | ierr =NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim_rlatu,nvarid) |
---|
| 155 | #endif |
---|
| 156 | ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north") |
---|
| 157 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14, |
---|
| 158 | . "North latitude") |
---|
| 159 | ierr = NF_ENDDEF(nid) |
---|
| 160 | #ifdef NC_DOUBLE |
---|
| 161 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180) |
---|
| 162 | #else |
---|
| 163 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180) |
---|
| 164 | #endif |
---|
| 165 | c |
---|
| 166 | c -------------------------- |
---|
| 167 | ierr = NF_REDEF (nid) |
---|
| 168 | #ifdef NC_DOUBLE |
---|
| 169 | ierr =NF_DEF_VAR(nid,"longitude", NF_DOUBLE, 1, idim_rlonv,nvarid) |
---|
| 170 | #else |
---|
| 171 | ierr = NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, idim_rlonv,nvarid) |
---|
| 172 | #endif |
---|
| 173 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14, |
---|
| 174 | . "East longitude") |
---|
| 175 | ierr = NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east") |
---|
| 176 | ierr = NF_ENDDEF(nid) |
---|
| 177 | #ifdef NC_DOUBLE |
---|
| 178 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv/pi*180) |
---|
| 179 | #else |
---|
| 180 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv/pi*180) |
---|
| 181 | #endif |
---|
| 182 | c |
---|
| 183 | c -------------------------- |
---|
| 184 | ierr = NF_REDEF (nid) |
---|
| 185 | #ifdef NC_DOUBLE |
---|
| 186 | ierr = NF_DEF_VAR (nid, "altitude", NF_DOUBLE, 1, |
---|
| 187 | . idim_llm,nvarid) |
---|
| 188 | #else |
---|
| 189 | ierr = NF_DEF_VAR (nid, "altitude", NF_FLOAT, 1, |
---|
| 190 | . idim_llm,nvarid) |
---|
| 191 | #endif |
---|
| 192 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name",10,"pseudo-alt") |
---|
| 193 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,'units',2,"km") |
---|
| 194 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,'positive',2,"up") |
---|
| 195 | |
---|
| 196 | ierr = NF_ENDDEF(nid) |
---|
| 197 | #ifdef NC_DOUBLE |
---|
| 198 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,pseudoalt) |
---|
| 199 | #else |
---|
| 200 | ierr = NF_PUT_VAR_REAL (nid,nvarid,pseudoalt) |
---|
| 201 | #endif |
---|
| 202 | c |
---|
| 203 | c -------------------------- |
---|
| 204 | ierr = NF_REDEF (nid) |
---|
| 205 | #ifdef NC_DOUBLE |
---|
| 206 | ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid) |
---|
| 207 | #else |
---|
| 208 | ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid) |
---|
| 209 | #endif |
---|
| 210 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20, |
---|
| 211 | . "Latitudes at v nodes") |
---|
| 212 | ierr = NF_ENDDEF(nid) |
---|
| 213 | #ifdef NC_DOUBLE |
---|
| 214 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180) |
---|
| 215 | #else |
---|
| 216 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180) |
---|
| 217 | #endif |
---|
| 218 | c |
---|
| 219 | c -------------------------- |
---|
| 220 | c Vertical levels |
---|
| 221 | call def_var(nid,"aps","hybrid pressure at midlayers ","Pa", |
---|
| 222 | . 1,idim_llm,nvarid,ierr) |
---|
| 223 | #ifdef NC_DOUBLE |
---|
| 224 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aps) |
---|
| 225 | #else |
---|
| 226 | ierr = NF_PUT_VAR_REAL (nid,nvarid,aps) |
---|
| 227 | #endif |
---|
| 228 | |
---|
| 229 | call def_var(nid,"bps","hybrid sigma at midlayers"," ", |
---|
| 230 | . 1,idim_llm,nvarid,ierr) |
---|
| 231 | #ifdef NC_DOUBLE |
---|
| 232 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bps) |
---|
| 233 | #else |
---|
| 234 | ierr = NF_PUT_VAR_REAL (nid,nvarid,bps) |
---|
| 235 | #endif |
---|
| 236 | |
---|
| 237 | call def_var(nid,"ap","hybrid pressure at interlayers","Pa", |
---|
| 238 | . 1,idim_llmp1,nvarid,ierr) |
---|
| 239 | #ifdef NC_DOUBLE |
---|
| 240 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) |
---|
| 241 | #else |
---|
| 242 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) |
---|
| 243 | #endif |
---|
| 244 | |
---|
| 245 | call def_var(nid,"bp","hybrid sigma at interlayers"," ", |
---|
| 246 | . 1,idim_llmp1,nvarid,ierr) |
---|
| 247 | #ifdef NC_DOUBLE |
---|
| 248 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) |
---|
| 249 | #else |
---|
| 250 | ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) |
---|
| 251 | #endif |
---|
| 252 | |
---|
| 253 | !------------------------------- |
---|
| 254 | ! (soil) depth variable mlayer() (known from comsoil.h) |
---|
| 255 | !------------------------------- |
---|
| 256 | ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode |
---|
| 257 | ! define variable |
---|
| 258 | #ifdef NC_DOUBLE |
---|
| 259 | ierr=NF_DEF_VAR(nid,"soildepth",NF_DOUBLE,1,idim_nsoilmx,nvarid) |
---|
| 260 | #else |
---|
| 261 | ierr=NF_DEF_VAR(nid,"soildepth",NF_FLOAT,1,idim_nsoilmx,nvarid) |
---|
| 262 | #endif |
---|
| 263 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 20, |
---|
| 264 | . "Soil mid-layer depth") |
---|
| 265 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",1,"m") |
---|
| 266 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"positive",4,"down") |
---|
| 267 | ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode |
---|
| 268 | ! write variable |
---|
| 269 | #ifdef NC_DOUBLE |
---|
| 270 | ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,mlayer) |
---|
| 271 | #else |
---|
| 272 | ierr=NF_PUT_VAR_REAL (nid,nvarid,mlayer) |
---|
| 273 | #endif |
---|
| 274 | |
---|
| 275 | c |
---|
| 276 | c -------------------------- |
---|
| 277 | c Mesh area and conversion coefficients cov. <-> contra. <--> natural |
---|
| 278 | |
---|
| 279 | id(1)=idim_rlonu |
---|
| 280 | id(2)=idim_rlatu |
---|
| 281 | c |
---|
| 282 | ierr = NF_REDEF (nid) |
---|
| 283 | #ifdef NC_DOUBLE |
---|
| 284 | ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid) |
---|
| 285 | #else |
---|
| 286 | ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid) |
---|
| 287 | #endif |
---|
| 288 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, |
---|
| 289 | . "Conversion coefficients cov <--> natural") |
---|
| 290 | ierr = NF_ENDDEF(nid) |
---|
| 291 | #ifdef NC_DOUBLE |
---|
| 292 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) |
---|
| 293 | #else |
---|
| 294 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) |
---|
| 295 | #endif |
---|
| 296 | c |
---|
| 297 | id(1)=idim_rlonv |
---|
| 298 | id(2)=idim_rlatv |
---|
| 299 | c |
---|
| 300 | c -------------------------- |
---|
| 301 | ierr = NF_REDEF (nid) |
---|
| 302 | #ifdef NC_DOUBLE |
---|
| 303 | ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid) |
---|
| 304 | #else |
---|
| 305 | ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid) |
---|
| 306 | #endif |
---|
| 307 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, |
---|
| 308 | . "Conversion coefficients cov <--> natural") |
---|
| 309 | ierr = NF_ENDDEF(nid) |
---|
| 310 | #ifdef NC_DOUBLE |
---|
| 311 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) |
---|
| 312 | #else |
---|
| 313 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) |
---|
| 314 | #endif |
---|
| 315 | c |
---|
| 316 | id(1)=idim_rlonv |
---|
| 317 | id(2)=idim_rlatu |
---|
| 318 | c |
---|
| 319 | c -------------------------- |
---|
| 320 | ierr = NF_REDEF (nid) |
---|
| 321 | #ifdef NC_DOUBLE |
---|
| 322 | ierr = NF_DEF_VAR (nid, "aire", NF_DOUBLE, 2, id,nvarid) |
---|
| 323 | #else |
---|
| 324 | ierr = NF_DEF_VAR (nid, "aire", NF_FLOAT, 2, id,nvarid) |
---|
| 325 | #endif |
---|
| 326 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
| 327 | . "Mesh area") |
---|
| 328 | ierr = NF_ENDDEF(nid) |
---|
| 329 | #ifdef NC_DOUBLE |
---|
| 330 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) |
---|
| 331 | #else |
---|
| 332 | ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) |
---|
| 333 | #endif |
---|
| 334 | c |
---|
| 335 | c Surface geopotential |
---|
| 336 | id(1)=idim_rlonv |
---|
| 337 | id(2)=idim_rlatu |
---|
| 338 | c |
---|
| 339 | ierr = NF_REDEF (nid) |
---|
| 340 | #ifdef NC_DOUBLE |
---|
| 341 | ierr = NF_DEF_VAR (nid, "phisinit", NF_DOUBLE, 2, id,nvarid) |
---|
| 342 | #else |
---|
| 343 | ierr = NF_DEF_VAR (nid, "phisinit", NF_FLOAT, 2, id,nvarid) |
---|
| 344 | #endif |
---|
| 345 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 27, |
---|
| 346 | . "Geopotential at the surface") |
---|
| 347 | ierr = NF_ENDDEF(nid) |
---|
| 348 | #ifdef NC_DOUBLE |
---|
| 349 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) |
---|
| 350 | #else |
---|
| 351 | ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) |
---|
| 352 | #endif |
---|
| 353 | c |
---|
| 354 | |
---|
| 355 | write(*,*)'iniwrite: iim,jjm,llm,idayref',iim,jjm,llm,idayref |
---|
| 356 | write(*,*)'iniwrite: rad,omeg,g,mugaz,rcp', |
---|
| 357 | s rad,omeg,g,mugaz,rcp |
---|
| 358 | write(*,*)'iniwrite: daysec,dtphys',daysec,dtphys |
---|
| 359 | |
---|
| 360 | END |
---|