Open tulasinandan opened 4 years ago
Are you looking to do design something that prints these parameters, returns these parameters, or both? I've done something similar to this before. It kinda looked like...
in file plasma.py
class Plasma:
...
@property
def report(self):
from .report_plasma import ReportPlasma
return ReportPlasma(self)
in file report_plasma.py
from .plasma import Plasma
class ReportPlasma:
def __init__(self, plasma: Plasma):
self._plasma = plasma
...
@property
def scales(self):
scales['frequencies'] = self.frequencies
...
return scales
@property
def frequencies(self):
freq['ion-cyclotron frequency'] = self._plasma.ion_cyclotron_frequency
freq['plasma frequency'] = self._plasma.plasma_frequency
...
return freq
def print_frequencies(self):
# do some pretty print with self.frequencies
Then you could do...
myplasma = Plasma()
# get all requencies
freqs = myplasma.report.frequencies
# print frequencies
myplasma.report.print_frequencies()
I've also set this up before such that print_frequencies()
could print to screen or a text file.
This is also setup such that all properties are calculated when called, so if you were to update myplasma
then those parameter changes would be reflected in the next myplasma.report.frequencies
call.
Feature request
A frequent task that we perform is computation and comparison of various scales of interest for the plasma under consideration. Once a plasma is loaded, we typically want to know what various length-scales (Debye length, particle gyro-radii, inertial lengths, ...), and time scales (plasma frequencies for all species, gyro-frequencies, possibly frequencies of some wave-modes of interest).
We should have a (set of) method(s) attached to plasma class that facilitates this. If I create a plasma object with given parameters, I should be able to call these methods to print/visualize and compare various scales of interest.
As an example, I attach the output of my code that does this using P3D input parameter files. This is very specific to simulations, but gives a general idea of the kind of comparisons we want to have