source: flexpart.git/src/readspecies.f90 @ e9e0f06

10.4.1_peseiGFS_025bugfixes+enhancementsdevrelease-10release-10.4.1scaling-bug
Last change on this file since e9e0f06 was e9e0f06, checked in by Sabine <sabine.eckhardt@…>, 5 years ago

Removed kao and ass_spec and obsolete lines in get_wetscav.f90

  • Property mode set to 100644
File size: 15.2 KB
Line 
1!**********************************************************************
2! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
3! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
4! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
5!                                                                     *
6! This file is part of FLEXPART.                                      *
7!                                                                     *
8! FLEXPART is free software: you can redistribute it and/or modify    *
9! it under the terms of the GNU General Public License as published by*
10! the Free Software Foundation, either version 3 of the License, or   *
11! (at your option) any later version.                                 *
12!                                                                     *
13! FLEXPART is distributed in the hope that it will be useful,         *
14! but WITHOUT ANY WARRANTY; without even the implied warranty of      *
15! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *
16! GNU General Public License for more details.                        *
17!                                                                     *
18! You should have received a copy of the GNU General Public License   *
19! along with FLEXPART.  If not, see <http://www.gnu.org/licenses/>.   *
20!**********************************************************************
21
22subroutine readspecies(id_spec,pos_spec)
23
24  !*****************************************************************************
25  !                                                                            *
26  !     This routine reads names and physical constants of chemical species/   *
27  !     radionuclides given in the parameter pos_spec                          *
28  !                                                                            *
29  !   Author: A. Stohl                                                         *
30  !                                                                            *
31  !   11 July 1996                                                             *
32  !                                                                            *
33  !   Changes:                                                                 *
34  !   N. Kristiansen, 31.01.2013: Including parameters for in-cloud scavenging *
35  !                                                                            *
36  !   HSO, 13 August 2013
37  !   added optional namelist input
38  !                                                                            *
39  !*****************************************************************************
40  !                                                                            *
41  ! Variables:                                                                 *
42  ! decaytime(maxtable)   half time for radiological decay                     *
43  ! specname(maxtable)    names of chemical species, radionuclides             *
44  ! weta_gas, wetb_gas    Parameters for below-cloud scavenging of gasses      *
45  ! crain_aero,csnow_aero Parameters for below-cloud scavenging of aerosols    *
46  ! ccn_aero,in_aero      Parameters for in-cloud scavenging of aerosols       *
47  ! ohcconst              OH reaction rate constant C                          *
48  ! ohdconst              OH reaction rate constant D                          *
49  ! ohnconst              OH reaction rate constant n                          *
50  ! id_spec               SPECIES number as referenced in RELEASE file         *
51  ! id_pos                position where SPECIES data shall be stored          *
52  !                                                                            *
53  ! Constants:                                                                 *
54  !                                                                            *
55  !*****************************************************************************
56
57  use par_mod
58  use com_mod
59
60  implicit none
61
62  integer :: i, pos_spec,j
63  integer :: idow,ihour,id_spec
64  character(len=3) :: aspecnumb
65  logical :: spec_found
66
67  character(len=16) :: pspecies
68  real :: pdecay, pweta_gas, pwetb_gas, preldiff, phenry, pf0, pdensity, pdquer
69  real :: pdsigma, pdryvel, pweightmolar, pohcconst, pohdconst, pohnconst
70  real :: pcrain_aero, pcsnow_aero, pccn_aero, pin_aero
71  integer :: readerror
72
73! declare namelist
74  namelist /species_params/ &
75       pspecies, pdecay, pweta_gas, pwetb_gas, &
76       pcrain_aero, pcsnow_aero, pccn_aero, pin_aero, &
77       preldiff, phenry, pf0, pdensity, pdquer, &
78       pdsigma, pdryvel, pweightmolar, pohcconst, pohdconst, pohnconst
79
80  pspecies="" ! read failure indicator value
81  pdecay=-999.9
82  pweta_gas=-9.9E-09
83  pwetb_gas=0.0
84  pcrain_aero=-9.9E-09
85  pcsnow_aero=-9.9E-09
86  pccn_aero=-9.9E-09
87  pin_aero=-9.9E-09
88  preldiff=-9.9
89  phenry=0.0
90  pf0=0.0
91  pdensity=-9.9E09
92  pdquer=0.0
93  pdsigma=0.0
94  pdryvel=-9.99
95  pohcconst=-9.99
96  pohdconst=-9.9E-09
97  pohnconst=2.0
98  pweightmolar=-999.9
99
100! Open the SPECIES file and read species names and properties
101!************************************************************
102  specnum(pos_spec)=id_spec
103  write(aspecnumb,'(i3.3)') specnum(pos_spec)
104  open(unitspecies,file=path(1)(1:length(1))//'SPECIES/SPECIES_'//aspecnumb,status='old',form='formatted',err=998)
105!write(*,*) 'reading SPECIES',specnum(pos_spec)
106
107  ASSSPEC=.FALSE.
108
109! try namelist input
110  read(unitspecies,species_params,iostat=readerror)
111  close(unitspecies)
112
113  if ((len(trim(pspecies)).eq.0).or.(readerror.ne.0)) then ! no namelist found
114    if (lroot) write(*,*) "SPECIES file not in NAMELIST format, attempting to &
115         &read as fixed format"
116
117    readerror=1
118
119    open(unitspecies,file=path(1)(1:length(1))//'SPECIES/SPECIES_'//aspecnumb,status='old',err=998)
120
121    do i=1,6
122      read(unitspecies,*)
123    end do
124
125    read(unitspecies,'(a10)',end=22) species(pos_spec)
126!  write(*,*) species(pos_spec)
127    read(unitspecies,'(f18.1)',end=22) decay(pos_spec)
128!  write(*,*) decay(pos_spec)
129    read(unitspecies,'(e18.1)',end=22) weta_gas(pos_spec)
130!  write(*,*) weta_gas(pos_spec)
131    read(unitspecies,'(f18.2)',end=22) wetb_gas(pos_spec)
132!  write(*,*) wetb_gas(pos_spec)
133    read(unitspecies,'(e18.1)',end=22) crain_aero(pos_spec)
134!  write(*,*) crain_aero(pos_spec)
135    read(unitspecies,'(f18.2)',end=22) csnow_aero(pos_spec)
136!  write(*,*) csnow_aero(pos_spec)
137!*** NIK 31.01.2013: including in-cloud scavening parameters
138    read(unitspecies,'(e18.1)',end=22) ccn_aero(pos_spec)
139!  write(*,*) ccn_aero(pos_spec)
140    read(unitspecies,'(f18.2)',end=22) in_aero(pos_spec)
141!  write(*,*) in_aero(pos_spec)
142    read(unitspecies,'(f18.1)',end=22) reldiff(pos_spec)
143!  write(*,*) reldiff(pos_spec)
144    read(unitspecies,'(e18.1)',end=22) henry(pos_spec)
145!  write(*,*) henry(pos_spec)
146    read(unitspecies,'(f18.1)',end=22) f0(pos_spec)
147!  write(*,*) f0(pos_spec)
148    read(unitspecies,'(e18.1)',end=22) density(pos_spec)
149!  write(*,*) density(pos_spec)
150    read(unitspecies,'(e18.1)',end=22) dquer(pos_spec)
151!  write(*,*) 'dquer(pos_spec):', dquer(pos_spec)
152    read(unitspecies,'(e18.1)',end=22) dsigma(pos_spec)
153!  write(*,*) dsigma(pos_spec)
154    read(unitspecies,'(f18.2)',end=22) dryvel(pos_spec)
155!  write(*,*) dryvel(pos_spec)
156    read(unitspecies,'(f18.2)',end=22) weightmolar(pos_spec)
157!  write(*,*) weightmolar(pos_spec)
158    read(unitspecies,'(e18.2)',end=22) ohcconst(pos_spec)
159!  write(*,*) ohcconst(pos_spec)
160    read(unitspecies,'(f8.2)',end=22) ohdconst(pos_spec)
161!  write(*,*) ohdconst(pos_spec)
162    read(unitspecies,'(f8.2)',end=22) ohnconst(pos_spec)
163!  write(*,*) ohnconst(pos_spec)
164
165    pspecies=species(pos_spec)
166    pdecay=decay(pos_spec)
167    pweta_gas=weta_gas(pos_spec)
168    pwetb_gas=wetb_gas(pos_spec)
169    pcrain_aero=crain_aero(pos_spec)
170    pcsnow_aero=csnow_aero(pos_spec)
171    pccn_aero=ccn_aero(pos_spec)
172    pin_aero=in_aero(pos_spec)
173    preldiff=reldiff(pos_spec)
174    phenry=henry(pos_spec)
175    pf0=f0(pos_spec)
176    pdensity=density(pos_spec)
177    pdquer=dquer(pos_spec)
178    pdsigma=dsigma(pos_spec)
179    pdryvel=dryvel(pos_spec)
180    pweightmolar=weightmolar(pos_spec)
181    pohcconst=ohcconst(pos_spec)
182    pohdconst=ohdconst(pos_spec)
183    pohnconst=ohnconst(pos_spec)
184
185  else
186
187    species(pos_spec)=pspecies
188    decay(pos_spec)=pdecay
189    weta_gas(pos_spec)=pweta_gas
190    wetb_gas(pos_spec)=pwetb_gas
191    crain_aero(pos_spec)=pcrain_aero
192    csnow_aero(pos_spec)=pcsnow_aero
193    ccn_aero(pos_spec)=pccn_aero
194    in_aero(pos_spec)=pin_aero
195    reldiff(pos_spec)=preldiff
196    henry(pos_spec)=phenry
197    f0(pos_spec)=pf0
198    density(pos_spec)=pdensity
199    dquer(pos_spec)=pdquer
200    dsigma(pos_spec)=pdsigma
201    dryvel(pos_spec)=pdryvel
202    weightmolar(pos_spec)=pweightmolar
203    ohcconst(pos_spec)=pohcconst
204    ohdconst(pos_spec)=pohdconst
205    ohnconst(pos_spec)=pohnconst
206  endif
207
208  i=pos_spec
209
210!NIK 16.02.2015
211! Check scavenging parameters given in SPECIES file
212
213  if (lroot) then
214! ZHG 2016.04.07 Start of changes
215    write(*,*) ' '
216    if (dquer(pos_spec) .gt.0)  write(*,'(a,i3,a,a,a)')       ' SPECIES: ', &
217         &id_spec,'  ', species(pos_spec),'  (AEROSOL) '
218    if (dquer(pos_spec) .le.0)  write(*,'(a,i3,a,a,a)')       ' SPECIES: ', &
219         &id_spec,'  ', species(pos_spec),'  (GAS) '
220
221! Particles
222!**********
223    if (dquer(pos_spec).gt.0) then
224      if (ccn_aero(pos_spec) .gt. 0) then
225        write(*,'(a,f5.2)') '  Particle CCN  efficiency (CCNeff):', ccn_aero(pos_spec)
226      else
227        write(*,'(a)')      '  Particle CCN  efficiency (CCNeff):   OFF'
228      endif
229      if (in_aero(pos_spec) .gt. 0) then
230        write(*,'(a,f5.2)') '  Particle  IN  efficiency (INeff) :', in_aero(pos_spec)
231      else
232        write(*,'(a)')      '  Particle  IN  efficiency (INeff) :   OFF'
233      endif
234      if (crain_aero(pos_spec) .gt. 0) then
235        write(*,'(a,f5.2)') '  Particle Rain efficiency (Crain) :', crain_aero(pos_spec)
236      else
237        write(*,'(a)')      '  Particle Rain efficiency (Crain) :   OFF'
238      endif
239      if (csnow_aero(pos_spec) .gt. 0) then
240        write(*,'(a,f5.2)') '  Particle Snow efficiency (Csnow) :', csnow_aero(pos_spec)
241      else
242        write(*,'(a)')      '  Particle Snow efficiency (Csnow) :   OFF'
243      end if
244      if (density(pos_spec) .gt. 0) then
245        write(*,'(a)') '  Dry deposition is turned         :   ON'
246      else
247        write(*,'(a)') '  Dry deposition is (density<0)    :   OFF'
248      end if
249      if (crain_aero(pos_spec).gt.10.0 .or. csnow_aero(pos_spec).gt.10.0 .or. &
250           &ccn_aero(pos_spec).gt.1.0 .or. in_aero(pos_spec).gt.1.0) then
251        write(*,*) '*******************************************'
252        write(*,*) ' WARNING: Particle Scavenging parameter likely out of range '
253        write(*,*) '       Likely   range for Crain    0.0-10'
254        write(*,*) '       Likely   range for Csnow    0.0-10'
255        write(*,*) '       Physical range for CCNeff   0.0-1'
256        write(*,*) '       Physical range for INeff    0.0-1'
257        write(*,*) '*******************************************'
258      end if
259    else
260! Gas
261!****
262      if (weta_gas(pos_spec) .gt. 0 .and. wetb_gas(pos_spec).gt.0) then
263        write(*,*)          '  Wet removal for gases      is turned: ON'
264        write(*,*)          '  Gas below-cloud scavenging parameter A  ', &
265             &weta_gas(pos_spec)
266        write(*,'(a,f5.2)') '  Gas below-cloud scavenging parameter B  ', &
267             &wetb_gas(pos_spec)
268      else
269        write(*,*)          '  Wet removal for gases      is turned: OFF '
270      end if
271      if (reldiff(i).gt.0.) then
272        write(*,*)          '  Dry deposition for gases   is turned: ON '
273      else
274        write(*,*)          '  Dry deposition for gases   is turned: OFF '
275      end if
276      if (weta_gas(pos_spec).gt.0.) then !if wet deposition is turned on
277        if (weta_gas(pos_spec).gt.1E-04 .or. weta_gas(pos_spec).lt.1E-09 .or. &
278             &wetb_gas(pos_spec).gt.0.8 .or. wetb_gas(pos_spec).lt.0.4) then
279          write(*,*) '*******************************************'
280          write(*,*) ' WARNING: Gas below-cloud scavengig is out of likely range'
281          write(*,*) '          Likely range for A is 1E-04 to 1E-08'
282          write(*,*) '          Likely range for B is 0.60  to 0.80 '
283          write(*,*) '*******************************************'
284        end if
285      endif
286
287      if (((weta_gas(pos_spec).gt.0).or.(wetb_gas(pos_spec).gt.0)).and.&
288           &(henry(pos_spec).le.0)) then
289        if (dquer(pos_spec).le.0) goto 996 ! no particle, no henry set
290      endif
291    end if
292  end if
293
294  if (dsigma(i).eq.0.) dsigma(i)=1.0001   ! avoid floating exception
295
296  if ((reldiff(i).gt.0.).and.(density(i).gt.0.)) then
297    write(*,*) '#### FLEXPART MODEL ERROR! FILE "SPECIES"    ####'
298    write(*,*) '#### IS CORRUPT. SPECIES CANNOT BE BOTH      ####'
299    write(*,*) '#### PARTICLE AND GAS.                       ####'
300    write(*,*) '#### SPECIES NUMBER',aspecnumb
301    stop
302  endif
30320 continue
304
305
306! Read in daily and day-of-week variation of emissions, if available
307!*******************************************************************
308! HSO: This is not yet implemented as namelist parameters
309
310  do j=1,24           ! initialize everything to no variation
311    area_hour(i,j)=1.
312    point_hour(i,j)=1.
313  end do
314  do j=1,7
315    area_dow(i,j)=1.
316    point_dow(i,j)=1.
317  end do
318
319  if (readerror.ne.0) then ! text format input
320
321    read(unitspecies,*,end=22)
322    do j=1,24     ! 24 hours, starting with 0-1 local time
323      read(unitspecies,*) ihour,area_hour(i,j),point_hour(i,j)
324    end do
325    read(unitspecies,*)
326    do j=1,7      ! 7 days of the week, starting with Monday
327      read(unitspecies,*) idow,area_dow(i,j),point_dow(i,j)
328    end do
329
330  endif
331
33222 close(unitspecies)
333
334! namelist output if requested
335  if (nmlout.and.lroot) then
336    open(unitspecies,file=path(2)(1:length(2))//'SPECIES_'//aspecnumb//'.namelist',access='append',status='replace',err=1000)
337    write(unitspecies,nml=species_params)
338    close(unitspecies)
339  endif
340
341  return
342
343996 write(*,*) '#####################################################'
344  write(*,*) '#### FLEXPART MODEL ERROR!                      #### '
345  write(*,*) '#### WET DEPOSITION SWITCHED ON, BUT NO HENRYS  #### '
346  write(*,*) '#### CONSTANT IS SET                            ####'
347  write(*,*) '#### PLEASE MODIFY SPECIES DESCR. FILE!        #### '
348  write(*,*) '#####################################################'
349  stop
350
351
352997 write(*,*) '#####################################################'
353  write(*,*) '#### FLEXPART MODEL ERROR!                      #### '
354  write(*,*) '#### THE ASSSOCIATED SPECIES HAS TO BE DEFINED  #### '
355  write(*,*) '#### BEFORE THE ONE WHICH POINTS AT IT          #### '
356  write(*,*) '#### PLEASE CHANGE ORDER IN RELEASES OR ADD     #### '
357  write(*,*) '#### THE ASSOCIATED SPECIES IN RELEASES         #### '
358  write(*,*) '#####################################################'
359  stop
360
361
362998 write(*,*) '#####################################################'
363  write(*,*) '#### FLEXPART MODEL ERROR!                      #### '
364  write(*,*) '#### THE SPECIES FILE FOR SPECIES ', id_spec
365  write(*,*) '#### CANNOT BE FOUND: CREATE FILE'
366  write(*,*) '#### ',path(1)(1:length(1)),'SPECIES/SPECIES_',aspecnumb
367  write(*,*) '#####################################################'
368  stop
369
3701000 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "SPECIES_',aspecnumb,'.namelist'
371  write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY       #### '
372  write(*,'(a)') path(2)(1:length(2))
373  stop
374
375end subroutine readspecies
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG