idstools.compute.core_sources¶
This module provides compute functions and classes for core_sources ids data
Module Contents¶
- class idstools.compute.core_sources.CoreSourcesCompute(ids)[source]¶
This class provides compute functions for core sources ids.
- ids¶
The core sources IDS (Integrated Data Structure) object containing source/sink data for particles and energy in the core plasma including heating, current drive, and particle injection sources.
- ids¶
- get_flux_info_from_sources(time_slice)[source]¶
The function retrieves information about sources, including their name, particle flux, energy flux, and ion properties, and returns a dictionary containing this information.
- Returns:¶
The function returns a dictionary containing information about the sources. The dictionary has the following structure:
{ 0: { "energy_flux": 22081836.173650958, "ions": { 0: { "a": 2.0, "energy_flux": None, "particles_flux": 4.947616643196025e21, "z_ion": -9e40, "z_n": 1.0, }, "name": "total", "particles_flux": None, }, } }
- get_rho_tor_norm(time_slice) numpy.ndarray | None[source]¶
The function get_rho_tor_norm returns the value of grid.rho_tor_norm if it is not empty, otherwise it returns None.
- Returns:¶
the value of the variable rho_tor_norm.
- get_single_and_total_current_torque(time_slice)[source]¶
The function get_single_and_total_current_torque calculates the total and individual current and torque waveforms for a given set of sources.
- get_single_and_total_electrons_and_ions_profiles(time_slice) dict[str, numpy.ndarray][source]¶
The function returns the total current profile and the individual current profiles for each valid and active source. SINGLE AND TOTAL PROFILES (ELECTRONS+IONS)
- Returns:¶
“total_current_profile” and “single_current_profile”. The value associated with the “total_current_profile” key is a numpy array representing the total current profile. The value associated with the “single_current_profile” key is a dictionary where the keys are the indices of the sources and the values are numpy arrays representing the current profiles for each individual source.
- Return type:¶
a dictionary with two keys
- get_single_and_total_electrons_ions_waveforms(time_slice)[source]¶
This function calculates single and total waveforms for electrons and ions based on power and particle quantities.
- Returns:¶
The function get_single_and_total_electrons_ions_waveforms returns a dictionary containing four key-value pairs: 1. “total_power_waveform”: an array representing the total power waveform 2. “total_particles_waveform”: an array representing the total particles waveform 3. “single_power_waveform”: a dictionary where each key is a source index and the corresponding value is an array 4. “single_particles_waveform”: particles waveform
- get_single_and_total_electrons_profiles(time_slice) dict[str, numpy.ndarray][source]¶
The function calculates and returns profiles of total and single electron power and particles based on valid and active sources.
- Returns:¶
“total_electron_power_profile”: Profile of total electron power “total_electron_particles_profile”: Profile of total electron particles “single_electron_power_profile”: Dictionary with profiles of single electron power for each source “single_electron_particles_profile”: Dictionary containing profiles of single electron particles for each data source
- Return type:¶
a dictionary with the following keys and corresponding values
- get_single_and_total_electrons_waveforms(time_slice)[source]¶
The function calculates and returns waveforms for total electron power, total electron particles, single electron power, and single electron particles.
- Returns:¶
“total_electron_power_waveform”: total_electron_power_waveform, “total_electron_particles_waveform”: total_electron_particles_waveform, “single_electron_power_waveform”: single_electron_power_waveform, “single_electron_particles_waveform”: single_electron_particles_waveform,
- Return type:¶
a dictionary with the following keys and values
- get_single_and_total_ion_profiles(time_slice) dict[str, numpy.ndarray][source]¶
The function calculates the total and individual power and particle profiles for ions in a plasma simulation.
- get_single_and_total_ions_waveforms(time_slice)[source]¶
The function calculates and returns the waveforms for single ion power, single ion particles, total ion power, and total ion particles.
- Returns:¶
a dictionary with four key-value pairs. The keys are “single_ion_power_waveform”, “single_ion_particles_waveform”, “total_ion_power_waveform”, and “total_ion_particles_waveform”. The corresponding values are the waveforms for single ion power, single ion particles, total ion power, and total ion particles, respectively.
- get_source_names(time_slice) dict[source]¶
This function retrieves the names of valid and active sources and returns them in uppercase.
- Returns:¶
A dictionary containing the index of valid and active sources as keys and the uppercase name
of the source as values.
- get_valid_and_active_sources(time_slice) dict[int, dict[str, bool]][source]¶
The function get_valid_and_active_sources returns a dictionary of valid and active sources, where each source is represented by a dictionary with the keys “valid” and “active”.
- Returns:¶
a dictionary of dictionaries. The outer dictionary has integer keys representing the index of each source, and the inner dictionaries have string keys (“valid” and “active”) representing the validity and activity status of each source.
- is_active_source_available(time_slice) bool[source]¶
The function checks if there is an active source available among the valid and active sources.
- Returns:¶
a boolean value. It is checking if there are any active sources in the list of valid and active sources and returning True if there is at least one active source, and False otherwise.
- idstools.compute.core_sources.logger¶