Ignore:
Timestamp:
May 11, 2012, 2:23:57 PM (13 years ago)
Author:
flefevre
Message:
  • aeronomars/inichim_newstart.F : initialization of chemistry now handles

nitrogen species and ions (FGG, FL)

  • aeronomars/conc.h : cleaning of obsolete variables (FL)
  • aeronomars/chimiedata.h : cleaning of obsolete variables (FL)
Location:
trunk/LMDZ.MARS/libf/aeronomars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/aeronomars/chimiedata.h

    r517 r655  
    1 ! ------------------------------------
    2 ! ---  Data for chemical routines ---
    3 ! ------------------------------------
    4 !
     1! -----------------------------------------
     2! ---  Data for photolysis lookup table ---
     3! -----------------------------------------
     4
    55      integer nd, nozo, nr, nsza, ntemp, ntau
    6 !
     6
    77      parameter (nd    = 29)
    88      parameter (nozo  = 7)
     
    1111      parameter (ntemp = 4)
    1212      parameter (ntau  = 8)
    13 !
     13
    1414      real kb
    1515      parameter (kb = 1.3806e-23)
    16 !
     16
    1717      common/chimiedata/jphot,colairtab,table_ozo
    18 !
     18
    1919      real jphot(ntemp,nsza,0:200,nozo,ntau,nd)
    2020      real colairtab(0:200)
     
    2222      real table_ozo(nozo)
    2323      real tautab(ntau)
    24 !
     24
    2525      data szatab/0.,  5., 10., 15., 20., 25.,                          &
    2626     &            30., 35., 40., 45., 50., 55.,                         &
     
    2828     &            84., 86., 88., 90., 91., 92.,                         &
    2929     &            93., 94., 95./
    30 !
     30
    3131      data tautab/0., 0.2, 0.4, 0.6, 0.8, 1., 2., 4./
    32 !
    33       integer       ncomp
    34       parameter    (ncomp = 15)
    35       character*10  nomchem(ncomp)
    36       data          nomchem/"co2","co","o","o1d","o2","o3","h","h2",    &
    37      &                      "oh","ho2","h2o2", "ch4", "n2", "ar", "h2o"/
    38 !
    39       real mmolchem(ncomp)
    40       data mmolchem/44.,28.,16.,16.,32.,48., 1.,                        &
    41      &               2.,17.,33.,34.,16.,28.,40.,18./
  • trunk/LMDZ.MARS/libf/aeronomars/conc.h

    r517 r655  
    44       
    55!**********************************************************************
    6 
    7       integer ncomptot
    8 
    9       parameter (ncomptot=ncomp+1)
    106
    117      common/conc/mmean,Akknew,cpnew,rnew
  • trunk/LMDZ.MARS/libf/aeronomars/inichim_newstart.F90

    r618 r655  
    5858
    5959      integer, parameter         :: nalt = 252    ! number of altitudes in the initialization files
    60       integer, parameter         :: nspe = 14     ! number of species in the initialization files
    61       integer, dimension(nspe)   :: niq           ! local index of species in initialization files
     60      integer                    :: nspe          ! number of species in the initialization files
     61      integer, allocatable       :: niq(:)        ! local index of species in initialization files
    6262      real, dimension(nalt)      :: tinit, zzfile ! temperature in initialization files
    6363      real, dimension(nalt)      :: pinit         ! pressure in initialization files
    6464      real, dimension(nalt)      :: densinit      ! total number density in initialization files
    65       real, dimension(nalt,nspe) :: vmrinit       ! mixing ratios in initialization files
    66       real, dimension(nspe)      :: vmrint        ! mixing ratio interpolated onto the gcm vertical grid
     65      real, allocatable          :: vmrinit(:,:)  ! mixing ratios in initialization files
     66      real, allocatable          :: vmrint(:)     ! mixing ratio interpolated onto the gcm vertical grid
    6767      real                       :: vmr
    6868
    6969      character(len=20)          :: txt           ! to store some text
     70      logical                    :: flagnitro     ! checks if N species present
    7071
    7172! 1. identify tracers by their names: (and set corresponding values of mmol)
     
    107108      igcm_n2plus      = 0
    108109      igcm_hplus       = 0
     110      igcm_hco2plus    = 0
    109111      igcm_elec        = 0
    110112
     
    342344           nbqchem = nbqchem + 1
    343345        end if
     346        if (noms(iq) == "hco2plus") then
     347           igcm_hco2plus = iq
     348           mmol(igcm_hco2plus) = 45.
     349           count = count + 1
     350           nbqchem = nbqchem + 1
     351        end if
    344352        if (noms(iq) == "elec") then
    345353           igcm_elec = iq
     
    373381         end do
    374382      end if
     383
     384! 1.7 check if nitrogen species are present:
     385
     386      if(igcm_no == 0) then
     387         !check that no N species is in traceur.def
     388         if(igcm_n /= 0 .or. igcm_no2 /= 0 .or. igcm_n2d /= 0) then
     389            write(*,*)'inichim_newstart error:'
     390            write(*,*)'N, NO2 and/or N2D are in traceur.def, but not NO'
     391            write(*,*)'stop'
     392            stop
     393         endif
     394         flagnitro = .false.
     395         nspe = 14
     396      else
     397         !check that all N species are in traceur.def
     398         if(igcm_n == 0 .or. igcm_no2 == 0 .or. igcm_n2d == 0) then
     399            write(*,*)'inichim_newstart error:'
     400            write(*,*)'if NO is in traceur.def, N, NO2 and N2D must also be'
     401            write(*,*)'stop'
     402            stop
     403         endif
     404         flagnitro = .true.
     405         nspe = 18
     406      endif
     407
     408! 1.8 allocate arrays
     409
     410      allocate(niq(nspe))
     411      allocate(vmrinit(nalt,nspe))
     412      allocate(vmrint(nspe))
    375413
    376414! 2. load in chemistry data for initialization:
     
    395433!    6: o1d
    396434!    7: o3
     435!
     436! order of nitrogen species in initialization file:
     437!
     438!    1: n
     439!    2: no
     440!    3: no2
     441!    4: n2d
    397442
    398443! major species:
     
    416461      niq(14) = igcm_o3
    417462
     463! nitrogen species:
     464
     465      if (flagnitro) then
     466         niq(15) = igcm_n
     467         niq(16) = igcm_no
     468         niq(17) = igcm_no2
     469         niq(18) = igcm_n2d         
     470      end if
     471
    418472! 2.1 open initialization files
    419473
    420       open(210, iostat=ierr,file=trim(datafile)// &
    421                             '/atmosfera_LMD_may.dat')
     474      open(210, iostat=ierr,file=trim(datafile)//'/atmosfera_LMD_may.dat')
    422475      if (ierr /= 0) then
    423476         write(*,*)'Error : cannot open file atmosfera_LMD_may.dat '
    424          write(*,*)'(in aeronomars/inichim.F)'
     477         write(*,*)'(in aeronomars/inichim_newstart.F)'
    425478         write(*,*)'It should be in :', trim(datafile),'/'
    426479         write(*,*)'1) You can change this path in callphys.def with'
     
    431484         stop
    432485      end if
    433       open(220, iostat=ierr,file=trim(datafile)// &
    434                             '/atmosfera_LMD_min.dat')
     486      open(220, iostat=ierr,file=trim(datafile)//'/atmosfera_LMD_min.dat')
    435487      if (ierr /= 0) then
    436488         write(*,*)'Error : cannot open file atmosfera_LMD_min.dat '
    437          write(*,*)'(in aeronomars/inichim.F)'
     489         write(*,*)'(in aeronomars/inichim_newstart.F)'
    438490         write(*,*)'It should be in :', trim(datafile),'/'
    439491         write(*,*)'1) You can change this path in callphys.def with'
     
    444496         stop
    445497      end if
     498      if(flagnitro) then
     499         open(230, iostat=ierr,file=trim(datafile)//'/atmosfera_LMD_nitr.dat')
     500         if (ierr.ne.0) then
     501            write(*,*)'Error : cannot open file atmosfera_LMD_nitr.dat '
     502            write(*,*)'(in aeronomars/inichim_newstart.F)'
     503            write(*,*)'It should be in :', datafile
     504            write(*,*)'1) You can change this directory address in '
     505            write(*,*)'   file phymars/datafile.h'
     506            write(*,*)'2) If necessary atmosfera_LMD_nitr.dat (and others)'
     507            write(*,*)'   can be obtained online on:'
     508            write(*,*)' http://www.lmd.jussieu.fr/~forget/datagcm/datafile'
     509            STOP
     510         endif
     511      endif   ! Of if(flagnitro)
    446512
    447513! 2.2 read initialization files
     
    466532      close(220)
    467533
     534! nitrogen species
     535
     536      if (flagnitro) then
     537         read(230,*)
     538         do l = 1,nalt
     539            read(230,*) dummy, (vmrinit(l,n), n = 15,18)
     540         end do
     541         close(230)
     542      end if
     543     
    468544! 3. initialization of tracers
    469545
     
    488564!                             - with our without h2o
    489565
    490                if (flagthermo == 0 .or. (flagthermo == 1 .and. exp(pgcm) < 1.e-3)) then
     566               if (flagthermo == 0 .or. (flagthermo == 1 .and. exp(pgcm) < 0.1)) then
    491567                  do n = 1,nspe
    492568                     iq = niq(n)
     
    501577      end do
    502578
    503       ! set surface values of chemistry tracers to zero
     579! set surface values of chemistry tracers to zero
     580
    504581      if (flagthermo == 0) then
    505         ! NB: no problem for "surface water vapour" tracer which is always 0
    506         do n=1,nspe
    507           iq=niq(n)
    508           qsurf(1:ngridmx,iq)=0
    509         enddo
    510       endif
    511 
     582         ! NB: no problem for "surface water vapour" tracer which is always 0
     583         do n = 1,nspe
     584            iq = niq(n)
     585            qsurf(1:ngridmx,iq) = 0.
     586         end do
     587      end if
    512588
    513589! 3.3 initialization of tracers not contained in the initialization files
     
    525601         end do
    526602         ! set surface value to zero
    527          qsurf(1:ngridmx,igcm_ch4)=0
     603         qsurf(1:ngridmx,igcm_ch4) = 0.
    528604      end if
    529605
     606! ions: 0
     607
     608      if (igcm_co2plus /= 0) then
     609         !check that all required ions are in traceur.def
     610         if (igcm_o2plus == 0 .or. igcm_oplus == 0 .or. igcm_coplus == 0          &
     611              .or. igcm_cplus == 0 .or. igcm_nplus == 0 .or. igcm_noplus == 0    &
     612              .or. igcm_n2plus == 0 .or. igcm_hplus == 0 .or. igcm_hco2plus == 0 &
     613              .or. igcm_elec == 0) then
     614            write(*,*)'inichim_newstart error:'
     615            write(*,*)'if co2plus is in traceur.def, all other ions must also be'
     616            write(*,*)'o2plus, oplus, coplus, cplus, nplus, noplus, n2plus'
     617            write(*,*)'hplus, hco2plus and elec'
     618            write(*,*)'stop'
     619            stop
     620         end if
     621
     622         do i = 1,iip1
     623            do j = 1,jjp1
     624               do l = 1,llm
     625                  ! all ions to 0     
     626                  pq(i,j,l,igcm_co2plus)  = 0.
     627                  pq(i,j,l,igcm_o2plus)   = 0.
     628                  pq(i,j,l,igcm_oplus)    = 0.
     629                  pq(i,j,l,igcm_coplus)   = 0.
     630                  pq(i,j,l,igcm_cplus)    = 0.
     631                  pq(i,j,l,igcm_nplus)    = 0.
     632                  pq(i,j,l,igcm_noplus)   = 0.
     633                  pq(i,j,l,igcm_n2plus)   = 0.
     634                  pq(i,j,l,igcm_hplus)    = 0.
     635                  pq(i,j,l,igcm_hco2plus) = 0.
     636                  pq(i,j,l,igcm_elec)     = 0.
     637               end do
     638            end do
     639         end do
     640
     641         ! surface value to 0
     642
     643         qsurf(1:ngridmx,igcm_co2plus)  = 0.
     644         qsurf(1:ngridmx,igcm_o2plus)   = 0.
     645         qsurf(1:ngridmx,igcm_oplus)    = 0.
     646         qsurf(1:ngridmx,igcm_coplus)   = 0.
     647         qsurf(1:ngridmx,igcm_cplus)    = 0.
     648         qsurf(1:ngridmx,igcm_nplus)    = 0.
     649         qsurf(1:ngridmx,igcm_noplus)   = 0.
     650         qsurf(1:ngridmx,igcm_n2plus)   = 0.
     651         qsurf(1:ngridmx,igcm_hplus)    = 0.
     652         qsurf(1:ngridmx,igcm_hco2plus) = 0.
     653         qsurf(1:ngridmx,igcm_elec)     = 0.
     654
     655      else
     656
     657         if (igcm_o2plus /= 0 .or. igcm_oplus /= 0 .or. igcm_coplus /= 0          &
     658              .or. igcm_cplus /= 0 .or. igcm_nplus /= 0 .or. igcm_noplus /= 0    &
     659              .or. igcm_n2plus /= 0 .or. igcm_hplus /= 0 .or. igcm_hco2plus /= 0 &
     660              .or. igcm_elec /= 0) then
     661            write(*,*)'inichim_newstart error:'
     662            write(*,*)'some ions are in traceur.def, but not co2plus'
     663            write(*,*)'stop'
     664            stop
     665         end if
     666      end if    ! of if(igcm_co2 /= 0)
     667     
     668      ! deallocations
     669
     670      deallocate(niq)
     671      deallocate(vmrinit)
     672      deallocate(vmrint)
     673
    530674      end
Note: See TracChangeset for help on using the changeset viewer.