Skip to content

Commit

Permalink
pySTEL: in plasma class, add function to introduce new species
Browse files Browse the repository at this point in the history
  • Loading branch information
ajchcoelho committed Dec 9, 2024
1 parent aeba431 commit 6c8cced
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pySTEL/libstell/plasma.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,26 @@ def give_Zcharge_to_species(self,species_list,Zcharge=None):

for species in species_list:
self.Zcharge[species] = self.Zcharge_database[f'{species}']

def add_species_to_plasma(self,species):
#adds a new species to the plasma

# Chech if species is a string
if not isinstance(species, str):
raise ValueError("species must be a string")

self.check_species_exist(species)

self.list_of_species.append(species)

self.give_mass_to_species(self.list_of_species)
self.give_charge_to_species(self.list_of_species)
self.give_Zcharge_to_species(self.list_of_species)

#create self.ion_species and self.num_ion_species
self.set_ion_species()

if(self.lverb): print(f'Plasma updated and now has species: {", ".join(self.list_of_species)}')

def set_density(self,species,n0,nedge,exponent):

Expand Down

0 comments on commit 6c8cced

Please sign in to comment.