Contents

RAPTOR Exercise 1: Ramp-up current diffusion with varying heating

In this exercise you will test the effect of differently timed heating during a plasma current ramp.

First we set up the RAPTOR simulation.

clear
run ../../RAPTOR_path.m

% load the default parameters for ITER
config = RAPTOR_config('ITER'); % load default params
config.grid.tgrid = [0:0.1:1,3:2:140];

% tranport model: choose empirical model with
% transport reduction at low shear.
config.chi_e = chi_e('FF');
config.chi_e.params.cano = 4;
config.chi_e.params.cneo = 0.1;

% Heating actuators: EC and NBI
config.nbhcd = nbhcd('nbhcd_gaussian');
config.nbhcd.params.active = true;
config.nbhcd.params.rdep = [0.26]; %
config.nbhcd.params.wdep = [0.15]; % broad heating
config.nbhcd.params.wdep_out = [0.75]; % broad heating
config.nbhcd.params.cd_eff = [5]; % current drive
config.nbhcd.params.uindices = [2];% index in input vector

config.echcd = echcd('echcd_gaussian');
config.echcd.params.active = true;
config.echcd.params.rdep = [0.2 0.4 0.55 ]; % two actuators, set rdep=0 for first, rdep=0.4 for second
config.echcd.params.wdep = [.05 .05 .05 ];  % wdep =0.35 for each
config.echcd.params.cd_eff = [10 10 10];  % current drive efficiency factor: pure ECH for first, co-ECCD for second
config.echcd.params.uindices = [3 4 5]; % index of power for each actuator in input vector

% radiation modules etc
config.prad.active = false;
config.pei.active = true;
config.palpha.active = false;

[~,model,params,init] = RAPTOR_config(config); % generate model structure for these params.
params.debug.iterdisp = 10; % display every 10

% Plasma current ramp
rampfun = @(t,tmin,ymin,tmax,ymax) max(ymin,min((ymax-ymin)/(tmax-tmin)*(t-tmin),ymax-ymin)+ymin); % anonymous function for ramps

U(1,:) = rampfun(params.tgrid.tgrid,0,4e6,100,12e6); % input Ip trace
U(2,:) = zeros(size(U(1,:))); % placeholder, will replace this with heating later.
U(3,:) = zeros(size(U(1,:))); % placeholder, will replace this with heating later.
U(4,:) = zeros(size(U(1,:))); % placeholder, will replace this with heating later.
U(5,:) = zeros(size(U(1,:))); % placeholder, will replace this with heating later.

% initial conditions
init.te0 = 2e3;
init.ne0 = 1e19;
[x0,g0,v0] = RAPTOR_initial_conditions(U(1),model,init); % Define the initial condition
v0 = v0*ones(1,params.tgrid.nt);

% specify density ramp: multiply initial profile by ne0(t)
negauss = model.te.LamTegauss*v0(model.ne.ind,1);
ne0 = rampfun(params.tgrid.tgrid,0,1,100,5);
negauss_varying = negauss*ne0;
v0(model.ne.ind,:) = model.te.LamTegauss \ negauss_varying;
v0(model.ni.ind,:) = 0.9*v0(model.ne.ind,:);

% Run the simulation
simres = RAPTOR_predictive(x0,g0,v0,U,model,params);
out = RAPTOR_out(simres,model,params);
RAPTOR_plot_GUI(out);
Loading default configuration for ITER
loading CHEASE equilibrium from /Users/ffelici/Dropbox/4K480 - Dropbox/Exercises/Week7/RAPTOR_exercise/chease_equils/ITER_hybrid_citrin_equil_cheasedata
Scaling Te initial condition to match edge value boundary value (200)
  istep  telaps newt     res   t[ s]  dt[ s]  Ip[MA] Icd[MA] Ibs[MA] Ioh[MA]      qe    qmin      q0   Vl[V] Te0[keV] ne0[e19]  Wi[MJ] We[MJ]  f_ss  
      1   0.031    4 1.2e-10       0     0.1       4       0  0.0559    3.95    14.7    3.68    3.68 6.6e-01    1.58    1.00   22.69    0.57 9.2e+00 
     11    0.26    3 1.9e-10       1       2    4.08       0  0.0358    4.05    14.5     2.6     2.6 1.3e+00    1.17    1.04   24.41    0.46 4.3e+00 
     21    0.46    2 9.5e-11      21       2    5.68       0  0.0535    5.63    10.4     1.2     1.2 1.5e+00    1.56    1.84   53.82    0.97 3.4e+00 
     31    0.64    2 4.6e-11      41       2    7.28       0  0.0713    7.21     8.1   0.851   0.851 1.5e+00    1.88    2.64   95.55    1.63 3.5e+00 
     41    0.81    2 5.3e-11      61       2    8.88       0  0.0883     8.8    6.64   0.657   0.657 1.6e+00    2.16    3.44  149.89    2.41 3.5e+00 
     51    0.98    2 5.5e-11      81       2    10.5       0   0.104    10.4    5.63   0.533   0.533 1.6e+00    2.43    4.24  217.17    3.32 3.5e+00 
     61     1.2    3 8.3e-11     101       2      12       0   0.119    11.9    4.92   0.448   0.448 1.6e+00    2.69    5.00  296.17    4.30 3.3e+00 
     71     1.4    2 7.7e-10     121       2      12       0   0.121    11.9    4.92   0.381   0.381 1.3e+00    3.07    5.00  334.19    4.59 1.9e+00 

EXERCISES

  1. By varying U(1,:), investigate the effect of different plasma current ramp rates on the speed of penetration of inductive current, the evolution of the loop voltage profile U_{pl}, and the q profile.
  2. Returning to the original Ip time trace, now use U(2,:) to add 16MW of NBI power starting at different times during the ramp-up. Examine the effect on the T_e q and jpar profiles and explain the results.
  3. Vary U(3:5,:) to add at most 20MW of off-axis EC current drive at different times, and try to obtain a transport barrier by getting a reversed-shear q profile.
  4. Find a combination of timing for heating and current drive to keep qmin above 1 for as long as possible.

SOLUTION 1

tflattopgrid = [20:40:100];
cgrid = {'b','r','k','m'};
clear out simres

for ii=1:numel(tflattopgrid)
tflattop = tflattopgrid(ii);
U(1,:) = rampfun(params.tgrid.tgrid,0,4e6,tflattop,12e6); % input Ip trace
simres{ii} = RAPTOR_predictive(x0,g0,v0,U,model,params); % run sim
out{ii} = RAPTOR_out(simres{ii},model,params); % get outputs
  istep  telaps newt     res   t[ s]  dt[ s]  Ip[MA] Icd[MA] Ibs[MA] Ioh[MA]      qe    qmin      q0   Vl[V] Te0[keV] ne0[e19]  Wi[MJ] We[MJ]  f_ss  
      1   0.046    4 1.2e-10       0     0.1       4       0  0.0559    3.95    14.7    3.68    3.68 6.6e-01    1.58    1.00   22.69    0.57 9.2e+00 
     11    0.29    4 1.4e-12       1       2     4.4       0  0.0378    4.36    13.4    2.62    2.62 1.4e+00    1.20    1.04   26.75    0.49 5.0e+00 
     21    0.54    3 2.5e-10      21       2      12       0  0.0981    11.9    4.92    1.19    1.19 1.9e+00    2.79    1.84  184.15    2.22 9.4e+00 
     31    0.77    3 2.9e-11      41       2      12       0   0.109    11.9    4.92   0.699   0.699 1.2e+00    3.43    2.64  271.59    3.20 5.1e+00 
     41       1    3 7.2e-11      61       2      12       0   0.114    11.9    4.92   0.462   0.462 1.1e+00    3.59    3.44  320.19    3.88 3.2e+00 
     51     1.2    2 5.8e-09      81       2      12       0   0.119    11.9    4.92   0.368   0.368 1.1e+00    3.53    4.24  348.88    4.42 1.9e+00 
     61     1.4    3 7.5e-11     101       2      12       0   0.121    11.9    4.92   0.329   0.329 1.2e+00    3.37    5.00  363.06    4.80 9.1e-01 
     71     1.6    2 1.0e-10     121       2      12       0   0.121    11.9    4.92   0.311   0.311 1.1e+00    3.46    5.00  371.48    4.85 4.9e-01 
  istep  telaps newt     res   t[ s]  dt[ s]  Ip[MA] Icd[MA] Ibs[MA] Ioh[MA]      qe    qmin      q0   Vl[V] Te0[keV] ne0[e19]  Wi[MJ] We[MJ]  f_ss  
      1   0.035    4 1.2e-10       0     0.1       4       0  0.0559    3.95    14.7    3.68    3.68 6.6e-01    1.58    1.00   22.69    0.57 9.2e+00 
     11    0.32    3 1.7e-10       1       2    4.14       0  0.0361     4.1    14.3     2.6     2.6 1.3e+00    1.17    1.04   24.80    0.46 4.4e+00 
     21     0.5    2 3.2e-11      21       2     6.8       0  0.0629    6.74    8.67    1.15    1.15 1.6e+00    1.81    1.84   73.48    1.18 5.2e+00 
     31    0.68    2 6.6e-11      41       2    9.47       0  0.0894    9.38    6.23   0.753   0.753 1.7e+00    2.43    2.64  155.63    2.22 5.4e+00 
     41    0.86    3 4.5e-11      61       2      12       0   0.113    11.9    4.92   0.555   0.555 1.6e+00    2.99    3.44  268.14    3.52 5.0e+00 
     51     1.1    2 3.0e-09      81       2      12       0   0.119    11.9    4.92   0.431   0.431 1.2e+00    3.21    4.24  320.93    4.24 2.8e+00 
     61     1.3    3 9.7e-11     101       2      12       0   0.121    11.9    4.92   0.361   0.361 1.2e+00    3.19    5.00  346.45    4.69 1.5e+00 
     71     1.6    2 6.0e-11     121       2      12       0   0.121    11.9    4.92   0.328   0.328 1.2e+00    3.36    5.00  361.69    4.78 8.7e-01 
  istep  telaps newt     res   t[ s]  dt[ s]  Ip[MA] Icd[MA] Ibs[MA] Ioh[MA]      qe    qmin      q0   Vl[V] Te0[keV] ne0[e19]  Wi[MJ] We[MJ]  f_ss  
      1   0.049    4 1.2e-10       0     0.1       4       0  0.0559    3.95    14.7    3.68    3.68 6.6e-01    1.58    1.00   22.69    0.57 9.2e+00 
     11    0.31    3 1.9e-10       1       2    4.08       0  0.0358    4.05    14.5     2.6     2.6 1.3e+00    1.17    1.04   24.41    0.46 4.3e+00 
     21    0.52    2 9.5e-11      21       2    5.68       0  0.0535    5.63    10.4     1.2     1.2 1.5e+00    1.56    1.84   53.82    0.97 3.4e+00 
     31     0.7    2 4.6e-11      41       2    7.28       0  0.0713    7.21     8.1   0.851   0.851 1.5e+00    1.88    2.64   95.55    1.63 3.5e+00 
     41    0.88    2 5.3e-11      61       2    8.88       0  0.0883     8.8    6.64   0.657   0.657 1.6e+00    2.16    3.44  149.89    2.41 3.5e+00 
     51       1    2 5.5e-11      81       2    10.5       0   0.104    10.4    5.63   0.533   0.533 1.6e+00    2.43    4.24  217.17    3.32 3.5e+00 
     61     1.2    3 8.3e-11     101       2      12       0   0.119    11.9    4.92   0.448   0.448 1.6e+00    2.69    5.00  296.17    4.30 3.3e+00 
     71     1.4    2 7.7e-10     121       2      12       0   0.121    11.9    4.92   0.381   0.381 1.3e+00    3.07    5.00  334.19    4.59 1.9e+00 
end
%
RAPTOR_plot_GUI(out);

The fastest ramp rate leads to a non-monotinic current density profile and flatter, or more reversed, q profiles. This can lead to transport barriers. In reality, the ramp rate is limited by MHD modes which can appear, especially for very steep current density profiles.

SOLUTION 2

clear simres out
% Back to default Ip trace
U(1,:) = rampfun(params.tgrid.tgrid,0,2e6,100,12e6); % input Ip trace

tstartgrid = [20:40:100];
for ii=1:numel(tstartgrid);
    tstart = tstartgrid(ii);
    U(2,:) = rampfun(params.tgrid.tgrid,tstart,0,tstart+10,16e6);
    simres{ii} = RAPTOR_predictive(x0,g0,v0,U,model,params);
    out{ii} = RAPTOR_out(simres{ii},model,params);
end
RAPTOR_plot_GUI(out);
  istep  telaps newt     res   t[ s]  dt[ s]  Ip[MA] Icd[MA] Ibs[MA] Ioh[MA]      qe    qmin      q0   Vl[V] Te0[keV] ne0[e19]  Wi[MJ] We[MJ]  f_ss  
      1    0.03    4 1.8e-09       0     0.1       2       0   0.056    1.95    29.5    3.68    3.68 -8.3e+00    1.57    1.00   19.72    0.56 1.3e+02 
     11    0.29    5 1.7e-12       1       2     2.1       0  0.0225    2.08    28.1    2.53    2.53 2.7e-01    0.91    1.04   10.53    0.31 7.4e+00 
     21     0.6    4 1.2e-11      21       2     4.1   0.205  0.0375    3.86    14.4    2.78    2.78 1.6e+00    0.83    1.84   21.34    0.64 3.9e+00 
     31    0.89    3 2.4e-11      41       2     6.1    2.05   0.212    3.85    9.67    2.51     2.9 7.2e-01    3.04    2.64   57.95    2.84 3.5e+00 
     41     1.1    2 3.5e-09      61       2     8.1    2.05   0.205    5.85    7.28    1.73    1.76 8.7e-01    3.05    3.44  107.59    3.85 3.7e+00 
     51     1.3    2 3.7e-10      81       2    10.1    2.05   0.207    7.85    5.84    1.14    1.14 9.9e-01    3.16    4.24  174.24    5.01 3.8e+00 
     61     1.5    3 4.0e-11     101       2      12    2.05   0.214    9.75    4.92    0.83    0.83 1.0e+00    3.33    5.00  256.61    6.26 3.6e+00 
     71     1.7    2 5.8e-10     121       2      12    2.05   0.212    9.75    4.92   0.647   0.647 7.1e-01    3.67    5.00  290.59    6.64 1.7e+00 
  istep  telaps newt     res   t[ s]  dt[ s]  Ip[MA] Icd[MA] Ibs[MA] Ioh[MA]      qe    qmin      q0   Vl[V] Te0[keV] ne0[e19]  Wi[MJ] We[MJ]  f_ss  
      1   0.041    4 1.8e-09       0     0.1       2       0   0.056    1.95    29.5    3.68    3.68 -8.3e+00    1.57    1.00   19.72    0.56 1.3e+02 
     11    0.32    5 1.7e-12       1       2     2.1       0  0.0225    2.08    28.1    2.53    2.53 2.7e-01    0.91    1.04   10.53    0.31 7.4e+00 
     21    0.62    2 8.7e-09      21       2     4.1       0  0.0303    4.07    14.4    2.67    2.67 1.7e+00    0.75    1.84   20.82    0.57 3.3e+00 
     31    0.85    2 5.4e-11      41       2     6.1       0  0.0539    6.05    9.67    1.42    1.42 1.8e+00    1.19    2.64   54.93    1.17 4.2e+00 
     41     1.1    4 5.4e-11      61       2     8.1   0.205  0.0838    7.82    7.28   0.905   0.905 1.7e+00    1.72    3.44  109.77    2.11 4.2e+00 
     51     1.3    2 4.8e-09      81       2    10.1    2.05   0.202    7.86    5.84   0.911   0.911 9.6e-01    3.17    4.24  179.22    5.02 3.4e+00 
     61     1.5    3 4.6e-11     101       2      12    2.05   0.213    9.75    4.92   0.782   0.782 1.0e+00    3.35    5.00  259.31    6.28 3.4e+00 
     71     1.8    2 4.1e-10     121       2      12    2.05   0.211    9.75    4.92   0.634   0.634 7.1e-01    3.68    5.00  291.99    6.65 1.6e+00 
  istep  telaps newt     res   t[ s]  dt[ s]  Ip[MA] Icd[MA] Ibs[MA] Ioh[MA]      qe    qmin      q0   Vl[V] Te0[keV] ne0[e19]  Wi[MJ] We[MJ]  f_ss  
      1   0.029    4 1.8e-09       0     0.1       2       0   0.056    1.95    29.5    3.68    3.68 -8.3e+00    1.57    1.00   19.72    0.56 1.3e+02 
     11    0.34    5 1.7e-12       1       2     2.1       0  0.0225    2.08    28.1    2.53    2.53 2.7e-01    0.91    1.04   10.53    0.31 7.4e+00 
     21    0.61    2 8.7e-09      21       2     4.1       0  0.0303    4.07    14.4    2.67    2.67 1.7e+00    0.75    1.84   20.82    0.57 3.3e+00 
     31    0.82    2 5.4e-11      41       2     6.1       0  0.0539    6.05    9.67    1.42    1.42 1.8e+00    1.19    2.64   54.93    1.17 4.2e+00 
     41       1    2 5.0e-11      61       2     8.1       0  0.0774    8.03    7.28   0.898   0.898 1.8e+00    1.65    3.44  109.46    2.00 4.3e+00 
     51     1.3    2 6.9e-11      81       2    10.1       0   0.099      10    5.84   0.647   0.647 1.8e+00    2.08    4.24  184.23    3.01 4.4e+00 
     61     1.5    3 9.5e-10     101       2      12   0.205   0.124    11.7    4.92   0.505   0.505 1.7e+00    2.55    5.00  277.60    4.30 3.8e+00 
     71     1.8    2 5.0e-10     121       2      12    2.05   0.208    9.75    4.92   0.497   0.497 6.5e-01    3.85    5.00  308.48    6.78 6.1e-01 
Error using handle.handle/get
Invalid or deleted object.

Error in RAPTOR_plot_GUI>gui_init/wbmf (line 218)
                haxpos = get(hax(iax),'position');
 
Error using drawnow
Error while evaluating figure WindowButtonMotionFcn

Turning on the heating very early slows the current penetration, but is not enough to create a transport barrier.

SOLUTION 3

clear simres out
% Back to default Ip trace
U(1,:) = rampfun(params.tgrid.tgrid,0,2e6,100,12e6); % input Ip trace
U(2,:) = rampfun(params.tgrid.tgrid,40,0,40+10,16e6); % early NBI

tstartgrid = [20:40:100];
for ii=1:numel(tstartgrid);
    tstart = tstartgrid(ii);
    U(4,:) = rampfun(params.tgrid.tgrid,tstart,0,tstart+5,20e6);
    simres{ii} = RAPTOR_predictive(x0,g0,v0,U,model,params);
    out{ii} = RAPTOR_out(simres{ii},model,params);
end
hf = RAPTOR_plot_GUI(out);
  istep  telaps newt     res   t[ s]  dt[ s]  Ip[MA] Icd[MA] Ibs[MA] Ioh[MA]      qe    qmin      q0   Vl[V] Te0[keV] ne0[e19]  Wi[MJ] We[MJ]  f_ss  
      1   0.046    4 1.8e-09       0     0.1       2       0   0.056    1.95    29.5    3.68    3.68 -8.3e+00    1.57    1.00   19.72    0.56 1.3e+02 
     11    0.55    5 1.7e-12       1       2     2.1       0  0.0225    2.08    28.1    2.53    2.53 2.7e-01    0.91    1.04   10.53    0.31 7.4e+00 
     21       1    5 1.0e-11      21       2     4.1  0.0241  0.0587    4.02    14.4    2.77    2.77 1.4e+00    1.04    1.84   22.05    0.84 5.1e+00 
     31     1.4    3 1.0e-10      41       2     6.1   0.665   0.563    4.88    9.67    2.01    2.47 6.3e-01    8.37    2.64   65.67    6.56 3.8e+00 
     41       2    3 3.6e-11      61       2     8.1    2.56    1.08    4.49    7.28    1.63    2.62 4.8e-01   14.21    3.44  111.59   13.56 3.0e+00 
     51     2.3    3 2.6e-11      81       2    10.1    2.41   0.768    6.94    5.84    1.36    2.74 5.8e-01    9.94    4.24  173.44   13.13 3.4e+00 
     61     2.7    3 3.2e-11     101       2      12    2.34     0.6    9.08    4.92    1.15    2.12 6.0e-01    7.92    5.00  251.09   13.73 3.3e+00 
     71     2.9    2 1.4e-09     121       2      12    2.35   0.525    9.14    4.92       1    1.36 3.5e-01    7.75    5.00  285.95   13.80 1.9e+00 
  istep  telaps newt     res   t[ s]  dt[ s]  Ip[MA] Icd[MA] Ibs[MA] Ioh[MA]      qe    qmin      q0   Vl[V] Te0[keV] ne0[e19]  Wi[MJ] We[MJ]  f_ss  
      1   0.032    4 1.8e-09       0     0.1       2       0   0.056    1.95    29.5    3.68    3.68 -8.3e+00    1.57    1.00   19.72    0.56 1.3e+02 
     11    0.31    5 1.7e-12       1       2     2.1       0  0.0225    2.08    28.1    2.53    2.53 2.7e-01    0.91    1.04   10.53    0.31 7.4e+00 
     21    0.63    2 8.7e-09      21       2     4.1       0  0.0303    4.07    14.4    2.67    2.67 1.7e+00    0.75    1.84   20.82    0.57 3.3e+00 
     31    0.97    4 2.3e-11      41       2     6.1   0.205  0.0607    5.84    9.67    1.45    1.45 1.7e+00    1.26    2.64   55.36    1.26 4.2e+00 
     41     1.6    4 3.5e-11      61       2     8.1    2.09   0.243    5.78    7.28    1.44    1.44 7.8e-01    3.48    3.44  109.24    4.52 3.5e+00 
     51       2    3 9.1e-11      81       2    10.1    2.39   0.605    7.12    5.84    1.33    1.33 6.0e-01    7.98    4.24  172.30   11.63 3.4e+00 
     61     2.3    3 9.4e-11     101       2      12    2.34   0.562    9.12    4.92    1.16    1.27 6.1e-01    7.50    5.00  251.09   13.35 3.3e+00 
     71     2.5    2 2.0e-09     121       2      12    2.35   0.513    9.15    4.92       1    1.08 3.5e-01    7.60    5.00  286.52   13.66 1.8e+00 
  istep  telaps newt     res   t[ s]  dt[ s]  Ip[MA] Icd[MA] Ibs[MA] Ioh[MA]      qe    qmin      q0   Vl[V] Te0[keV] ne0[e19]  Wi[MJ] We[MJ]  f_ss  
      1    0.03    4 1.8e-09       0     0.1       2       0   0.056    1.95    29.5    3.68    3.68 -8.3e+00    1.57    1.00   19.72    0.56 1.3e+02 
     11    0.31    5 1.7e-12       1       2     2.1       0  0.0225    2.08    28.1    2.53    2.53 2.7e-01    0.91    1.04   10.53    0.31 7.4e+00 
     21    0.58    2 8.7e-09      21       2     4.1       0  0.0303    4.07    14.4    2.67    2.67 1.7e+00    0.75    1.84   20.82    0.57 3.3e+00 
     31    0.77    4 2.3e-11      41       2     6.1   0.205  0.0607    5.84    9.67    1.45    1.45 1.7e+00    1.26    2.64   55.36    1.26 4.2e+00 
     41       1    3 5.0e-11      61       2     8.1    2.05   0.199    5.86    7.28    1.45    1.45 8.6e-01    3.01    3.44  109.07    3.83 3.5e+00 
     51     1.2    2 1.2e-10      81       2    10.1    2.05   0.206    7.85    5.84     1.1     1.1 9.9e-01    3.16    4.24  175.00    5.01 3.8e+00 
     61     1.4    4 4.8e-11     101       2      12    2.08   0.248    9.69    4.92   0.821   0.821 9.4e-01    3.71    5.00  257.51    7.11 3.5e+00 
     71     1.9    2 8.0e-09     121       2      12    2.35   0.473     9.2    4.92   0.727   0.727 3.4e-01    7.14    5.00  293.59   13.21 1.3e+00 

Adding off-axis ECCD at rho=0.4 gives (at least transiently) a reverse-shear q profile and thus triggers a transport barrier, as is visible from the locally very steep temperature gradient.