Changeset 320 for trunk/LMDZ.MARS/libf/phymars/writediagfi.F
- Timestamp:
- Oct 20, 2011, 12:39:09 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/writediagfi.F
r228 r320 22 22 ! 23 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 24 26 ! 25 27 ! parametres (input) : … … 53 55 54 56 ! Arguments on input: 55 integer ngrid56 character (len=*) :: nom,titre,unite57 integer dim58 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) 59 61 60 62 ! Local variables: … … 65 67 real*4 dx0 66 68 67 real*4 date69 real*4,save :: date 68 70 69 71 REAL phis(ip1jmp1) 70 72 71 73 integer irythme 72 integer ierr 74 integer ierr,ierr2 73 75 integer iq 74 76 integer i,j,l,zmax , ig0 75 77 76 integer zitau 77 character firstnom*20 78 SAVE firstnom 79 SAVE zitau 80 SAVE date 81 data firstnom /'1234567890'/ 82 data zitau /0/ 78 integer,save :: zitau=0 79 character(len=20),save :: firstnom='1234567890' 83 80 84 81 ! Ajouts … … 86 83 integer :: idim,varid 87 84 integer :: nid 88 character (len =50):: fichnom85 character(len=*),parameter :: fichnom="diagfi.nc" 89 86 integer, dimension(4) :: id 90 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. 91 97 92 98 #ifndef MESOSCALE … … 102 108 !*************************************************************** 103 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 104 149 105 150 ! Initialisation of 'firstnom' and create/open the "diagfi.nc" NetCDF file 106 151 ! ------------------------------------------------------------------------ 107 ! (Au tout premier appel de la subroutine durant le run.) 108 109 fichnom="diagfi.nc" 110 111 if (firstnom.eq.'1234567890') then ! .true. for the very first call 112 ! 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' 113 156 firstnom = nom 114 157 ! just to be sure, check that firstnom is large enough to hold nom
Note: See TracChangeset
for help on using the changeset viewer.