rundke_norm

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 p_opt = 2;
0012 %
0013 permission = test_permissions_yp;
0014 %
0015 if ~permission 
0016     disp('Please move the script to a local folder where you have write permission before to run it')
0017     return;
0018 end
0019 %
0020 % ***********************This part must be specified by the user, run make files if necessary) *****************************
0021 %
0022 id_simul = 'Runaway_norm';%Simulation ID
0023 path_simul = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0024 %
0025 psin_S = [];%Normalized poloidal flux grid where calculations are performed (0 < psin_S < 1) (If one value: local calculation only, not used if empty)
0026 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)
0027 %
0028 id_path = '';%For all paths used by DKE solver
0029 path_path = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0030 %
0031 id_equil = 'TScyl';%For plasma equilibrium
0032 path_equil = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0033 %
0034 id_dkeparam = 'UNIFORM10010020';%For DKE code parameters
0035 path_dkeparam = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0036 %
0037 id_display = 'NO_DISPLAY';%For output code display
0038 path_display = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0039 %
0040 id_ohm = '';%For Ohmic electric contribution
0041 path_ohm = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0042 %
0043 ids_wave = {''};%For RF waves contribution (put all the type of waves needed)
0044 paths_wave = {''};%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0045 %
0046 id_transpfaste = '';%For fast electron radial transport
0047 path_transpfaste = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0048 %
0049 id_ripple = '';%For fast electron magnetic ripple losses
0050 path_ripple = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0051 %
0052 %************************************************************************************************************************************
0053 %************************************************************************************************************************************
0054 %************************************************************************************************************************************
0055 %
0056 [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);
0057 %
0058 %************************************************************************************************************************************
0059 %
0060 if exist('dmumpsmex');dkeparam.invproc = -2;end
0061 %
0062 betath = 0.001;%validated for NR limit
0063 %
0064 [qe,me,mp,mn,e0,mu0,re,mc2] = pc_dke_yp;%Universal physics constants
0065 %
0066 equil.pTe = betath^2*mc2*ones(size(equil.pTe));
0067 equil.pzTi = 1e-10*ones(size(equil.pzTi));
0068 %
0069 dkeparam.coll_mode = 0;% Relativistic Maxwellian background
0070 dkeparam.timevol = 1;%to calculate moments at all internal times
0071 %
0072 dkeparam.psin_S = psin_S;
0073 dkeparam.rho_S = rho_S;
0074 %
0075 dtn = 100;% time step
0076 nit = 100;% number of iterations
0077 tn_max = dtn*nit;% total time
0078 %
0079 epsi = 0.04;%corresponds to pc/pT = 5
0080 %
0081 ohm = ohm_flat(equil,epsi);
0082 %
0083 RR_kulsrud = 1.914*1e-6;%Kulsrud (PRL, 31,11, (1972) 690)
0084 %
0085 % Different conservation schemes
0086 %
0087 dkeparam.dtn = dtn; 
0088 dkeparam.tn = tn_max; 
0089 %
0090 dkeparam.boundary_mode_f = 0;%Enforcing the Maxwellian initial value at the first "boundary_mode_f" grid points
0091 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
0092 %
0093 [dummy,dummy,dummy,dke_out_0] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0094 %
0095 xRRv_0 = NaN(1,nit);
0096 xRRs_0 = NaN(1,nit);
0097 for it=1:nit,
0098     xRRv_0(it) = (dke_out_0.normf0{it}(1) - dke_out_0.normf0{it}(end))/dtn;
0099     xRRs_0(it) = dke_out_0.XxRR_fsav{it}(end,:);
0100 end
0101 %
0102 dkeparam.boundary_mode_f = 1;%Enforcing the Maxwellian initial value at the first "boundary_mode_f" grid points
0103 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
0104 %
0105 [dummy,dummy,dummy,dke_out_1] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0106 %
0107 xRRv_1 = NaN(1,nit);
0108 xRRs_1 = NaN(1,nit);
0109 for it=1:nit,
0110     xRRv_1(it) = (dke_out_1.normf0{it}(1) - dke_out_1.normf0{it}(end))/dtn;
0111     xRRs_1(it) = dke_out_1.XxRR_fsav{it}(end,:);
0112 end
0113 %
0114 dkeparam.boundary_mode_f = 0;%Enforcing the Maxwellian initial value at the first "boundary_mode_f" grid points
0115 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
0116 %
0117 [dummy,dummy,dummy,dke_out_2] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0118 %
0119 xRRv_2 = NaN(1,nit);
0120 xRRs_2 = NaN(1,nit);
0121 for it=1:nit,
0122     xRRv_2(it) = (dke_out_2.normf0{it}(1) - dke_out_2.normf0{it}(end))/dtn;
0123     xRRs_2(it) = dke_out_2.XxRR_fsav{it}(end,:);
0124 end
0125 %
0126 %************************************************************************************************************************************
0127 %
0128 figure(1),clf
0129 %
0130 leg = {'Volumic losses','Boundary losses','Runaway losses'};
0131 xlim = [0,tn_max];
0132 ylim = [1.5e-6,2e-6];
0133 xlab = 't/\tau_c';
0134 ylab = '\Gamma_R';
0135 tit = '';
0136 siz = 20+14i;
0137 %
0138 graph1D_jd(dtn:dtn:tn_max,xRRv_0,0,0,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0139 graph1D_jd(dtn:dtn:tn_max,xRRs_0,0,0,'','','',NaN,xlim,ylim,'--','none','r',2,siz,gca);
0140 graph1D_jd(xlim,[RR_kulsrud,RR_kulsrud],0,0,'','','',leg,xlim,ylim,'--','none','k',2,siz,gca);
0141 graph1D_jd(dtn:dtn:tn_max,xRRv_1,0,0,'','','',NaN,xlim,ylim,'-','none','b',2,siz,gca);
0142 graph1D_jd(dtn:dtn:tn_max,xRRs_1,0,0,'','','',NaN,xlim,ylim,'--','none','b',2,siz,gca);
0143 graph1D_jd(dtn:dtn:tn_max,xRRv_2,0,0,'','','',NaN,xlim,ylim,'-','none','g',2,siz,gca);
0144 graph1D_jd(dtn:dtn:tn_max,xRRs_2,0,0,'','','',NaN,xlim,ylim,'--','none','g',2,siz,gca);
0145 %
0146 print_jd(p_opt,'fig_runaway_norm','./figures',1)
0147 %
0148 %************************************************************************************************************************************
0149 %
0150 eval(['save ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);
0151 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.