source: trunk/LMDZ.GENERIC/libf/phystd/interpolateCO2CH4.F90 @ 2987

Last change on this file since 2987 was 2861, checked in by mturbet, 23 months ago

add the CO2-CH4 CIA opacity from Turbet2020 in the model

File size: 4.3 KB
Line 
1subroutine interpolateCO2CH4(wn,temp,presCO2,presCH4,abcoef,firstcall,ind)
2
3  !==================================================================
4  !     
5  !     Purpose
6  !     -------
7  !     Calculates the CO2-CH4 CIA opacity, using a lookup table from
8  !     Turbet et al. 2020, Icarus, Volume 346, article id. 113762
9  !
10  !     Authors
11  !     -------
12  !     M. Turbet (2023)
13  !     
14  !==================================================================
15
16  use datafile_mod, only: datadir
17  implicit none
18
19  ! input
20  double precision wn                 ! wavenumber             (cm^-1)
21  double precision temp               ! temperature            (Kelvin)
22  double precision presCO2            ! CO2 partial pressure    (Pascals)
23  double precision presCH4            ! CH4 partial pressure    (Pascals)
24
25  ! output
26  double precision abcoef             ! absorption coefficient (m^-1)
27
28  integer nS,nT
29  parameter(nS=240)
30  parameter(nT=6)
31  double precision, parameter :: losch = 2.6867774e19
32  ! Loschmit's number (molecule cm^-3 at STP)
33  ! converts cm^5 molecule^-2 --> cm^-1 amagat^-2
34  ! see Richard et al. 2011, JQSRT for details
35
36  double precision amagatCO2
37  double precision amagatCH4
38  double precision wn_arr(nS)
39  double precision temp_arr(nT)
40  double precision abs_arr(nS,nT)
41
42  integer k,iT
43  logical firstcall
44
45  save wn_arr, temp_arr, abs_arr !read by master
46
47  character*100 dt_file
48  integer strlen,ios
49
50  character(LEN=*), parameter :: fmat1 = "(A21,F10.3,F10.3,I7,F7.1,E10.3,F5.3)"
51
52  character*21 bleh
53  double precision blah, Ttemp
54  integer nres
55  integer ind
56
57  if(temp.gt.600)then
58     print*,'Your temperatures are too high for this CO2-CH4 CIA dataset.'
59     print*,'Please run mixed CO2-CH4 atmospheres below T = 600 K.'     
60     stop
61  endif
62 
63  if(temp.lt.100)then
64     print*,'Your temperatures are too low for this CO2-CH4 CIA dataset.'
65     print*,'Please run mixed CO2-CH4 atmospheres above T = 100 K.'     
66     stop
67  endif
68
69  amagatCO2 = (273.15/temp)*(presCO2/101325.0)
70  amagatCH4 = (273.15/temp)*(presCH4/101325.0)
71
72  if(firstcall)then ! called by sugas_corrk only
73     print*,'----------------------------------------------------'
74     print*,'Initialising CO2-CH4 continuum from Turbet et al. 2020'
75
76     !     1.1 Open the ASCII files
77     dt_file=TRIM(datadir)//'/continuum_data/CO2-CH4_TURBET2020.cia'
78
79
80!$OMP MASTER
81     open(33,file=dt_file,form='formatted',status='old',iostat=ios)
82     if (ios.ne.0) then        ! file not found
83        write(*,*) 'Error from interpolateCO2CH4'
84        write(*,*) 'Data file ',trim(dt_file),' not found.'
85        write(*,*) 'Check that your path to datagcm:',trim(datadir)
86        write(*,*) 'is correct. You can change it in callphys.def with:'
87        write(*,*) 'datadir = /absolute/path/to/datagcm'
88        write(*,*) 'Also check that the continuum data continuum_data/CO2-CH4_TURBET2020.cia is there.'       
89        call abort
90     else
91
92        do iT=1,nT
93
94           read(33,fmat1) bleh,blah,blah,nres,Ttemp
95           if(nS.ne.nres)then
96              print*,'Resolution given in file: ',trim(dt_file)
97              print*,'is ',nres,', which does not match nS.'
98              print*,'Please adjust nS value in interpolateCO2CH4.F90'
99              stop
100           endif
101           temp_arr(iT)=Ttemp
102
103           do k=1,nS
104              read(33,*) wn_arr(k),abs_arr(k,it)
105              write(*,*) 'for k = ', k, ' we have ', wn_arr(k),abs_arr(k,it)
106           end do
107
108        end do
109
110     endif
111     close(33)
112!$OMP END MASTER
113!$OMP BARRIER
114
115     print*,'interpolateCO2CH4: At wavenumber ',wn,' cm^-1'
116     print*,'   temperature                 ',temp,' K'
117     print*,'   CO2 partial pressure         ',presCO2,' Pa'
118     print*,'   and CH4 partial pressure     ',presCH4,' Pa'
119
120  endif
121
122  call bilinearbig(nS,nT,wn_arr,temp_arr,abs_arr,wn,temp,abcoef,ind)
123
124!     print*,'the absorption is ',abcoef,' cm^5 molecule^-2'
125!     print*,'or ',abcoef*losch**2,' cm^-1 amagat^-2'
126
127  abcoef=abcoef*100.0*amagatCO2*amagatCH4 ! convert to m^-1
128
129!     print*,'We have ',amagatCO2,' amagats of CO2'
130!     print*,'and     ',amagaCH4,' amagats of CH4'
131!     print*,'So the absorption is ',abcoef,' m^-1'
132
133
134!  unlike for Rayleigh scattering, we do not currently weight by the BB function
135!  however our bands are normally thin, so this is no big deal.
136
137
138  return
139end subroutine interpolateCO2CH4
140
Note: See TracBrowser for help on using the repository browser.