diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index d60a438..e1efa13 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-22T21:07:11","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-24T00:01:17","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index fd2b029..526d96c 100644 --- a/dev/index.html +++ b/dev/index.html @@ -9,12 +9,12 @@ )

Searches a list of allowed folders for a set of filenames that will provide information about the SOLPS case. Returns a list of filenames with complete paths.

Example:

SD4SOLPS.find_files_in_allowed_folders(
     "<your samples folder>/D3D_Ma_184833_03600";
     eqdsk_file="g184833.03600",
-)
source
SD4SOLPS.geqdsk_to_imas!Function
geqdsk_to_imas!(
+)
source
SD4SOLPS.geqdsk_to_imas!Function
geqdsk_to_imas!(
     eqdsk_file::String,
     dd::IMASDD.dd;
     set_time::Union{Nothing, Float64}=nothing,
     time_index::Int=1,
-)

Transfers the equilibrium reconstruction from an EFIT-style gEQDSK file into the IMAS DD structure.

source
SD4SOLPS.preparationFunction
preparation(
+)

Transfers the equilibrium reconstruction from an EFIT-style gEQDSK file into the IMAS DD structure.

source
SD4SOLPS.preparationFunction
preparation(
     eqdsk_file::String,
     dirs::String...;
     core_method::String="simple",
@@ -22,15 +22,15 @@
     output_format::String="json",
     eqdsk_set_time::Union{Nothing, Float64}=nothing,
     eq_time_index::Int64=1,
-)::IMASDD.dd

Gathers SOLPS and EFIT files and loads them into IMAS structure. Extrapolates profiles as needed to get a complete picture.

source

Repairing/filling out partial equilibrium files

Tools for repairing/filling out partial equilibrium files.

Some of the added fields may not be totally accurate, so it is recommended to use this tool mainly for test cases, as a utility. For a real equilibrium, problems should be fixed properly.

SD4SOLPS.add_rho_to_equilibrium!Function
function add_rho_to_equilibrium(dd:IMASDD.dd)

Adds equilibrium rho profile to the DD

source
SD4SOLPS.check_rho_1dFunction
check_rho_1d(
+)::IMASDD.dd

Gathers SOLPS and EFIT files and loads them into IMAS structure. Extrapolates profiles as needed to get a complete picture.

source

Repairing/filling out partial equilibrium files

Tools for repairing/filling out partial equilibrium files.

Some of the added fields may not be totally accurate, so it is recommended to use this tool mainly for test cases, as a utility. For a real equilibrium, problems should be fixed properly.

SD4SOLPS.add_rho_to_equilibrium!Function
function add_rho_to_equilibrium(dd:IMASDD.dd)

Adds equilibrium rho profile to the DD

source
SD4SOLPS.check_rho_1dFunction
check_rho_1d(
     dd::IMASDD.dd;
     time_slice::Int64=1,
     throw_on_fail::Bool=false,
-)::Bool

Checks to see if rho exists and is valid in the equilibrium 1d profiles

source

Extrapolations

Utilities for extrapolating profiles

Core profile extrapolations

SD4SOLPS.extrapolate_coreFunction
extrapolate_core(
+)::Bool

Checks to see if rho exists and is valid in the equilibrium 1d profiles

source

Extrapolations

Utilities for extrapolating profiles

Core profile extrapolations

SD4SOLPS.extrapolate_coreFunction
extrapolate_core(
     edge_rho::Vector{Float64},
     edge_quantity::Vector{Float64},
     rho_output::Vector{Float64},
-)::Vector{Float64}

Function for assuming a core profile when given edge profile data.

Concept:

  1. value and derivative should be continuous when joining real data
  2. derivative at magnetic axis is known to be 0 when making profile vs. rho, by the definition of rho
  3. derivative probably does something fancier between the pedestal and axis than just linear interpolation, so add an extra point in there
  4. there's a joint between the steep pedestal and the shallow core that needs an extra knot to manage it properly
  5. after making up a very simple gradient profile out of a few line segments, integrate it to get the profile of the quantity in question
source
SD4SOLPS.fill_in_extrapolated_core_profile!Function
fill_in_extrapolated_core_profile!(
+)::Vector{Float64}

Function for assuming a core profile when given edge profile data.

Concept:

  1. value and derivative should be continuous when joining real data
  2. derivative at magnetic axis is known to be 0 when making profile vs. rho, by the definition of rho
  3. derivative probably does something fancier between the pedestal and axis than just linear interpolation, so add an extra point in there
  4. there's a joint between the steep pedestal and the shallow core that needs an extra knot to manage it properly
  5. after making up a very simple gradient profile out of a few line segments, integrate it to get the profile of the quantity in question
source
SD4SOLPS.fill_in_extrapolated_core_profile!Function
fill_in_extrapolated_core_profile!(
     dd::IMASDD.dd,
     quantity_name::String;
     method::String="simple",
@@ -38,7 +38,7 @@
     eq_profiles_2d_idx::Int64=1,
     grid_ggd_idx::Int64=1,
     space_idx::Int64=1,
-)

This function accepts a DD that should be populated with equilibrium and edge_profiles as well as a request for a quantity to extrapolate into the core. It then maps edge_profiles data to rho, calls the function that performs the extrapolation (which is not a simple linear extrapolation but has some trickery to attempt to make a somewhat convincing profile shape), and writes the result to core_profiles. This involves a bunch of interpolations and stuff.

Input arguments:

  • dd: an IMAS data dictionary
  • quantity_name: the name of a quantity in edge_profiles.profiles_2d and core_profiles.profiles_1d, such as "electrons.density"
  • method: Extrapolation method.
  • eq_time_idx: index of the equilibrium time slice to use. For a typical SOLPS run, the SOLPS mesh will be based on the equilibrium reconstruction at a single time, so the DD associated with the SOLPS run only needs one equilibrium time slice to be loaded. However, one could combine the complete equilibrium time series with the SOLPS run and then have to specify which slice of the equilibrium corresponds to the SOLPS mesh.
  • eq_profiles_2d_idx: index of the profiles_2D in equilibrium time_slice.
  • grid_ggd_idx: index of the grid_ggd to use. For a typical SOLPS run, the SOLPS grid is fixed, so this index defaults to 1. But in future, if a time varying grid is used, then this index will need to be specified.
  • space_idx: index of the space to use. For a typical SOLPS run, there will be only one space so this index will mostly remain at 1.
  • cell_subset_idx: index of the subset of cells to use for the extrapolation. The default is 5, which is the subset of all cells. If edge_profiles data is instead present for a different subset, for instance, -5, which are b2.5 cells only, then this index should be set to -5.
source

Edge profiles extrapolations

These functions have not been fully tested and/or supported yet.

SD4SOLPS.mesh_psi_spacingFunction
mesh_psi_spacing(
+)

This function accepts a DD that should be populated with equilibrium and edge_profiles as well as a request for a quantity to extrapolate into the core. It then maps edge_profiles data to rho, calls the function that performs the extrapolation (which is not a simple linear extrapolation but has some trickery to attempt to make a somewhat convincing profile shape), and writes the result to core_profiles. This involves a bunch of interpolations and stuff.

Input arguments:

  • dd: an IMAS data dictionary
  • quantity_name: the name of a quantity in edge_profiles.profiles_2d and core_profiles.profiles_1d, such as "electrons.density"
  • method: Extrapolation method.
  • eq_time_idx: index of the equilibrium time slice to use. For a typical SOLPS run, the SOLPS mesh will be based on the equilibrium reconstruction at a single time, so the DD associated with the SOLPS run only needs one equilibrium time slice to be loaded. However, one could combine the complete equilibrium time series with the SOLPS run and then have to specify which slice of the equilibrium corresponds to the SOLPS mesh.
  • eq_profiles_2d_idx: index of the profiles_2D in equilibrium time_slice.
  • grid_ggd_idx: index of the grid_ggd to use. For a typical SOLPS run, the SOLPS grid is fixed, so this index defaults to 1. But in future, if a time varying grid is used, then this index will need to be specified.
  • space_idx: index of the space to use. For a typical SOLPS run, there will be only one space so this index will mostly remain at 1.
  • cell_subset_idx: index of the subset of cells to use for the extrapolation. The default is 5, which is the subset of all cells. If edge_profiles data is instead present for a different subset, for instance, -5, which are b2.5 cells only, then this index should be set to -5.
source

Edge profiles extrapolations

These functions have not been fully tested and/or supported yet.

SD4SOLPS.mesh_psi_spacingFunction
mesh_psi_spacing(
     dd::IMASDD.dd;
     eq_time_idx::Int64=1,
     eq_profiles_2d_idx::Int64=1,
@@ -46,7 +46,7 @@
     space_idx::Int64=1,
     avoid_guard_cell::Bool=true,
     spacing_rule="mean",
-)

Inspects the mesh to see how far apart faces are in psi_N. Requires that GGD and equilibrium are populated.

Input Arguments:

  • dd: a data dictionary instance with required data loaded into it
  • eq_time_idx: index of the equilibrium time slice to use. For a typical SOLPS run, the SOLPS mesh will be based on the equilibrium reconstruction at a single time, so the DD associated with the SOLPS run only needs one equilibrium time slice to be loaded. However, one could combine the complete equilibrium time series with the SOLPS run and then have to specify which slice of the equilibrium corresponds to the SOLPS mesh.
  • eq_profiles_2d_idx: index of the profiles_2D in equilibrium time_slice.
  • grid_ggd_idx: index of the grid_ggd to use. For a typical SOLPS run, the SOLPS grid is fixed, so this index defaults to 1. But in future, if a time varying grid is used, then this index will need to be specified.
  • space_idx: index of the space to use. For a typical SOLPS run, there will be only one space so this index will mostly remain at 1.
  • avoid_guard_cell: assume that the last cell is a guard cell so take end-2 and end-1 instead of end and end-1
  • spacing_rule: "edge" or "mean" to make spacing of new cells (in psi_N) be the same as the spacing at the edge of the mesh, or the same as the average spacing
source
SD4SOLPS.cached_mesh_extension!Function
cached_mesh_extension!(
+)

Inspects the mesh to see how far apart faces are in psi_N. Requires that GGD and equilibrium are populated.

Input Arguments:

  • dd: a data dictionary instance with required data loaded into it
  • eq_time_idx: index of the equilibrium time slice to use. For a typical SOLPS run, the SOLPS mesh will be based on the equilibrium reconstruction at a single time, so the DD associated with the SOLPS run only needs one equilibrium time slice to be loaded. However, one could combine the complete equilibrium time series with the SOLPS run and then have to specify which slice of the equilibrium corresponds to the SOLPS mesh.
  • eq_profiles_2d_idx: index of the profiles_2D in equilibrium time_slice.
  • grid_ggd_idx: index of the grid_ggd to use. For a typical SOLPS run, the SOLPS grid is fixed, so this index defaults to 1. But in future, if a time varying grid is used, then this index will need to be specified.
  • space_idx: index of the space to use. For a typical SOLPS run, there will be only one space so this index will mostly remain at 1.
  • avoid_guard_cell: assume that the last cell is a guard cell so take end-2 and end-1 instead of end and end-1
  • spacing_rule: "edge" or "mean" to make spacing of new cells (in psi_N) be the same as the spacing at the edge of the mesh, or the same as the average spacing
source
SD4SOLPS.cached_mesh_extension!Function
cached_mesh_extension!(
     dd::IMASDD.dd,
     eqdsk_file::String,
     b2fgmtry::String;
@@ -55,16 +55,16 @@
     grid_ggd_idx::Int64=1,
     space_idx::Int64=1,
     clear_cache::Bool=false,
-)::String

Adds an extended mesh to a data dictionary, possibly from a cached result.

Input Arguments:

  • dd: The data dictionary. It will be modified in place.
  • eqdsk_file: the name of the EQDSK file that was used to get equilibrium data in the dd.
  • b2fgmtry: the name of the SOLPS geometry file that was used to get GGD info in edge_profiles in the dd.
  • eq_time_idx: Index of the time slice in equilibrium
  • eq_profiles_2d_idx: Index of the 2D profile set in equilibrium (there is usually only one)
  • grid_ggd_idx: Index of the grid_ggd set in edge_profiles
  • space_idx: Index of the space
  • clear_cache: delete any existing cache file (for use in testing)
source

Unit conversion utilities

SD4SOLPS.gas_unit_converterFunction
gas_unit_converter(
+)::String

Adds an extended mesh to a data dictionary, possibly from a cached result.

Input Arguments:

  • dd: The data dictionary. It will be modified in place.
  • eqdsk_file: the name of the EQDSK file that was used to get equilibrium data in the dd.
  • b2fgmtry: the name of the SOLPS geometry file that was used to get GGD info in edge_profiles in the dd.
  • eq_time_idx: Index of the time slice in equilibrium
  • eq_profiles_2d_idx: Index of the 2D profile set in equilibrium (there is usually only one)
  • grid_ggd_idx: Index of the grid_ggd set in edge_profiles
  • space_idx: Index of the space
  • clear_cache: delete any existing cache file (for use in testing)
source

Unit conversion utilities

SD4SOLPS.gas_unit_converterFunction
gas_unit_converter(
     value_in::Float64,
     units_in::String,
     units_out::String;
     species::String="H",
     temperature::Float64=293.15,
-)

Converts gas flows between different units. Uses ideal gas law to convert between Pressure * volume type flows / quantities and count / current types of units. There is a version that accepts floats in and outputs floats, and another that deals in Unitful quantities.

source
gas_unit_converter(
+)

Converts gas flows between different units. Uses ideal gas law to convert between Pressure * volume type flows / quantities and count / current types of units. There is a version that accepts floats in and outputs floats, and another that deals in Unitful quantities.

source
gas_unit_converter(
     value_in::Unitful.Quantity,
     units_in::String,
     units_out::String;
     species::String="H",
     temperature=293.15 * Unitful.K,
-)

Converts gas flows between different units. Uses ideal gas law to convert between Pressure * volume type flows / quantities and count / current types of units. This is the Unitful version.

Output will be unitful, but the units are not simplified automatically. You can perform operations such as

  • (output |> Unitful.upreferred).val
  • Unitful.uconvert(Unitful.whatever, output).val

to handle simplification or conversion of units.

Although this function pretends torr L s$^{-1}$ and Pa m$^3$ s$^{-1}$ are different, use of Unitful should cause them to behave the same way as long as you simplify or convert units at the end. This means that you can use other pressure*volume type gas units and call them torr L s$^{-1}$ and the script will deal with them up to having messy units in the output.

source
+)

Converts gas flows between different units. Uses ideal gas law to convert between Pressure * volume type flows / quantities and count / current types of units. This is the Unitful version.

Output will be unitful, but the units are not simplified automatically. You can perform operations such as

to handle simplification or conversion of units.

Although this function pretends torr L s$^{-1}$ and Pa m$^3$ s$^{-1}$ are different, use of Unitful should cause them to behave the same way as long as you simplify or convert units at the end. This means that you can use other pressure*volume type gas units and call them torr L s$^{-1}$ and the script will deal with them up to having messy units in the output.

source diff --git a/dev/objects.inv b/dev/objects.inv index 79bd846..44348d7 100644 Binary files a/dev/objects.inv and b/dev/objects.inv differ