source: lmdz_wrf/WRFV3/share/init_modules.F @ 1

Last change on this file since 1 was 1, checked in by lfita, 10 years ago
  • -- --- Opening of the WRF+LMDZ coupling repository --- -- -

WRF: version v3.3
LMDZ: version v1818

More details in:

File size: 3.3 KB
Line 
1!WRF:MEDIATION_LAYER
2!
3SUBROUTINE 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
15#ifdef DM_PARALLEL
16 USE module_wrf_quilt           , ONLY : init_module_wrf_quilt
17 USE module_dm                  , ONLY : init_module_dm, split_communicator
18#endif
19#ifdef INTIO
20 USE module_ext_internal        , ONLY : init_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
53IF ( 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 split_communicator
66 CALL init_module_wrf_quilt    !! this *must* be called before init_module_dm
67 CALL init_module_dm
68#endif
69ELSE
70 CALL init_module_nesting
71 CALL init_module_timing
72 CALL init_module_tiles
73 CALL init_module_io_wrf
74 CALL init_module_io
75
76! core specific initializations -- add new cores here
77#if (EM_CORE == 1)
78#  if ( DA_CORE != 1)
79 CALL init_modules_em
80#  endif
81#endif
82#if (NMM_CORE == 1)
83 CALL init_modules_nmm
84#endif
85ENDIF
86 
87END SUBROUTINE init_modules
88
Note: See TracBrowser for help on using the repository browser.