rundke

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 = 'Zero_test';%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.05:0.02:0.2,0.22:0.03:0.6,0.62:0.05:0.95];%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 = 'JETh77';%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 = 'BOUNCE3D_MUMPS';%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 = 'PARTIAL_VISUAL';%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 = 'OHM_p005_flat';%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 = {'LH_karney_offaxis_2'};%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 = 'nomagneticturbulence';%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 %
0061 if exist('dmumpsmex');dkeparam.invproc = -2;end
0062 %
0063 dkeparam.psin_S = psin_S;
0064 dkeparam.rho_S = rho_S;
0065 %
0066 transpfaste.Dr0 = 5;
0067 %
0068 [Znorm_p,Zcurr_p,ZP0_p,dke_out_p,radialDKE,equilDKE,momentumDKE,gridDKE,Zmomcoef,Zbouncecoef,Zmripple,mksa,XXsinksource] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0069 %
0070 ohm.epsi = -ohm.epsi;%The Ohmic electric field is reversed
0071 waves{1}.rays{1}.sNpar = -waves{1}.rays{1}.sNpar;%The wave direction is reversed
0072 [Znorm_m,Zcurr_m,ZP0_m,dke_out_m] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0073 %
0074 figure(1),clf,graph1D_jd(equilDKE.xrho,Zcurr_p.x_tot_fsav,0,0,'\rho','Current density','',NaN,'','','-','none','r',2,20,gca,1,0.6,0.6);hold on
0075 graph1D_jd(equilDKE.xrho,Zcurr_m.x_tot_fsav,0,0,'\rho','Current density','',NaN,'','','-','none','b',2,20,gca,1,0.6,0.6);hold on
0076 graph1D_jd(equilDKE.xrho,Zcurr_p.x_tot_fsav+Zcurr_m.x_tot_fsav,0,0,'\rho','Current density','',NaN,'','','none','*','g',2,20,gca,1,0.6,0.6);
0077 legend('N_{||} > 0, E_{field} > 0','N_{||}< 0, E_{field} < 0','Sum')
0078 print_jd(p_opt,'profcurr_testzero')
0079 %
0080 figure(2),clf,graph1D_jd(equilDKE.xrho,ZP0_p.x_rf_fsav,0,0,'','','',NaN,'','','-','none','r',2,20,gca,1,0.6,0.6);hold on
0081 graph1D_jd(equilDKE.xrho,ZP0_p.x_c_fsav,0,0,'','','',NaN,'','','--','none','r',2,20,gca,1,0.6,0.6);hold on
0082 graph1D_jd(equilDKE.xrho,ZP0_m.x_rf_fsav,0,0,'','','',NaN,'','','none','+','b',2,20,gca,1,0.6,0.6);
0083 graph1D_jd(equilDKE.xrho,ZP0_m.x_c_fsav,0,0,'\rho','Power','',NaN,'','','none','*','b',2,20,gca,1,0.6,0.6);
0084 legend('P_{LH}: N_{||} > 0, E_{field} > 0','P_{coll}: N_{||} > 0, E_{field} > 0','P_{LH}: N_{||} < 0, E_{field} < 0','P_{coll}: N_{||} < 0, E_{field} < 0')
0085 print_jd(p_opt,'profP_testzero')
0086 %
0087 figure(3),clf,graph1D_jd(equilDKE.xrho,Znorm_p.x_0_fsav,0,0,'','','',NaN,'','','-','none','r',2,20,gca,1,0.6,0.6);hold on
0088 graph1D_jd(equilDKE.xrho,Znorm_m.x_0_fsav,0,0,'\rho','Density','',NaN,'','','none','*','b',2,20,gca,1,0.6,0.6);
0089 legend('N_{||} > 0, E_{field} > 0','N_{||} < 0, E_{field} < 0')
0090 print_jd(p_opt,'profne_testzero')
0091 %
0092 %************************************************************************************************************************************
0093 eval(['save ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);
0094 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.