0001 function [ZXXD_rf,ZXXF_rf,ZXXD_rf_tp,ZXXF_rf_tp] = raysum_rf_jd(dkeparam,ZXYD_rf,ZXYF_rf,ZXYD_rf_tp,ZXYF_rf_tp,xyP0_2piRp,gridindex_rf);
0002
0003 npn = gridindex_rf.npn;
0004 nmhu = gridindex_rf.nmhu;
0005 nr = gridindex_rf.nr;
0006 nr_dke = gridindex_rf.nr_dke;
0007 ny = gridindex_rf.ny;
0008 nn_rf = gridindex_rf.nn_rf;
0009
0010 ixy = (gridindex_rf.mask_y - 1)*nr + gridindex_rf.mask_r;
0011
0012 XYP0_2piRp = xyP0_2piRp(ixy);
0013
0014 ZXYD_rf.pp_ipj = ZXYD_rf.pp_ipj.*XYP0_2piRp;
0015 ZXYD_rf.pp_imj = ZXYD_rf.pp_imj.*XYP0_2piRp;
0016 ZXYD_rf.pm_ipj = ZXYD_rf.pm_ipj.*XYP0_2piRp;
0017 ZXYD_rf.pm_imj = ZXYD_rf.pm_imj.*XYP0_2piRp;
0018 ZXYD_rf.pr_ipj = ZXYD_rf.pr_ipj.*XYP0_2piRp;
0019 ZXYD_rf.pr_imj = ZXYD_rf.pr_imj.*XYP0_2piRp;
0020
0021 ZXYD_rf.mm_ijp = ZXYD_rf.mm_ijp.*XYP0_2piRp;
0022 ZXYD_rf.mm_ijm = ZXYD_rf.mm_ijm.*XYP0_2piRp;
0023 ZXYD_rf.mp_ijp = ZXYD_rf.mp_ijp.*XYP0_2piRp;
0024 ZXYD_rf.mp_ijm = ZXYD_rf.mp_ijm.*XYP0_2piRp;
0025 ZXYD_rf.mr_ijp = ZXYD_rf.mr_ijp.*XYP0_2piRp;
0026 ZXYD_rf.mr_ijm = ZXYD_rf.mr_ijm.*XYP0_2piRp;
0027
0028 ZXYD_rf.rr_lp = ZXYD_rf.rr_lp.*XYP0_2piRp;
0029 ZXYD_rf.rr_lm = ZXYD_rf.rr_lm.*XYP0_2piRp;
0030 ZXYD_rf.rp_lp = ZXYD_rf.rp_lp.*XYP0_2piRp;
0031 ZXYD_rf.rp_lm = ZXYD_rf.rp_lm.*XYP0_2piRp;
0032 ZXYD_rf.rm_lp = ZXYD_rf.rm_lp.*XYP0_2piRp;
0033 ZXYD_rf.rm_lm = ZXYD_rf.rm_lm.*XYP0_2piRp;
0034
0035 ZXYD_rf.pp_ij = ZXYD_rf.pp_ij.*XYP0_2piRp;
0036 ZXYD_rf.pm_ij = ZXYD_rf.pm_ij.*XYP0_2piRp;
0037 ZXYD_rf.mp_ij = ZXYD_rf.mp_ij.*XYP0_2piRp;
0038
0039 ZXYD_rf.parpar_ij = ZXYD_rf.parpar_ij.*XYP0_2piRp;
0040 ZXYD_rf.ij = ZXYD_rf.ij.*XYP0_2piRp;
0041
0042 iXX = double(((gridindex_rf.mask_r - 1)*nmhu + (gridindex_rf.mask_m - 1))*npn + gridindex_rf.mask_p);
0043 iyn = double((gridindex_rf.mask_n - 1)*ny + gridindex_rf.mask_y);
0044
0045 gridindex_rf = rmfield(gridindex_rf,['mask_r';'mask_m';'mask_p';'mask_n';'mask_y']);
0046
0047 ZXXD_rf.pp_ipj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.pp_ipj ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0048 ZXXD_rf.pp_imj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.pp_imj ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0049 ZXXD_rf.pm_ipj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.pm_ipj ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0050 ZXXD_rf.pm_imj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.pm_imj ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0051 ZXXD_rf.pr_ipj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.pr_ipj ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0052 ZXXD_rf.pr_imj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.pr_imj ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0053 ZXXF_rf.p_ipj = zeros(npn,nmhu,nr);
0054 ZXXF_rf.p_imj = zeros(npn,nmhu,nr);
0055
0056 ZXXD_rf.mm_ijp = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.mm_ijp ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0057 ZXXD_rf.mm_ijm = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.mm_ijm ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0058 ZXXD_rf.mp_ijp = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.mp_ijp ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0059 ZXXD_rf.mp_ijm = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.mp_ijm ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0060 ZXXD_rf.mr_ijp = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.mr_ijp ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0061 ZXXD_rf.mr_ijm = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.mr_ijm ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0062 ZXXF_rf.m_ijp = zeros(npn,nmhu,nr);
0063 ZXXF_rf.m_ijm = zeros(npn,nmhu,nr);
0064
0065 ZXXD_rf.rr_lp = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.rr_lp ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0066 ZXXD_rf.rr_lm = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.rr_lm ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0067 ZXXD_rf.rp_lp = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.rp_lp ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0068 ZXXD_rf.rp_lm = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.rp_lm ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0069 ZXXD_rf.rm_lp = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.rm_lp ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0070 ZXXD_rf.rm_lm = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.rm_lm ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0071 ZXXF_rf.r_lp = zeros(npn,nmhu,nr);
0072 ZXXF_rf.r_lm = zeros(npn,nmhu,nr);
0073
0074 ZXXD_rf.pp_ij = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.pp_ij ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0075 ZXXD_rf.pm_ij = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.pm_ij ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0076 ZXXD_rf.mp_ij = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.mp_ij ),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0077 ZXXF_rf.p_ij = zeros(npn,nmhu,nr);
0078
0079 ZXXD_rf.parpar_ij = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.parpar_ij),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0080 ZXXD_rf.ij = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf.ij),ny*nn_rf,npn*nmhu*nr),1)),[npn,nmhu,nr]);
0081
0082 clear ZXYD_rf XYP0_2piRp
0083
0084 if isfield(dkeparam,'Dparparmax'),
0085 Dparparmax = dkeparam.Dparparmax;
0086 else
0087 Dparparmax = Inf;
0088 end
0089
0090 if imag(Dparparmax) == 0,
0091 XXredfac = ZXXD_rf.parpar_ij/Dparparmax;
0092 else
0093 XXredfac = ZXXD_rf.ij/imag(Dparparmax);
0094 end
0095 XXredfac(XXredfac < 1) = 1;
0096
0097 ZXXD_rf.pp_ipj = ZXXD_rf.pp_ipj./XXredfac;
0098 ZXXD_rf.pp_imj = ZXXD_rf.pp_imj./XXredfac;
0099 ZXXD_rf.pm_ipj = ZXXD_rf.pm_ipj./XXredfac;
0100 ZXXD_rf.pm_imj = ZXXD_rf.pm_imj./XXredfac;
0101
0102 ZXXD_rf.mm_ijp = ZXXD_rf.mm_ijp./XXredfac;
0103 ZXXD_rf.mm_ijm = ZXXD_rf.mm_ijm./XXredfac;
0104 ZXXD_rf.mp_ijp = ZXXD_rf.mp_ijp./XXredfac;
0105 ZXXD_rf.mp_ijm =ZXXD_rf.mp_ijm./XXredfac;
0106
0107 ZXXD_rf.pp_ij = ZXXD_rf.pp_ij./XXredfac;
0108 ZXXD_rf.pm_ij = ZXXD_rf.pm_ij./XXredfac;
0109 ZXXD_rf.mp_ij = ZXXD_rf.mp_ij./XXredfac;
0110
0111 ZXXD_rf.parpar_ij = ZXXD_rf.parpar_ij./XXredfac;
0112 ZXXD_rf.ij = ZXXD_rf.ij./XXredfac;
0113
0114 if dkeparam.dke_mode == 1,
0115
0116 XYP0_2piRp_tp = xyP0_2piRp(ixy(gridindex_rf.mask_dke));
0117
0118 ZXYD_rf_tp.pp_ippj = ZXYD_rf_tp.pp_ippj.*XYP0_2piRp_tp;
0119 ZXYD_rf_tp.pp_ipj = ZXYD_rf_tp.pp_ipj.*XYP0_2piRp_tp;
0120 ZXYD_rf_tp.pp_ij = ZXYD_rf_tp.pp_ij.*XYP0_2piRp_tp;
0121 ZXYD_rf_tp.pp_imj = ZXYD_rf_tp.pp_imj.*XYP0_2piRp_tp;
0122 ZXYD_rf_tp.pp_immj = ZXYD_rf_tp.pp_immj.*XYP0_2piRp_tp;
0123 ZXYD_rf_tp.pm_ipj = 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Rp_tp;
0144 ZXYF_rf_tp.m_ijm = ZXYF_rf_tp.m_ijm.*XYP0_2piRp_tp;
0145
0146 iXX = iXX(gridindex_rf.mask_dke);
0147 iyn = iyn(gridindex_rf.mask_dke);
0148
0149 ZXXD_rf_tp.pp_ippj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.pp_ippj),ny*nn_rf,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0150 ZXXD_rf_tp.pp_ipj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.pp_ipj),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0151 ZXXD_rf_tp.pp_ij = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.pp_ij),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0152 ZXXD_rf_tp.pp_imj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.pp_imj),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0153 ZXXD_rf_tp.pp_immj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.pp_immj),ny*nn_rf,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0154 ZXXD_rf_tp.pm_ipj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.pm_ipj),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0155 ZXXD_rf_tp.pm_ij = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.pm_ij),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0156 ZXXD_rf_tp.pm_imj = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.pm_imj),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0157 ZXXD_rf_tp.mp_ijp = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.mp_ijp),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0158 ZXXD_rf_tp.mp_ij = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.mp_ij),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0159 ZXXD_rf_tp.mp_ijm = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.mp_ijm),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0160 ZXXD_rf_tp.mm_ijp = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.mm_ijp),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0161 ZXXD_rf_tp.mm_ijm = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.mm_ijm),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0162
0163
0164
0165 ZXXD_rf_tp.mp1_ijp = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.mp1_ijp),ny*nn_rf,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0166 ZXXD_rf_tp.mp1_ij = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.mp1_ij),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0167 ZXXD_rf_tp.mp1_ijm = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.mp1_ijm),ny*nn_rf,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0168 ZXXD_rf_tp.mm1_ijp = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.mm1_ijp),ny*nn_rf,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0169 ZXXD_rf_tp.mm1_ijm = reshape(full(sum(sparse(iyn,iXX,double(ZXYD_rf_tp.mm1_ijm),ny*nn_rf,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0170
0171 ZXXF_rf_tp.p_ippj = reshape(full(sum(sparse(iyn,iXX,double(ZXYF_rf_tp.p_ippj),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0172 ZXXF_rf_tp.p_ipj = reshape(full(sum(sparse(iyn,iXX,double(ZXYF_rf_tp.p_ipj),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0173 ZXXF_rf_tp.p_ij = reshape(full(sum(sparse(iyn,iXX,double(ZXYF_rf_tp.p_ij),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0174 ZXXF_rf_tp.p_imj = reshape(full(sum(sparse(iyn,iXX,double(ZXYF_rf_tp.p_imj),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0175 ZXXF_rf_tp.p_immj = reshape(full(sum(sparse(iyn,iXX,double(ZXYF_rf_tp.p_immj),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0176 ZXXF_rf_tp.m_ijp = reshape(full(sum(sparse(iyn,iXX,double(ZXYF_rf_tp.m_ijp),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0177 ZXXF_rf_tp.m_ijm = reshape(full(sum(sparse(iyn,iXX,double(ZXYF_rf_tp.m_ijm),ny*nn_rf ,npn*nmhu*nr_dke),1)),[npn,nmhu,nr_dke]);
0178 else
0179 ZXXD_rf_tp = [];
0180 ZXXF_rf_tp = [];
0181 end
0182