3 SUBROUTINE init_modules( phase )
4 USE module_bc , ONLY : init_module_bc
5 USE module_configure , ONLY : init_module_configure
6 USE module_driver_constants , ONLY : init_module_driver_constants
7 USE module_model_constants , ONLY : init_module_model_constants
8 USE module_domain , ONLY : init_module_domain
9 USE module_machine , ONLY : init_module_machine
10 USE module_nesting , ONLY : init_module_nesting
11 USE module_timing , ONLY : init_module_timing
12 USE module_tiles , ONLY : init_module_tiles
13 USE module_io_wrf , ONLY : init_module_io_wrf
14 USE module_io , ONLY : init_module_io
16 USE module_wrf_quilt , ONLY : init_module_wrf_quilt
17 USE module_dm , ONLY : init_module_dm, split_communicator,hwrf_coupler_init
19 USE module_dm , ONLY : init_module_dm
22 USE module_ext_internal , ONLY : init_module_ext_internal
24 USE module_wrf_error , ONLY : init_module_wrf_error
27 USE module_cpl, ONLY : coupler_on, cpl_init
31 ! This routine USES the modules in WRF and then calls the init routines
32 ! they provide to perform module specific initializations at the
33 ! beginning of a run. Note, this is only once per run, not once per
34 ! domain; domain specific initializations should be handled elsewhere,
35 ! such as in <a href=start_domain.html>start_domain</a>.
37 ! Certain framework specific module initializations in this file are
38 ! dependent on order they are called. For example, since the quilt module
39 ! relies on internal I/O, the init routine for internal I/O must be
40 ! called first. In the case of DM_PARALLEL compiles, the quilt module
41 ! calls MPI_INIT as part of setting up and dividing communicators between
42 ! compute and I/O server tasks. Therefore, it must be called prior to
43 ! module_dm, which will <em>also</em> try to call MPI_INIT if it sees
44 ! that MPI has not be initialized yet (implementations of module_dm
45 ! should in fact behave this way by first calling MPI_INITIALIZED before
46 ! they try to call MPI_INIT). If MPI is already initialized before the
47 ! the quilting module is called, quilting will not work.
49 ! The phase argument is used to allow other superstructures like ESMF to
50 ! place their initialization calls following the WRF initialization call
51 ! that calls MPI_INIT(). When used with ESMF, ESMF will call wrf_init()
52 ! which in turn will call phase 2 of this routine. Phase 1 will be called
57 INTEGER, INTENT(IN) :: phase ! phase==1 means return after MPI_INIT()
58 ! phase==2 means resume after MPI_INIT()
59 integer mpi_comm_here,myrank_,ntasks_,ierr_
61 IF ( phase == 1 ) THEN
63 CALL init_module_configure
64 CALL init_module_driver_constants
65 CALL init_module_model_constants
66 CALL init_module_domain
67 CALL init_module_machine
70 CALL init_module_ext_internal !! must be called before quilt
74 CALL split_communicator
75 CALL init_module_wrf_quilt !! this *must* be called before init_module_dm
80 CALL init_module_wrf_error ! must be called after init_module_dm
82 CALL init_module_nesting
83 CALL init_module_timing
84 CALL init_module_tiles
85 CALL init_module_io_wrf
88 ! core specific initializations -- add new cores here
96 END SUBROUTINE init_modules