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
6f748597
Commit
6f748597
authored
7 months ago
by
Antonia Frank
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup spacing and recheck of comments
parent
87bccfb3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!137
Add quantities to ids for MRE
Pipeline
#203588
failed
7 months ago
Stage: test
Stage: post-test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/TCV_IMAS/tcv_get_ids_core_sources.m
+14
-20
14 additions, 20 deletions
matlab/TCV_IMAS/tcv_get_ids_core_sources.m
with
14 additions
and
20 deletions
matlab/TCV_IMAS/tcv_get_ids_core_sources.m
+
14
−
20
View file @
6f748597
...
@@ -103,10 +103,6 @@ params_eff = params_eff_ref; params_eff.data_request='bs_data';
...
@@ -103,10 +103,6 @@ params_eff = params_eff_ref; params_eff.data_request='bs_data';
bs_gdat
=
gdat
(
params_core_sources
.
shot
,
params_eff
);
bs_data
=
bs_gdat
.
bs
.
bs_data
;
bs_gdat
=
gdat
(
params_core_sources
.
shot
,
params_eff
);
bs_data
=
bs_gdat
.
bs
.
bs_data
;
bs_t_grid
=
bs_gdat
.
bs
.
t
;
bs_n_t
=
numel
(
bs_t_grid
);
bs_t_grid
=
bs_gdat
.
bs
.
t
;
bs_n_t
=
numel
(
bs_t_grid
);
if
any
(
bs_t_grid
-
ohm_t_grid
'
)
>
0
warning
(
'Bootstrap and ohmic time grids are not the same! Interpolation needed.'
)
end
main_desc
=
'Bootstrap current'
;
production
=
'IBS nodes'
;
main_desc
=
'Bootstrap current'
;
production
=
'IBS nodes'
;
id_bs
.
description
=
sprintf
(
'%s from %s'
,
main_desc
,
production
);
id_bs
.
description
=
sprintf
(
'%s from %s'
,
main_desc
,
production
);
id_bs
.
index
=
13
;
id_bs
.
name
=
'bootstrap_current'
;
id_bs
.
index
=
13
;
id_bs
.
name
=
'bootstrap_current'
;
...
@@ -138,7 +134,7 @@ ids_core_sources.source{last_index+1}.global_quantities.current_parallel = curre
...
@@ -138,7 +134,7 @@ ids_core_sources.source{last_index+1}.global_quantities.current_parallel = curre
last_index
=
last_index
+
1
;
% add if statement to only increment if bs source has been added
last_index
=
last_index
+
1
;
% add if statement to only increment if bs source has been added
%% ec
%% ec
params_eff
=
params_eff_ref
;
params_eff
=
params_eff_ref
;
params_eff
.
data_request
=
'ec_data'
;
params_eff
.
data_request
=
'ec_data'
;
params_eff
.
ec_inputs
=
1
;
% load EC input information
params_eff
.
ec_inputs
=
1
;
% load EC input information
ec_gdat
=
gdat
(
params_core_sources
.
shot
,
params_eff
);
ec_gdat
=
gdat
(
params_core_sources
.
shot
,
params_eff
);
...
@@ -153,17 +149,17 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
...
@@ -153,17 +149,17 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
nb_launchers
=
numel
(
ec_inputs
.
launchers_active
.
data
);
nb_launchers
=
numel
(
ec_inputs
.
launchers_active
.
data
);
active_launchers
=
find
(
ec_inputs
.
launchers_active
.
data
==
1
)
'
;
active_launchers
=
find
(
ec_inputs
.
launchers_active
.
data
==
1
)
'
;
% find times of injected
ec
power
s, for setting up source and
% find times of injected
EC
power
to interpolate power & current densities
%
interpolating the power & current densities on p_inj time
grid
%
on p_ec_injected t
grid
ec_powers_tgrid
=
powers_gdat
.
ec
.
t
;
%nt_ec_powers = numel(ec_powers_tgrid);
ec_powers_tgrid
=
powers_gdat
.
ec
.
t
;
%nt_ec_powers = numel(ec_powers_tgrid);
itime_ec
=
powers_gdat
.
ec
.
data
(:,
end
)
>
0
;
itime_ec
=
powers_gdat
.
ec
.
data
(:,
end
)
>
0
;
interp_tgrid
=
ec_powers_tgrid
(
itime_ec
);
nt_interp
=
numel
(
interp_tgrid
);
interp_tgrid
=
ec_powers_tgrid
(
itime_ec
);
nt_interp
=
numel
(
interp_tgrid
);
interp_p_ec_injected
=
powers_gdat
.
ec
.
data
(
itime_ec
,
end
);
interp_p_ec_injected
=
powers_gdat
.
ec
.
data
(
itime_ec
,
end
);
% Setup struct
ure
s for active launchers from template
% Setup
source
structs for active launchers from template
main_desc
=
'Source from electron cyclotron heating and current drive'
;
main_desc
=
'Source from electron cyclotron heating and current drive'
;
production
=
'TORAY'
;
production
=
'TORAY'
;
id_ec
.
index
=
3
;
id_ec
.
name
=
'ec'
;
id_ec
.
index
=
3
;
id_ec
.
name
=
'ec'
;
for
i_lau
=
active_launchers
for
i_lau
=
active_launchers
id_ec
.
description
=
sprintf
(
'L%i/G%i, %s from %s double width CD profiles'
,
i_lau
,
ec_inputs
.
gyro2launcher
.
data
(
i_lau
),
main_desc
,
production
);
id_ec
.
description
=
sprintf
(
'L%i/G%i, %s from %s double width CD profiles'
,
i_lau
,
ec_inputs
.
gyro2launcher
.
data
(
i_lau
),
main_desc
,
production
);
ids_core_sources
.
source
{
last_index
+
i_lau
}
=
source_template
;
ids_core_sources
.
source
{
last_index
+
i_lau
}
=
source_template
;
...
@@ -197,27 +193,26 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
...
@@ -197,27 +193,26 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
interp1
(
rho_pol_norm_liu
,
vol
(:,
ii
),
ec_data
.
cd_dens
.
grids
.
rho_pol_norm
(:,
ii
));
interp1
(
rho_pol_norm_liu
,
vol
(:,
ii
),
ec_data
.
cd_dens
.
grids
.
rho_pol_norm
(:,
ii
));
end
end
%
interpoating p_dens
profiles from
'
ec_
tgrid' grid (toray tgrid) to 'ec_powers_tgrid' (powers tgrid)
%
load 1d_
profiles from ec_
data
p_dens
=
ec_data
.
p_dens
.
data
;
p_dens
=
ec_data
.
p_dens
.
data
;
p_integrated
=
ec_data
.
p_integrated
.
data
;
p_integrated
=
ec_data
.
p_integrated
.
data
;
cd_dens
=
ec_data
.
cd_dens_doublewidth
.
data
;
% use double width to have realistic deposition broadening
cd_dens
=
ec_data
.
cd_dens_doublewidth
.
data
;
% use double width to have realistic deposition broadening
cd_integrated
=
ec_data
.
cd_integrated
.
data
;
cd_integrated
=
ec_data
.
cd_integrated
.
data
;
%
for
i_lau
=
active_launchers
for
i_lau
=
active_launchers
% convert to j// with conversion factor
% convert to j// with conversion factor
cd_dens
(:,
i_lau
,:)
=
squeeze
(
cd_dens
(:,
i_lau
,:))
.*
jtoray_to_jpar0_mapped
;
cd_dens
(:,
i_lau
,:)
=
squeeze
(
cd_dens
(:,
i_lau
,:))
.*
jtoray_to_jpar0_mapped
;
for
ii
=
1
:
nt_ec_data
for
ii
=
1
:
nt_ec_data
% integrate j//
% integrate j//
cd_integrated
(:,
i_lau
,
ii
)
=
cumtrapz
(
vol_mapped
(:,
ii
),
cd_dens
(:,
i_lau
,
ii
))/(
2
*
pi
*
R0
);
cd_integrated
(:,
i_lau
,
ii
)
=
cumtrapz
(
vol_mapped
(:,
ii
),
cd_dens
(:,
i_lau
,
ii
))/(
2
*
pi
*
R0
);
end
end
end
end
%% remap ec outputs on power time grid
%% interpolating 1d_profiles from 'ec_tgrid' grid (toray tgrid) to 'interp_tgrid' (powers tgrid when powers.data>0)
ij
=
iround_os
(
interp_tgrid
,
ec_tgrid
);
ij
=
iround_os
(
interp_tgrid
,
ec_tgrid
);
sparse_p_ec_injected
=
interp_p_ec_injected
(
ij
,:);
% injected ec power vals corresponding to ec_tgrid
sparse_p_ec_injected
=
interp_p_ec_injected
(
ij
,:);
% injected ec power vals corresponding to ec_tgrid
n_rho
=
size
(
p_dens
,
1
);
n_rho
=
size
(
p_dens
,
1
);
%rho grids to be interpolated on power time grid
%rho grids to be interpolated on power time grid
rho_pol_norm
=
ec_data
.
cd_dens
.
grids
.
rho_pol_norm
;
rho_pol_norm
=
ec_data
.
cd_dens
.
grids
.
rho_pol_norm
;
rho_tor_norm
=
ec_data
.
cd_dens
.
grids
.
rho_tor_norm
;
rho_tor_norm
=
ec_data
.
cd_dens
.
grids
.
rho_tor_norm
;
...
@@ -254,12 +249,12 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
...
@@ -254,12 +249,12 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
interp_norm_p_integrated
(
irho
,
i_lau
,:)
=
interpos
(
ec_tgrid
,
trace_p_integrated
,
interp_tgrid
);
interp_norm_p_integrated
(
irho
,
i_lau
,:)
=
interpos
(
ec_tgrid
,
trace_p_integrated
,
interp_tgrid
);
interp_norm_cd_dens
(
irho
,
i_lau
,:)
=
interpos
(
ec_tgrid
,
trace_cd_dens
,
interp_tgrid
);
interp_norm_cd_dens
(
irho
,
i_lau
,:)
=
interpos
(
ec_tgrid
,
trace_cd_dens
,
interp_tgrid
);
interp_norm_cd_integrated
(
irho
,
i_lau
,:)
=
interpos
(
ec_tgrid
,
trace_cd_integrated
,
interp_tgrid
);
interp_norm_cd_integrated
(
irho
,
i_lau
,:)
=
interpos
(
ec_tgrid
,
trace_cd_integrated
,
interp_tgrid
);
% only interpolate rho grids once
% only interpolate rho grids once
if
interp_rho_flag
if
interp_rho_flag
interp_rho_pol
(
irho
,:)
=
interpos
(
ec_tgrid
,
rho_pol_norm
(
irho
,:),
interp_tgrid
'
);
interp_rho_pol
(
irho
,:)
=
interpos
(
ec_tgrid
,
rho_pol_norm
(
irho
,:),
interp_tgrid
'
);
interp_rho_tor
(
irho
,:)
=
interpos
(
ec_tgrid
,
rho_tor_norm
(
irho
,:),
interp_tgrid
'
);
interp_rho_tor
(
irho
,:)
=
interpos
(
ec_tgrid
,
rho_tor_norm
(
irho
,:),
interp_tgrid
'
);
end
end
end
end
interp_rho_flag
=
0
;
interp_rho_flag
=
0
;
end
end
...
@@ -282,7 +277,7 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
...
@@ -282,7 +277,7 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
% integrated j// profiles and pdens last entry
% integrated j// profiles and pdens last entry
current_parallel_tmp
=
nan
(
1
,
nt_interp
);
current_parallel_tmp
=
nan
(
1
,
nt_interp
);
power_coupled_tmp
=
nan
(
1
,
nt_interp
);
power_coupled_tmp
=
nan
(
1
,
nt_interp
);
for
ii
=
1
:
nt_interp
for
ii
=
1
:
nt_interp
% time
% time
ids_core_sources
.
source
{
last_index
+
i_lau
}
.
profiles_1d
{
ii
}
.
time
=
interp_tgrid
(
ii
);
ids_core_sources
.
source
{
last_index
+
i_lau
}
.
profiles_1d
{
ii
}
.
time
=
interp_tgrid
(
ii
);
...
@@ -307,7 +302,7 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
...
@@ -307,7 +302,7 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
ids_core_sources
.
source
{
last_index
+
i_lau
}
.
globa_quantities
.
time
=
interp_tgrid
;
ids_core_sources
.
source
{
last_index
+
i_lau
}
.
globa_quantities
.
time
=
interp_tgrid
;
ids_core_sources
.
source
{
last_index
+
i_lau
}
.
global_quantities
.
power
=
power_coupled_tmp
;
ids_core_sources
.
source
{
last_index
+
i_lau
}
.
global_quantities
.
power
=
power_coupled_tmp
;
ids_core_sources
.
source
{
last_index
+
i_lau
}
.
global_quantities
.
current_parallel
=
current_parallel_tmp
;
ids_core_sources
.
source
{
last_index
+
i_lau
}
.
global_quantities
.
current_parallel
=
current_parallel_tmp
;
end
end
%add empty sources for rest of unsused launchers
%add empty sources for rest of unsused launchers
if
numel
(
ids_core_sources
.
source
)
-
last_index
~=
nb_launchers
if
numel
(
ids_core_sources
.
source
)
-
last_index
~=
nb_launchers
...
@@ -315,7 +310,6 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
...
@@ -315,7 +310,6 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
end
end
last_index
=
last_index
+
nb_launchers
;
last_index
=
last_index
+
nb_launchers
;
end
end
%% nbi
%% nbi
...
...
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