-
Notifications
You must be signed in to change notification settings - Fork 306
/
abstractions.py
190 lines (150 loc) · 4.14 KB
/
abstractions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
"""
Abstract classes for numerical simulations.
.. attention::
|expect-api-changes|
"""
__all__ = [
"AbstractNormalizations",
"AbstractSimulation",
"AbstractTimeDependentSimulation",
]
import astropy.units as u
from abc import ABC, abstractmethod
from typing import NoReturn
class AbstractSimulation(ABC):
"""
A prototype abstract interface for numerical simulations.
.. attention::
|expect-api-changes|
"""
@abstractmethod
def summarize(self):
"""
Print a summary of the simulation parameters and status.
"""
...
@abstractmethod
def initialize(self) -> NoReturn:
"""Prepare the simulation to be run."""
...
@abstractmethod
def simulate(self):
"""Perform the simulation."""
...
@abstractmethod
def finalize(self) -> NoReturn:
"""Perform the steps to close the simulation."""
...
class AbstractTimeDependentSimulation(AbstractSimulation):
"""
A prototype abstract interface for time-dependent numerical simulations.
.. warning::
This interface is unstable and is subject to change.
"""
...
class AbstractNormalizations(ABC):
"""
An abstract base class to represent the normalization constants for
systems of equations describing plasmas.
.. warning::
This interface is unstable and is subject to change.
"""
@property
@abstractmethod
def current_density(self) -> u.A / u.m**2:
"""The current density normalization."""
...
@property
@abstractmethod
def diffusivity(self) -> u.m**2 / u.s:
"""The normalization for diffusivity."""
...
@property
@abstractmethod
def dynamic_viscosity(self) -> u.Pa * u.s:
"""The normalization for dynamic viscosity."""
...
@property
@abstractmethod
def electric_field(self) -> u.V / u.m:
"""The electric field normalization."""
...
@property
@abstractmethod
def heat_flux(self) -> u.J * u.m**-2 * u.s**-1:
"""The normalization for heat flux."""
...
@property
@abstractmethod
def length(self) -> u.m:
"""The normalization for length."""
...
@property
@abstractmethod
def magnetic_field(self) -> u.T:
"""The magnetic field normalization."""
...
@property
@abstractmethod
def magnetic_flux(self) -> u.T * u.m:
"""The normalization for the magnetic flux or vector potential."""
...
@property
@abstractmethod
def mass(self) -> u.kg:
"""The normalization for mass."""
...
@property
@abstractmethod
def mass_density(self) -> u.kg / u.m**3:
"""The normalization for mass density."""
...
@property
@abstractmethod
def number_density(self) -> u.m**-3:
"""The normalization for number density."""
...
@property
@abstractmethod
def pressure(self) -> u.Pa:
"""The normalization for pressure."""
...
@property
@abstractmethod
def temperature(self) -> u.K:
"""The normalization for temperature."""
...
@property
@abstractmethod
def thermal_conductivity(self) -> u.W / (u.K * u.m):
"""The normalization for thermal conductivity."""
...
@property
@abstractmethod
def time(self) -> u.s:
"""The normalization for time."""
...
@property
@abstractmethod
def wavenumber(self) -> u.m**-1:
"""The normalization for inverse length."""
...
@property
@abstractmethod
def velocity(self) -> u.m / u.s:
"""The normalization for velocity."""
...
@property
@abstractmethod
def volumetric_heating_rate(self) -> u.J * u.m**-3 * u.s**-1:
"""The normalization for the volumetric heating rate."""
...
@property
@abstractmethod
def volumetric_rate(self) -> u.m**-3 * u.s**-1:
"""
The normalization for a volumetric rate.
This normalization is applicable to, for example, the number
of collisions per unit volume per unit time.
"""
...