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

Last change on this file 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
Line 
1      subroutine calc_cpp_mugaz
2
3!==================================================================
4!     Purpose
5!     -------
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.
11!
12!     Authors
13!     -------
14!     Robin Wordsworth (2009)
15!     A. Spiga: make the routine OK with latest changes in rcm1d
16!
17!==================================================================
18
19      use gases_h
20      use comcstfi_mod, only: cpp, mugaz
21      use callkeys_mod, only: check_cpp_match,force_cpp
22      implicit none
23
24      real cpp_c   
25      real mugaz_c
26
27      integer igas
28
29      cpp_c   = 0.0
30      mugaz_c = 0.0
31
32
33! compute mugaz
34      do igas=1,ngasmx
35
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)
43         else
44            print*,'Error in calc_cpp_mugaz: Gas species not recognised!'
45            call abort
46         endif
47      enddo
48
49!compute cpp
50      do igas=1,ngasmx
51
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
59         else
60            print*,'Error in calc_cpp_mugaz: Gas species not recognised!'
61            call abort
62         endif
63      enddo
64
65      cpp_c = 1000.0*cpp_c
66
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'
71
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.  &
75              (abs(1.-mugaz/mugaz_c).gt.1.e-6)) then
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.'
80            stop
81         else
82            print*,'--> OK. Settings match composition.'
83         endif
84      endif
85
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
95      return
96    end subroutine calc_cpp_mugaz
Note: See TracBrowser for help on using the repository browser.