[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 |
---|
[253] | 20 | implicit none |
---|
| 21 | |
---|
[538] | 22 | #include "dimensions.h" |
---|
| 23 | #include "dimphys.h" |
---|
[253] | 24 | #include "comcstfi.h" |
---|
[538] | 25 | #include "callkeys.h" |
---|
[253] | 26 | |
---|
[589] | 27 | real cpp_c |
---|
[538] | 28 | real mugaz_c |
---|
| 29 | |
---|
[253] | 30 | integer igas |
---|
| 31 | |
---|
[538] | 32 | cpp_c = 0.0 |
---|
| 33 | mugaz_c = 0.0 |
---|
[253] | 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 |
---|
[538] | 42 | cpp_c = cpp_c + 0.846*gfrac(igas) |
---|
| 43 | mugaz_c = mugaz_c + 44.01*gfrac(igas) |
---|
[253] | 44 | elseif(gnom(igas).eq.'N2_')then |
---|
[538] | 45 | cpp_c = cpp_c + 1.040*gfrac(igas) |
---|
| 46 | mugaz_c = mugaz_c + 28.01*gfrac(igas) |
---|
[253] | 47 | elseif(gnom(igas).eq.'H2_')then |
---|
[538] | 48 | cpp_c = cpp_c + 14.31*gfrac(igas) |
---|
| 49 | mugaz_c = mugaz_c + 2.01*gfrac(igas) |
---|
[253] | 50 | elseif(gnom(igas).eq.'H2O')then |
---|
[538] | 51 | cpp_c = cpp_c + 1.864*gfrac(igas) |
---|
| 52 | mugaz_c = mugaz_c + 18.02*gfrac(igas) |
---|
[253] | 53 | elseif(gnom(igas).eq.'CH4')then |
---|
[538] | 54 | cpp_c = cpp_c + 2.226*gfrac(igas) |
---|
| 55 | mugaz_c = mugaz_c + 16.04*gfrac(igas) |
---|
[253] | 56 | elseif(gnom(igas).eq.'NH3')then |
---|
[538] | 57 | cpp_c = cpp_c + 2.175*gfrac(igas) |
---|
| 58 | mugaz_c = mugaz_c + 17.03*gfrac(igas) |
---|
[253] | 59 | print*,'WARNING, cpp for NH3 may be for liquid' |
---|
| 60 | else |
---|
| 61 | print*,'Error in calc_cpp_mugaz: Gas species not recognised!' |
---|
| 62 | call abort |
---|
| 63 | endif |
---|
| 64 | endif |
---|
| 65 | |
---|
| 66 | enddo |
---|
| 67 | |
---|
[538] | 68 | cpp_c = 1000.0*cpp_c |
---|
[253] | 69 | |
---|
[538] | 70 | print*,'Cp in calc_cpp_mugaz is ',cpp_c,'J kg^-1 K^-1' |
---|
| 71 | print*,'Mg in calc_cpp_mugaz is ',mugaz_c,'amu' |
---|
| 72 | print*,'Predefined Cp in physics is ',cpp,'J kg^-1 K^-1' |
---|
| 73 | print*,'Predefined Mg in physics is ',mugaz,'amu' |
---|
[253] | 74 | |
---|
[589] | 75 | if (check_cpp_match) then |
---|
| 76 | print*,'REQUEST TO CHECK cpp_match :' |
---|
| 77 | if((abs(1.-cpp/cpp_c).gt.1.e-6) .or. & |
---|
[588] | 78 | (abs(1.-mugaz/mugaz_c).gt.1.e-6)) then |
---|
[589] | 79 | ! Ehouarn: tolerate a small mismatch between computed/stored values |
---|
| 80 | print*,'--> Values do not match!' |
---|
| 81 | print*,' Either adjust cpp / mugaz via newstart to calculated values,' |
---|
| 82 | print*,' or set check_cpp_match to .false. in callphys.def.' |
---|
[538] | 83 | stop |
---|
[589] | 84 | else |
---|
| 85 | print*,'--> OK. Settings match composition.' |
---|
[538] | 86 | endif |
---|
| 87 | endif |
---|
[253] | 88 | |
---|
[589] | 89 | if (.not.force_cpp) then |
---|
| 90 | print*,'*** Setting cpp & mugaz to computations in calc_cpp_mugaz.' |
---|
| 91 | mugaz = mugaz_c |
---|
| 92 | cpp = cpp_c |
---|
| 93 | else |
---|
| 94 | print*,'*** Setting cpp & mugaz to predefined values.' |
---|
| 95 | endif |
---|
| 96 | |
---|
| 97 | |
---|
[253] | 98 | return |
---|
| 99 | end subroutine calc_cpp_mugaz |
---|