updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / var / da / da_test / da_test.f90
bloba490164cfbb3952d8dfe690705a56462aecdedb1
1 module da_test
3 !---------------------------------------------------------------------------
4 ! Purpose: Collection of routines associated with minimisation.
5 !---------------------------------------------------------------------------
7 use module_configure, only : grid_config_rec_type
8 use module_dm, only : wrf_dm_sum_real, wrf_dm_sum_integer
10 #ifdef DM_PARALLEL
11 use module_dm, only : local_communicator, &
12 ntasks_x, ntasks_y, data_order_xyz, mytask, &
13 ntasks, data_order_xy
14 use module_comm_dm, only : halo_psichi_uv_adj_sub, halo_xa_sub, &
15 halo_sfc_xa_sub, halo_ssmi_xa_sub, halo_radar_xa_w_sub
16 ! use mpi, only : mpi_sum
17 #endif
19 use da_control, only : num_procs, var4d_bin, var4d_lbc
20 use module_domain, only : vp_type, xb_type, x_type, ep_type, &
21 domain, domain_clock_get, domain_clock_set, domain_clockprint, domain_clockadvance
22 use module_state_description, only : dyn_em,dyn_em_tl,dyn_em_ad,p_a_qv
24 use da_control, only : trace_use,ierr, trace_use_dull, comm,global,stdout,rootproc, &
25 sfc_assi_options,typical_qrn_rms,typical_qci_rms,typical_qsn_rms,typical_qgr_rms,jcdfi_use, jcdfi_diag, &
26 typical_u_rms,typical_v_rms,typical_w_rms,typical_t_rms, typical_p_rms, typical_rain_rms, &
27 typical_q_rms,typical_qcw_rms,print_detail_testing,typical_rh_rms, &
28 fg_format, fg_format_wrf_arw_global, fg_format_wrf_arw_regional,fg_format_wrf_nmm_regional, &
29 typical_rf_rms,typical_rv_rms, typical_thickness_rms, typical_tb19v_rms,typical_tb37h_rms, &
30 typical_tb85h_rms,typical_tb37v_rms,typical_tb85v_rms,typical_tb22v_rms, &
31 typical_tb19h_rms,typical_speed_rms,typical_tpw_rms,typical_ref_rms, &
32 cv_options_hum,inv_typ_vp5_sumsq,inv_typ_vp1_sumsq, trajectory_io, &
33 inv_typ_vp3_sumsq,inv_typ_vp2_sumsq,inv_typ_vpalpha_sumsq, &
34 inv_typ_vp4_sumsq,typical_rho_rms,balance_geo,balance_cyc,balance_type, &
35 balance_geocyc, var4d, num_fgat_time,cv_options_hum_specific_humidity, &
36 cv_options_hum_relative_humidity, ids, ide, jds, jde, kds, kde, &
37 sound, sonde_sfc, mtgirs, synop, profiler, gpsref, gpspw, polaramv, geoamv, ships, metar, &
38 satem, radar, ssmi_rv, ssmi_tb, ssmt1, ssmt2, airsr, pilot, airep, tamdar, tamdar_sfc, rain, &
39 bogus, buoy, qscat, pseudo, radiance, use_radarobs, use_ssmiretrievalobs,use_rainobs, &
40 use_gpsrefobs, use_ssmt1obs, use_ssmitbobs, use_ssmt2obs, use_gpspwobs, &
41 use_gpsztdobs, use_radar_rf, use_radar_rhv, use_rad, crtm_cloud, cloud_cv_options, &
42 ids,ide,jds,jde,kds,kde, ims,ime,jms,jme,kms,kme, fgat_rain_flags, &
43 its,ite,jts,jte,kts,kte, ips,ipe,jps,jpe,kps,kpe, cv_options, cv_size, &
44 cloud_cv_options, cp, gas_constant, test_dm_exact, cv_size_domain, &
45 its_int, ite_int, jts_int, jte_int, kts_int, kte_int, &
46 ims_int, ime_int, jms_int, jme_int, kms_int, kme_int
47 use da_control, only : use_cv_w
48 use da_control, only : typical_eph_rms, gpseph, use_gpsephobs, missing_r
50 use da_define_structures, only : da_zero_x,da_zero_vp_type,da_allocate_y, &
51 da_deallocate_y,be_type, xbx_type, iv_type, y_type, j_type, da_initialize_cv
52 use da_dynamics, only : da_uv_to_divergence,da_uv_to_vorticity, &
53 da_psichi_to_uv, da_psichi_to_uv_adj, da_uv_to_divergence_adj, &
54 da_divergence_constraint, da_divergence_constraint_adj
55 use da_ffts, only : da_solve_poissoneqn_fct
56 use da_minimisation, only : da_transform_vtoy_adj,da_transform_vtoy, da_swap_xtraj, &
57 da_read_basicstates, da_calculate_j, da_calculate_gradj
58 use da_obs, only : da_transform_xtoy,da_transform_xtoy_adj
59 use da_par_util, only : da_patch_to_global, da_system, da_cv_to_global
60 #ifdef DM_PARALLEL
61 use da_par_util1, only : true_mpi_real
62 #endif
63 use da_physics, only : da_transform_xtopsfc,da_transform_xtopsfc_adj, &
64 da_pt_to_rho_lin,da_transform_xtotpw,da_transform_xtogpsref_lin, &
65 da_transform_xtowtq, da_transform_xtowtq_adj,da_pt_to_rho_adj, &
66 da_transform_xtotpw_adj, da_transform_xtoztd_lin, da_transform_xtoztd_adj, &
67 da_moist_phys_lin, da_moist_phys_adj, da_uvprho_to_w_lin, da_uvprho_to_w_adj
68 use da_reporting, only : da_error, message, da_message
69 use da_spectral, only : da_test_spectral
70 use da_ssmi, only : da_transform_xtoseasfcwind_lin, &
71 da_transform_xtoseasfcwind_adj
72 use da_statistics, only : da_correlation_coeff1d,da_correlation_coeff2d
73 use da_tools_serial, only : da_get_unit,da_free_unit
74 use da_tracing, only : da_trace_entry,da_trace_exit
75 use da_transfer_model, only : da_transfer_wrftltoxa,da_transfer_xatowrftl, da_transfer_wrftoxb, &
76 da_transfer_xatowrftl_adj,da_transfer_wrftltoxa_adj,da_transfer_wrftoxb
77 use da_wrf_interfaces, only : wrf_dm_bcast_real
78 use da_wrf_interfaces, only : wrf_debug, wrf_shutdown
79 use da_wrfvar_io, only : da_med_initialdata_output,da_med_initialdata_input
80 use da_vtox_transforms, only : da_transform_xtotb_lin, &
81 da_transform_xtotb_adj, da_vertical_transform, da_transform_vptox, &
82 da_transform_xtogpsref_adj,da_transform_vptox_adj,da_transform_vtox, &
83 da_transform_vtox_adj,da_transform_vtovv,da_transform_vtovv_global, &
84 da_transform_vtovv_global_adj, da_transform_vtovv_adj, da_transform_xtoxa, &
85 da_transform_xtoxa_adj, da_apply_be, da_apply_be_adj, da_transform_bal, &
86 da_transform_bal_adj
87 #if (WRF_CHEM == 1)
88 use da_vtox_transforms, only : da_transform_vchemtox, da_transform_vchemtox_adj, &
89 da_transform_vpatox_adj
90 #endif
91 #ifdef VAR4D
92 use da_transfer_model, only : da_transfer_xatowrftl_lbc, da_transfer_xatowrftl_adj_lbc, da_get_2nd_firstguess
93 use da_4dvar, only : model_grid, da_tl_model, da_ad_model, input_nl_xtraj, upsidedown_ad_forcing, &
94 u6_2, v6_2, w6_2, t6_2, ph6_2, p6, mu6_2, psfc6, moist6
95 use da_rain, only : da_transform_xtoy_rain, da_transform_xtoy_rain_adj
96 #endif
98 implicit none
100 private :: da_dot_cv, da_dot
102 #ifdef DM_PARALLEL
103 include 'mpif.h'
104 #endif
106 contains
108 #include "da_check_balance.inc"
109 #include "da_check_cvtovv_adjoint.inc"
110 #include "da_check_vtox_adjoint.inc"
111 #include "da_check_vptox_adjoint.inc"
112 #if (WRF_CHEM == 1)
113 #include "da_check_cvtovv_adjoint_chem.inc"
114 #include "da_check_vtox_adjoint_chem.inc"
115 #include "da_check_vchemtox_adjoint.inc"
116 #endif
117 #include "da_check_vp_errors.inc"
118 #include "da_check_vvtovp_adjoint.inc"
119 #include "da_check_xtovptox_errors.inc"
120 #include "da_check_xtoy_adjoint.inc"
121 #include "da_check_xtoy_adjoint_airep.inc"
122 #include "da_check_xtoy_adjoint_gpspw.inc"
123 #include "da_check_xtoy_adjoint_gpsref.inc"
124 #include "da_check_xtoy_adjoint_gpseph.inc"
125 #include "da_check_xtoy_adjoint_metar.inc"
126 #include "da_check_xtoy_adjoint_pilot.inc"
127 #include "da_check_xtoy_adjoint_ssmi_rv.inc"
128 #include "da_check_xtoy_adjoint_ssmi_tb.inc"
129 #include "da_check_xtoy_adjoint_satem.inc"
130 #include "da_check_xtoy_adjoint_geoamv.inc"
131 #include "da_check_xtoy_adjoint_polaramv.inc"
132 #include "da_check_xtoy_adjoint_ships.inc"
133 #include "da_check_xtoy_adjoint_radar.inc"
134 #include "da_check_xtoy_adjoint_rain.inc"
135 #include "da_check_xtoy_adjoint_bogus.inc"
136 #include "da_check_xtoy_adjoint_sound.inc"
137 #include "da_check_xtoy_adjoint_sonde_sfc.inc"
138 #include "da_check_xtoy_adjoint_mtgirs.inc"
139 #include "da_check_xtoy_adjoint_tamdar.inc"
140 #include "da_check_xtoy_adjoint_tamdar_sfc.inc"
141 #include "da_check_xtoy_adjoint_synop.inc"
142 #include "da_check_xtoy_adjoint_rad.inc"
143 #include "da_transform_xtovp.inc"
144 #include "da_check.inc"
145 #include "da_dot.inc"
146 #include "da_dot_cv.inc"
147 #include "da_check_xtoy_adjoint_pseudo.inc"
148 #include "da_check_xtoy_adjoint_qscat.inc"
149 #include "da_check_xtoy_adjoint_ssmt1.inc"
150 #include "da_check_xtoy_adjoint_ssmt2.inc"
151 #include "da_check_xtoy_adjoint_profiler.inc"
152 #include "da_check_xtoy_adjoint_buoy.inc"
153 #include "da_setup_testfield.inc"
154 #include "da_check_sfc_assi.inc"
155 #include "da_check_psfc.inc"
156 #include "da_set_tst_trnsf_fld.inc"
157 #include "da_check_vtoy_adjoint.inc"
158 #include "da_get_y_lhs_value.inc"
159 #include "da_check_gradient.inc"
160 #include "da_check_dynamics_adjoint.inc"
162 end module da_test