Script testing the stability and the fastness of the change of variable from cartesian to flux coordinates for a chosen cartesian couple and on average for a cartesian grid By Guillaume Brochard (CEA-DRFC, guillaume.brochard@cea.fr)
0001 %Script testing the stability and the fastness of the change of variable from cartesian to flux coordinates for a chosen cartesian couple and on average for a cartesian grid 0002 %By Guillaume Brochard (CEA-DRFC, guillaume.brochard@cea.fr) 0003 0004 nharm = 20;%Harmonic number for the spline/pchip interpolation 0005 x0=0.05;%Set the wanted x coordinate 0006 y0=0.01;%Set the wanted y coordinate 0007 x1=x0; 0008 y1=y0; 0009 load('EQUIL_JETliketest.mat');%Load discrete equilibrium 0010 equil_fit = fitequil_yp(equil,1,'spline',1001,nharm);%Fit vectorial equilibrium 0011 rayparam.dS = 1.e-4; 0012 equilparam.ap = 0.95; 0013 0014 N=1;%Set the wanted number of change of variable 0015 for i=0:N 0016 t=cputime;% 0017 [rho,theta] = xy2rhotheta_gb(equil_fit,rayparam,equilparam,x1,y1); 0018 e=cputime - t;%Elapsed time for the (x,y)->(rho,theta) operation 0019 [x1,y1] = rhotheta2xy_gb(equil_fit,rayparam,equilparam,rho,theta); 0020 end 0021 error = sqrt((x0-x1)*(x0-x1) + (y0-y1)*(y0-y1));%Precision of the change of variable 0022 disp('Execution time for the chosen cartesian couple'); 0023 disp(e); 0024 disp('Precision for the chosen cartesian couple'); 0025 disp(error); 0026 0027 %ngrid = 30;%Grid points number on a side of the square grid 0028 %length = 0.02;%Grid's length 0029 0030 %data = test_grid_substitution(equil_fit,rayparam,equilparam,ngrid,length);%Output matrix 0031 %disp('Mean precision for the chosen grid'); 0032 %disp(data(1)); 0033 %disp('Mean deviation for the chosen grid'); 0034 %disp(data(2)); 0035 %disp('Mean execution time for the chosen grid'); 0036 %disp(data(3));