Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_main / da_wrfvar_main.f90
blobdaed12da15ee77782686cbcfd8f055f0c7cdbd05
1 program da_wrfvar_main
3 !-----------------------------------------------------------------------
4 ! Purpose: Main program of WRF-Var. Responsible for starting up, reading
5 ! in (and broadcasting for distributed memory) configuration data, defining
6 ! and initializing the top-level domain, either from initial or restart
7 ! data, setting up time-keeping, and then calling the da_solve
8 ! routine assimilation. After the assimilation is completed,
9 ! the model is properly shut down.
10 !-----------------------------------------------------------------------
12 use module_symbols_util, only : wrfu_finalize
14 use da_control, only : trace_use, var4d
15 use da_tracing, only : da_trace_init, da_trace_report, da_trace_entry, &
16 da_trace_exit
17 use da_wrf_interfaces, only : wrf_shutdown, wrf_message, disable_quilting
18 use da_wrfvar_top, only : da_wrfvar_init1,da_wrfvar_init2,da_wrfvar_run, &
19 da_wrfvar_finalize
20 #ifdef VAR4D
21 use da_4dvar, only : clean_4dvar, da_finalize_model
22 #endif
24 implicit none
26 ! Split initialization into 2 parts so we can start and stop trace here
28 call disable_quilting
30 call da_wrfvar_init1
32 if (trace_use) call da_trace_init
33 if (trace_use) call da_trace_entry("da_wrfvar_main")
35 call da_wrfvar_init2
37 call da_wrfvar_run
39 call da_wrfvar_finalize
41 #ifdef VAR4D
42 if (var4d) then
43 call clean_4dvar
44 call da_finalize_model
45 end if
46 #endif
48 call wrf_message("*** WRF-Var completed successfully ***")
50 if (trace_use) call da_trace_exit("da_wrfvar_main")
51 if (trace_use) call da_trace_report
53 call wrfu_finalize
54 call wrf_shutdown
56 end program da_wrfvar_main