3 SUBROUTINE init_modules( phase )
6 USE module_driver_constants
7 USE module_model_constants
20 USE module_ext_internal
24 ! This routine USES the modules in WRF and then calls the init routines
25 ! they provide to perform module specific initializations at the
26 ! beginning of a run. Note, this is only once per run, not once per
27 ! domain; domain specific initializations should be handled elsewhere,
28 ! such as in <a href=start_domain.html>start_domain</a>.
30 ! Certain framework specific module initializations in this file are
31 ! dependent on order they are called. For example, since the quilt module
32 ! relies on internal I/O, the init routine for internal I/O must be
33 ! called first. In the case of DM_PARALLEL compiles, the quilt module
34 ! calls MPI_INIT as part of setting up and dividing communicators between
35 ! compute and I/O server tasks. Therefore, it must be called prior to
36 ! module_dm, which will <em>also</em> try to call MPI_INIT if it sees
37 ! that MPI has not be initialized yet (implementations of module_dm
38 ! should in fact behave this way by first calling MPI_INITIALIZED before
39 ! they try to call MPI_INIT). If MPI is already initialized before the
40 ! the quilting module is called, quilting will not work.
42 ! The phase argument is used to allow other superstructures like ESMF to
43 ! place their initialization calls following the WRF initialization call
44 ! that calls MPI_INIT(). When used with ESMF, ESMF will call wrf_init()
45 ! which in turn will call phase 2 of this routine. Phase 1 will be called
50 INTEGER, INTENT(IN) :: phase ! phase==1 means return after MPI_INIT()
51 ! phase==2 means resume after MPI_INIT()
53 IF ( phase == 1 ) THEN
55 CALL init_module_configure
56 CALL init_module_driver_constants
57 CALL init_module_model_constants
58 CALL init_module_domain
59 CALL init_module_machine
62 CALL init_module_ext_internal !! must be called before quilt
65 CALL split_communicator
66 CALL init_module_wrf_quilt !! this *must* be called before init_module_dm
70 CALL init_module_nesting
71 CALL init_module_timing
72 CALL init_module_tiles
73 CALL init_module_io_wrf
76 ! core specific initializations -- add new cores here
85 #if (COAMPS_CORE == 1)
86 CALL init_modules_coamps
90 END SUBROUTINE init_modules