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