source: trunk/LMDZ.TITAN/libf/phytitan/calc_cpp_mugaz.F90 @ 3529

Last change on this file since 3529 was 1648, checked in by jvatant, 8 years ago

Modifications to custom radiative transfer to Titan
+ Enables an altitude dependant gfrac for CIA computations

-> many radical changes in su_gases and co ..
-> read vertical CH4 profile with call_profilgases
-> Now you need a 'profile.def' that I will add in the deftank

+ Added interpolate CIA routines for CH4
+ Added temporary mean aerosol profile opacity routine (disr_haze)

File size: 3.0 KB
RevLine 
[253]1      subroutine calc_cpp_mugaz
2
3!==================================================================
4!     Purpose
5!     -------
[538]6!     Check to see if the atmospheric specific heat capacity and
7!     mean molar mass for the gas mixture defined in gases.def
8!     corresponds to what we're using. If it doesn't, abort run
9!     unless option 'check_cpp_match' is set to false in
10!     callphys.def.
[253]11!
12!     Authors
13!     -------
14!     Robin Wordsworth (2009)
[589]15!     A. Spiga: make the routine OK with latest changes in rcm1d
[253]16!
17!==================================================================
18
[471]19      use gases_h
[1384]20      use comcstfi_mod, only: cpp, mugaz
[1397]21      use callkeys_mod, only: check_cpp_match,force_cpp
[253]22      implicit none
23
[589]24      real cpp_c   
[538]25      real mugaz_c
26
[253]27      integer igas
28
[538]29      cpp_c   = 0.0
30      mugaz_c = 0.0
[253]31
[1364]32
33! compute mugaz
[253]34      do igas=1,ngasmx
35
[1648]36         ! all values at 300 K from Engineering Toolbox
37         if(igas.eq.igas_N2)then
38            mugaz_c = mugaz_c + 28.01*gfrac(igas,nivref)
39         elseif(igas.eq.igas_H2)then
40            mugaz_c = mugaz_c + 2.01*gfrac(igas,nivref)
41         elseif(igas.eq.igas_CH4)then
42            mugaz_c = mugaz_c + 16.04*gfrac(igas,nivref)
[253]43         else
[1648]44            print*,'Error in calc_cpp_mugaz: Gas species not recognised!'
45            call abort
[253]46         endif
47      enddo
48
[1364]49!compute cpp
50      do igas=1,ngasmx
51
[1648]52         ! all values at 300 K from Engineering Toolbox
53         if(igas.eq.igas_N2)then
54            cpp_c   = cpp_c   + 1.040*gfrac(igas,nivref)*28.01/mugaz_c
55         elseif(igas.eq.igas_H2)then
56            cpp_c   = cpp_c   + 14.31*gfrac(igas,nivref)*2.01/mugaz_c
57         elseif(igas.eq.igas_CH4)then
58            cpp_c   = cpp_c   + 2.226*gfrac(igas,nivref)*16.04/mugaz_c
[1364]59         else
[1648]60            print*,'Error in calc_cpp_mugaz: Gas species not recognised!'
61            call abort
[1364]62         endif
63      enddo
64
[538]65      cpp_c = 1000.0*cpp_c
[253]66
[538]67      print*,'Cp in calc_cpp_mugaz is ',cpp_c,'J kg^-1 K^-1'
68      print*,'Mg in calc_cpp_mugaz is ',mugaz_c,'amu'
69      print*,'Predefined Cp in physics is ',cpp,'J kg^-1 K^-1'
70      print*,'Predefined Mg in physics is ',mugaz,'amu'
[253]71
[589]72      if (check_cpp_match) then
73         print*,'REQUEST TO CHECK cpp_match :'
74         if((abs(1.-cpp/cpp_c).gt.1.e-6) .or.  &
[588]75              (abs(1.-mugaz/mugaz_c).gt.1.e-6)) then
[589]76            ! Ehouarn: tolerate a small mismatch between computed/stored values
77            print*,'--> Values do not match!'
78            print*,'    Either adjust cpp / mugaz via newstart to calculated values,'
79            print*,'    or set check_cpp_match to .false. in callphys.def.'
[538]80            stop
[589]81         else
82            print*,'--> OK. Settings match composition.'
[538]83         endif
84      endif
[253]85
[589]86      if (.not.force_cpp) then
87          print*,'*** Setting cpp & mugaz to computations in calc_cpp_mugaz.'
88          mugaz = mugaz_c
89          cpp = cpp_c
90      else
91          print*,'*** Setting cpp & mugaz to predefined values.'
92      endif
93
94
[253]95      return
96    end subroutine calc_cpp_mugaz
Note: See TracBrowser for help on using the repository browser.