da_wrfvar_init1.inc
References to this file elsewhere.
1 subroutine da_wrfvar_init1(no_init1)
2
3 !-----------------------------------------------------------------------
4 ! Purpose: WRFVAR initialization routine, part 1
5 !-----------------------------------------------------------------------
6
7 implicit none
8
9 logical, optional, intent(in) :: no_init1
10
11 !<DESCRIPTION>
12 ! Program_name, a global variable defined in frame/module_domain.F, is
13 ! set, then a routine <a href=init_modules.html>init_modules</a> is
14 ! called. This calls all the init programs that are provided by the
15 ! modules that are linked into WRF. These include initialization of
16 ! external I/O packages. Also, some key initializations for
17 ! distributed-memory parallelism occur here if DM_PARALLEL is specified
18 ! in the compile: setting up I/O quilt processes to act as I/O servers
19 ! and dividing up MPI communicators among those as well as initializing
20 ! external communication packages.
21 !
22 !</DESCRIPTION>
23
24 ! FIX? keep this version so netcdf files are the same until near release
25 program_name = "WRFVAR V2.2 (COMPATIBLE WITH WRF V2.2) MODEL"
26 ! program_name = "WRFVAR "//release_version
27
28 ! Initialize WRF modules:
29 ! Phase 1 returns after mpi_init() (if it is called)
30 if (.NOT. present(no_init1)) then
31 call init_modules (1)
32 ! Initialize utilities (time manager, etc.)
33 call wrfu_initialize (defaultCalendar=WRFU_CAL_GREGORIAN)
34 end if
35 ! Phase 2 resumes after mpi_init() (if it is called)
36 call init_modules (2)
37
38 !<DESCRIPTION>
39 ! The wrf namelist.input file is read and stored in the use associated
40 ! structure model_config_rec, defined in frame/module_configure.F, by the
41 ! call to <a href=initial_config.html>initial_config</a>. On distributed
42 ! memory parallel runs this is done only on one processor, and then
43 ! broadcast as a buffer. For distributed-memory, the broadcast of the
44 ! configuration information is accomplished by first putting the
45 ! configuration information into a buffer (<a
46 ! href=get_config_as_buffer.html>get_config_as_buffer</a>), broadcasting
47 ! the buffer, then setting the configuration information (<a
48 ! href=set_config_as_buffer.html>set_config_as_buffer</a>).
49 !
50 !</DESCRIPTION>
51
52 ! Don't use stdout here, too early
53 write(unit=6,fmt='(A)') "*** VARIATIONAL ANALYSIS ***"
54
55 #ifdef DM_PARALLEL
56 call wrf_get_dm_communicator (comm)
57 call mpi_comm_size (comm, num_procs, ierr)
58 call mpi_comm_rank (comm, myproc, ierr)
59 #else
60 num_procs = 1
61 myproc = 0
62 comm = 0
63 #endif
64
65 if (myproc==0) then
66 rootproc=.true.
67 else
68 rootproc=.false.
69 end if
70
71 #ifdef DM_PARALLEL
72 if (rootproc) then
73 call initial_config
74 end if
75 call get_config_as_buffer (configbuf, configbuflen, nbytes)
76 call wrf_dm_bcast_bytes (configbuf, nbytes)
77 call set_config_as_buffer (configbuf, configbuflen)
78 call wrf_dm_initialize
79 #else
80 call initial_config
81 #endif
82
83 ! Copy namelist variables to da_control
84
85 #define SOURCE_RECORD model_config_rec%
86 #define DEST_RECORD
87
88 #include "config_assigns.inc"
89
90 if (.NOT. rootproc) check_max_iv_print=.false.
91
92 end subroutine da_wrfvar_init1
93
94