Changeset 10 for branches/flexpart91_hasod/src_parallel/readspecies.f90
- Timestamp:
- Aug 15, 2013, 3:23:48 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/flexpart91_hasod/src_parallel/readspecies.f90
r8 r10 30 30 ! * 31 31 ! 11 July 1996 * 32 ! 33 ! HSO, 13 August 2013 34 ! added optional namelist input 32 35 ! * 33 36 !***************************************************************************** … … 55 58 logical :: spec_found 56 59 60 character(len=16) :: pspecies 61 real :: pdecay, pweta, pwetb, preldiff, phenry, pf0, pdensity, pdquer 62 real :: pdsigma, pdryvel, pweightmolar, pohreact, pspec_ass, pkao 63 integer :: readerror 64 65 ! declare namelist 66 namelist /species_params/ & 67 pspecies, pdecay, pweta, pwetb, preldiff, phenry, pf0, pdensity, pdquer, & 68 pdsigma, pdryvel, pweightmolar, pohreact, pspec_ass, pkao 69 70 pspecies=" " 71 pdecay=-999.9 72 pweta=-9.9E-09 73 pwetb=0.0 74 preldiff=-9.9 75 phenry=0.0 76 pf0=0.0 77 pdensity=-9.9E09 78 pdquer=0.0 79 pdsigma=0.0 80 pdryvel=-9.99 81 pohreact=-9.9E-09 82 pspec_ass=-9 83 pkao=-99.99 84 pweightmolar=-789.0 ! read failure indicator value 85 57 86 ! Open the SPECIES file and read species names and properties 58 87 !************************************************************ 59 88 specnum(pos_spec)=id_spec 60 89 write(aspecnumb,'(i3.3)') specnum(pos_spec) 61 open(unitspecies,file= & 62 path(1)(1:length(1))//'SPECIES/SPECIES_'//aspecnumb,status='old', & 63 err=998) 64 !write(*,*) 'reading SPECIES',specnum(pos_spec) 90 open(unitspecies,file=path(1)(1:length(1))//'SPECIES/SPECIES_'//aspecnumb,status='old',err=998) 91 write(*,*) 'reading SPECIES',specnum(pos_spec) 65 92 66 93 ASSSPEC=.FALSE. 67 94 68 do i=1,6 69 read(unitspecies,*) 70 end do 95 ! try namelist input 96 read(unitspecies,species_params,iostat=readerror) 97 98 if ((pweightmolar.eq.-789.0).or.(readerror.ne.0)) then ! no namelist found 99 100 rewind(unitspecies) 101 102 do i=1,6 103 read(unitspecies,*) 104 end do 71 105 72 106 read(unitspecies,'(a10)',end=22) species(pos_spec) 73 ! write(*,*) species(pos_spec)74 107 read(unitspecies,'(f18.1)',end=22) decay(pos_spec) 75 ! write(*,*) decay(pos_spec)76 108 read(unitspecies,'(e18.1)',end=22) weta(pos_spec) 77 ! write(*,*) weta(pos_spec)78 109 read(unitspecies,'(f18.2)',end=22) wetb(pos_spec) 79 ! write(*,*) wetb(pos_spec)80 110 read(unitspecies,'(f18.1)',end=22) reldiff(pos_spec) 81 ! write(*,*) reldiff(pos_spec)82 111 read(unitspecies,'(e18.1)',end=22) henry(pos_spec) 83 ! write(*,*) henry(pos_spec)84 112 read(unitspecies,'(f18.1)',end=22) f0(pos_spec) 85 ! write(*,*) f0(pos_spec)86 113 read(unitspecies,'(e18.1)',end=22) density(pos_spec) 87 ! write(*,*) density(pos_spec)88 114 read(unitspecies,'(e18.1)',end=22) dquer(pos_spec) 89 ! write(*,*) dquer(pos_spec)90 115 read(unitspecies,'(e18.1)',end=22) dsigma(pos_spec) 91 ! write(*,*) dsigma(pos_spec)92 116 read(unitspecies,'(f18.2)',end=22) dryvel(pos_spec) 93 ! write(*,*) dryvel(pos_spec)94 117 read(unitspecies,'(f18.2)',end=22) weightmolar(pos_spec) 95 ! write(*,*) weightmolar(pos_spec)96 118 read(unitspecies,'(e18.1)',end=22) ohreact(pos_spec) 97 ! write(*,*) ohreact(pos_spec)98 119 read(unitspecies,'(i18)',end=22) spec_ass(pos_spec) 99 ! write(*,*) spec_ass(pos_spec)100 120 read(unitspecies,'(f18.2)',end=22) kao(pos_spec) 101 ! write(*,*) kao(pos_spec) 102 i=pos_spec 103 104 if ((weta(pos_spec).gt.0).and.(henry(pos_spec).le.0)) then 105 if (dquer(pos_spec).le.0) goto 996 ! no particle, no henry set 106 endif 107 108 if (spec_ass(pos_spec).gt.0) then 109 spec_found=.FALSE. 110 do j=1,pos_spec-1 111 if (spec_ass(pos_spec).eq.specnum(j)) then 112 spec_ass(pos_spec)=j 113 spec_found=.TRUE. 114 ASSSPEC=.TRUE. 115 endif 116 end do 117 if (spec_found.eqv..FALSE.) then 118 goto 997 119 endif 120 endif 121 122 if (dsigma(i).eq.1.) dsigma(i)=1.0001 ! avoid floating exception 123 if (dsigma(i).eq.0.) dsigma(i)=1.0001 ! avoid floating exception 124 125 if ((reldiff(i).gt.0.).and.(density(i).gt.0.)) then 126 write(*,*) '#### FLEXPART MODEL ERROR! FILE "SPECIES" ####' 127 write(*,*) '#### IS CORRUPT. SPECIES CANNOT BE BOTH ####' 128 write(*,*) '#### PARTICLE AND GAS. ####' 129 write(*,*) '#### SPECIES NUMBER',aspecnumb 130 stop 131 endif 121 122 else 123 124 species(pos_spec)=pspecies 125 decay(pos_spec)=pdecay 126 weta(pos_spec)=pweta 127 wetb(pos_spec)=pwetb 128 reldiff(pos_spec)=preldiff 129 henry(pos_spec)=phenry 130 f0(pos_spec)=pf0 131 density(pos_spec)=pdensity 132 dquer(pos_spec)=pdquer 133 dsigma(pos_spec)=pdsigma 134 dryvel(pos_spec)=pdryvel 135 weightmolar(pos_spec)=pweightmolar 136 ohreact(pos_spec)=pohreact 137 spec_ass(pos_spec)=pspec_ass 138 kao(pos_spec)=pkao 139 140 endif 141 142 i=pos_spec 143 144 if ((weta(pos_spec).gt.0).and.(henry(pos_spec).le.0)) then 145 if (dquer(pos_spec).le.0) goto 996 ! no particle, no henry set 146 endif 147 148 if (spec_ass(pos_spec).gt.0) then 149 spec_found=.FALSE. 150 do j=1,pos_spec-1 151 if (spec_ass(pos_spec).eq.specnum(j)) then 152 spec_ass(pos_spec)=j 153 spec_found=.TRUE. 154 ASSSPEC=.TRUE. 155 endif 156 end do 157 if (spec_found.eqv..FALSE.) then 158 goto 997 159 endif 160 endif 161 162 if (dsigma(i).eq.1.) dsigma(i)=1.0001 ! avoid floating exception 163 if (dsigma(i).eq.0.) dsigma(i)=1.0001 ! avoid floating exception 164 165 if ((reldiff(i).gt.0.).and.(density(i).gt.0.)) then 166 write(*,*) '#### FLEXPART MODEL ERROR! FILE "SPECIES" ####' 167 write(*,*) '#### IS CORRUPT. SPECIES CANNOT BE BOTH ####' 168 write(*,*) '#### PARTICLE AND GAS. ####' 169 write(*,*) '#### SPECIES NUMBER',aspecnumb 170 stop 171 endif 132 172 20 continue 133 173
Note: See TracChangeset
for help on using the changeset viewer.