[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 | |
---|
| 36 | if(igas.eq.vgas)then |
---|
| 37 | ! ignore variable gas in cpp calculation |
---|
| 38 | else |
---|
| 39 | ! all values at 300 K from Engineering Toolbox |
---|
[869] | 40 | if(igas.eq.igas_CO2)then |
---|
[538] | 41 | mugaz_c = mugaz_c + 44.01*gfrac(igas) |
---|
[869] | 42 | elseif(igas.eq.igas_N2)then |
---|
[538] | 43 | mugaz_c = mugaz_c + 28.01*gfrac(igas) |
---|
[869] | 44 | elseif(igas.eq.igas_H2)then |
---|
[538] | 45 | mugaz_c = mugaz_c + 2.01*gfrac(igas) |
---|
[869] | 46 | elseif(igas.eq.igas_He)then |
---|
[716] | 47 | mugaz_c = mugaz_c + 4.003*gfrac(igas) |
---|
[869] | 48 | elseif(igas.eq.igas_H2O)then |
---|
[538] | 49 | mugaz_c = mugaz_c + 18.02*gfrac(igas) |
---|
[869] | 50 | elseif(igas.eq.igas_SO2)then |
---|
[716] | 51 | mugaz_c = mugaz_c + 64.066*gfrac(igas) |
---|
[869] | 52 | elseif(igas.eq.igas_H2S)then |
---|
[716] | 53 | mugaz_c = mugaz_c + 34.08*gfrac(igas) |
---|
[869] | 54 | elseif(igas.eq.igas_CH4)then |
---|
[538] | 55 | mugaz_c = mugaz_c + 16.04*gfrac(igas) |
---|
[869] | 56 | elseif(igas.eq.igas_NH3)then |
---|
[538] | 57 | mugaz_c = mugaz_c + 17.03*gfrac(igas) |
---|
[869] | 58 | elseif(igas.eq.igas_C2H6)then |
---|
[868] | 59 | ! C2H6 http://encyclopedia.airliquide.com/Encyclopedia.asp?GasID=28 |
---|
| 60 | mugaz_c = mugaz_c + 30.07*gfrac(igas) |
---|
[869] | 61 | elseif(igas.eq.igas_C2H2)then |
---|
[868] | 62 | ! C2H2 http://encyclopedia.airliquide.com/Encyclopedia.asp?GasID=1 |
---|
| 63 | mugaz_c = mugaz_c + 26.04*gfrac(igas) |
---|
[253] | 64 | else |
---|
| 65 | print*,'Error in calc_cpp_mugaz: Gas species not recognised!' |
---|
| 66 | call abort |
---|
| 67 | endif |
---|
| 68 | endif |
---|
| 69 | |
---|
| 70 | enddo |
---|
| 71 | |
---|
[1364] | 72 | !compute cpp |
---|
| 73 | do igas=1,ngasmx |
---|
| 74 | |
---|
| 75 | if(igas.eq.vgas)then |
---|
| 76 | ! ignore variable gas in cpp calculation |
---|
| 77 | else |
---|
| 78 | ! all values at 300 K from Engineering Toolbox |
---|
| 79 | if(igas.eq.igas_CO2)then |
---|
| 80 | !cpp_c = cpp_c + 0.744*gfrac(igas) ! @ ~210 K (better for |
---|
| 81 | !Mars conditions) |
---|
| 82 | cpp_c = cpp_c + 0.846*gfrac(igas)*44.01/mugaz_c |
---|
| 83 | elseif(igas.eq.igas_N2)then |
---|
| 84 | cpp_c = cpp_c + 1.040*gfrac(igas)*28.01/mugaz_c |
---|
| 85 | elseif(igas.eq.igas_H2)then |
---|
| 86 | cpp_c = cpp_c + 14.31*gfrac(igas)*2.01/mugaz_c |
---|
| 87 | elseif(igas.eq.igas_He)then |
---|
| 88 | cpp_c = cpp_c + 5.19*gfrac(igas)*4.003/mugaz_c |
---|
| 89 | elseif(igas.eq.igas_H2O)then |
---|
| 90 | cpp_c = cpp_c + 1.864*gfrac(igas)*18.02/mugaz_c |
---|
| 91 | elseif(igas.eq.igas_SO2)then |
---|
| 92 | cpp_c = cpp_c + 0.64*gfrac(igas)*64.066/mugaz_c |
---|
| 93 | elseif(igas.eq.igas_H2S)then |
---|
| 94 | cpp_c = cpp_c + 1.003*gfrac(igas)*34.08/mugaz_c ! from wikipedia... |
---|
| 95 | elseif(igas.eq.igas_CH4)then |
---|
| 96 | cpp_c = cpp_c + 2.226*gfrac(igas)*16.04/mugaz_c |
---|
| 97 | elseif(igas.eq.igas_NH3)then |
---|
| 98 | cpp_c = cpp_c + 2.175*gfrac(igas)*17.03/mugaz_c |
---|
| 99 | print*,'WARNING, cpp for NH3 may be for liquid' |
---|
| 100 | elseif(igas.eq.igas_C2H6)then |
---|
| 101 | ! C2H6 |
---|
| 102 | ! http://encyclopedia.airliquide.com/Encyclopedia.asp?GasID=28 |
---|
| 103 | cpp_c = cpp_c + 1.763*gfrac(igas)*30.07/mugaz_c |
---|
| 104 | elseif(igas.eq.igas_C2H2)then |
---|
| 105 | ! C2H2 |
---|
| 106 | ! http://encyclopedia.airliquide.com/Encyclopedia.asp?GasID=1 |
---|
| 107 | cpp_c = cpp_c + 1.575*gfrac(igas)*26.04/mugaz_c |
---|
| 108 | else |
---|
| 109 | print*,'Error in calc_cpp_mugaz: Gas species not recognised!' |
---|
| 110 | call abort |
---|
| 111 | endif |
---|
| 112 | endif |
---|
| 113 | |
---|
| 114 | enddo |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | |
---|
[538] | 120 | cpp_c = 1000.0*cpp_c |
---|
[253] | 121 | |
---|
[538] | 122 | print*,'Cp in calc_cpp_mugaz is ',cpp_c,'J kg^-1 K^-1' |
---|
| 123 | print*,'Mg in calc_cpp_mugaz is ',mugaz_c,'amu' |
---|
| 124 | print*,'Predefined Cp in physics is ',cpp,'J kg^-1 K^-1' |
---|
| 125 | print*,'Predefined Mg in physics is ',mugaz,'amu' |
---|
[253] | 126 | |
---|
[589] | 127 | if (check_cpp_match) then |
---|
| 128 | print*,'REQUEST TO CHECK cpp_match :' |
---|
| 129 | if((abs(1.-cpp/cpp_c).gt.1.e-6) .or. & |
---|
[588] | 130 | (abs(1.-mugaz/mugaz_c).gt.1.e-6)) then |
---|
[589] | 131 | ! Ehouarn: tolerate a small mismatch between computed/stored values |
---|
| 132 | print*,'--> Values do not match!' |
---|
| 133 | print*,' Either adjust cpp / mugaz via newstart to calculated values,' |
---|
| 134 | print*,' or set check_cpp_match to .false. in callphys.def.' |
---|
[538] | 135 | stop |
---|
[589] | 136 | else |
---|
| 137 | print*,'--> OK. Settings match composition.' |
---|
[538] | 138 | endif |
---|
| 139 | endif |
---|
[253] | 140 | |
---|
[589] | 141 | if (.not.force_cpp) then |
---|
| 142 | print*,'*** Setting cpp & mugaz to computations in calc_cpp_mugaz.' |
---|
| 143 | mugaz = mugaz_c |
---|
| 144 | cpp = cpp_c |
---|
| 145 | else |
---|
| 146 | print*,'*** Setting cpp & mugaz to predefined values.' |
---|
| 147 | endif |
---|
| 148 | |
---|
| 149 | |
---|
[253] | 150 | return |
---|
| 151 | end subroutine calc_cpp_mugaz |
---|