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
c49e10c3
Commit
c49e10c3
authored
1 year ago
by
Chatzilouka Aliki
Committed by
Antonia Frank
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
some variable name changes to clean up code
parent
8598a6e5
No related branches found
No related tags found
1 merge request
!137
Add quantities to ids for MRE
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/TCV_IMAS/tcv_get_ids_core_sources.m
+46
-43
46 additions, 43 deletions
matlab/TCV_IMAS/tcv_get_ids_core_sources.m
with
46 additions
and
43 deletions
matlab/TCV_IMAS/tcv_get_ids_core_sources.m
+
46
−
43
View file @
c49e10c3
...
...
@@ -40,7 +40,7 @@ powers_gdat = gdat(shot,'powers');
last_index
=
0
;
%% initialize source from template
% ohm
ohm_t_grid
=
powers_gdat
.
ohm
.
t
;
ohm_n_t
=
numel
(
ohm_t_grid
);
t_spacing
=
mean
(
diff
(
ohm_t_grid
));
ohm_t_grid
=
powers_gdat
.
ohm
.
t
;
ohm_n_t
=
numel
(
ohm_t_grid
);
id_ohm
.
description
=
'Source from ohmic heating'
;
id_ohm
.
index
=
7
;
id_ohm
.
name
=
'ohmic'
;
...
...
@@ -66,18 +66,20 @@ end
last_index
=
last_index
+
1
;
% add if statement to only increment if ohmic source has been added
%% bs
bs_gdat
=
gdat
(
shot
,
'bs_data'
);
bs_data
=
bs_gdat
.
bs
.
bs_data
;
bs_t_grid
=
bs_gdat
.
bs
.
t
;
bs_n_t
=
numel
(
bs_t_grid
);
id_bs
.
description
=
'Bootstrap current'
;
id_bs
.
index
=
13
;
id_bs
.
name
=
'bootstrap_current'
;
ids_core_sources
.
source
{
last_index
+
1
}
=
source_template
;
ids_core_sources
.
source
{
last_index
+
1
}
.
identifier
=
id_bs
;
ids_core_sources
.
source
{
last_index
+
1
}
.
profiles_1d
(
1
:
ohm_n_t
)
=
{
profiles_template
};
ids_core_sources
.
source
{
last_index
+
1
}
.
global_quantities
(
1
:
ohm_n_t
)
=
{
globals_template
};
% load data
bs_gdat
=
gdat
(
shot
,
'bs_data'
);
bs_data
=
bs_gdat
.
bs
.
bs_data
;
% fill profiles for times n t_grid
for
ii
=
1
:
ohm
_n_t
ids_core_sources
.
source
{
last_index
+
1
}
.
profiles_1d
{
ii
}
.
time
=
ohm
_t_grid
(
ii
);
for
ii
=
1
:
bs
_n_t
ids_core_sources
.
source
{
last_index
+
1
}
.
profiles_1d
{
ii
}
.
time
=
bs
_t_grid
(
ii
);
ids_core_sources
.
source
{
last_index
+
1
}
.
profiles_1d
{
ii
}
.
j_parallel
=
...
bs_data
.
cd_dens
.
data
(:,
ii
)
'
;
end
...
...
@@ -88,16 +90,17 @@ last_index = last_index+1; % add if statement to only increment if bs source ha
% load data
ec_gdat
=
gdat
(
shot
,
'ec_data'
);
ec_data
=
ec_gdat
.
ec
.
ec_data
;
ec_time
=
ec_data
.
p_dens
.
t
;
ec_t_grid
=
powers_gdat
.
ec
.
t
;
ec_n_t
=
numel
(
ec_t_grid
);
t_spacing
=
mean
(
diff
(
ec_t_grid
));
n_ec_time
=
numel
(
ec_time
);
ec_t_grid
=
powers_gdat
.
ec
.
t
;
ec_n_t
=
numel
(
ec_t_grid
);
nb_launchers
=
size
(
ec_gdat
.
ec
.
ec_data
.
rho_max_pow_dens
.
data
,
1
);
id_ec
.
description
=
'Sources from electron cyclotron heating and current drive'
;
id_ec
.
index
=
3
;
id_ec
.
name
=
'ec'
;
for
i
=
1
:
nb_launchers
ids_core_sources
.
source
{
last_index
+
i
}
=
source_template
;
ids_core_sources
.
source
{
last_index
+
i
}
.
identifier
=
id_ec
;
ids_core_sources
.
source
{
last_index
+
i
}
.
profiles_1d
(
1
:
ec_n_t
)
=
{
profiles_template
};
ids_core_sources
.
source
{
last_index
+
i
}
.
global_quantities
(
1
:
ec_n_t
)
=
{
globals_template
};
for
i
_lau
=
1
:
nb_launchers
ids_core_sources
.
source
{
last_index
+
i
_lau
}
=
source_template
;
ids_core_sources
.
source
{
last_index
+
i
_lau
}
.
identifier
=
id_ec
;
ids_core_sources
.
source
{
last_index
+
i
_lau
}
.
profiles_1d
(
1
:
ec_n_t
)
=
{
profiles_template
};
ids_core_sources
.
source
{
last_index
+
i
_lau
}
.
global_quantities
(
1
:
ec_n_t
)
=
{
globals_template
};
end
ec_total_pow
=
transpose
(
powers_gdat
.
ec
.
data
(:,
nb_launchers
+
1
));
%use power from powers_gdat(injected ec power) instead of ec_data power
...
...
@@ -105,15 +108,15 @@ ec_total_pow(isnan(ec_total_pow)) = 0;
ec_total_cur
=
ec_data
.
cd_tot
.
data
(
nb_launchers
+
1
,:);
ec_total_cur
(
isnan
(
ec_total_cur
))
=
0
;
for
i
=
1
:
nb_launchers
for
i
_lau
=
1
:
nb_launchers
for
ii
=
1
:
ec_n_t
ids_core_sources
.
source
{
last_index
+
i
}
.
profiles_1d
{
ii
}
.
time
=
ec_t_grid
(
ii
);
% profiles time
ids_core_sources
.
source
{
last_index
+
i
}
.
global_quantities
{
ii
}
.
time
=
ec_t_grid
(
ii
);
% globals time
ids_core_sources
.
source
{
last_index
+
i
_lau
}
.
profiles_1d
{
ii
}
.
time
=
ec_t_grid
(
ii
);
% profiles time
ids_core_sources
.
source
{
last_index
+
i
_lau
}
.
global_quantities
{
ii
}
.
time
=
ec_t_grid
(
ii
);
% globals time
% globals
ids_core_sources
.
source
{
last_index
+
i
}
.
global_quantities
{
ii
}
.
time
=
ec_t_grid
(
ii
);
ids_core_sources
.
source
{
last_index
+
i
}
.
global_quantities
{
ii
}
.
power
=
ec_total_pow
(
ii
);
ids_core_sources
.
source
{
last_index
+
i
}
.
global_quantities
{
ii
}
.
current_parallel
=
ec_total_cur
(
ii
);
ids_core_sources
.
source
{
last_index
+
i
_lau
}
.
global_quantities
{
ii
}
.
time
=
ec_t_grid
(
ii
);
ids_core_sources
.
source
{
last_index
+
i
_lau
}
.
global_quantities
{
ii
}
.
power
=
ec_total_pow
(
ii
);
ids_core_sources
.
source
{
last_index
+
i
_lau
}
.
global_quantities
{
ii
}
.
current_parallel
=
ec_total_cur
(
ii
);
end
end
...
...
@@ -127,17 +130,17 @@ cd_integrated = ec_data.cd_integrated.data;
p_ec_injected
=
powers_gdat
.
ec
.
data
;
it
=
iround_os
(
ec_t_grid
,
ec_time
);
sparse_p_ec_injected
=
p_ec_injected
(
it
,:);
% injected ec power vals corresponding to ec_time grid
rho_grid
=
size
(
p_dens
,
1
);
% calculate normalised profiles on ec_time grid
norm_p_dens
=
zeros
(
size
(
p_dens
,
1
)
,
nb_launchers
+
1
,
length
(
ec_time
)
)
;
norm_p_integrated
=
zeros
(
size
(
p_integrated
,
1
)
,
nb_launchers
+
1
,
length
(
ec_time
)
)
;
norm_cd_dens
=
zeros
(
size
(
cd_dens
,
1
)
,
nb_launchers
+
1
,
length
(
ec_time
)
)
;
norm_cd_integrated
=
zeros
(
size
(
cd_integrated
,
1
)
,
nb_launchers
+
1
,
length
(
ec_time
)
)
;
for
t
=
1
:
length
(
ec_time
)
norm_p_dens_temp
=
zeros
(
size
(
p_dens
,
1
)
,
nb_launchers
+
1
);
norm_p_integrated_temp
=
zeros
(
size
(
p_integrated
,
1
)
,
nb_launchers
+
1
);
norm_cd_dens_temp
=
zeros
(
size
(
cd_dens
,
1
)
,
nb_launchers
+
1
);
norm_cd_integrated_temp
=
zeros
(
size
(
cd_integrated
,
1
)
,
nb_launchers
+
1
);
norm_p_dens
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
n_
ec_time
);
norm_p_integrated
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
n_
ec_time
);
norm_cd_dens
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
n_
ec_time
);
norm_cd_integrated
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
n_
ec_time
);
for
t
=
1
:
n_
ec_time
norm_p_dens_temp
=
zeros
(
rho_grid
,
nb_launchers
+
1
);
norm_p_integrated_temp
=
zeros
(
rho_grid
,
nb_launchers
+
1
);
norm_cd_dens_temp
=
zeros
(
rho_grid
,
nb_launchers
+
1
);
norm_cd_integrated_temp
=
zeros
(
rho_grid
,
nb_launchers
+
1
);
for
launcher
=
1
:
nb_launchers
+
1
norm_p_dens_temp
(:,
launcher
)
=
p_dens
(:,
launcher
,
t
)
.
/
sparse_p_ec_injected
(
t
,
launcher
);
norm_p_integrated_temp
(:,
launcher
)
=
p_integrated
(:,
launcher
,
t
)
.
/
sparse_p_ec_injected
(
t
,
launcher
);
...
...
@@ -151,12 +154,12 @@ for t = 1:length(ec_time)
end
% interpolate normalised p_dens profiles on ec_t_grid
interp_norm_p_dens
=
zeros
(
size
(
norm_p_dens
,
1
),
size
(
norm_p_dens
,
2
)
,
ec_n_t
);
interp_norm_p_integrated
=
zeros
(
size
(
norm_p_integrated
,
1
),
size
(
norm_p_integrated
,
2
)
,
ec_n_t
);
interp_norm_cd_dens
=
zeros
(
size
(
norm_cd_dens
,
1
),
size
(
norm_cd_dens
,
2
)
,
ec_n_t
);
interp_norm_cd_integrated
=
zeros
(
size
(
norm_cd_integrated
,
1
),
size
(
norm_cd_integrated
,
2
)
,
ec_n_t
);
for
rho
=
1
:
size
(
norm_p_dens
,
1
)
for
launcher
=
1
:
size
(
norm_p_dens
,
2
)
interp_norm_p_dens
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
ec_n_t
);
interp_norm_p_integrated
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
ec_n_t
);
interp_norm_cd_dens
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
ec_n_t
);
interp_norm_cd_integrated
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
ec_n_t
);
for
rho
=
1
:
rho_grid
for
launcher
=
1
:
nb_launchers
+
1
profile_p_dens
=
squeeze
(
norm_p_dens
(
rho
,
launcher
,
:));
profile_p_integrated
=
squeeze
(
norm_p_integrated
(
rho
,
launcher
,
:));
profile_cd_dens
=
squeeze
(
norm_cd_dens
(
rho
,
launcher
,
:));
...
...
@@ -173,15 +176,15 @@ for rho = 1:size(norm_p_dens, 1)
end
% normalised & interpolated profiles * p_ec_injected on ec_t_grid
interp_p_dens
=
zeros
(
size
(
interp_norm_p_dens
,
1
),
size
(
interp_norm_p_dens
,
2
)
,
ec_n_t
);
interp_p_integrated
=
zeros
(
size
(
interp_norm_p_integrated
,
1
),
size
(
interp_norm_p_integrated
,
2
)
,
ec_n_t
);
interp_cd_dens
=
zeros
(
size
(
interp_norm_cd_dens
,
1
),
size
(
interp_norm_cd_dens
,
2
)
,
ec_n_t
);
interp_cd_integrated
=
zeros
(
size
(
interp_norm_cd_integrated
,
1
),
size
(
interp_norm_cd_integrated
,
2
)
,
ec_n_t
);
for
t
=
1
:
length
(
ec_t_grid
)
unnormalised_p_dens
=
zeros
(
size
(
p_dens
,
1
)
,
nb_launchers
+
1
);
unnormalised_p_integrated
=
zeros
(
size
(
p_integrated
,
1
)
,
nb_launchers
+
1
);
unnormalised_cd_dens
=
zeros
(
size
(
cd_dens
,
1
)
,
nb_launchers
+
1
);
unnormalised_cd_integrated
=
zeros
(
size
(
cd_integrated
,
1
)
,
nb_launchers
+
1
);
interp_p_dens
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
ec_n_t
);
interp_p_integrated
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
ec_n_t
);
interp_cd_dens
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
ec_n_t
);
interp_cd_integrated
=
zeros
(
rho_grid
,
nb_launchers
+
1
,
ec_n_t
);
for
t
=
1
:
numel
(
ec_t_grid
)
unnormalised_p_dens
=
zeros
(
rho_grid
,
nb_launchers
+
1
);
unnormalised_p_integrated
=
zeros
(
rho_grid
,
nb_launchers
+
1
);
unnormalised_cd_dens
=
zeros
(
rho_grid
,
nb_launchers
+
1
);
unnormalised_cd_integrated
=
zeros
(
rho_grid
,
nb_launchers
+
1
);
for
launcher
=
1
:
nb_launchers
+
1
unnormalised_p_dens
(:,
launcher
)
=
interp_norm_p_dens
(:,
launcher
,
t
)
.*
p_ec_injected
(
t
,
launcher
);
unnormalised_p_integrated
(:,
launcher
)
=
interp_norm_p_integrated
(:,
launcher
,
t
)
.*
p_ec_injected
(
t
,
launcher
);
...
...
@@ -233,7 +236,7 @@ id_total.index = 1; id_total.name = 'total';
%% add descriptions for profiles_1d
desc
.
source
=
'available by now
, 1:total, 3:ec, 7:ohm, 13:bootstrap
'
;
desc
.
source
=
'available by now
: ohm [id=7], bootstrap [id=13], ec [id=3] (if present in shot)
'
;
desc
.
profiles_1d
.
j_parallel
=
'parallel current density'
;
desc
.
profiles_1d
.
current_parallel_inside
=
'integrated parallel current density'
;
desc
.
globals
.
power
=
'total power coupled to the plasma'
;
...
...
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