1 subroutine da_transform_xtoy_chem_sfc (grid, iv, y)
3 !-----------------------------------------------------------------------
5 ! Updated for Analysis on Arakawa-C grid
6 ! Author: Syed RH Rizvi, MMM/ESSL/NCAR, Date: 10/22/2008
7 !-----------------------------------------------------------------------
11 type (domain), intent(inout) :: grid
12 type (iv_type), intent(in) :: iv ! Innovation vector (O-B).
13 type (y_type), intent(inout) :: y ! y = h (grid%xa) (linear)
15 integer :: n,ichem ! Loop counter.
17 real, allocatable :: model_rho(:,:) ! model rho for each species at obs sites [kg/m^3]
18 real, allocatable :: model_chemic(:,:) ! model increments in each aerosol/gas species at obs sites
19 real, allocatable :: model_chemic_surf(:,:) ! model increments in each observation variable at obs sites
21 if (trace_use_dull) call da_trace_entry("da_transform_xtoy_chem_sfc")
23 allocate (model_rho (iv%info(chemic_surf)%n1:iv%info(chemic_surf)%n2,num_chem))
24 allocate (model_chemic (iv%info(chemic_surf)%n1:iv%info(chemic_surf)%n2,num_chem))
25 allocate (model_chemic_surf(iv%info(chemic_surf)%n1:iv%info(chemic_surf)%n2,num_chemic_surf))
29 model_chemic_surf = 0.0
31 ! [1.0] Get horizontal interpolation weights:
32 do ichem = PARAM_FIRST_SCALAR ,num_chem
33 call da_interp_lin_2d (grid%xachem%chem_ic(:,:,1,ichem), iv%info(chemic_surf), 1, model_chemic(:,ichem))
34 call da_interp_lin_2d (grid%xb%rho(:,:,1), iv%info(chemic_surf), 1, model_rho (:,ichem))
37 ! [1.1] Compute prior observations at obs sites
38 if (chem_cv_options == 10) then
40 model_chemic_surf(:,p_chemsi_pm25)=model_rho(:,p_chem_ic_p25)*(model_chemic(:,p_chem_ic_p25) + &
41 1.375*(96.06/28.964*1000)*model_chemic(:,p_chem_ic_sulf) + &
42 model_chemic(:,p_chem_ic_bc1)+model_chemic(:,p_chem_ic_bc2) + &
43 1.8*(model_chemic(:,p_chem_ic_oc1)+model_chemic(:,p_chem_ic_oc2)) + &
44 model_chemic(:,p_chem_ic_dust_1) + 0.286*model_chemic(:,p_chem_ic_dust_2) + &
45 model_chemic(:,p_chem_ic_seas_1) + 0.942*model_chemic(:,p_chem_ic_seas_2))
47 else if (chem_cv_options == 20) then
49 if (chemicda_opt == 1 ) then
50 model_chemic_surf(:,p_chemsi_pm25)=model_rho(:,p_chem_ic_bc_a01)*(model_chemic(:,p_chem_ic_bc_a01)+model_chemic(:,p_chem_ic_bc_a02) + &
51 model_chemic(:,p_chem_ic_bc_a03)+model_chemic(:,p_chem_ic_oc_a01)+model_chemic(:,p_chem_ic_oc_a02)+model_chemic(:,p_chem_ic_oc_a03) + &
52 model_chemic(:,p_chem_ic_so4_a01)+model_chemic(:,p_chem_ic_so4_a02)+model_chemic(:,p_chem_ic_so4_a03)+model_chemic(:,p_chem_ic_no3_a01) + &
53 model_chemic(:,p_chem_ic_no3_a02)+model_chemic(:,p_chem_ic_no3_a03)+model_chemic(:,p_chem_ic_nh4_a01)+model_chemic(:,p_chem_ic_nh4_a02) + &
54 model_chemic(:,p_chem_ic_nh4_a03)+model_chemic(:,p_chem_ic_cl_a01)+model_chemic(:,p_chem_ic_cl_a02)+model_chemic(:,p_chem_ic_cl_a03) + &
55 model_chemic(:,p_chem_ic_na_a01)+model_chemic(:,p_chem_ic_na_a02)+model_chemic(:,p_chem_ic_na_a03)+model_chemic(:,p_chem_ic_oin_a01) + &
56 model_chemic(:,p_chem_ic_oin_a02)+model_chemic(:,p_chem_ic_oin_a03))
57 else if (chemicda_opt == 2 ) then
58 model_chemic_surf(:,p_chemsi_pm10)=model_rho(:,p_chem_ic_bc_a01)*(model_chemic(:,p_chem_ic_bc_a01)+model_chemic(:,p_chem_ic_bc_a02) + &
59 model_chemic(:,p_chem_ic_bc_a03)+model_chemic(:,p_chem_ic_bc_a04)+model_chemic(:,p_chem_ic_oc_a01)+model_chemic(:,p_chem_ic_oc_a02) + &
60 model_chemic(:,p_chem_ic_oc_a03)+model_chemic(:,p_chem_ic_oc_a04)+model_chemic(:,p_chem_ic_so4_a01)+model_chemic(:,p_chem_ic_so4_a02) + &
61 model_chemic(:,p_chem_ic_so4_a03)+model_chemic(:,p_chem_ic_so4_a04)+model_chemic(:,p_chem_ic_no3_a01)+model_chemic(:,p_chem_ic_no3_a02) + &
62 model_chemic(:,p_chem_ic_no3_a03)+model_chemic(:,p_chem_ic_no3_a04)+model_chemic(:,p_chem_ic_nh4_a01)+model_chemic(:,p_chem_ic_nh4_a02) + &
63 model_chemic(:,p_chem_ic_nh4_a03)+model_chemic(:,p_chem_ic_nh4_a04)+model_chemic(:,p_chem_ic_cl_a01)+model_chemic(:,p_chem_ic_cl_a02) + &
64 model_chemic(:,p_chem_ic_cl_a03)+model_chemic(:,p_chem_ic_cl_a04)+model_chemic(:,p_chem_ic_na_a01)+model_chemic(:,p_chem_ic_na_a02) + &
65 model_chemic(:,p_chem_ic_na_a03)+model_chemic(:,p_chem_ic_na_a04)+model_chemic(:,p_chem_ic_oin_a01)+model_chemic(:,p_chem_ic_oin_a02) + &
66 model_chemic(:,p_chem_ic_oin_a03)+model_chemic(:,p_chem_ic_oin_a04))
67 else if (chemicda_opt == 3 ) then
68 model_chemic_surf(:,p_chemsi_pm25)=model_rho(:,p_chem_ic_bc_a01)*(model_chemic(:,p_chem_ic_bc_a01)+model_chemic(:,p_chem_ic_bc_a02) + &
69 model_chemic(:,p_chem_ic_bc_a03)+model_chemic(:,p_chem_ic_oc_a01)+model_chemic(:,p_chem_ic_oc_a02)+model_chemic(:,p_chem_ic_oc_a03) + &
70 model_chemic(:,p_chem_ic_so4_a01)+model_chemic(:,p_chem_ic_so4_a02)+model_chemic(:,p_chem_ic_so4_a03)+model_chemic(:,p_chem_ic_no3_a01) + &
71 model_chemic(:,p_chem_ic_no3_a02)+model_chemic(:,p_chem_ic_no3_a03)+model_chemic(:,p_chem_ic_nh4_a01)+model_chemic(:,p_chem_ic_nh4_a02) + &
72 model_chemic(:,p_chem_ic_nh4_a03)+model_chemic(:,p_chem_ic_cl_a01)+model_chemic(:,p_chem_ic_cl_a02)+model_chemic(:,p_chem_ic_cl_a03) + &
73 model_chemic(:,p_chem_ic_na_a01)+model_chemic(:,p_chem_ic_na_a02)+model_chemic(:,p_chem_ic_na_a03)+model_chemic(:,p_chem_ic_oin_a01) + &
74 model_chemic(:,p_chem_ic_oin_a02)+model_chemic(:,p_chem_ic_oin_a03))
75 model_chemic_surf(:,p_chemsi_pm10)=model_rho(:,p_chem_ic_bc_a04)*(model_chemic(:,p_chem_ic_bc_a04)+model_chemic(:,p_chem_ic_oc_a04) + &
76 model_chemic(:,p_chem_ic_so4_a04)+model_chemic(:,p_chem_ic_no3_a04)+model_chemic(:,p_chem_ic_nh4_a04)+model_chemic(:,p_chem_ic_cl_a04) + &
77 model_chemic(:,p_chem_ic_na_a04)+model_chemic(:,p_chem_ic_oin_a04))
78 else if (chemicda_opt == 4 ) then
79 model_chemic_surf(:,p_chemsi_so2)=model_rho(:,p_chem_ic_so2)*(64.06/28.964*1000)*(model_chemic(:,p_chem_ic_so2))
80 model_chemic_surf(:,p_chemsi_no2)=model_rho(:,p_chem_ic_no2)*(46.01/28.964*1000)*(model_chemic(:,p_chem_ic_no2))
81 model_chemic_surf(:,p_chemsi_o3)=model_rho(:,p_chem_ic_o3)*(48.00/28.964*1000)*(model_chemic(:,p_chem_ic_o3))
82 model_chemic_surf(:,p_chemsi_co)=model_rho(:,p_chem_ic_co)*(28.01/28.964*1000)*(model_chemic(:,p_chem_ic_co))
83 else if (chemicda_opt == 5 ) then
84 model_chemic_surf(:,p_chemsi_pm25)=model_rho(:,p_chem_ic_bc_a01)*(model_chemic(:,p_chem_ic_bc_a01)+model_chemic(:,p_chem_ic_bc_a02) + &
85 model_chemic(:,p_chem_ic_bc_a03)+model_chemic(:,p_chem_ic_oc_a01)+model_chemic(:,p_chem_ic_oc_a02)+model_chemic(:,p_chem_ic_oc_a03) + &
86 model_chemic(:,p_chem_ic_so4_a01)+model_chemic(:,p_chem_ic_so4_a02)+model_chemic(:,p_chem_ic_so4_a03)+model_chemic(:,p_chem_ic_no3_a01) + &
87 model_chemic(:,p_chem_ic_no3_a02)+model_chemic(:,p_chem_ic_no3_a03)+model_chemic(:,p_chem_ic_nh4_a01)+model_chemic(:,p_chem_ic_nh4_a02) + &
88 model_chemic(:,p_chem_ic_nh4_a03)+model_chemic(:,p_chem_ic_cl_a01)+model_chemic(:,p_chem_ic_cl_a02)+model_chemic(:,p_chem_ic_cl_a03) + &
89 model_chemic(:,p_chem_ic_na_a01)+model_chemic(:,p_chem_ic_na_a02)+model_chemic(:,p_chem_ic_na_a03)+model_chemic(:,p_chem_ic_oin_a01) + &
90 model_chemic(:,p_chem_ic_oin_a02)+model_chemic(:,p_chem_ic_oin_a03))
91 model_chemic_surf(:,p_chemsi_pm10)=model_rho(:,p_chem_ic_bc_a04)*(model_chemic(:,p_chem_ic_bc_a04)+model_chemic(:,p_chem_ic_oc_a04) + &
92 model_chemic(:,p_chem_ic_so4_a04)+model_chemic(:,p_chem_ic_no3_a04)+model_chemic(:,p_chem_ic_nh4_a04)+model_chemic(:,p_chem_ic_cl_a04) + &
93 model_chemic(:,p_chem_ic_na_a04)+model_chemic(:,p_chem_ic_oin_a04))
94 model_chemic_surf(:,p_chemsi_so2)=model_rho(:,p_chem_ic_so2)*(64.06/28.964*1000)*(model_chemic(:,p_chem_ic_so2))
95 model_chemic_surf(:,p_chemsi_no2)=model_rho(:,p_chem_ic_no2)*(46.01/28.964*1000)*(model_chemic(:,p_chem_ic_no2))
96 model_chemic_surf(:,p_chemsi_o3)=model_rho(:,p_chem_ic_o3)*(48.00/28.964*1000)*(model_chemic(:,p_chem_ic_o3))
97 model_chemic_surf(:,p_chemsi_co)=model_rho(:,p_chem_ic_co)*(28.01/28.964*1000)*(model_chemic(:,p_chem_ic_co))
100 else if (chem_cv_options == 108) then ! racm_soa_vbs_da
102 if (chemicda_opt == 1 .or. chemicda_opt == 3 .or. chemicda_opt == 5) then ! pm2.5
103 model_chemic_surf(:,p_chemsi_pm25) = 0.0
104 do ichem = p_chem_ic_so4aj, p_chem_ic_p25i
105 model_chemic_surf(:,p_chemsi_pm25) = model_chemic_surf(:,p_chemsi_pm25) + &
106 model_rho(:,ichem) * model_chemic(:,ichem)
110 if (chemicda_opt == 2) then ! pm10 only
111 model_chemic_surf(:,p_chemsi_pm10) = 0.0
112 do ichem = p_chem_ic_so4aj, p_chem_ic_soila
113 model_chemic_surf(:,p_chemsi_pm10) = model_chemic_surf(:,p_chemsi_pm10) + &
114 model_rho(:,ichem) * model_chemic(:,ichem)
118 if (chemicda_opt == 3 .or. chemicda_opt == 5) then ! pm10 after pm2.5
119 ! pm10 - pm2.5 residual
120 model_chemic_surf(:,p_chemsi_pm10) = 0.0
121 do ichem = p_chem_ic_antha, p_chem_ic_soila
122 model_chemic_surf(:,p_chemsi_pm10) = model_chemic_surf(:,p_chemsi_pm10) + &
123 model_rho(:,ichem) * model_chemic(:,ichem)
127 if ( chemicda_opt >= 4 ) then
128 model_chemic_surf(:,p_chemsi_so2)=model_chemic(:,p_chem_ic_so2)
129 model_chemic_surf(:,p_chemsi_no2)=model_chemic(:,p_chem_ic_no2)
130 model_chemic_surf(:,p_chemsi_o3) =model_chemic(:,p_chem_ic_o3 )
131 model_chemic_surf(:,p_chemsi_co) =model_chemic(:,p_chem_ic_co )
134 end if ! if (chem_cv_options == 108) then
136 ! [1.2] Interpolate horizontally:
137 do ichem = PARAM_FIRST_SCALAR, num_chemic_surf
138 do n=iv%info(chemic_surf)%n1,iv%info(chemic_surf)%n2
139 if(iv%chemic_surf(n)%chem(ichem)%qc >= obs_qc_pointer) then
140 y%chemic_surf(n)%chem(ichem) = model_chemic_surf(n,ichem)
142 y%chemic_surf(n)%chem(ichem) = 0.0
147 deallocate (model_rho)
148 deallocate (model_chemic)
149 deallocate (model_chemic_surf)
151 if (trace_use_dull) call da_trace_exit("da_transform_xtoy_chem_sfc")
153 end subroutine da_transform_xtoy_chem_sfc