1 | MODULE module_cam_support |
---|
2 | !------------------------------------------------------------------------ |
---|
3 | ! This module contains global scope variables and routines shared by |
---|
4 | ! multiple CAM physics routines. As much as possible, the codes is copied |
---|
5 | ! verbatim from the corresponding CAM modules noted below. |
---|
6 | ! |
---|
7 | ! Author: William.Gustafson@pnl.gov, Nov 2009 |
---|
8 | !------------------------------------------------------------------------ |
---|
9 | use module_state_description, only: param_num_moist |
---|
10 | use shr_kind_mod |
---|
11 | |
---|
12 | implicit none |
---|
13 | |
---|
14 | public |
---|
15 | save |
---|
16 | |
---|
17 | integer(SHR_KIND_IN),parameter,private :: R8 = SHR_KIND_R8 ! rename for local readability only |
---|
18 | |
---|
19 | ! From spmd_utils in CAM... |
---|
20 | logical, parameter :: masterproc = .true. |
---|
21 | |
---|
22 | ! From ppgrid in CAM... |
---|
23 | integer, parameter :: pcols = 1 !Always have a chunk size of 1 in WRF |
---|
24 | integer :: pver !Number of model level middles in CAM speak |
---|
25 | integer :: pverp !Number of model level interfaces in CAM speak |
---|
26 | |
---|
27 | ! From constituents in CAM... |
---|
28 | integer, parameter :: pcnst = param_num_moist !Number of tracer constituents for CAM q array |
---|
29 | !In WRF this is currently setup to only handle |
---|
30 | !the moist array, and then even in a half-handed way. |
---|
31 | !We allocate the max possible size, but loops need to |
---|
32 | !be over a smaller number. |
---|
33 | !Scalar and chem need to eventually be handled too. |
---|
34 | real(kind=r8), parameter, dimension(pcnst) :: qmin = 0. !Minimun constituent concentration |
---|
35 | !(kg/kg) Normally 0. |
---|
36 | |
---|
37 | ! From cam_logfile... |
---|
38 | character(len=250) :: iulog !In CAM this is a file handle. In WRF, this is a string |
---|
39 | !that can be used to send messages via wrf_message, etc. |
---|
40 | |
---|
41 | !From cam_pio_utils.F90 |
---|
42 | integer, parameter, public :: phys_decomp=100 |
---|
43 | |
---|
44 | ! From cam_pio_utils (used in camuwpbl_driver module)... |
---|
45 | integer, parameter :: fieldname_len = 16 ! max chars for field name |
---|
46 | |
---|
47 | !------------------------------------------------------------------------ |
---|
48 | CONTAINS |
---|
49 | !------------------------------------------------------------------------ |
---|
50 | |
---|
51 | !!$!------------------------------------------------------------------------ |
---|
52 | !!$CHARACTER(len=3) FUNCTION cnst_get_type_byind(ind) |
---|
53 | !!$! Gets the consituent type. |
---|
54 | !!$! |
---|
55 | !!$! Replaces function of same name in constituents module in CAM. |
---|
56 | !!$! ~This routine is currently hard-coded for the indices. It should be |
---|
57 | !!$! generalized to handle arbitrary values, especially for chemical |
---|
58 | !!$! tracers and advanced microphysics with additional phases. |
---|
59 | !!$! |
---|
60 | !!$! Author: William.Gustafson@pnl.gov, Nov 2009 |
---|
61 | !!$!------------------------------------------------------------------------ |
---|
62 | !!$ integer, intent(in) :: ind !global constituent index (in q array) |
---|
63 | !!$ |
---|
64 | !!$ select case (ind) |
---|
65 | !!$ |
---|
66 | !!$ case(1) !vapor |
---|
67 | !!$ cnst_get_type_byind = "wet" |
---|
68 | !!$ case (2) !cloud droplets |
---|
69 | !!$ cnst_get_type_byind = "wet" |
---|
70 | !!$ case (3) !cloud ice crystals |
---|
71 | !!$ cnst_get_type_byind = "wet" |
---|
72 | !!$ case default |
---|
73 | !!$ cnst_get_type_byind = "wet" |
---|
74 | !!$ end select |
---|
75 | !!$ |
---|
76 | !!$END FUNCTION cnst_get_type_byind |
---|
77 | |
---|
78 | |
---|
79 | !------------------------------------------------------------------------ |
---|
80 | SUBROUTINE endrun(msg) |
---|
81 | ! Pass through routine to wrf_error_fatal that mimics endrun in module |
---|
82 | ! abortutils of CAM. |
---|
83 | ! |
---|
84 | ! Replaces endrun in abortutils module in CAM. |
---|
85 | ! |
---|
86 | ! Author: William.Gustafson@pnl.gov, Nov 2009 |
---|
87 | ! Modified : Balwinder.Singh@pnl.gov - Argument made optional |
---|
88 | !------------------------------------------------------------------------ |
---|
89 | USE module_wrf_error |
---|
90 | |
---|
91 | ! Argument of the subroutine is made optional to accomodate endrun calls with no argument |
---|
92 | character(len=*), intent(in), optional :: msg |
---|
93 | |
---|
94 | if(present(msg)) then |
---|
95 | call wrf_error_fatal(msg) |
---|
96 | else |
---|
97 | ! The error message is written to iulog bwfore the endrun call |
---|
98 | call wrf_error_fatal(iulog) |
---|
99 | endif |
---|
100 | |
---|
101 | END SUBROUTINE endrun |
---|
102 | |
---|
103 | |
---|
104 | |
---|
105 | !------------------------------------------------------------------------ |
---|
106 | SUBROUTINE t_stopf(event) |
---|
107 | ! Stub to accomodate stop time calls of CAM |
---|
108 | ! |
---|
109 | ! Replaces t_stopf in perf_mod module in CAM. |
---|
110 | ! |
---|
111 | ! Author: Balwinder.Singh@pnl.gov |
---|
112 | !------------------------------------------------------------------------ |
---|
113 | character(len=*), intent(in) :: event |
---|
114 | |
---|
115 | END SUBROUTINE t_stopf |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | !------------------------------------------------------------------------ |
---|
120 | SUBROUTINE t_startf(event) |
---|
121 | ! Stub to accomodate start time calls of CAM |
---|
122 | ! |
---|
123 | ! Replaces t_startf in perf_mod module in CAM. |
---|
124 | ! |
---|
125 | ! Author: Balwinder.Singh@pnl.gov |
---|
126 | !------------------------------------------------------------------------ |
---|
127 | |
---|
128 | character(len=*), intent(in) :: event |
---|
129 | |
---|
130 | END SUBROUTINE t_startf |
---|
131 | |
---|
132 | |
---|
133 | |
---|
134 | !------------------------------------------------------------------------ |
---|
135 | SUBROUTINE outfld( fname, field, idim, c) |
---|
136 | ! Stub to accomodate outfld calls of CAM |
---|
137 | ! |
---|
138 | ! Replaces outfld in cam_history module in CAM. |
---|
139 | ! |
---|
140 | ! Author: Balwinder.Singh@pnl.gov |
---|
141 | !------------------------------------------------------------------------ |
---|
142 | character(len=*), intent(in) :: fname |
---|
143 | integer, intent(in) :: idim |
---|
144 | integer, intent(in) :: c |
---|
145 | real(r8), intent(in) :: field(idim,*) |
---|
146 | |
---|
147 | END SUBROUTINE outfld |
---|
148 | |
---|
149 | |
---|
150 | |
---|
151 | !------------------------------------------------------------------------ |
---|
152 | SUBROUTINE addfld(fname, units, numlev, avgflag, long_name, & |
---|
153 | decomp_type, flag_xyfill, flag_isccplev, sampling_seq) |
---|
154 | ! Stub to accomodate addfld calls of CAM |
---|
155 | ! |
---|
156 | ! Replaces addfld in cam_history module in CAM. |
---|
157 | ! |
---|
158 | ! Author: Balwinder.Singh@pnl.gov |
---|
159 | !------------------------------------------------------------------------ |
---|
160 | character(len=*), intent(in) :: fname |
---|
161 | character(len=*), intent(in) :: units |
---|
162 | character(len=1), intent(in) :: avgflag |
---|
163 | character(len=*), intent(in) :: long_name |
---|
164 | |
---|
165 | integer, intent(in) :: numlev |
---|
166 | integer, intent(in) :: decomp_type |
---|
167 | |
---|
168 | logical, intent(in), optional :: flag_xyfill |
---|
169 | logical, intent(in), optional :: flag_isccplev |
---|
170 | character(len=*), intent(in), optional :: sampling_seq |
---|
171 | |
---|
172 | END SUBROUTINE ADDFLD |
---|
173 | |
---|
174 | END MODULE module_cam_support |
---|