Ignore:
Timestamp:
Feb 24, 2020, 6:55:50 PM (5 years ago)
Author:
jvatant
Message:

+ Add a 'versH2H2cia' int key in callphys that allows two values (2011 or 2018) to

deal with updated HITRAN file (for interpolateH2H2.F90) from 2018 that includes the
H2H2 dimer from Fletcher et al. 2018, useful for giant planets.
Retrocompatibility is ok, default value to 2011.

--JVO

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phystd/interpolateH2H2.F90

    r1315 r2245  
    66!     -------
    77!     Calculates the H2-H2 CIA opacity, using a lookup table from
    8 !     HITRAN (2011)
     8!     HITRAN (2011 or later)
    99!
    1010!     Authors
    1111!     -------
    1212!     R. Wordsworth (2011)
    13 !     
     13!
     14!     + J.Vatant d'Ollone (2019)
     15!        - Enable updated HITRAN file (Karman2019,Fletcher2018)
     16!           (2018 one should be default for giant planets)
    1417!==================================================================
    1518
     19      use callkeys_mod, only: versH2H2cia
    1620      use datafile_mod, only: datadir
    1721
     
    2731
    2832      integer nS,nT
    29       parameter(nS=2428)
    3033      parameter(nT=10)
    3134
     
    3639
    3740      double precision amagat
    38       double precision wn_arr(nS)
    3941      double precision temp_arr(nT)
    40       double precision abs_arr(nS,nT)
     42     
     43      double precision, dimension(:),   allocatable :: wn_arr
     44      double precision, dimension(:,:), allocatable :: abs_arr
    4145
    4246      integer k,iT
    4347      logical firstcall
    4448
    45       save wn_arr, temp_arr, abs_arr !read by master
     49      save nS, wn_arr, temp_arr, abs_arr !read by master
    4650
    4751      character*100 dt_file
    48       integer strlen,ios
     52      integer ios
    4953
    50       character(LEN=*), parameter :: fmat1 = "(A20,F10.3,F10.3,I7,F7.1,E10.3,F5.3)"
     54      character(LEN=*), parameter :: fmat11 = "(A20,F10.3,F10.3,I7,F7.1,E10.3,F5.3)"
     55      character(LEN=*), parameter :: fmat18 = "(A12,A3,A5,F10.6,F10.4,I7,F7.3,E10.3,F5.3)"
    5156
    5257      character*20 bleh
     
    6974         print*,'Initialising H2-H2 continuum from HITRAN database...'
    7075
    71 !     1.1 Open the ASCII files
    72          dt_file=TRIM(datadir)//'/continuum_data/H2-H2_norm_2011.cia'
     76!     1.1 Open the ASCII files and set nS according to version
     77         ! Only two possible versions for now : 2011 or 2018 (sanity check in inifis_mod)
     78         if (versH2H2cia.eq.2011) then
     79           dt_file=TRIM(datadir)//'/continuum_data/H2-H2_norm_2011.cia'
     80           nS = 2428
     81         else if (versH2H2cia.eq.2018) then
     82           dt_file=TRIM(datadir)//'/continuum_data/H2-H2_norm_2018.cia'
     83           nS = 9600
     84         endif
     85
     86         if(.not.allocated(wn_arr))  allocate(wn_arr(nS))
     87         if(.not.allocated(abs_arr)) allocate(abs_arr(nS,nT))
    7388
    7489!$OMP MASTER
     
    8095           write(*,*) 'is correct. You can change it in callphys.def with:'
    8196           write(*,*) 'datadir = /absolute/path/to/datagcm'
    82            write(*,*) 'Also check that the continuum data continuum_data/H2-H2_norm_2011.cia is there.'
     97           write(*,*) 'Also check that the continuum data continuum_data/H2-H2_norm_2011.cia or H2-H2_norm_2018.cia is there.'
    8398           call abort
    8499         else
     100         
     101         if(versH2H2cia.eq.2011) then
     102           write(*,*) '... You are using H2-H2 CIA from 2011 but you should use more recent data available on HITRAN !'
     103           write(*,*) '... (Especially if you are running a giant planet atmosphere)'
     104           write(*,*) '... Just find out the H2-H2_norm_2018.cia, put it in your datadir and have a look at interpolateH2H2.F90 ! .'
     105         endif
    85106
    86107            do iT=1,nT
     108               
     109               ! Only two possibles values for now : 2011 or 2018 (sanity check in inifis_mod)
     110               if(versH2H2cia.eq.2011) then
     111                 read(33,fmat11) bleh,blah,blah,nres,Ttemp
     112               else if (versH2H2cia.eq.2018) then
     113                 read(33,fmat18) bleh,bleh,bleh,blah,blah,nres,Ttemp
     114               endif
    87115
    88                read(33,fmat1) bleh,blah,blah,nres,Ttemp
    89116               if(nS.ne.nres)then
    90117                  print*,'Resolution given in file: ',trim(dt_file)
Note: See TracChangeset for help on using the changeset viewer.