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
15 module module_state_description
16 integer, parameter:: num_tracer=1
25 end module module_state_description
31 module module_wrf_error
35 ! mock-up of various wrf utility functions
37 subroutine wrf_error_fatal(s)
38 !*** purpose: abort with a message
40 character(len=*), intent(in)::s
41 call latch ! food for debugger so you can say "stop at latch" and not worry about module name
44 end subroutine wrf_error_fatal
50 subroutine wrf_debug(level,s)
51 !*** purpose: print a message
54 character(len=*), intent(in)::s
55 integer, intent(in):: level
57 end subroutine wrf_debug
63 subroutine wrf_message(s)
64 character(len=*), intent(in)::s
73 1 write(6,'(a)')s(1:i)
74 end subroutine wrf_message
76 end module module_wrf_error
86 subroutine wrf_error_fatal(s)
87 ! ESMF has this subroutine outside the module for some reason
88 use module_wrf_error, ONLY : wrf_error_fatal_mod => wrf_error_fatal
90 character(len=*),intent(in)::s
91 call wrf_error_fatal_mod(s)
92 end subroutine wrf_error_fatal
95 !*** various stubs, mostly doing nothing
102 subroutine wrf_get_nproc (nprocs)
105 end subroutine wrf_get_nproc
111 subroutine wrf_get_myproc( myproc )
114 end subroutine wrf_get_myproc
120 subroutine wrf_dm_maxval_integer( val, idex, jdex )
123 call wrf_error_fatal('wrf_dm_maxval_integer:not implemented')
124 end subroutine wrf_dm_maxval_integer
126 subroutine wrf_dm_sum_reals(t,s)
127 real, intent(in)::t(:)
128 real, intent(out)::s(:)
130 end subroutine wrf_dm_sum_reals
139 SUBROUTINE wrf_dm_bcast_real( BUF, N1 )
144 END SUBROUTINE wrf_dm_bcast_real
150 LOGICAL FUNCTION wrf_dm_on_monitor()
151 wrf_dm_on_monitor = .true.
152 END FUNCTION wrf_dm_on_monitor
158 SUBROUTINE wrf_dm_bcast_integer( BUF, N1 )
163 END SUBROUTINE wrf_dm_bcast_integer
166 !WRF:DRIVER_LAYER:UTIL
172 INTEGER, PARAMETER, PRIVATE :: cnmax = 30
173 INTEGER, PRIVATE, DIMENSION(cnmax) :: count_int1 , count_rate_int1 , count_max_int1
174 INTEGER, PRIVATE, DIMENSION(cnmax) :: count_int2 , count_rate_int2 , count_max_int2
175 INTEGER, PRIVATE :: cn = 0
176 REAL, PRIVATE :: elapsed_seconds , elapsed_seconds_total = 0
177 REAL, PRIVATE :: cpu_1 , cpu_2 , cpu_seconds , cpu_seconds_total = 0
181 SUBROUTINE init_module_timing
183 END SUBROUTINE init_module_timing
186 SUBROUTINE start_timing
191 IF ( cn .gt. cnmax ) THEN
192 CALL wrf_error_fatal( 'module_timing: clock nesting error (too many nests)' )
195 CALL SYSTEM_CLOCK ( count_int1(cn) , count_rate_int1(cn) , count_max_int1(cn) )
196 ! CALL CPU_TIME ( cpu_1 )
198 END SUBROUTINE start_timing
201 SUBROUTINE end_timing ( string )
205 CHARACTER *(*) :: string
207 IF ( cn .lt. 1 ) THEN
208 CALL wrf_error_fatal( 'module_timing: clock nesting error, cn<1' )
209 ELSE IF ( cn .gt. cnmax ) THEN
210 CALL wrf_error_fatal( 'module_timing: clock nesting error, cn>cnmax' )
213 CALL SYSTEM_CLOCK ( count_int2(cn) , count_rate_int2(cn) , count_max_int2(cn) )
214 ! CALL CPU_TIME ( cpu_2 )
216 IF ( count_int2(cn) < count_int1(cn) ) THEN
217 count_int2(cn) = count_int2(cn) + count_max_int2(cn)
220 count_int2(cn) = count_int2(cn) - count_int1(cn)
221 elapsed_seconds = REAL(count_int2(cn)) / REAL(count_rate_int2(cn))
222 elapsed_seconds_total = elapsed_seconds_total + elapsed_seconds
224 WRITE(6,'(A,A,A,F10.5,A)') 'Timing for ',TRIM(string),': ',elapsed_seconds,' elapsed seconds.'
225 #if defined(DM_PARALLEL) && ! defined(STUBMPI)
226 WRITE(0,'(A,A,A,F10.5,A)') 'Timing for ',TRIM(string),': ',elapsed_seconds,' elapsed seconds.'
229 ! cpu_seconds = cpu_2 - cpu_1
230 ! cpu_seconds_total = cpu_seconds_total + cpu_seconds
231 ! PRINT '(A,A,A,F10.5,A)' ,'Timing for ',TRIM(string),': ',cpu_seconds,' cpu seconds.'
235 END SUBROUTINE end_timing
237 END MODULE module_timing