1 | !WRF:MEDIATION_LAYER |
---|
2 | ! |
---|
3 | SUBROUTINE init_modules( phase ) |
---|
4 | USE module_bc |
---|
5 | USE module_configure |
---|
6 | USE module_driver_constants |
---|
7 | USE module_model_constants |
---|
8 | USE module_domain |
---|
9 | USE module_machine |
---|
10 | USE module_nesting |
---|
11 | USE module_timing |
---|
12 | USE module_tiles |
---|
13 | USE module_io_wrf |
---|
14 | USE module_io |
---|
15 | #ifdef DM_PARALLEL |
---|
16 | USE module_wrf_quilt |
---|
17 | USE module_dm |
---|
18 | #endif |
---|
19 | #ifdef INTIO |
---|
20 | USE module_ext_internal |
---|
21 | #endif |
---|
22 | |
---|
23 | ! <DESCRIPTION> |
---|
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>. |
---|
29 | ! |
---|
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. |
---|
41 | ! |
---|
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 |
---|
46 | ! earlier. |
---|
47 | ! |
---|
48 | ! </DESCRIPTION> |
---|
49 | |
---|
50 | INTEGER, INTENT(IN) :: phase ! phase==1 means return after MPI_INIT() |
---|
51 | ! phase==2 means resume after MPI_INIT() |
---|
52 | |
---|
53 | IF ( phase == 1 ) THEN |
---|
54 | CALL init_module_bc |
---|
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 |
---|
60 | |
---|
61 | #ifdef INTIO |
---|
62 | CALL init_module_ext_internal !! must be called before quilt |
---|
63 | #endif |
---|
64 | #ifdef DM_PARALLEL |
---|
65 | CALL init_module_wrf_quilt !! this *must* be called before init_module_dm |
---|
66 | CALL init_module_dm |
---|
67 | #endif |
---|
68 | ELSE |
---|
69 | CALL init_module_nesting |
---|
70 | CALL init_module_timing |
---|
71 | CALL init_module_tiles |
---|
72 | CALL init_module_io_wrf |
---|
73 | CALL init_module_io |
---|
74 | |
---|
75 | ! core specific initializations -- add new cores here |
---|
76 | #if (EM_CORE == 1) |
---|
77 | # if ( DA_CORE != 1) |
---|
78 | CALL init_modules_em |
---|
79 | # endif |
---|
80 | #endif |
---|
81 | #if (NMM_CORE == 1) |
---|
82 | CALL init_modules_nmm |
---|
83 | #endif |
---|
84 | #if (COAMPS_CORE == 1) |
---|
85 | CALL init_modules_coamps |
---|
86 | #endif |
---|
87 | ENDIF |
---|
88 | |
---|
89 | END SUBROUTINE init_modules |
---|
90 | |
---|