Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_chem_sfc / da_chem_sfc.f90
blobdc47adc2325722441736e7cd083682ba2bd33eb8
1 module da_chem_sfc
3 !---------------------------------------------------------------------------
4 ! Purpose: Collection of routines associated with CHEM observations
5 ! and CVs
6 !---------------------------------------------------------------------------
8 use module_dm, only : wrf_dm_sum_reals, wrf_dm_sum_real
9 use module_domain, only : head_grid
10 use da_reporting, only : da_message,da_warning,message
11 ! use da_wrf_interfaces, only : wrf_debug
13 use module_domain_type, only : domain !!! add !!!
14 #if (WRF_CHEM == 1)
15 use da_control, only : rootproc,ierr,comm, &
16 fails_error_max, trace_use, trace_use_dull, &
17 chemic_surf, test_dm_exact, &
18 sfc_assi_options, sfc_assi_options_1,sfc_assi_options_2, &
19 obs_qc_pointer,missing_r, qcstat_conv_unit, &
20 check_max_iv_print, check_max_iv, missing, rootproc, &
21 max_error_chemic_surf, &
22 chem_cv_options, &
23 chemicda_opt, &
24 use_chemic_surfobs, chemic_surf, &
25 missing_r, stdout, &
26 its, ite, jts, jte, kts, kte, &
27 ims, ime, jms, jme, kms, kme, &
28 ids, ide, jds, jde, kds, kde
29 use module_domain, only : xchem_type
30 use da_define_structures, only : da_allocate_observations_chem_sfc
31 use da_interpolation, only : da_interp_lin_2d,da_interp_lin_2d_adj
32 use da_statistics, only : da_stats_calculate
33 use da_par_util1, only : da_proc_sum_int, da_proc_sum_ints
34 use da_par_util, only : da_proc_stats_combine
35 use module_state_description, only : num_chemic_surf, num_chem, &
36 PARAM_FIRST_SCALAR, &
37 p_chemsi_pm25, p_chemsi_pm10, &
38 p_chemsi_so2, p_chemsi_no2, p_chemsi_o3, p_chemsi_co, &
39 p_chem_ic_p25, p_chem_ic_p10, p_chem_ic_sulf, p_chem_ic_bc1, p_chem_ic_bc2, p_chem_ic_oc1, p_chem_ic_oc2, &
40 p_chem_ic_dust_1, p_chem_ic_dust_2, p_chem_ic_dust_3, p_chem_ic_dust_4, &
41 p_chem_ic_seas_1, p_chem_ic_seas_2, p_chem_ic_seas_3, p_chem_ic_seas_4, &
42 p_chem_ic_bc_a01, p_chem_ic_bc_a02, p_chem_ic_bc_a03, p_chem_ic_bc_a04, p_chem_ic_oc_a01, p_chem_ic_oc_a02, p_chem_ic_oc_a03, p_chem_ic_oc_a04, &
43 p_chem_ic_so4_a01, p_chem_ic_so4_a02, p_chem_ic_so4_a03, p_chem_ic_so4_a04, p_chem_ic_no3_a01, p_chem_ic_no3_a02, p_chem_ic_no3_a03, p_chem_ic_no3_a04,&
44 p_chem_ic_nh4_a01, p_chem_ic_nh4_a02, p_chem_ic_nh4_a03, p_chem_ic_nh4_a04, p_chem_ic_cl_a01, p_chem_ic_cl_a02, p_chem_ic_cl_a03, p_chem_ic_cl_a04, &
45 p_chem_ic_na_a01, p_chem_ic_na_a02, p_chem_ic_na_a03, p_chem_ic_na_a04, p_chem_ic_oin_a01, p_chem_ic_oin_a02, p_chem_ic_oin_a03, p_chem_ic_oin_a04, &
46 p_chem_ic_so2, p_chem_ic_no2, p_chem_ic_o3, p_chem_ic_co, &
47 p_chem_ic_so4aj, p_chem_ic_so4ai, p_chem_ic_nh4aj, p_chem_ic_nh4ai, & ! aerosols in racm_soa_vbs_da
48 p_chem_ic_no3aj, p_chem_ic_no3ai, p_chem_ic_naaj, p_chem_ic_naai, &
49 p_chem_ic_asoa1j, p_chem_ic_asoa1i, p_chem_ic_asoa2j, p_chem_ic_asoa2i, &
50 p_chem_ic_asoa3j, p_chem_ic_asoa3i, p_chem_ic_asoa4j, p_chem_ic_asoa4i, &
51 p_chem_ic_bsoa1j, p_chem_ic_bsoa1i, p_chem_ic_bsoa2j, p_chem_ic_bsoa2i, &
52 p_chem_ic_bsoa3j, p_chem_ic_bsoa3i, p_chem_ic_bsoa4j, p_chem_ic_bsoa4i, &
53 p_chem_ic_orgpaj, p_chem_ic_orgpai, p_chem_ic_ecj, p_chem_ic_eci, &
54 p_chem_ic_p25j, p_chem_ic_p25i, p_chem_ic_antha, p_chem_ic_seas, &
55 p_chem_ic_claj, p_chem_ic_clai, p_chem_ic_soila
56 #endif
58 use da_define_structures, only : iv_type, y_type, jo_type, maxmin_type, &
59 bad_data_type, number_type
61 use da_tools_serial, only : da_get_unit,da_free_unit
62 use da_tracing, only: da_trace_entry, da_trace_exit
63 use da_tools, only : da_max_error_qc, da_residual
65 type residual_chem_sfc_type
66 real, pointer :: chem(:)
67 end type residual_chem_sfc_type
69 type maxmin_chem_sfc_stats_type
70 type (maxmin_type), pointer :: chem(:)
71 end type maxmin_chem_sfc_stats_type
73 type stats_chem_sfc_type
74 type (maxmin_chem_sfc_stats_type) :: maximum, minimum
75 type (residual_chem_sfc_type) :: average, rms_err
76 end type stats_chem_sfc_type
78 ! use da_wrf_interfaces, only: da_wrf_get_dm_communicator
80 #ifdef DM_PARALLEL
81 include 'mpif.h'
82 #endif
84 contains
86 #if (WRF_CHEM == 1)
87 #include "da_ao_stats_chem_sfc.inc"
88 #include "da_jo_and_grady_chem_sfc.inc"
89 #include "da_jo_chem_sfc.inc"
90 #include "da_residual_chem_sfc.inc"
91 #include "da_transform_xtoy_chem_sfc.inc"
92 #include "da_transform_xtoy_chem_sfc_adj.inc"
93 #include "da_get_innov_vector_chem_sfc.inc"
94 #include "da_check_max_iv_chem_sfc.inc"
95 #include "da_calculate_grady_chem_sfc.inc"
96 #include "da_oi_stats_chem_sfc.inc"
97 #include "da_print_stats_chem_sfc.inc"
99 #endif
101 end module da_chem_sfc