make_equil_TORPEX

PURPOSE ^

SYNOPSIS ^

function [equil] = make_equil_TORPEX

DESCRIPTION ^

   This script generates the magnetic equilibrium-like data file of the TORPEX toric machine (CRPP, Switzerland)

   By Y. Peysson <yves.peysson@cea.fr> and J. Decker <joan.decker@epfl.ch>

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [equil] = make_equil_TORPEX
0002 %
0003 %   This script generates the magnetic equilibrium-like data file of the TORPEX toric machine (CRPP, Switzerland)
0004 %
0005 %   By Y. Peysson <yves.peysson@cea.fr> and J. Decker <joan.decker@epfl.ch>
0006 %
0007 clear all
0008 close all
0009 clc
0010 %
0011 id = 'TORPEX';
0012 %
0013 B_torpex_data_x = load('Sources/B_V_x.txt','-ascii');% Radial magnetic field, TORPEX B_X [T]
0014 B_torpex_data_y = load('Sources/B_Tbc_y.txt','-ascii');% Toroidal magnetic field, TORPEX B_Y [T]
0015 B_torpex_data_z = load('Sources/B_V_z.txt','-ascii');% Vertical magnetic field, TORPEX B_Z [T]
0016 %
0017 ne_torpex_data = load('Sources/ne.txt','-ascii');% electron density [m-3]
0018 %
0019 if sum(sum(B_torpex_data_x(1:2,:) - B_torpex_data_y(1:2,:)) + sum(B_torpex_data_x(1:2,:) - B_torpex_data_z(1:2,:)) + sum(B_torpex_data_y(1:2,:) - B_torpex_data_z(1:2,:))) ~= 0,%grid consistency
0020     error('ERROR: inconsistent raw TORPEX B data');
0021 end
0022 %
0023 if sum(sum(B_torpex_data_x(1:2,:) - ne_torpex_data(1:2,:))) ~= 0,%grid consistency
0024     error('ERROR: inconsistent raw TORPEX ne data');
0025 end
0026 %
0027 Rp = (B_torpex_data_x(1,end) + B_torpex_data_x(1,1))/2;%Major radius (m) at phi = 0
0028 Zp = (B_torpex_data_x(2,end) + B_torpex_data_x(2,1))/2;%Vertical position (m) at phi = 0
0029 %
0030 xyx = B_torpex_data_x(1,:) - Rp;
0031 xyy = B_torpex_data_x(2,:) - Zp;
0032 %
0033 xyBx = B_torpex_data_x(3:end,:);
0034 xyBy = B_torpex_data_z(3:end,:);
0035 xyBz = B_torpex_data_y(3:end,:);%toroidal direction
0036 %
0037 xyne = ne_torpex_data(3:end,:);
0038 xyTe = zeros(size(xyne));
0039 %
0040 zZi = [1,1,1,2];%Ion types: (1) H/D/T, (2) He, ..., (6) C [1,p] (WARNING: Zi must be [1,1,1,imp1,imp2] for hydrogen plasmas)
0041 zmi = [1,2,3,4];%Ion mass (uma) [1,p] (WARNING: Zi must be [1,2,3,mimp1,mimp2] for hydrogen plasmas)
0042 zfi = [1,0,0];%Hydrogen isotopic fraction (H/D/T) [1,3] (WARNING: only used when hydrogen plasmas are considered)
0043 zeff = 1;%Effective charge
0044 %
0045 xyzTi = repmat(zeros(size(xyne)),[length(zZi),1]);% Same temperature for all ion species
0046 xyzni = species_dke_yp(xyne,zeff,zZi,zfi);
0047 %
0048 equil.id = id;
0049 %
0050 equil.Rp = Rp;
0051 equil.Zp = Zp;
0052 %
0053 equil.xyx = xyx;
0054 equil.xyy = xyy;
0055 %
0056 equil.xyBx = xyBx;
0057 equil.xyBy = xyBy;
0058 equil.xyBz = xyBz;%check sign for the reference frame
0059 %
0060 equil.xyTe = xyTe;
0061 equil.xyne = xyne;
0062 %
0063 equil.zZi = zZi;
0064 equil.zmi = zmi;
0065 equil.zfi = zfi;
0066 %
0067 equil.xyzTi = xyzTi;
0068 equil.xyzni = xyzni;
0069 %
0070 % Display TORPEX configuration
0071 %
0072 [xyR,xyZ] = meshgrid(xyx + Rp,xyy + Zp);
0073 %
0074 figure('Name','Radial magnetic field'),graph2D_jd(xyR,xyZ,xyBx.','R[m]','Z[m]','Radial magnetic field Bx [Tesla]',[],[],1);axis('equal'),colorbar;
0075 figure('Name','Vertical magnetic field'),graph2D_jd(xyR,xyZ,xyBy.','R[m]','Z[m]','Vertical magnetic field By [Tesla]',[],[],1);axis('equal'),colorbar;
0076 figure('Name','Toroidal magnetic field'),graph2D_jd(xyR,xyZ,xyBz.','R[m]','Z[m]','Toroidal magnetic field Bz [Tesla]',[],[],1);axis('equal'),colorbar;
0077 figure('Name','Electron density'),graph2D_jd(xyR,xyZ,xyne.','R[m]','Z[m]','Interpolated electron density n_e[m^{-3}]',[],[],1);axis('equal'),colorbar;
0078 %
0079 filename = ['EQUIL_',equil.id,'.mat'];
0080 %
0081 eval(['save ',filename,' equil']);
0082 %
0083 [equil_fit] = fitequil_yp(equil,2,'spline');
0084 %
0085 [equil_val] = equilval_yp(equil_fit,[-0.015,0.12,0.027;0.18,-0.02,0.0],[0.017,0.19,-0.03;-0.15,0.1,0.03]);
0086 
0087

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.