Changeset 323 for trunk/LMDZ.GENERIC
- Timestamp:
- Oct 21, 2011, 11:29:30 AM (13 years ago)
- Location:
- trunk/LMDZ.GENERIC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/README
r253 r323 528 528 A bug involving the definition of the Planck function boundaries was corrected in sfluxi.F90 529 529 and gfluxi.F. 530 531 == 21/10/2011 == EM 532 - added FF's upgrade of writediagfi. Now, if at runtime there is a diagfi.def 533 file, it should contain the list of variables (1 per line) than will be put 534 in the diagfi.nc file. If there is no diagfi.def file, then all variables 535 are put in the diagfi.nc file (as was the case before). -
trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F
r253 r323 6 6 ! 0d (pour un scalaire qui ne depend que du temps : ex : la longitude 7 7 ! solaire) 8 ! (ou encore 1d, dans le cas de rcm1d, pour sortir une colonne)8 ! (ou encore 1d, dans le cas de testphys1d, pour sortir une colonne) 9 9 ! La periode d'ecriture est donnee par 10 10 ! "ecritphy " regle dans le fichier de controle de run : run.def … … 21 21 ! avant l'ecriture dans diagfi (cf. physiq.F) 22 22 ! 23 ! Modifs: Aug.2010 Ehouarn: enforce outputs to be real*4 24 ! Oct 2011 Francois: enable having a 'diagfi.def' file to select 25 ! at runtime, which variables to put in file 23 26 ! 24 27 ! parametres (input) : … … 52 55 53 56 ! Arguments on input: 54 integer ngrid55 character (len=*) :: nom,titre,unite56 integer dim57 real px(ngrid,llm)57 integer,intent(in) :: ngrid 58 character (len=*),intent(in) :: nom,titre,unite 59 integer,intent(in) :: dim 60 real,intent(in) :: px(ngrid,llm) 58 61 59 62 ! Local variables: 60 63 61 real dx3(iip1,jjp1,llm) ! to store a 3D data set62 real dx2(iip1,jjp1) ! to store a 2D (surface) data set63 real dx1(llm) ! to store a 1D (column) data set64 real dx065 66 real date64 real*4 dx3(iip1,jjp1,llm) ! to store a 3D data set 65 real*4 dx2(iip1,jjp1) ! to store a 2D (surface) data set 66 real*4 dx1(llm) ! to store a 1D (column) data set 67 real*4 dx0 68 69 real*4,save :: date 67 70 68 71 REAL phis(ip1jmp1) 69 72 70 73 integer irythme 71 integer ierr 74 integer ierr,ierr2 72 75 integer iq 73 76 integer i,j,l,zmax , ig0 74 77 75 integer zitau 76 character firstnom*20 77 SAVE firstnom 78 SAVE zitau 79 SAVE date 80 data firstnom /'1234567890'/ 81 data zitau /0/ 78 integer,save :: zitau=0 79 character(len=20),save :: firstnom='1234567890' 82 80 83 81 ! Ajouts … … 85 83 integer :: idim,varid 86 84 integer :: nid 87 character (len =50):: fichnom85 character(len=*),parameter :: fichnom="diagfi.nc" 88 86 integer, dimension(4) :: id 89 87 integer, dimension(4) :: edges,corner 88 89 ! Added to use diagfi.def to select output variable 90 logical,save :: diagfi_def 91 logical :: getout 92 integer,save :: n_nom_def 93 integer :: n 94 integer,parameter :: n_nom_def_max=99 95 character(len=20),save :: nom_def(n_nom_def_max) 96 logical,save :: firstcall=.true. 90 97 91 98 #ifndef MESOSCALE 92 99 !*************************************************************** 93 100 !Sortie des variables au rythme voulu … … 101 108 !*************************************************************** 102 109 110 ! At very first call, check if there is a "diagfi.def" to use and read it 111 ! ----------------------------------------------------------------------- 112 IF (firstcall) THEN 113 firstcall=.false. 114 115 ! Open diagfi.def definition file if there is one: 116 open(99,file="diagfi.def",status='old',form='formatted', 117 s iostat=ierr2) 118 119 if(ierr2.eq.0) then 120 diagfi_def=.true. 121 write(*,*) "******************" 122 write(*,*) "Reading diagfi.def" 123 write(*,*) "******************" 124 do n=1,n_nom_def_max 125 read(99,fmt='(a)',end=88) nom_def(n) 126 write(*,*) 'Output in diagfi: ', trim(nom_def(n)) 127 end do 128 88 continue 129 if (n.ge.n_nom_def_max) then 130 write(*,*)"n_nom_def_max too small in writediagfi.F:",n 131 stop 132 end if 133 n_nom_def=n-1 134 close(99) 135 else 136 diagfi_def=.false. 137 endif 138 END IF ! of IF (firstcall) 139 140 ! Get out of write_diagfi if there is diagfi.def AND variable not listed 141 ! --------------------------------------------------------------------- 142 if (diagfi_def) then 143 getout=.true. 144 do n=1,n_nom_def 145 if(trim(nom_def(n)).eq.nom) getout=.false. 146 end do 147 if (getout) return 148 end if 103 149 104 150 ! Initialisation of 'firstnom' and create/open the "diagfi.nc" NetCDF file 105 151 ! ------------------------------------------------------------------------ 106 ! (Au tout premier appel de la subroutine durant le run.) 107 108 fichnom="diagfi.nc" 109 110 if (firstnom.eq.'1234567890') then ! .true. for the very first call 111 ! to this subroutine; now set 'firstnom' 152 ! (at very first call to the subroutine, in accordance with diagfi.def) 153 154 if (firstnom.eq.'1234567890') then ! .true. for the very first valid 155 ! call to this subroutine; now set 'firstnom' 112 156 firstnom = nom 113 157 ! just to be sure, check that firstnom is large enough to hold nom … … 124 168 ierr = nf_def_dim(nid,"Time",NF_UNLIMITED,idim) 125 169 ! Define the 'Time' variable 126 #ifdef NC_DOUBLE127 ierr = NF_DEF_VAR (nid, "Time", NF_DOUBLE, 1, idim,varid)128 #else170 !#ifdef NC_DOUBLE 171 ! ierr = NF_DEF_VAR (nid, "Time", NF_DOUBLE, 1, idim,varid) 172 !#else 129 173 ierr = NF_DEF_VAR (nid, "Time", NF_FLOAT, 1, idim,varid) 130 #endif174 !#endif 131 175 ! Add a long_name attribute 132 176 ierr = NF_PUT_ATT_TEXT (nid, varid, "long_name", … … 149 193 150 194 if (ngridmx.eq.1) then 151 ! in rcm1d, for the 1d version of the GCM, iphysiq and irythme195 ! in testphys1d, for the 1d version of the GCM, iphysiq and irythme 152 196 ! are undefined; so set them to 1 153 197 iphysiq=1 … … 182 226 ierr= NF_INQ_VARID(nid,"Time",varid) 183 227 ! Write (append) the new date to the 'Time' array 184 #ifdef NC_DOUBLE185 ierr= NF_PUT_VARA_DOUBLE(nid,varid,ntime,1,date)186 #else228 !#ifdef NC_DOUBLE 229 ! ierr= NF_PUT_VARA_DOUBLE(nid,varid,ntime,1,date) 230 !#else 187 231 ierr= NF_PUT_VARA_REAL(nid,varid,ntime,1,date) 188 #endif232 !#endif 189 233 if (ierr.ne.NF_NOERR) then 190 234 write(*,*) "***** PUT_VAR matter in writediagfi_nc" … … 247 291 edges(3)=llm 248 292 edges(4)=1 249 #ifdef NC_DOUBLE250 ierr= NF_PUT_VARA_DOUBLE(nid,varid,corner,edges,dx3)251 #else293 !#ifdef NC_DOUBLE 294 ! ierr= NF_PUT_VARA_DOUBLE(nid,varid,corner,edges,dx3) 295 !#else 252 296 ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,dx3) 253 #endif297 !#endif 254 298 255 299 if (ierr.ne.NF_NOERR) then … … 306 350 307 351 308 #ifdef NC_DOUBLE309 ierr = NF_PUT_VARA_DOUBLE (nid,varid,corner,edges,dx2)310 #else352 !#ifdef NC_DOUBLE 353 ! ierr = NF_PUT_VARA_DOUBLE (nid,varid,corner,edges,dx2) 354 !#else 311 355 ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,dx2) 312 #endif356 !#endif 313 357 314 358 if (ierr.ne.NF_NOERR) then … … 349 393 edges(1)=llm 350 394 edges(2)=1 351 #ifdef NC_DOUBLE352 ierr= NF_PUT_VARA_DOUBLE(nid,varid,corner,edges,dx1)353 #else395 !#ifdef NC_DOUBLE 396 ! ierr= NF_PUT_VARA_DOUBLE(nid,varid,corner,edges,dx1) 397 !#else 354 398 ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,dx1) 355 #endif399 !#endif 356 400 357 401 if (ierr.ne.NF_NOERR) then … … 385 429 edges(1)=1 386 430 387 #ifdef NC_DOUBLE388 ierr = NF_PUT_VARA_DOUBLE (nid,varid,corner,edges,dx0)389 #else431 !#ifdef NC_DOUBLE 432 ! ierr = NF_PUT_VARA_DOUBLE (nid,varid,corner,edges,dx0) 433 !#else 390 434 ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,dx0) 391 #endif435 !#endif 392 436 if (ierr.ne.NF_NOERR) then 393 437 write(*,*) "***** PUT_VAR matter in writediagfi" … … 403 447 ierr= NF_CLOSE(nid) 404 448 449 #endif 405 450 end
Note: See TracChangeset
for help on using the changeset viewer.