rundke_Ti

PURPOSE ^

Script for running the DKE solver (can be modified by the user for specific simulations)

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

Script for running the DKE solver (can be modified by the user for specific simulations)
by Y.Peysson CEA-DRFC <yves.peysson@cea.fr> and Joan Decker MIT-RLE (jodecker@mit.edu)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %Script for running the DKE solver (can be modified by the user for specific simulations)
0002 %by Y.Peysson CEA-DRFC <yves.peysson@cea.fr> and Joan Decker MIT-RLE (jodecker@mit.edu)
0003 %
0004 clear all
0005 clear mex
0006 clear functions
0007 close all
0008 warning off
0009 global nfig
0010 %
0011 permission = test_permissions_yp;
0012 %
0013 if ~permission 
0014     disp('Please move the script to a local folder where you have write permission before to run it')
0015     return;
0016 end
0017 %
0018 % ***********************This part must be specified by the user, run make files in $HOME/Database directory if necessary *****************************
0019 %
0020 id_simul = 'Thermal_Ti';%Simulation ID
0021 path_simul = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0022 %
0023 psin_S = [];%Normalized poloidal flux grid where calculations are performed (0 < psin_S < 1) (If one value: local calculation only, not used if empty)
0024 rho_S = [0.5];%Normalized radial flux grid where calculations are performed (0 < rho_S < 1) (If one value: local calculation only, not used if empty)
0025 %
0026 id_path = '';%For all paths used by DKE solver
0027 path_path = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0028 %
0029 id_equil = 'TScyl';%For plasma equilibrium
0030 path_equil = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0031 %
0032 id_dkeparam = 'UNIFORM10010020';%For DKE code parameters
0033 path_dkeparam = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0034 %
0035 id_display = 'NO_DISPLAY';%For output code display
0036 path_display = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0037 %
0038 id_ohm = '';%For Ohmic electric contribution
0039 path_ohm = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0040 %
0041 ids_wave = {''};%For RF waves contribution (put all the type of waves needed)
0042 paths_wave = {''};%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0043 %
0044 id_transpfaste = '';%For fast electron radial transport
0045 path_transpfaste = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0046 %
0047 id_ripple = '';%For fast electron magnetic ripple losses
0048 path_ripple = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0049 %
0050 %************************************************************************************************************************************
0051 %************************************************************************************************************************************
0052 %************************************************************************************************************************************
0053 %
0054 [dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple] = load_structures_yp('dkepath',id_path,path_path,'equil',id_equil,path_equil,'dkeparam',id_dkeparam,path_dkeparam,'dkedisplay',id_display,path_display,'ohm',id_ohm,path_ohm,'waves',ids_wave,paths_wave,'transpfaste',id_transpfaste,path_transpfaste,'ripple',id_ripple,path_ripple);
0055 %
0056 %************************************************************************************************************************************
0057 %
0058 if exist('dmumpsmex');dkeparam.invproc = -2;end
0059 %
0060 dtn = 10000;
0061 tnmax = 100000;
0062 %
0063 dkeparam.coll_mode = 2;%Relativistic collision operator: (0) Relativistic Maxwellian background, (1) High-velocity limit, (2) Linearized Belaiev-Budker (3) Non-relativistic Lorentz model, (4) Non-relativistic Maxwellian background
0064 dkeparam.dtn = dtn;
0065 dkeparam.tn = tnmax;
0066 dkeparam.prec0_f = 0;
0067 %
0068 dkeparam.psin_S = psin_S;
0069 dkeparam.rho_S = rho_S;
0070 %
0071 pzTi = equil.pzTi;
0072 Tifac_list = logspace(-2,2,21);
0073 %
0074 for iTi = 1:length(Tifac_list);
0075     %
0076     equil.pzTi = pzTi*Tifac_list(iTi);
0077     %
0078     % free mode
0079     %
0080     dkeparam.boundary_mode_f = 0;%Number of points where the Maxwellian distribution is enforced from p = 0 (p=0, free conservative mode but param_inv(1) must be less than 1e-4, otherwise 1e-3 is OK most of the time. Sensitive to the number of points in p)
0081     dkeparam.norm_mode_f = 0;%Local normalization of f0 at each iteration: (0) no, the default value when the numerical conservative scheme is correct, (1) yes
0082     %
0083     [dummy,dummy,dummy,dke_out] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0084     normf0_final_0(iTi) = dke_out.normf0{end}(end);
0085     residue_final_0(iTi) = dke_out.residu_f{end}(end);
0086     %
0087     % boundary mode
0088     %
0089     dkeparam.boundary_mode_f = 1;%Number of points where the Maxwellian distribution is enforced from p = 0 (p=0, free conservative mode but param_inv(1) must be less than 1e-4, otherwise 1e-3 is OK most of the time. Sensitive to the number of points in p)
0090     dkeparam.norm_mode_f = 0;%Local normalization of f0 at each iteration: (0) no, the default value when the numerical conservative scheme is correct, (1) yes
0091     %
0092     [dummy,dummy,dummy,dke_out] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0093     normf0_final_1(iTi) = dke_out.normf0{end}(end);
0094     residue_final_1(iTi) = dke_out.residu_f{end}(end);
0095     %
0096     % norm mode
0097     %
0098     dkeparam.boundary_mode_f = 0;%Number of points where the Maxwellian distribution is enforced from p = 0 (p=0, free conservative mode but param_inv(1) must be less than 1e-4, otherwise 1e-3 is OK most of the time. Sensitive to the number of points in p)
0099     dkeparam.norm_mode_f = 1;%Local normalization of f0 at each iteration: (0) no, the default value when the numerical conservative scheme is correct, (1) yes
0100     %
0101     [dummy,dummy,dummy,dke_out] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0102     normf0_final_2(iTi) = dke_out.normf0{end}(end);
0103     residue_final_2(iTi) = dke_out.residu_f{end}(end);
0104 end
0105 %
0106 figure(1),clf
0107 %
0108 leg = {'Free Mode','Fixed point','Normalization'};
0109 xlim = 10.^[-2,2];
0110 ylim = [-4,4]*1e-2;
0111 xlab = 'T_i/T_e';
0112 ylab = '\Deltan/n_0';
0113 tit = '';
0114 colors = {'r','b','g','m'};
0115 siz = 20+14i;
0116 %
0117 graph1D_jd(Tifac_list,normf0_final_0-1,1,0,xlab,ylab,tit,NaN,xlim,ylim,'-','none',colors{1},2,siz,gca,0.9,0.7,0.7);
0118 graph1D_jd(Tifac_list,normf0_final_1-1,1,0,'','','',NaN,xlim,ylim,'-','none',colors{2},2,siz,gca);
0119 graph1D_jd(Tifac_list,normf0_final_2-1,1,0,'','','',leg,xlim,ylim,'-','none',colors{3},2,siz,gca);
0120 %
0121 set(gca,'xtick',[0.01,0.1,1,10,100])
0122 set(gca,'XMinorGrid','off')
0123 set(gca,'XMinorTick','on')
0124 set(gca,'ytick',[-4:2:4]*1e-2)
0125 %
0126 figure(2),clf
0127 %
0128 ylim = 10.^[-23,-21];
0129 ylab = 'Legendre convergence parameter';
0130 %
0131 graph1D_jd(Tifac_list,residue_final_0,1,1,xlab,ylab,tit,NaN,xlim,ylim,'-','+',colors{1},2,siz,gca,0.9,0.7,0.7);
0132 graph1D_jd(Tifac_list,residue_final_1,1,1,'','','',NaN,xlim,ylim,'-','+',colors{2},2,siz,gca);
0133 graph1D_jd(Tifac_list,residue_final_2,1,1,'','','',leg,xlim,ylim,'-','+',colors{3},2,siz,gca);
0134 %
0135 set(gca,'xtick',[0.01,0.1,1,10,100])
0136 set(gca,'XMinorGrid','off')
0137 set(gca,'XMinorTick','on')
0138 set(gca,'ytick',10.^[-23:21])
0139 set(gca,'YMinorGrid','off')
0140 set(gca,'YMinorTick','off')
0141 %
0142 print_jd(2,'fig_thermal_Ti_deltan','./figures',1)
0143 print_jd(2,'fig_thermal_Ti_residue','./figures',2)
0144 %
0145 %************************************************************************************************************************************
0146 %
0147 eval(['save ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);
0148 info_dke_yp(2,['Data saved in ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.