source: trunk/LMDZ.GENERIC/libf/phystd/calc_cpp_mugaz.F90 @ 544

Last change on this file since 544 was 538, checked in by rwordsworth, 13 years ago

calc_cpp_mugaz changed to a check only in 3D

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!     NOTE: for now, in 1D we do as before. Jeremy, if you're
12!     re-writing rcm1d you may want to alter this.
13!
14!     Authors
15!     -------
16!     Robin Wordsworth (2009)
17!
18!==================================================================
19
20      use gases_h
21      implicit none
22
23#include "dimensions.h"
24#include "dimphys.h"
25#include "comcstfi.h"
26#include "callkeys.h"
27
28      real cpp_c
29      real mugaz_c
30
31      integer igas
32
33      cpp_c   = 0.0
34      mugaz_c = 0.0
35
36      do igas=1,ngasmx
37
38         if(igas.eq.vgas)then
39            ! ignore variable gas in cpp calculation
40         else
41            ! all values at 300 K from Engineering Toolbox
42            if(gnom(igas).eq.'CO2')then
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.'H2O')then
52               cpp_c   = cpp_c   + 1.864*gfrac(igas)
53               mugaz_c = mugaz_c + 18.02*gfrac(igas)
54            elseif(gnom(igas).eq.'CH4')then
55               cpp_c   = cpp_c   + 2.226*gfrac(igas)
56               mugaz_c = mugaz_c + 16.04*gfrac(igas)
57            elseif(gnom(igas).eq.'NH3')then
58               cpp_c   = cpp_c   + 2.175*gfrac(igas)
59               mugaz_c = mugaz_c + 17.03*gfrac(igas)
60               print*,'WARNING, cpp for NH3 may be for liquid'
61            else
62               print*,'Error in calc_cpp_mugaz: Gas species not recognised!'
63               call abort
64            endif
65         endif
66
67      enddo
68
69      cpp_c = 1000.0*cpp_c
70
71      print*,'Cp in calc_cpp_mugaz is ',cpp_c,'J kg^-1 K^-1'
72      print*,'Mg in calc_cpp_mugaz is ',mugaz_c,'amu'
73      print*,'Predefined Cp in physics is ',cpp,'J kg^-1 K^-1'
74      print*,'Predefined Mg in physics is ',mugaz,'amu'
75
76      if(ngridmx.eq.1)then
77         print*,'Automatically setting cpp & mugaz to calculated values in calc_cpp_mugaz'
78         cpp   = cpp_c
79         mugaz = mugaz_c
80         R     = 8.314511E+0 *1000.E+0/mugaz
81         rcp   = R/cpp
82      elseif((cpp.ne.cpp_c) .or. (mugaz.ne.mugaz_c))then
83         if(check_cpp_match)then
84            print*,'Values do not match!'
85            print*,'Either adjust cpp / mugaz via newstart to calculated values,'
86            print*,'or set check_cpp_match to .false. in callphys.def.'
87            stop
88         endif
89      endif
90
91      return
92    end subroutine calc_cpp_mugaz
Note: See TracBrowser for help on using the repository browser.