[779] | 1 | SUBROUTINE writerestartphy(fichnom,tab_cntrl,klon,klev, |
---|
[3] | 2 | . rlat,rlon, tsol,tsoil, |
---|
| 3 | . albedo, |
---|
| 4 | . solsw, sollw,fder, |
---|
| 5 | . radsol, |
---|
[808] | 6 | . zmea, zstd, zsig, zgam, zthe, zpic, zval, |
---|
[3] | 7 | . t_ancien) |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | c====================================================================== |
---|
| 11 | c Ecriture de l'etat de redemarrage pour la physique (pour newstart) |
---|
| 12 | c====================================================================== |
---|
[101] | 13 | IMPLICIT none |
---|
[3] | 14 | #include "dimensions.h" |
---|
| 15 | #include "netcdf.inc" |
---|
| 16 | #include "dimsoil.h" |
---|
| 17 | c====================================================================== |
---|
| 18 | CHARACTER*13 fichnom |
---|
[779] | 19 | INTEGER length,klon,klev |
---|
[3] | 20 | PARAMETER (length=100) |
---|
| 21 | REAL tab_cntrl(length) |
---|
| 22 | REAL rlat(klon), rlon(klon) |
---|
| 23 | REAL tsol(klon) |
---|
| 24 | REAL tsoil(klon,nsoilmx) |
---|
| 25 | REAL albedo(klon) |
---|
| 26 | real solsw(klon) |
---|
| 27 | real sollw(klon) |
---|
| 28 | real fder(klon) |
---|
| 29 | REAL radsol(klon) |
---|
[808] | 30 | REAL zmea(klon), zstd(klon) |
---|
| 31 | REAL zsig(klon), zgam(klon), zthe(klon) |
---|
| 32 | REAL zpic(klon), zval(klon) |
---|
[3] | 33 | REAL t_ancien(klon,klev) |
---|
| 34 | c |
---|
| 35 | INTEGER nid, nvarid, idim1, idim2, idim3 |
---|
| 36 | INTEGER ierr |
---|
| 37 | c |
---|
| 38 | INTEGER isoil |
---|
| 39 | CHARACTER*2 str2 |
---|
| 40 | c |
---|
| 41 | c----------------------------------------------------------------------- |
---|
| 42 | c Creation du fichier: |
---|
| 43 | c----------------------------------------------------------------------- |
---|
| 44 | c |
---|
| 45 | c print*,'fichnom',fichnom |
---|
| 46 | ierr = NF_CREATE(fichnom, NF_CLOBBER, nid) |
---|
| 47 | IF (ierr.NE.NF_NOERR) THEN |
---|
| 48 | write(6,*)' Pb d''ouverture du fichier '//fichnom |
---|
| 49 | write(6,*)' ierr = ', ierr |
---|
| 50 | CALL ABORT |
---|
| 51 | ENDIF |
---|
| 52 | c |
---|
| 53 | ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 28, |
---|
| 54 | . "Fichier redemarrage physique") |
---|
| 55 | c |
---|
| 56 | ierr = NF_DEF_DIM (nid, "index", length, idim1) |
---|
| 57 | ierr = NF_DEF_DIM (nid, "points_physiques", klon, idim2) |
---|
| 58 | ierr = NF_DEF_DIM (nid, "horizon_vertical", klon*klev, idim3) |
---|
| 59 | c |
---|
| 60 | |
---|
| 61 | #ifdef NC_DOUBLE |
---|
| 62 | ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, idim1,nvarid) |
---|
| 63 | #else |
---|
| 64 | ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, idim1,nvarid) |
---|
| 65 | #endif |
---|
| 66 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22, |
---|
| 67 | . "Parametres de controle") |
---|
| 68 | ierr = NF_ENDDEF(nid) |
---|
| 69 | #ifdef NC_DOUBLE |
---|
| 70 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
| 71 | #else |
---|
| 72 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
| 73 | #endif |
---|
| 74 | c |
---|
| 75 | ierr = NF_REDEF (nid) |
---|
| 76 | #ifdef NC_DOUBLE |
---|
| 77 | ierr = NF_DEF_VAR (nid, "longitude", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 78 | #else |
---|
| 79 | ierr = NF_DEF_VAR (nid, "longitude", NF_FLOAT, 1, idim2,nvarid) |
---|
| 80 | #endif |
---|
| 81 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32, |
---|
| 82 | . "Longitudes de la grille physique") |
---|
| 83 | ierr = NF_ENDDEF(nid) |
---|
| 84 | #ifdef NC_DOUBLE |
---|
| 85 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlon) |
---|
| 86 | #else |
---|
| 87 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlon) |
---|
| 88 | #endif |
---|
| 89 | c |
---|
| 90 | ierr = NF_REDEF (nid) |
---|
| 91 | #ifdef NC_DOUBLE |
---|
| 92 | ierr = NF_DEF_VAR (nid, "latitude", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 93 | #else |
---|
| 94 | ierr = NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim2,nvarid) |
---|
| 95 | #endif |
---|
| 96 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 31, |
---|
| 97 | . "Latitudes de la grille physique") |
---|
| 98 | ierr = NF_ENDDEF(nid) |
---|
| 99 | #ifdef NC_DOUBLE |
---|
| 100 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlat) |
---|
| 101 | #else |
---|
| 102 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlat) |
---|
| 103 | #endif |
---|
| 104 | c |
---|
| 105 | c----------------------------------------------------------------------- |
---|
| 106 | c Ecriture des variables: |
---|
| 107 | c----------------------------------------------------------------------- |
---|
| 108 | c |
---|
| 109 | ierr = NF_REDEF (nid) |
---|
| 110 | #ifdef NC_DOUBLE |
---|
| 111 | ierr = NF_DEF_VAR (nid, "TS", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 112 | #else |
---|
| 113 | ierr = NF_DEF_VAR (nid, "TS", NF_FLOAT, 1, idim2,nvarid) |
---|
| 114 | #endif |
---|
| 115 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22, |
---|
| 116 | . "Temperature de surface") |
---|
| 117 | ierr = NF_ENDDEF(nid) |
---|
| 118 | #ifdef NC_DOUBLE |
---|
| 119 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tsol) |
---|
| 120 | #else |
---|
| 121 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tsol) |
---|
| 122 | #endif |
---|
| 123 | c |
---|
| 124 | DO isoil=1, nsoilmx |
---|
| 125 | IF (isoil.LE.99) THEN |
---|
| 126 | WRITE(str2,'(i2.2)') isoil |
---|
| 127 | ierr = NF_REDEF (nid) |
---|
| 128 | #ifdef NC_DOUBLE |
---|
| 129 | ierr = NF_DEF_VAR (nid, "Tsoil"//str2,NF_DOUBLE,1,idim2,nvarid) |
---|
| 130 | #else |
---|
| 131 | ierr = NF_DEF_VAR (nid, "Tsoil"//str2,NF_FLOAT,1,idim2,nvarid) |
---|
| 132 | #endif |
---|
| 133 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 24, |
---|
| 134 | . "Temperature du sol No."//str2) |
---|
| 135 | ierr = NF_ENDDEF(nid) |
---|
| 136 | ELSE |
---|
| 137 | PRINT*, "Trop de couches" |
---|
| 138 | CALL abort |
---|
| 139 | ENDIF |
---|
| 140 | #ifdef NC_DOUBLE |
---|
| 141 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tsoil(1,isoil)) |
---|
| 142 | #else |
---|
| 143 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tsoil(1,isoil)) |
---|
| 144 | #endif |
---|
| 145 | ENDDO |
---|
| 146 | c |
---|
| 147 | ierr = NF_REDEF (nid) |
---|
| 148 | #ifdef NC_DOUBLE |
---|
| 149 | ierr = NF_DEF_VAR (nid,"ALBE",NF_DOUBLE,1,idim2,nvarid) |
---|
| 150 | #else |
---|
| 151 | ierr = NF_DEF_VAR (nid,"ALBE",NF_FLOAT,1,idim2,nvarid) |
---|
| 152 | #endif |
---|
| 153 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18, |
---|
| 154 | . "albedo de surface") |
---|
| 155 | ierr = NF_ENDDEF(nid) |
---|
| 156 | #ifdef NC_DOUBLE |
---|
| 157 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,albedo) |
---|
| 158 | #else |
---|
| 159 | ierr = NF_PUT_VAR_REAL (nid,nvarid,albedo) |
---|
| 160 | #endif |
---|
| 161 | c |
---|
| 162 | ierr = NF_REDEF (nid) |
---|
| 163 | #ifdef NC_DOUBLE |
---|
| 164 | ierr = NF_DEF_VAR (nid, "solsw", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 165 | #else |
---|
| 166 | ierr = NF_DEF_VAR (nid, "solsw", NF_FLOAT, 1, idim2,nvarid) |
---|
| 167 | #endif |
---|
| 168 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32, |
---|
| 169 | . "Rayonnement solaire a la surface") |
---|
| 170 | ierr = NF_ENDDEF(nid) |
---|
| 171 | #ifdef NC_DOUBLE |
---|
| 172 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,solsw) |
---|
| 173 | #else |
---|
| 174 | ierr = NF_PUT_VAR_REAL (nid,nvarid,solsw) |
---|
| 175 | #endif |
---|
| 176 | c |
---|
| 177 | ierr = NF_REDEF (nid) |
---|
| 178 | #ifdef NC_DOUBLE |
---|
| 179 | ierr = NF_DEF_VAR (nid, "sollw", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 180 | #else |
---|
| 181 | ierr = NF_DEF_VAR (nid, "sollw", NF_FLOAT, 1, idim2,nvarid) |
---|
| 182 | #endif |
---|
| 183 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 27, |
---|
| 184 | . "Rayonnement IF a la surface") |
---|
| 185 | ierr = NF_ENDDEF(nid) |
---|
| 186 | #ifdef NC_DOUBLE |
---|
| 187 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,sollw) |
---|
| 188 | #else |
---|
| 189 | ierr = NF_PUT_VAR_REAL (nid,nvarid,sollw) |
---|
| 190 | #endif |
---|
| 191 | c |
---|
| 192 | ierr = NF_REDEF (nid) |
---|
| 193 | #ifdef NC_DOUBLE |
---|
| 194 | ierr = NF_DEF_VAR (nid, "fder", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 195 | #else |
---|
| 196 | ierr = NF_DEF_VAR (nid, "fder", NF_FLOAT, 1, idim2,nvarid) |
---|
| 197 | #endif |
---|
| 198 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14, |
---|
| 199 | . "Derive de flux") |
---|
| 200 | ierr = NF_ENDDEF(nid) |
---|
| 201 | #ifdef NC_DOUBLE |
---|
| 202 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,fder) |
---|
| 203 | #else |
---|
| 204 | ierr = NF_PUT_VAR_REAL (nid,nvarid,fder) |
---|
| 205 | #endif |
---|
| 206 | c |
---|
| 207 | ierr = NF_REDEF (nid) |
---|
| 208 | #ifdef NC_DOUBLE |
---|
| 209 | ierr = NF_DEF_VAR (nid, "RADS", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 210 | #else |
---|
| 211 | ierr = NF_DEF_VAR (nid, "RADS", NF_FLOAT, 1, idim2,nvarid) |
---|
| 212 | #endif |
---|
| 213 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
| 214 | . "Rayonnement net a la surface") |
---|
| 215 | ierr = NF_ENDDEF(nid) |
---|
| 216 | #ifdef NC_DOUBLE |
---|
| 217 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,radsol) |
---|
| 218 | #else |
---|
| 219 | ierr = NF_PUT_VAR_REAL (nid,nvarid,radsol) |
---|
| 220 | #endif |
---|
| 221 | c |
---|
| 222 | ierr = NF_REDEF (nid) |
---|
| 223 | #ifdef NC_DOUBLE |
---|
[808] | 224 | ierr = NF_DEF_VAR (nid, "ZMEA", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 225 | #else |
---|
| 226 | ierr = NF_DEF_VAR (nid, "ZMEA", NF_FLOAT, 1, idim2,nvarid) |
---|
| 227 | #endif |
---|
| 228 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
| 229 | . "zmea Orographie sous-maille") |
---|
| 230 | ierr = NF_ENDDEF(nid) |
---|
| 231 | #ifdef NC_DOUBLE |
---|
| 232 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zmea) |
---|
| 233 | #else |
---|
| 234 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zmea) |
---|
| 235 | #endif |
---|
| 236 | c |
---|
| 237 | ierr = NF_REDEF (nid) |
---|
| 238 | #ifdef NC_DOUBLE |
---|
| 239 | ierr = NF_DEF_VAR (nid, "ZSTD", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 240 | #else |
---|
| 241 | ierr = NF_DEF_VAR (nid, "ZSTD", NF_FLOAT, 1, idim2,nvarid) |
---|
| 242 | #endif |
---|
| 243 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
| 244 | . "zstd Orographie sous-maille") |
---|
| 245 | ierr = NF_ENDDEF(nid) |
---|
| 246 | #ifdef NC_DOUBLE |
---|
| 247 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zstd) |
---|
| 248 | #else |
---|
| 249 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zstd) |
---|
| 250 | #endif |
---|
| 251 | c |
---|
| 252 | ierr = NF_REDEF (nid) |
---|
| 253 | #ifdef NC_DOUBLE |
---|
| 254 | ierr = NF_DEF_VAR (nid, "ZSIG", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 255 | #else |
---|
| 256 | ierr = NF_DEF_VAR (nid, "ZSIG", NF_FLOAT, 1, idim2,nvarid) |
---|
| 257 | #endif |
---|
| 258 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
| 259 | . "zsig Orographie sous-maille") |
---|
| 260 | ierr = NF_ENDDEF(nid) |
---|
| 261 | #ifdef NC_DOUBLE |
---|
| 262 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zsig) |
---|
| 263 | #else |
---|
| 264 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zsig) |
---|
| 265 | #endif |
---|
| 266 | c |
---|
| 267 | ierr = NF_REDEF (nid) |
---|
| 268 | #ifdef NC_DOUBLE |
---|
| 269 | ierr = NF_DEF_VAR (nid, "ZGAM", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 270 | #else |
---|
| 271 | ierr = NF_DEF_VAR (nid, "ZGAM", NF_FLOAT, 1, idim2,nvarid) |
---|
| 272 | #endif |
---|
| 273 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
| 274 | . "zgam Orographie sous-maille") |
---|
| 275 | ierr = NF_ENDDEF(nid) |
---|
| 276 | #ifdef NC_DOUBLE |
---|
| 277 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zgam) |
---|
| 278 | #else |
---|
| 279 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zgam) |
---|
| 280 | #endif |
---|
| 281 | c |
---|
| 282 | ierr = NF_REDEF (nid) |
---|
| 283 | #ifdef NC_DOUBLE |
---|
| 284 | ierr = NF_DEF_VAR (nid, "ZTHE", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 285 | #else |
---|
| 286 | ierr = NF_DEF_VAR (nid, "ZTHE", NF_FLOAT, 1, idim2,nvarid) |
---|
| 287 | #endif |
---|
| 288 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
| 289 | . "zthe Orographie sous-maille") |
---|
| 290 | ierr = NF_ENDDEF(nid) |
---|
| 291 | #ifdef NC_DOUBLE |
---|
| 292 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zthe) |
---|
| 293 | #else |
---|
| 294 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zthe) |
---|
| 295 | #endif |
---|
| 296 | c |
---|
| 297 | ierr = NF_REDEF (nid) |
---|
| 298 | #ifdef NC_DOUBLE |
---|
| 299 | ierr = NF_DEF_VAR (nid, "ZPIC", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 300 | #else |
---|
| 301 | ierr = NF_DEF_VAR (nid, "ZPIC", NF_FLOAT, 1, idim2,nvarid) |
---|
| 302 | #endif |
---|
| 303 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
| 304 | . "zpic Orographie sous-maille") |
---|
| 305 | ierr = NF_ENDDEF(nid) |
---|
| 306 | #ifdef NC_DOUBLE |
---|
| 307 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zpic) |
---|
| 308 | #else |
---|
| 309 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zpic) |
---|
| 310 | #endif |
---|
| 311 | c |
---|
| 312 | ierr = NF_REDEF (nid) |
---|
| 313 | #ifdef NC_DOUBLE |
---|
| 314 | ierr = NF_DEF_VAR (nid, "ZVAL", NF_DOUBLE, 1, idim2,nvarid) |
---|
| 315 | #else |
---|
| 316 | ierr = NF_DEF_VAR (nid, "ZVAL", NF_FLOAT, 1, idim2,nvarid) |
---|
| 317 | #endif |
---|
| 318 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
| 319 | . "zval Orographie sous-maille") |
---|
| 320 | ierr = NF_ENDDEF(nid) |
---|
| 321 | #ifdef NC_DOUBLE |
---|
| 322 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zval) |
---|
| 323 | #else |
---|
| 324 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zval) |
---|
| 325 | #endif |
---|
| 326 | c |
---|
| 327 | ierr = NF_REDEF (nid) |
---|
| 328 | #ifdef NC_DOUBLE |
---|
[3] | 329 | ierr = NF_DEF_VAR (nid, "TANCIEN", NF_DOUBLE, 1, idim3,nvarid) |
---|
| 330 | #else |
---|
| 331 | ierr = NF_DEF_VAR (nid, "TANCIEN", NF_FLOAT, 1, idim3,nvarid) |
---|
| 332 | #endif |
---|
| 333 | ierr = NF_ENDDEF(nid) |
---|
| 334 | #ifdef NC_DOUBLE |
---|
| 335 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,t_ancien) |
---|
| 336 | #else |
---|
| 337 | ierr = NF_PUT_VAR_REAL (nid,nvarid,t_ancien) |
---|
| 338 | #endif |
---|
| 339 | c |
---|
| 340 | ierr = NF_CLOSE(nid) |
---|
| 341 | c |
---|
| 342 | RETURN |
---|
| 343 | END |
---|