This function ensures consistency between the power travelling with RF rays and the power absorbed by the plasma. Iterations between rfprop_dke_jd and dke_yp are required to reach consistency. INPUTS: - yb: list of ray starts - xyprop_dke: propagation factors at DKE FS - xyP0_2piRp_in: input incident power at each FP position - xyPabs: absorbed power density in the DKE FS - xydV_dke: incremental volume in the DKE FS OUTPUTS: - xyP0_2piRp_out: calculated current step incident power at each FP position - xyP0_2piRp_mod: estimated next step incident power at each FP position by J. Decker (jodecker@alum.mit.edu) and Y. Peysson (yves.peysson@cea.fr)
0001 function [xyP0_2piRp_out,xyP0_2piRp_mod] = rfprop_dke_jd(yb,yP0_2piRp,xyprop_dke,xyP0_2piRp_in,xyPabs_dke,xdV_2piRp_dke,xpsin,xpsin_dke,r_dke,dke_mode); 0002 % 0003 % This function ensures consistency between the power travelling with RF 0004 % rays and the power absorbed by the plasma. Iterations between 0005 % rfprop_dke_jd and dke_yp are required to reach consistency. 0006 % 0007 % INPUTS: 0008 % 0009 % - yb: list of ray starts 0010 % - xyprop_dke: propagation factors at DKE FS 0011 % - xyP0_2piRp_in: input incident power at each FP position 0012 % - xyPabs: absorbed power density in the DKE FS 0013 % - xydV_dke: incremental volume in the DKE FS 0014 % 0015 % OUTPUTS: 0016 % 0017 % - xyP0_2piRp_out: calculated current step incident power at each FP position 0018 % - xyP0_2piRp_mod: estimated next step incident power at each FP position 0019 % 0020 % by J. Decker (jodecker@alum.mit.edu) and Y. Peysson (yves.peysson@cea.fr) 0021 % 0022 [nr_dke,ny] = size(xyprop_dke); 0023 % 0024 xyP0_2piRp_out = xyP0_2piRp_in;%default values 0025 xyP0_2piRp_mod = xyP0_2piRp_in;%default values 0026 % 0027 xydV_2piRp_dke = xdV_2piRp_dke'*ones(1,ny); 0028 xyPrf_dke = xyPabs_dke.*xydV_2piRp_dke;%power absorbed from each ray within each FS 0029 xyPrf_dke(xyPrf_dke < 0) = 0; 0030 % 0031 xymask_prop_dke = xyprop_dke ~= 0;%DKE points visited by the ray 0032 % 0033 for iy = 1:ny 0034 if max(xyprop_dke(:,iy)) == 1 %ray portion is propagating outward 0035 ir_dke = min(find(xyprop_dke(:,iy) == 1)); %position of ray start 0036 % 0037 elseif min(xyprop_dke(:,iy)) == -1 %ray portion is propagating inward 0038 ir_dke = max(find(xyprop_dke(:,iy) == -1)); %position of ray start 0039 % 0040 else %no RT-DKE consistency seeked for current ray 0041 continue 0042 end 0043 ir = r_dke(ir_dke); 0044 % 0045 % check if new ray or only new portion 0046 % 0047 ib = find(iy == yb); 0048 if ~isempty(ib); %new ray 0049 bPrf = yP0_2piRp(ib); %initial power in the ray 0050 bPrf_mod = bPrf; %initial power in the ray 0051 end 0052 % 0053 while ir_dke <= nr_dke & ir_dke >= 1 & xyprop_dke(ir_dke,iy) ~= 0 % stay on current ray 0054 ir = r_dke(ir_dke); 0055 % 0056 Pabs = xyPrf_dke(ir_dke,iy);% absorbed power by resonant and non resonant interaction in this step 0057 if Pabs < 0, 0058 disp(['Warning Pabs < 0, Prf = ',num2str(xyPrf_dke(ir_dke,iy))]); 0059 end 0060 % 0061 if Pabs <= bPrf % absorbed power cannot be more than incident power 0062 % 0063 xyP0_2piRp_out(ir,iy) = bPrf - Pabs/2; %incident power consistent with absorbed power 0064 % 0065 else 0066 % 0067 xyP0_2piRp_out(ir,iy) = xyP0_2piRp_in(ir,iy)*bPrf/Pabs; %linear anticipation 0068 % 0069 Pabs = bPrf; 0070 % 0071 end 0072 % 0073 bPrf = bPrf - Pabs;%remaining power for next step 0074 % 0075 % estimated absorbed power in this step 0076 % anticipating the effect of variations in incident power compared 0077 % to previous QL iteration. This estimate 0078 % assumes linear power absorbed vs incident power dependence. 0079 % 0080 if xyP0_2piRp_in(ir,iy) > 0 0081 Pabs_mod = xyPrf_dke(ir_dke,iy)*bPrf_mod/(xyP0_2piRp_in(ir,iy) + xyPrf_dke(ir_dke,iy)/2);% absorbed power in this step 0082 else 0083 Pabs_mod = xyPrf_dke(ir_dke,iy);% absorbed power in this step 0084 end 0085 % 0086 if Pabs_mod <= bPrf_mod % absorbed power cannot be more than incident power 0087 % 0088 xyP0_2piRp_mod(ir,iy) = bPrf_mod - Pabs_mod/2; %incident power consistent with absorbed power 0089 % 0090 else 0091 % 0092 xyP0_2piRp_mod(ir,iy) = xyP0_2piRp_in(ir,iy)*bPrf_mod/xyPrf_dke(ir_dke,iy); %linear anticipation 0093 % 0094 Pabs_mod = bPrf_mod; 0095 % 0096 end 0097 % 0098 bPrf_mod = bPrf_mod - Pabs_mod; 0099 % 0100 % next FS 0101 % 0102 ir_dke = ir_dke + xyprop_dke(ir_dke,iy); 0103 end 0104 % 0105 % interpolation for the FP positions (only necessary if dke_mode == 1) 0106 % 0107 if dke_mode == 1 0108 xmask_prop_fp = [(min(r_dke(xymask_prop_dke(:,iy))) - 1):(max(r_dke(xymask_prop_dke(:,iy))) + 1)];%corresponding FP points 0109 % 0110 xyP0_2piRp_out(xmask_prop_fp,iy) = interp(xpsin_dke(xymask_prop_dke(:,iy)),xyP0_2piRp_out(xymask_prop_dke(:,iy)),xpsin(xmask_prop_fp),method); 0111 xyP0_2piRp_mod(xmask_prop_fp,iy) = interp(xpsin_dke(xymask_prop_dke(:,iy)),xyP0_2piRp_mod(xymask_prop_dke(:,iy)),xpsin(xmask_prop_fp),method); 0112 end 0113 end 0114 0115 0116 0117