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 | implicit none |
---|
21 | |
---|
22 | #include "dimensions.h" |
---|
23 | #include "dimphys.h" |
---|
24 | #include "comcstfi.h" |
---|
25 | #include "callkeys.h" |
---|
26 | |
---|
27 | real cpp_c |
---|
28 | real mugaz_c |
---|
29 | |
---|
30 | integer igas |
---|
31 | |
---|
32 | cpp_c = 0.0 |
---|
33 | mugaz_c = 0.0 |
---|
34 | |
---|
35 | do igas=1,ngasmx |
---|
36 | |
---|
37 | if(igas.eq.vgas)then |
---|
38 | ! ignore variable gas in cpp calculation |
---|
39 | else |
---|
40 | ! all values at 300 K from Engineering Toolbox |
---|
41 | if(gnom(igas).eq.'CO2')then |
---|
42 | !cpp_c = cpp_c + 0.744*gfrac(igas) ! @ ~210 K (better for Mars conditions) |
---|
43 | cpp_c = cpp_c + 0.846*gfrac(igas) |
---|
44 | mugaz_c = mugaz_c + 44.01*gfrac(igas) |
---|
45 | elseif(gnom(igas).eq.'N2_')then |
---|
46 | cpp_c = cpp_c + 1.040*gfrac(igas) |
---|
47 | mugaz_c = mugaz_c + 28.01*gfrac(igas) |
---|
48 | elseif(gnom(igas).eq.'H2_')then |
---|
49 | cpp_c = cpp_c + 14.31*gfrac(igas) |
---|
50 | mugaz_c = mugaz_c + 2.01*gfrac(igas) |
---|
51 | elseif(gnom(igas).eq.'He_')then |
---|
52 | cpp_c = cpp_c + 5.19*gfrac(igas) |
---|
53 | mugaz_c = mugaz_c + 4.003*gfrac(igas) |
---|
54 | elseif(gnom(igas).eq.'H2O')then |
---|
55 | cpp_c = cpp_c + 1.864*gfrac(igas) |
---|
56 | mugaz_c = mugaz_c + 18.02*gfrac(igas) |
---|
57 | elseif(gnom(igas).eq.'SO2')then |
---|
58 | cpp_c = cpp_c + 0.64*gfrac(igas) |
---|
59 | mugaz_c = mugaz_c + 64.066*gfrac(igas) |
---|
60 | elseif(gnom(igas).eq.'H2S')then |
---|
61 | cpp_c = cpp_c + 1.003*gfrac(igas) ! from wikipedia... |
---|
62 | mugaz_c = mugaz_c + 34.08*gfrac(igas) |
---|
63 | elseif(gnom(igas).eq.'CH4')then |
---|
64 | cpp_c = cpp_c + 2.226*gfrac(igas) |
---|
65 | mugaz_c = mugaz_c + 16.04*gfrac(igas) |
---|
66 | elseif(gnom(igas).eq.'NH3')then |
---|
67 | cpp_c = cpp_c + 2.175*gfrac(igas) |
---|
68 | mugaz_c = mugaz_c + 17.03*gfrac(igas) |
---|
69 | print*,'WARNING, cpp for NH3 may be for liquid' |
---|
70 | else |
---|
71 | print*,'Error in calc_cpp_mugaz: Gas species not recognised!' |
---|
72 | call abort |
---|
73 | endif |
---|
74 | endif |
---|
75 | |
---|
76 | enddo |
---|
77 | |
---|
78 | cpp_c = 1000.0*cpp_c |
---|
79 | |
---|
80 | print*,'Cp in calc_cpp_mugaz is ',cpp_c,'J kg^-1 K^-1' |
---|
81 | print*,'Mg in calc_cpp_mugaz is ',mugaz_c,'amu' |
---|
82 | print*,'Predefined Cp in physics is ',cpp,'J kg^-1 K^-1' |
---|
83 | print*,'Predefined Mg in physics is ',mugaz,'amu' |
---|
84 | |
---|
85 | if (check_cpp_match) then |
---|
86 | print*,'REQUEST TO CHECK cpp_match :' |
---|
87 | if((abs(1.-cpp/cpp_c).gt.1.e-6) .or. & |
---|
88 | (abs(1.-mugaz/mugaz_c).gt.1.e-6)) then |
---|
89 | ! Ehouarn: tolerate a small mismatch between computed/stored values |
---|
90 | print*,'--> Values do not match!' |
---|
91 | print*,' Either adjust cpp / mugaz via newstart to calculated values,' |
---|
92 | print*,' or set check_cpp_match to .false. in callphys.def.' |
---|
93 | stop |
---|
94 | else |
---|
95 | print*,'--> OK. Settings match composition.' |
---|
96 | endif |
---|
97 | endif |
---|
98 | |
---|
99 | if (.not.force_cpp) then |
---|
100 | print*,'*** Setting cpp & mugaz to computations in calc_cpp_mugaz.' |
---|
101 | mugaz = mugaz_c |
---|
102 | cpp = cpp_c |
---|
103 | else |
---|
104 | print*,'*** Setting cpp & mugaz to predefined values.' |
---|
105 | endif |
---|
106 | |
---|
107 | |
---|
108 | return |
---|
109 | end subroutine calc_cpp_mugaz |
---|