Tutorial showing some options for how to specify kinetic profiles

Kinetic profiles that are not solved for (i.e. are evolved as part of the state vector x, can be prescribed by other means. Either by scaling another profile, or by direct specification. This tutorial provides some examples

Contents

run(fullfile(pwd,'..','RAPTOR_path.m')); % add RAPTOR path
close all hidden; clear;
[config] = RAPTOR_config; % load default params
config.debug.iterdisp = 0; % nice and quiet

Basic default case

config.ti.method
config.ni.method
[model,params,init,g,v,U] = build_RAPTOR_model(config); % generate model structure for these params.

U(1,:) = 80e3*ones(size(params.tgrid)); % input Ip trace: constant 80kA
init.Ip0 = U(1); % initial condition for current
x0 = RAPTOR_initial_conditions(model,init,g(:,1),v(:,1)); % Define the initial condition
simres = RAPTOR_predictive(x0,g,v,U,model,params);
out = RAPTOR_out(simres,model,params);
ans =

tescal


ans =

direct

ti defined as independent state

config.ti.method = 'state';
config.ti.BCtype = 'Te';
config.ti.BCval = config.te.BCval;
[model,params,init,g,v,U] = build_RAPTOR_model(config); % generate model structure for these params.

U(1,:) = 80e3*ones(size(params.tgrid)); % input Ip trace: constant 80kA
init.Ip0 = U(1); % initial condition for current
x0 = RAPTOR_initial_conditions(model,init,g(:,1),v(:,1)); % Define the initial condition
simres = RAPTOR_predictive(x0,g,v,U,model,params);
out = RAPTOR_out(simres,model,params);

ti scaled with respect to te

config.ti.method = 'tescal';
[model,params,init,g,v,U] = build_RAPTOR_model(config);
disp(init)
init.ti0scal = 0.9;
init.tiescal = 1;
% Construct kinetic profiles according to the new settings.
v = build_kinetic_profiles(model,init);

U(1,:) = 80e3*ones(size(params.tgrid)); % input Ip trace: constant 80kA
init.Ip0 = U(1); % initial condition for current
x0 = RAPTOR_initial_conditions(model,init,g(:,1),v(:,1)); % Define the initial condition
v(model.ti.vind)

simres = RAPTOR_predictive(x0,g,v,U,model,params);
out = RAPTOR_out(simres,model,params);

plot(out.rho,[out.te(:,end),out.ti(:,end)]);
disp(out.ti(:,end)'./out.te(:,end)')
        te0: 200
    tewidth: 0.6000
    ti0scal: 1
    tiescal: 1
        ne0: 1.0000e+19
    newidth: 0.8000
        ni0: 1.0000e+19
    niwidth: 0.8000
     n1scal: 0
     n2scal: 0
     n3scal: 0
        ze0: 3.5000
        zee: 3.5000
       jpow: 4
        Ip0: 80000
      psib0: 0


ans =

    0.9000
    0.9022
    0.9067
    0.9133
    0.9200
    0.9267
    0.9333
    0.9400
    0.9467
    0.9533
    0.9600
    0.9667
    0.9733
    0.9800
    0.9867
    0.9933
    0.9978
    1.0000

  Columns 1 through 7

    0.9000    0.9067    0.9133    0.9200    0.9267    0.9333    0.9400

  Columns 8 through 14

    0.9467    0.9533    0.9600    0.9667    0.9733    0.9800    0.9867

  Columns 15 through 16

    0.9933    1.0000

ni scaled w.r.t. ne

config.ni.method = 'nescal';
[model,params,init,g,v,U] = build_RAPTOR_model(config);
disp(init)
init.ni0scal = 0.9;
init.niescal = 1;
% Construct kinetic profiles according to the new settings.
v = build_kinetic_profiles(model,init);

U(1,:) = 80e3*ones(size(params.tgrid)); % input Ip trace: constant 80kA
init.Ip0 = U(1); % initial condition for current
x0 = RAPTOR_initial_conditions(model,init,g(:,1),v(:,1)); % Define the initial condition
simres = RAPTOR_predictive(x0,g,v,U,model,params);
out = RAPTOR_out(simres,model,params);

plot(out.rho,[out.ne(:,end),out.ni(:,end)]);
disp(out.ni(:,end)'./out.ne(:,end)')
        te0: 200
    tewidth: 0.6000
    ti0scal: 1
    tiescal: 1
        ne0: 1.0000e+19
    newidth: 0.8000
    ni0scal: 1
    niescal: 1
     n1scal: 0
     n2scal: 0
     n3scal: 0
        ze0: 3.5000
        zee: 3.5000
       jpow: 4
        Ip0: 80000
      psib0: 0

  Columns 1 through 7

    0.9000    0.9067    0.9133    0.9200    0.9267    0.9333    0.9400

  Columns 8 through 14

    0.9467    0.9533    0.9600    0.9667    0.9733    0.9800    0.9867

  Columns 15 through 16

    0.9933    1.0000

kinetic profiles defined by hand

[config] = RAPTOR_config;
% Ti value will be defined below.
config.ti.method = 'direct';
% Generate model structure for these params.
[model,params,init,g,v,U] = build_RAPTOR_model(config);
% Check which profiles should be defined;
new_profiles = build_kinetic_profiles; % empty call
disp(new_profiles);
% Define new profiles and radial grid
np = 20;
new_profiles.rho = linspace(0,1,np)';
new_profiles.ne = 1.5e19*exp(-new_profiles.rho.^2/0.7^2);
new_profiles.ni = 1.0e19*exp(-new_profiles.rho.^2/0.7^2);
new_profiles.ti = 0.9e03*exp(-new_profiles.rho.^2/0.7^2);
new_profiles.ze = 1.85*ones(size(new_profiles.rho));
% Construct new plasma profiles
v = build_kinetic_profiles(model,config,new_profiles);
% input Ip trace: constant 80kA
U(1,:) = 80e3*ones(size(params.tgrid));
% initial condition for current
init.Ip0 = U(1,1);
% Define the initial condition
x0 = RAPTOR_initial_conditions(model,init,g(:,1),v(:,1));
% Run simulation
simres = RAPTOR_predictive(x0,g,v,U,model,params);
out = RAPTOR_out(simres,model,params);
     ne: []
     ni: []
     ti: []
     ze: []
     n1: []
    rho: []

     it  telaps newt     res   t[ms]  dt[ms]  Ip[kA] Icd[kA] Ibs[kA] Ioh[kA]      qe    qmin      q0   Vl[V] Te0[keV] Ti0[keV] ne0[e19]   f_ss  
      1   0.035    4 1.5e-13       0       1      80       0    4.16    75.8    15.3    5.76    5.82 2.2e+00    0.18    0.90    1.50 8.1e+00 
     11    0.22    2 5.2e-13      10       1      80       0    4.17    75.8    15.3    3.78    3.78 2.3e+00    0.19    0.90    1.50 2.0e+00 
     21     0.4    2 7.4e-15      20       1      80       0     4.2    75.8    15.3    3.23    3.23 2.2e+00    0.20    0.90    1.50 9.9e-01 
     31    0.58    2 1.0e-14      30       1      80       0    4.22    75.7    15.3       3       3 2.1e+00    0.21    0.90    1.50 5.2e-01 
     41    0.74    1 7.0e-09      40       1      80       0    4.23    75.7    15.3    2.89    2.89 2.1e+00    0.21    0.90    1.50 2.8e-01 
     51    0.86    1 2.0e-09      50       1      80       0    4.23    75.7    15.3    2.83    2.83 2.1e+00    0.21    0.90    1.50 1.5e-01