Skip to content

Commit

Permalink
removing bda workflow methods from plasma_profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-gemmell committed Oct 31, 2024
1 parent f242f75 commit 5a50d57
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions indica/models/plasma.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,6 @@ def __init__(
self,
plasma: Plasma,
profilers: dict[ProfilerBase],
plasma_attribute_names=None,
map_vtor: bool = False,
):
"""
Interface Profiler objects with Plasma object to generate plasma profiles
Expand All @@ -822,30 +820,8 @@ def __init__(
dictionary of Profiler objects to generate profiles
"""

if plasma_attribute_names is None:
plasma_attribute_names = [
"electron_temperature",
"electron_density",
"ion_temperature",
"ion_density",
"impurity_density",
"fast_density",
"pressure_fast",
"neutral_density",
"zeff",
"meanz",
"wp",
"wth",
"pressure_tot",
"pressure_th",
"toroidal_rotation",
]
self.plasma = plasma
self.profilers = profilers
self.plasma_attribute_names = plasma_attribute_names
self.map_vtor = map_vtor
self.phantom = None
self.phantom_profiles = None

def update_profilers(self, profilers: dict):
for profile_name, profiler in profilers.items():
Expand All @@ -872,16 +848,6 @@ def set_profiles(self, profiles: dict[xr.DataArray], t: float = None):
else:
getattr(self.plasma, profile_name).loc[dict(t=t)] = profile

def save_phantoms(self, phantom=False):
# if phantoms return profiles otherwise return empty arrays
self.phantom = phantom
phantom_profiles = self.plasma_attributes()
if not phantom:
for key, value in phantom_profiles.items():
phantom_profiles[key] = value * 0
self.phantom_profiles = phantom_profiles
return phantom_profiles

def map_plasma_profile_to_midplane(self, profiles: dict):
"""
Map profiles from flux space to real space on z=0
Expand All @@ -901,24 +867,6 @@ def map_plasma_profile_to_midplane(self, profiles: dict):
midplane_profiles[key] = value.interp(rho_poloidal=rho)
return midplane_profiles

def plasma_attributes(self):
plasma_attributes = {}
for attribute in self.plasma_attribute_names:
plasma_attributes[attribute] = getattr(self.plasma, attribute).sel(
t=self.plasma.time_to_calculate
)
return plasma_attributes

def map_toroidal_rotation_to_ion_temperature(
self,
):

self.plasma.toroidal_rotation = (
self.plasma.ion_temperature
/ self.plasma.ion_temperature.max("rho_poloidal")
* self.plasma.toroidal_rotation.max("rho_poloidal")
)

def __call__(self, parameters: dict = None, t=None):
"""
Set parameters of given profilers and assign to plasma profiles
Expand Down Expand Up @@ -963,5 +911,3 @@ def __call__(self, parameters: dict = None, t=None):
}
self.set_profiles(updated_profiles, t)

if "ion_temperature" in _profiles_to_update and self.map_vtor:
self.map_toroidal_rotation_to_ion_temperature()

0 comments on commit 5a50d57

Please sign in to comment.