2 ! things that would be normally done in WRF
4 module module_model_constants
5 ! The model may not define any physical constants, all must be done here.
6 ! copied what needed from WRFV3/share/module_model_constants.F
7 REAL , PARAMETER :: r_d = 287.
8 REAL , PARAMETER :: cp = 7.*r_d/2. ! specific heat of the atmosphere
9 REAL , PARAMETER :: xlv = 2.5E6 ! latent heat
10 REAL , PARAMETER :: pi2=2.*3.1415926 ! 2*pi
11 REAL , PARAMETER :: reradius = 1./6370.0e03 ! 1/earth radius
12 REAL , PARAMETER :: g = 9.81 ! gravity acceleration
13 end module module_model_constants
19 module module_wrf_error
23 ! mock-up of various wrf utility functions
25 subroutine wrf_error_fatal(s)
26 !*** purpose: abort with a message
28 character(len=*), intent(in)::s
29 call latch ! food for debugger so you can say "stop at latch" and not worry about module name
32 end subroutine wrf_error_fatal
38 subroutine wrf_debug(level,s)
39 !*** purpose: print a message
42 character(len=*), intent(in)::s
43 integer, intent(in):: level
45 end subroutine wrf_debug
51 subroutine wrf_message(s)
52 character(len=*), intent(in)::s
61 1 write(6,'(a)')s(1:i)
62 end subroutine wrf_message
64 end module module_wrf_error
75 !*** various stubs, mostly doing nothing
82 subroutine wrf_get_nproc (nprocs)
85 end subroutine wrf_get_nproc
91 subroutine wrf_get_myproc( myproc )
94 end subroutine wrf_get_myproc
100 subroutine wrf_dm_maxval_integer( val, idex, jdex )
103 call wrf_error_fatal('wrf_dm_maxval_integer:not implemented')
104 end subroutine wrf_dm_maxval_integer
113 SUBROUTINE wrf_dm_bcast_real( BUF, N1 )
118 END SUBROUTINE wrf_dm_bcast_real
124 LOGICAL FUNCTION wrf_dm_on_monitor()
125 wrf_dm_on_monitor = .true.
126 END FUNCTION wrf_dm_on_monitor
132 SUBROUTINE wrf_dm_bcast_integer( BUF, N1 )
137 END SUBROUTINE wrf_dm_bcast_integer
140 !WRF:DRIVER_LAYER:UTIL
146 INTEGER, PARAMETER, PRIVATE :: cnmax = 30
147 INTEGER, PRIVATE, DIMENSION(cnmax) :: count_int1 , count_rate_int1 , count_max_int1
148 INTEGER, PRIVATE, DIMENSION(cnmax) :: count_int2 , count_rate_int2 , count_max_int2
149 INTEGER, PRIVATE :: cn = 0
150 REAL, PRIVATE :: elapsed_seconds , elapsed_seconds_total = 0
151 REAL, PRIVATE :: cpu_1 , cpu_2 , cpu_seconds , cpu_seconds_total = 0
156 SUBROUTINE init_module_timing
158 END SUBROUTINE init_module_timing
161 SUBROUTINE start_timing
166 IF ( cn .gt. cnmax ) THEN
167 CALL wrf_error_fatal( 'module_timing: clock nesting error (too many nests)' )
170 CALL SYSTEM_CLOCK ( count_int1(cn) , count_rate_int1(cn) , count_max_int1(cn) )
171 ! CALL CPU_TIME ( cpu_1 )
173 END SUBROUTINE start_timing
176 SUBROUTINE end_timing ( string )
180 CHARACTER *(*) :: string
182 IF ( cn .lt. 1 ) THEN
183 CALL wrf_error_fatal( 'module_timing: clock nesting error, cn<1' )
184 ELSE IF ( cn .gt. cnmax ) THEN
185 CALL wrf_error_fatal( 'module_timing: clock nesting error, cn>cnmax' )
188 CALL SYSTEM_CLOCK ( count_int2(cn) , count_rate_int2(cn) , count_max_int2(cn) )
189 ! CALL CPU_TIME ( cpu_2 )
191 IF ( count_int2(cn) < count_int1(cn) ) THEN
192 count_int2(cn) = count_int2(cn) + count_max_int2(cn)
195 count_int2(cn) = count_int2(cn) - count_int1(cn)
196 elapsed_seconds = REAL(count_int2(cn)) / REAL(count_rate_int2(cn))
197 elapsed_seconds_total = elapsed_seconds_total + elapsed_seconds
199 WRITE(6,'(A,A,A,F10.5,A)') 'Timing for ',TRIM(string),': ',elapsed_seconds,' elapsed seconds.'
200 #if defined(DM_PARALLEL) && ! defined(STUBMPI)
201 WRITE(0,'(A,A,A,F10.5,A)') 'Timing for ',TRIM(string),': ',elapsed_seconds,' elapsed seconds.'
204 ! cpu_seconds = cpu_2 - cpu_1
205 ! cpu_seconds_total = cpu_seconds_total + cpu_seconds
206 ! PRINT '(A,A,A,F10.5,A)' ,'Timing for ',TRIM(string),': ',cpu_seconds,' cpu seconds.'
210 END SUBROUTINE end_timing
212 END MODULE module_timing