Contents

Simple RAPTOR speed benchmark in various cases

close all hidden;
clear

run(fullfile(pwd,'..','RAPTOR_path.m')); % add RAPTOR path
[config] = RAPTOR_config; % load default params
config.echcd = echcd('echcd_gaussian');

% Now we can change the default module parameters for ECRH/CD
config.echcd.params.active = true; % activate the module, otherwise it does nothing.
config.echcd.params.rdep = [0 0.4]; % two actuators, set rdep=0 for first, rdep=0.4 for second
config.echcd.params.wdep = [0.35, 0.35];  % wdep =0.35 for each
config.echcd.params.cd_eff = [0 1];  % current drive efficiency factor: pure ECH for first, co-ECCD for second
config.echcd.params.uindices = [2 3]; % index of power for each actuator in input vector

config.grid.tgrid = [0:0.002:1]; % time grid
nt = numel(config.grid.tgrid);

% generate the following structures for these params: model, params, init, geometry g, kinetic profiles v
[model,params,init,g,v,U] = build_RAPTOR_model(config);

Define inputs We must now define more inputs than the plasma current alone

% plasma current
U(1,:) = 120e3;
U(1,params.tgrid<0.02) = linspace(80e3,120e3,sum(params.tgrid<0.02));

% first EC actautor: on-axis heating 1MW starting at 60ms
U(2,:) = zeros(size(params.tgrid)); U(2,params.tgrid>0.06) = 1e6;

init.Ip0 = U(1,1);
% Define the initial condition
x0 = RAPTOR_initial_conditions(model,init,g(:,1),v(:,1));

params.debug.iterdisp = 0;

Run the first case with explicit evaluation of neoclassics, chie.

params.neos.implicit = false;
params.chi_e.implicit = false;
params.debug.iterdisp = 100;
tic
simres = RAPTOR_predictive(x0,g,v,U,model,params);
toc
out{1} = RAPTOR_out(simres,model,params);
     it  telaps newt     res   t[ s]  dt[ s]  Ip[kA] Icd[kA] Ibs[kA] Ioh[kA]      qe    qmin      q0   Vl[V] Te0[keV] Ti0[keV] ne0[e19]   f_ss  
      1   0.046    2 8.1e-16       0   0.002      80       0    1.41    78.6    15.3    4.63    4.63 4.7e+00    0.27    0.27    1.00 1.4e+01 
    101     1.4    1 4.3e-10     0.2   0.002     120       0    40.5    79.5    10.2    1.01    1.01 1.3e-01    8.22    8.22    1.00 4.4e-01 
    201     2.6    1 2.3e-11     0.4   0.002     120       0    38.1    81.8    10.2    0.73    0.73 1.0e-01    8.33    8.33    1.00 1.7e-01 
    301     3.8    1 2.9e-12     0.6   0.002     120       0    37.5    82.5    10.2   0.636   0.636 9.5e-02    8.37    8.37    1.00 6.1e-02 
    401       5    1 3.8e-13     0.8   0.002     120       0    37.3    82.7    10.2   0.607   0.607 9.2e-02    8.39    8.39    1.00 2.2e-02 
    501     6.2    1 6.9e-14       1   0.002     120       0    37.2    82.7    10.2   0.597   0.597 9.1e-02    8.40    8.40    1.00 8.2e-03 
Elapsed time is 6.171168 seconds.

Run the second case with implicit evaluation of neoclassics, chie (slower).

params.neos.implicit = true;
params.chi_e.implicit = true;
tic
simres2 = RAPTOR_predictive(x0,g,v,U,model,params);
toc
out{2} = RAPTOR_out(simres2,model,params);
     it  telaps newt     res   t[ s]  dt[ s]  Ip[kA] Icd[kA] Ibs[kA] Ioh[kA]      qe    qmin      q0   Vl[V] Te0[keV] Ti0[keV] ne0[e19]   f_ss  
      1   0.057    4 9.0e-10       0   0.002      80       0    1.41    78.6    15.3    5.07    5.07 3.4e+00    0.22    0.22    1.00 9.1e+00 
    101     2.1    2 2.2e-14     0.2   0.002     120       0    40.3    79.6    10.2   0.999   0.999 1.3e-01    8.22    8.22    1.00 4.3e-01 
    201     3.6    1 3.9e-10     0.4   0.002     120       0    38.1    81.8    10.2   0.726   0.726 1.0e-01    8.33    8.33    1.00 1.6e-01 
    301     4.9    1 5.7e-11     0.6   0.002     120       0    37.5    82.5    10.2   0.635   0.635 9.5e-02    8.37    8.37    1.00 5.9e-02 
    401     6.3    1 8.5e-12     0.8   0.002     120       0    37.3    82.7    10.2   0.607   0.607 9.2e-02    8.39    8.39    1.00 2.2e-02 
    501     7.7    1 1.2e-12       1   0.002     120       0    37.2    82.7    10.2   0.597   0.597 9.1e-02    8.40    8.40    1.00 8.0e-03 
Elapsed time is 7.713110 seconds.

Compare results

RAPTOR_plot_GUI(out)
ans = 

  Figure (1: RAPTOR output) with properties:

      Number: 1
        Name: 'RAPTOR output'
       Color: [0.9400 0.9400 0.9400]
    Position: [0.0490 0.1983 0.9010 0.7058]
       Units: 'normalized'

  Use GET to show all properties