Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gyacomo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Cyril David Hoffmann
Gyacomo
Commits
16e835a9
Commit
16e835a9
authored
1 year ago
by
Antoine Cyril David Hoffmann
Browse files
Options
Downloads
Patches
Plain Diff
script to load and analyze fast large scans
parent
beb91082
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wk/p3_geom_scan_analysis.m
+117
-0
117 additions, 0 deletions
wk/p3_geom_scan_analysis.m
with
117 additions
and
0 deletions
wk/p3_geom_scan_analysis.m
0 → 100644
+
117
−
0
View file @
16e835a9
% Get the current directory (wk)
curdir
=
pwd
;
% Get the scan directory
if
0
% delta kappa scan
scandir
=
'/misc/gyacomo23_outputs/paper_3/DTT_rho85_geom_scan/P2_J1_delta_kappa_scan/'
;
% scandir = '/misc/gyacomo23_outputs/paper_3/DTT_rho85_geom_scan/P4_J2/';
% scandir = '/misc/gyacomo23_outputs/paper_3/DTT_rho85_geom_scan/P4_J2_delta_kappa_scan/';
pnam1
=
'$\delta$'
;
attr1
=
'delta'
;
pref1
=
0.23
;
pnam2
=
'$\kappa$'
;
attr2
=
'kappa'
;
pref2
=
1.53
;
else
% shear safety factor scan
scandir
=
'/misc/gyacomo23_outputs/paper_3/DTT_rho85_geom_scan/P2_J1_PT_sfact_shear_scan/'
;
% scandir = '/misc/gyacomo23_outputs/paper_3/DTT_rho85_geom_scan/P2_J1_NT_sfact_shear_scan/';
pnam1
=
'$\hat s$'
;
attr1
=
'shear'
;
pref1
=
3.63
;
pnam2
=
'$q_0$'
;
attr2
=
'q0'
;
pref2
=-
2.15
;
end
% Get a list of all items in the current directory
contents
=
dir
(
scandir
);
% give ref value and param names
REFVAL
=
0
;
% Iterate through the contents
Qxavg
=
[];
Qxerr
=
[];
para1
=
[];
para2
=
[];
for
i
=
1
:
length
(
contents
)
% Check if the item is a directory and not '.' or '..'
if
contents
(
i
)
.
isdir
&&
~
strcmp
(
contents
(
i
)
.
name
,
'.'
)
&&
~
strcmp
(
contents
(
i
)
.
name
,
'..'
)
% Get and display the name of the subdirectory
sdubdir
=
[
scandir
,
contents
(
i
)
.
name
];
disp
([
'Subdirectory: '
contents
(
i
)
.
name
]);
% Get parameters
param
=
read_namelist
([
sdubdir
,
'/fort_00.90'
]);
para1
=
[
para1
param
.
GEOMETRY
.
(
attr1
)];
para2
=
[
para2
param
.
GEOMETRY
.
(
attr2
)];
% Now you are in the subdirectory. You can perform operations here.
[
t_all
,
Pxi_all
,
Qxi_all
,
Pxe_all
,
Qxe_all
]
=
read_flux_out_XX
(
sdubdir
);
if
(
t_all
(
end
)
>
40
)
[
fullAvg
,
sliceAvg
,
sliceErr
]
=
sliceAverage
(
Qxi_all
+
Qxe_all
,
3
);
Qxavg
=
[
Qxavg
fullAvg
];
Qxerr
=
[
Qxerr
mean
(
sliceErr
)];
else
Qxavg
=
[
Qxavg
nan
];
Qxerr
=
[
Qxerr
nan
];
end
end
end
%% reshaping, sorting and plotting
p1
=
unique
(
para1
);
p2
=
unique
(
para2
);
N1
=
numel
(
p1
);
N2
=
numel
(
p2
);
if
para1
(
1
)
==
para1
(
2
)
sz
=
[
N2
N1
];
TRANSPOSE
=
1
;
else
sz
=
[
N1
N2
];
TRANSPOSE
=
0
;
end
Zavg
=
reshape
(
Qxavg
,
sz
);
Zerr
=
reshape
(
Qxerr
,
sz
);
XX
=
reshape
(
para1
,
sz
);
YY
=
reshape
(
para2
,
sz
);
if
TRANSPOSE
Zavg
=
Zavg
'
;
Zerr
=
Zerr
'
;
XX
=
XX
'
;
YY
=
YY
'
;
end
[
~
,
idx1
]
=
sort
(
XX
(:,
1
));
[
~
,
idx2
]
=
sort
(
YY
(
1
,:));
Zavg
=
Zavg
(
idx1
,
idx2
);
Zerr
=
Zerr
(
idx1
,
idx2
);
XX
=
XX
(
idx1
,
idx2
);
YY
=
YY
(
idx1
,
idx2
);
% compute the
if
REFVAL
[
~
,
iref1
]
=
min
(
abs
(
XX
(:,
1
)
-
pref1
));
[
~
,
iref2
]
=
min
(
abs
(
YY
(
1
,:)
-
pref2
));
xref
=
XX
(
iref1
,
iref2
);
yref
=
YY
(
iref1
,
iref2
);
Qxref
=
Zavg
(
iref1
,
iref2
);
Zavg
=
(
Zavg
-
Qxref
)/
Qxref
*
100
;
Qxname
=
'$\langle (Q_{tot}-Q_{ref})/Q_{ref} \rangle_t[\%]$'
;
Qrefname
=
[
'$Q_{ref}=$'
,
num2str
(
Qxref
)];
else
Qxname
=
'$\langle Q_{tot} \rangle_t$'
;
end
% Figure
figure
subplot
(
1
,
2
,
1
)
% contourf(XX(:,1),YY(1,:),Zavg',13); hold on
[
xx_
,
yy_
]
=
meshgrid
(
XX
(:,
1
),
YY
(
1
,:));
imagesc_custom
(
xx_
,
yy_
,
Zavg
'
);
hold
on
if
REFVAL
plot
(
xref
,
yref
,
'xk'
,
'MarkerSize'
,
14
,
'DisplayName'
,
Qrefname
)
end
xlabel
(
pnam1
);
ylabel
(
pnam2
);
title
(
Qxname
)
colormap
(
bluewhitered
);
colorbar
;
subplot
(
1
,
2
,
2
)
for
i
=
1
:
N2
errorbar
(
XX
(:,
i
),
Zavg
(:,
i
),
Zerr
(:,
i
),
...
'DisplayName'
,[
pnam2
,
'='
,
num2str
(
para2
(
1
,
i
))]);
hold
on
;
end
if
REFVAL
plot
(
xref
,
0
,
'xk'
,
'MarkerSize'
,
14
,
'DisplayName'
,
Qrefname
)
end
grid
on
xlabel
(
pnam1
);
ylabel
(
Qxname
);
legend
(
'show'
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment