Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gdat
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
Model registry
Operate
Environments
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
SPC
gdat
Commits
9b232d6a
Commit
9b232d6a
authored
5 years ago
by
Olivier Sauter
Browse files
Options
Downloads
Plain Diff
Merge branch 'IMAS_codecamp_develop' of gitlab.epfl.ch:spc/tcv/tbx/gdat into IMAS_codecamp_develop
parents
0e441a28
807aa0aa
No related branches found
No related tags found
1 merge request
!16
Imas codecamp develop
Pipeline
#17912
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/TCV_IMAS/tcv_get_ids_nbi.m
+170
-5
170 additions, 5 deletions
matlab/TCV_IMAS/tcv_get_ids_nbi.m
with
170 additions
and
5 deletions
matlab/TCV_IMAS/tcv_get_ids_nbi.m
+
170
−
5
View file @
9b232d6a
...
...
@@ -7,29 +7,194 @@ function [ids_nbi,ids_nbi_description,varargout] = tcv_get_ids_nbi(shot,ids_nbi_
%
[
ids_nbi
,
params_nbi
]
=
tcv_ids_headpart
(
shot
,
ids_nbi_empty
,
'nbi'
,
'homogeneous_time'
,
0
,
varargin
{:});
ids_nbi_description
=
''
;
% As a general rule, for a new substructure under the main ids, construct a local structure like:
% "global_quantities" with subfields being the relevant data to get and a local structure:
% "global_quantities_desc" which contains the same subfields themselves containing the gdat string aftre shot used
%
pow
=
gdat_tcv
(
shot
,
'powers'
);
nb_units
=
2
;
% assume 2 units: 1st NBH and DNBI
ids_nbi
.
unit
(
1
:
nb_units
)
=
ids_nbi
.
unit
(
1
);
% copy empty structure for all units, then fill in
for
iunit
=
1
:
length
(
nb_units
)
for
iunit
=
1
:
nb_units
switch
iunit
case
1
ids_nbi
.
unit
{
iunit
}
.
identifier
=
'NBH1'
;
ids_nbi
.
unit
{
iunit
}
.
name
=
'25keV 1st NBH source'
;
%% power
pow
=
gdat_tcv
(
shot
,
'powers'
);
ids_nbi
.
unit
{
iunit
}
.
power_launched
.
time
=
pow
.
nbi
.
t
;
ids_nbi
.
unit
{
iunit
}
.
power_launched
.
data
=
pow
.
nbi
.
data
;
%% energy
ids_nbi
.
unit
{
iunit
}
.
energy
.
time
=
pow
.
nbi
.
t
;
ids_nbi
.
unit
{
iunit
}
.
energy
.
data
=
pow
.
nbi
.
energy
;
%% power & current fractions
p_frac
=
gdat
(
shot
,
'\results::nbh:fraction'
);
ids_nbi
.
unit
{
iunit
}
.
beam_power_fraction
.
data
=
p_frac
.
data
(:,
1
:
3
)
*
0.01
;
ids_nbi
.
unit
{
iunit
}
.
beam_power_fraction
.
time
=
p_frac
.
t
;
i_frac
=
p_frac
.
data
(:,
1
:
3
)
.*
[
1
2
3
];
i_frac
=
i_frac
.*
1.
/
sum
(
i_frac
);
ids_nbi
.
unit
{
iunit
}
.
beam_current_fraction
.
data
=
i_frac
;
ids_nbi
.
unit
{
iunit
}
.
beam_current_fraction
.
time
=
p_frac
.
t
;
%% species
ids_nbi
.
unit
{
iunit
}
.
species
.
a
=
2.
;
ids_nbi
.
unit
{
iunit
}
.
species
.
z_n
=
1.
;
ids_nbi
.
unit
{
iunit
}
.
species
.
label
=
[
'D'
];
%% beamlets group, now only one single beamlet
% https://spcwiki.epfl.ch/wiki/NB_Model
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
direction
=
-
1
;
%clockwise
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
tangency_radius
=
736
*
1e-3
;
%736mm
% ids_nbi.unit{iunit}.beamlets_group{1}.tangency_radius_error_index: -999999999
% ids_nbi.unit{iunit}.beamlets_group{1}.tangency_radius_error_lower: -9.0000e+40
% ids_nbi.unit{iunit}.beamlets_group{1}.tangency_radius_error_upper: -9.0000e+40
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
angle
=
0.
;
%injection parallel to midplane
% ids_nbi.unit{iunit}.beamlets_group{1}.angle_error_index: -999999999
% ids_nbi.unit{iunit}.beamlets_group{1}.angle_error_lower: -9.0000e+40
% ids_nbi.unit{iunit}.beamlets_group{1}.angle_error_upper: -9.0000e+40
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
width_horizontal
=
250
*
1e-3
;
% ids_nbi.unit{iunit}.beamlets_group{1}.width_horizontal_error_index: -999999999
% ids_nbi.unit{iunit}.beamlets_group{1}.width_horizontal_error_lower: -9.0000e+40
% ids_nbi.unit{iunit}.beamlets_group{1}.width_horizontal_error_upper: -9.0000e+40
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
width_vertical
=
250
*
1e-3
;
% ids_nbi.unit{iunit}.beamlets_group{1}.width_vertical_error_index: -999999999
% ids_nbi.unit{iunit}.beamlets_group{1}.width_vertical_error_lower: -9.0000e+40
% ids_nbi.unit{iunit}.beamlets_group{1}.width_vertical_error_upper: -9.0000e+40
%% focus struct
focus
=
struct
();
focus
.
focal_length_horizontal
=
3.76
;
% focus.focal_length_horizontal_error_index = -999999999;
% focus.focal_length_horizontal_error_lower = -9.0000e+40;
% focus.focal_length_horizontal_error_upper = -9.0000e+40;
focus
.
focal_length_vertical
=
3.98
;
% focus.focal_length_vertical_error_index: -999999999;
% focus.focal_length_vertical_error_lower: -9.0000e+40;
% focus.focal_length_vertical_error_upper: -9.0000e+40;
focus
.
width_min_horizontal
=
21.6
*
1e-2
;
% focus.width_min_horizontal_error_index: -999999999;
% focus.width_min_horizontal_error_lower: -9.0000e+40;
% focus.width_min_horizontal_error_upper: -9.0000e+40;
focus
.
width_min_vertical
=
9.4
*
1e-2
;
% focus.width_min_vertical_error_index: -999999999;
% focus.width_min_vertical_error_lower: -9.0000e+40;
% focus.width_min_vertical_error_upper: -9.0000e+40;
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
focus
=
focus
;
%% divergence component struct
div
=
struct
();
div
.
particle_fraction
=
1.
;
div
.
vertical
=
10.3
*
1e-3
;
%rad, in deg it is 0.59
div
.
horizontal
=
24.4
*
1e-3
;
%rad, in deg it is 1.4
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
divergence_component
{
1
}
=
div
;
%% tilting
% it is fixed in time. what should we do about it?
%% position
%dcd_NBH = psitbxdcd(4.5889, 0.0, 211.9535*pi/180, 0.0, -9.2308*pi/180);
pos
=
struct
();
pos
.
phi
=
211.9535
*
pi
/
180.
;
% pos.phi_error_index= -999999999;
% pos.phi_error_lower= -9.0000e+40;
% pos.phi_error_upper= -9.0000e+40;
pos
.
r
=
4.5889
;
% pos.r_error_index= -999999999;
% pos.r_error_lower= -9.0000e+40;
% pos.r_error_upper= -9.0000e+40;
pos
.
z
=
0.
;
% pos.z_error_index= -999999999;
% pos.z_error_lower= -9.0000e+40;
% pos.z_error_upper= -9.0000e+40;
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
position
=
pos
;
%% beamlets
% M. Vallar thinks it is useless now
case
2
ids_nbi
.
unit
{
iunit
}
.
identifier
=
'DNBI'
;
ids_nbi
.
unit
{
iunit
}
.
name
=
'diagnostic NBI'
;
% ids_nbi.unit{iunit}.power_launched.data = pow.nbi.data; % DNBI power time values and time
% ids_nbi.unit{iunit}.power_launched.time = ;
%% power
pow
=
gdat_tcv
(
shot
,
'\RESULTS::DNBI:POWR_TCV'
);
ids_nbi
.
unit
{
iunit
}
.
power_launched
.
time
=
pow
.
t
;
ids_nbi
.
unit
{
iunit
}
.
power_launched
.
data
=
pow
.
data
*
1e6
;
%% energy
en
=
gdat
(
shot
,
'\RESULTS::DNBI:ENERGY'
);
ids_nbi
.
unit
{
iunit
}
.
energy
.
data
=
en
.
data
*
1e3
;
ids_nbi
.
unit
{
iunit
}
.
energy
.
time
=
en
.
t
;
%% power & current fractions
p_frac
=
gdat
(
shot
,
'\results::dnbi:fraction'
);
ids_nbi
.
unit
{
iunit
}
.
beam_power_fraction
.
data
=
p_frac
.
data
(:,
1
:
3
)
*
0.01
;
ids_nbi
.
unit
{
iunit
}
.
beam_power_fraction
.
time
=
p_frac
.
t
;
i_frac
=
p_frac
.
data
(:,
1
:
3
)
.*
[
1
2
3
];
i_frac
=
i_frac
.*
1.
/
sum
(
i_frac
);
ids_nbi
.
unit
{
iunit
}
.
beam_current_fraction
.
data
=
i_frac
(:,:);
ids_nbi
.
unit
{
iunit
}
.
beam_current_fraction
.
time
=
p_frac
.
t
;
%% species
ids_nbi
.
unit
{
iunit
}
.
species
.
a
=
1.
;
ids_nbi
.
unit
{
iunit
}
.
species
.
z_n
=
1.
;
ids_nbi
.
unit
{
iunit
}
.
species
.
label
=
[
'H'
];
%% beamlets group, now only one single beamlet
% https://spcwiki.epfl.ch/wiki/NB_Model
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
direction
=
1
;
%ctr-clockwise
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
tangency_radius
=
235.3
*
1e-3
;
%736mm
% ids_nbi.unit{iunit}.beamlets_group{1}.tangency_radius_error_index: -999999999
% ids_nbi.unit{iunit}.beamlets_group{1}.tangency_radius_error_lower: -9.0000e+40
% ids_nbi.unit{iunit}.beamlets_group{1}.tangency_radius_error_upper: -9.0000e+40
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
angle
=
0.
;
%injection parallel to midplane
% ids_nbi.unit{iunit}.beamlets_group{1}.angle_error_index: -999999999
% ids_nbi.unit{iunit}.beamlets_group{1}.angle_error_lower: -9.0000e+40
% ids_nbi.unit{iunit}.beamlets_group{1}.angle_error_upper: -9.0000e+40
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
width_horizontal
=
87.2
*
1e-3
;
% ids_nbi.unit{iunit}.beamlets_group{1}.width_horizontal_error_index: -999999999
% ids_nbi.unit{iunit}.beamlets_group{1}.width_horizontal_error_lower: -9.0000e+40
% ids_nbi.unit{iunit}.beamlets_group{1}.width_horizontal_error_upper: -9.0000e+40
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
width_vertical
=
87.2
*
1e-3
;
% ids_nbi.unit{iunit}.beamlets_group{1}.width_vertical_error_index: -999999999
% ids_nbi.unit{iunit}.beamlets_group{1}.width_vertical_error_lower: -9.0000e+40
% ids_nbi.unit{iunit}.beamlets_group{1}.width_vertical_error_upper: -9.0000e+40
%% focus struct
focus
=
struct
();
focus
.
focal_length_horizontal
=
1.8
;
% focus.focal_length_horizontal_error_index = -999999999;
% focus.focal_length_horizontal_error_lower = -9.0000e+40;
% focus.focal_length_horizontal_error_upper = -9.0000e+40;
focus
.
focal_length_vertical
=
1.8
;
% focus.focal_length_vertical_error_index: -999999999;
% focus.focal_length_vertical_error_lower: -9.0000e+40;
% focus.focal_length_vertical_error_upper: -9.0000e+40;
focus
.
width_min_horizontal
=
12.1
*
1e-2
;
% focus.width_min_horizontal_error_index: -999999999;
% focus.width_min_horizontal_error_lower: -9.0000e+40;
% focus.width_min_horizontal_error_upper: -9.0000e+40;
focus
.
width_min_vertical
=
12.1
*
1e-2
;
% focus.width_min_vertical_error_index: -999999999;
% focus.width_min_vertical_error_lower: -9.0000e+40;
% focus.width_min_vertical_error_upper: -9.0000e+40;
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
focus
=
focus
;
%% divergence component struct
div
=
struct
();
div
.
particle_fraction
=
1.
;
div
.
vertical
=
9.2
*
1e-3
;
%rad, in deg it is 0.53
div
.
horizontal
=
9.2
*
1e-3
;
%rad, in deg it is 0.53
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
divergence_component
{
1
}
=
div
;
%% tilting
% it is fixed in time. what should we do about it?
%% position
%dcd_NBH = psitbxdcd(4.5889, 0.0, 211.9535*pi/180, 0.0, -9.2308*pi/180);
pos
=
struct
();
pos
.
phi
=
295.2416
*
pi
/
180.
;
% pos.phi_error_index= -999999999;
% pos.phi_error_lower= -9.0000e+40;
% pos.phi_error_upper= -9.0000e+40;
pos
.
r
=
4.9274
;
% pos.r_error_index= -999999999;
% pos.r_error_lower= -9.0000e+40;
% pos.r_error_upper= -9.0000e+40;
pos
.
z
=
0.
;
% pos.z_error_index= -999999999;
% pos.z_error_lower= -9.0000e+40;
% pos.z_error_upper= -9.0000e+40;
ids_nbi
.
unit
{
iunit
}
.
beamlets_group
{
1
}
.
position
=
pos
;
%% beamlets
% M. Vallar thinks it is useless now
otherwise
warning
([
'iunit = '
num2str
(
iunit
)
' not yet defined'
]);
end
...
...
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