-
Notifications
You must be signed in to change notification settings - Fork 1
/
VanRoosbrockEg.py
306 lines (273 loc) · 17.2 KB
/
VanRoosbrockEg.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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
#!/usr/bin/env python
# http://mathhub.info/MitM/Modelss?VanRoosbrockEg
from mpdbase import *
class MPD_VanRoosbrockEg(MPDBase):
def __init__(self, space, integration_surfaces=[]):
MPDBase.__init__(self,
'VanRoosbrockEg',
'http://mathhub.info/MitM/Modelss',
space,
integration_surfaces)
self.functional_graph = [('electron_mobility', 'electron_current'), ('electron_density', 'electron_current'), ('current_density', 'electron_current'), ('elementary_charge', 'electron_current'), ('electron_density', 'electron_density_law'), ('quasifermi_potential', 'electron_density_law'), ('electrostatic_potential', 'electron_density_law'), ('band_energy', 'electron_density_law'), ('band_density', 'electron_density_law'), ('temperature', 'electron_density_law'), ('boltzmann_constant', 'electron_density_law'), ('elementary_charge', 'electron_density_law'), ('electric_field', 'electric_field_law'), ('displacement', 'displacement_relation'), ('electric_field', 'displacement_relation'), ('absolute_permittivity', 'displacement_relation'), ('doping_profile', 'charge_density_law'), ('electron_density', 'charge_density_law'), ('charge_density', 'charge_density_law'), ('elementary_charge', 'charge_density_law'), ('charge_density', 'gauss_law'), ('absolute_permittivity', 'permitivity_law'), ('relative_permittivity', 'permitivity_law'), ('electric_constant', 'permitivity_law')]
self.graph = [('current_density', 'electron_continuity_eqn'), ('current_density', 'electron_current'), ('quasifermi_potential', 'electron_current'), ('electron_density', 'electron_current'), ('electron_mobility', 'electron_current'), ('elementary_charge', 'electron_current'), ('electron_density', 'electron_density_law'), ('temperature', 'electron_density_law'), ('boltzmann_constant', 'electron_density_law'), ('band_energy', 'electron_density_law'), ('quasifermi_potential', 'electron_density_law'), ('electrostatic_potential', 'electron_density_law'), ('elementary_charge', 'electron_density_law'), ('band_density', 'electron_density_law'), ('electric_field', 'electric_field_law'), ('electrostatic_potential', 'electric_field_law'), ('displacement', 'displacement_relation'), ('electric_field', 'displacement_relation'), ('absolute_permittivity', 'displacement_relation'), ('charge_density', 'charge_density_law'), ('electron_density', 'charge_density_law'), ('doping_profile', 'charge_density_law'), ('elementary_charge', 'charge_density_law'), ('charge_density', 'gauss_law'), ('displacement', 'gauss_law'), ('absolute_permittivity', 'permitivity_law'), ('relative_permittivity', 'permitivity_law'), ('electric_constant', 'permitivity_law')]
def init_quantity_decls(self):
self.quantity_decls['electron_mobility'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'electron_mobility',
is_uniform = False,
initial_value = numpy.array(1.0E-4),
is_constant = False,
dimension = '',
tensor_shape = []
)
self.quantity_decls['doping_profile'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'doping_profile',
is_uniform = False,
initial_value = numpy.array(1.0E-21),
is_constant = False,
dimension = 'VolumeDensity',
tensor_shape = []
)
self.quantity_decls['electron_density'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'electron_density',
is_uniform = False,
initial_value = numpy.array(-1.0E-21),
is_constant = False,
dimension = 'VolumeDensity',
tensor_shape = []
)
self.quantity_decls['charge_density'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'charge_density',
is_uniform = False,
initial_value = numpy.array(-2.0),
is_constant = False,
dimension = '',
tensor_shape = []
)
self.quantity_decls['displacement'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'displacement',
is_uniform = False,
is_constant = False,
dimension = '',
tensor_shape = [3]
)
self.quantity_decls['quasifermi_potential'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'quasifermi_potential',
is_uniform = False,
initial_value = numpy.array(-4.0999999999999994E-19),
is_constant = False,
dimension = 'ElectricPotential',
tensor_shape = []
)
self.quantity_decls['electrostatic_potential'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'electrostatic_potential',
is_uniform = False,
is_constant = False,
dimension = 'ElectricPotential',
tensor_shape = []
)
self.quantity_decls['electric_field'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'electric_field',
is_uniform = False,
is_constant = False,
dimension = 'ElectricField',
tensor_shape = [3]
)
self.quantity_decls['current_density'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'current_density',
is_uniform = False,
is_constant = False,
dimension = 'ElectricCurrentDensity',
tensor_shape = [3]
)
self.quantity_decls['absolute_permittivity'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'absolute_permittivity',
is_uniform = True,
initial_value = numpy.array(8.85418782E-12),
is_constant = False,
dimension = 'ElectricalPermittivity',
tensor_shape = []
)
self.quantity_decls['relative_permittivity'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'relative_permittivity',
is_uniform = True,
initial_value = numpy.array(1.0),
is_constant = False,
dimension = 'DimNone',
tensor_shape = []
)
self.quantity_decls['test_quantity2'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'test_quantity2',
is_uniform = True,
initial_value = numpy.array([[1.1 ,2.2 ,3.3] ,[4.4 ,5.5 ,6.6] ,[7.7 ,8.8 ,9.9]]),
is_constant = True,
dimension = 'ElectricalPermittivity',
tensor_shape = [3,3]
)
self.quantity_decls['test_quantity'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Quantities',
name = 'test_quantity',
is_uniform = True,
initial_value = numpy.array([1.1 ,2.2 ,3.3]),
is_constant = True,
dimension = 'ElectricalPermittivity',
tensor_shape = [3]
)
self.quantity_decls['band_energy'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Constants',
name = 'band_energy',
is_uniform = False,
initial_value = numpy.array(8.0E-19),
is_constant = True,
dimension = 'Energy',
tensor_shape = []
)
self.quantity_decls['band_density'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Constants',
name = 'band_density',
is_uniform = False,
initial_value = numpy.array(3.0E12),
is_constant = True,
dimension = 'VolumeDensity',
tensor_shape = []
)
self.quantity_decls['temperature'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Constants',
name = 'temperature',
is_uniform = True,
initial_value = numpy.array(200.0),
is_constant = True,
dimension = 'Temperature',
tensor_shape = []
)
self.quantity_decls['boltzmann_constant'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Constants',
name = 'boltzmann_constant',
is_uniform = True,
initial_value = numpy.array(1.3806852E-23),
is_constant = True,
dimension = '',
tensor_shape = []
)
self.quantity_decls['elementary_charge'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Constants',
name = 'elementary_charge',
is_uniform = True,
initial_value = numpy.array(-1.60217662E-19),
is_constant = True,
dimension = 'ElectricCharge',
tensor_shape = []
)
self.quantity_decls['electric_constant'] = QuantityDecl(
parent = 'http://mathhub.info/MitM/Modelss?Constants',
name = 'electric_constant',
is_uniform = True,
initial_value = numpy.array(8.854187816999999E-12),
is_constant = True,
dimension = 'ElectricalPermittivity',
tensor_shape = []
)
def init_laws(self):
self.laws['electron_continuity_eqn'] = Law(
parent = 'http://mathhub.info/MitM/Modelss?VanRoosbrockEg',
name = 'electron_continuity_eqn',
solvables = [],
law_test = lambda state: ((numpy.array(0.0)) - (divergence(state['current_density'], self.space))),
used_quantities = ['current_density']
)
self.laws['electron_current'] = Law(
parent = 'http://mathhub.info/MitM/Modelss?VanRoosbrockEg',
name = 'electron_current',
elementary_charge = lambda state: (((state['current_density'] / gradient(state['quasifermi_potential'], self.space)) / state['electron_density']) / state['electron_mobility']),
solvables = ['current_density' ,'quasifermi_potential' ,'electron_density' ,'electron_mobility' ,'elementary_charge'],
electron_density = lambda state: ((state['current_density'] / gradient(state['quasifermi_potential'], self.space)) / (state['elementary_charge'] * state['electron_mobility'])),
current_density = lambda state: (((state['elementary_charge'] * state['electron_mobility']) * state['electron_density']) * gradient(state['quasifermi_potential'], self.space)),
law_test = lambda state: (((((state['elementary_charge'] * state['electron_mobility']) * state['electron_density']) * gradient(state['quasifermi_potential'], self.space))) - (state['current_density'])),
electron_mobility = lambda state: (((state['current_density'] / gradient(state['quasifermi_potential'], self.space)) / state['electron_density']) / state['elementary_charge']),
used_quantities = ['current_density' ,'quasifermi_potential' ,'electron_density' ,'electron_mobility' ,'elementary_charge']
)
self.laws['electron_density_law'] = Law(
parent = 'http://mathhub.info/MitM/Modelss?VanRoosbrockEg',
name = 'electron_density_law',
electrostatic_potential = lambda state: ((((numpy.log((state['electron_density'] / state['band_density'])) * (state['boltzmann_constant'] * state['temperature'])) + state['band_energy']) / state['elementary_charge']) + state['quasifermi_potential']),
elementary_charge = lambda state: (((numpy.log((state['electron_density'] / state['band_density'])) * (state['boltzmann_constant'] * state['temperature'])) + state['band_energy']) / (state['electrostatic_potential'] - state['quasifermi_potential'])),
solvables = ['electron_density' ,'temperature' ,'boltzmann_constant' ,'band_energy' ,'quasifermi_potential' ,'electrostatic_potential' ,'elementary_charge' ,'band_density'],
temperature = lambda state: ((numpy.log((state['electron_density'] / state['band_density'])) * ((state['elementary_charge'] * (state['electrostatic_potential'] - state['quasifermi_potential'])) - state['band_energy'])) / state['boltzmann_constant']),
electron_density = lambda state: (state['band_density'] * numpy.exp((((state['elementary_charge'] * (state['electrostatic_potential'] - state['quasifermi_potential'])) - state['band_energy']) / (state['boltzmann_constant'] * state['temperature'])))),
quasifermi_potential = lambda state: ((((numpy.log((state['electron_density'] / state['band_density'])) * (state['boltzmann_constant'] * state['temperature'])) + state['band_energy']) / state['elementary_charge']) - state['electrostatic_potential']),
boltzmann_constant = lambda state: ((numpy.log((state['electron_density'] / state['band_density'])) * ((state['elementary_charge'] * (state['electrostatic_potential'] - state['quasifermi_potential'])) - state['band_energy'])) / state['temperature']),
law_test = lambda state: (((state['band_density'] * numpy.exp((((state['elementary_charge'] * (state['electrostatic_potential'] - state['quasifermi_potential'])) - state['band_energy']) / (state['boltzmann_constant'] * state['temperature']))))) - (state['electron_density'])),
band_density = lambda state: (state['electron_density'] / numpy.exp((((state['elementary_charge'] * (state['electrostatic_potential'] - state['quasifermi_potential'])) - state['band_energy']) / (state['boltzmann_constant'] * state['temperature'])))),
used_quantities = ['electron_density' ,'temperature' ,'boltzmann_constant' ,'band_energy' ,'quasifermi_potential' ,'electrostatic_potential' ,'elementary_charge' ,'band_density'],
band_energy = lambda state: ((numpy.log((state['electron_density'] / state['band_density'])) * (state['boltzmann_constant'] * state['temperature'])) - (state['elementary_charge'] * (state['electrostatic_potential'] - state['quasifermi_potential'])))
)
self.laws['electric_field_law'] = Law(
parent = 'http://mathhub.info/MitM/Modelss?VanRoosbrockEg',
name = 'electric_field_law',
solvables = ['electric_field' ,'electrostatic_potential'],
law_test = lambda state: (((- gradient(state['electrostatic_potential'], self.space))) - (state['electric_field'])),
used_quantities = ['electric_field' ,'electrostatic_potential'],
electric_field = lambda state: (- gradient(state['electrostatic_potential'], self.space))
)
self.laws['displacement_relation'] = Law(
parent = 'http://mathhub.info/MitM/Modelss?VanRoosbrockEg',
name = 'displacement_relation',
absolute_permittivity = lambda state: (state['displacement'] / state['electric_field']),
solvables = ['displacement' ,'electric_field' ,'absolute_permittivity'],
law_test = lambda state: (((state['absolute_permittivity'] * state['electric_field'])) - (state['displacement'])),
used_quantities = ['displacement' ,'electric_field' ,'absolute_permittivity'],
electric_field = lambda state: (state['displacement'] / state['absolute_permittivity']),
displacement = lambda state: (state['absolute_permittivity'] * state['electric_field'])
)
self.laws['charge_density_law'] = Law(
parent = 'http://mathhub.info/MitM/Modelss?VanRoosbrockEg',
name = 'charge_density_law',
elementary_charge = lambda state: (state['charge_density'] / (state['doping_profile'] - state['electron_density'])),
charge_density = lambda state: (state['elementary_charge'] * (state['doping_profile'] - state['electron_density'])),
doping_profile = lambda state: ((state['charge_density'] / state['elementary_charge']) + state['electron_density']),
solvables = ['charge_density' ,'electron_density' ,'doping_profile' ,'elementary_charge'],
electron_density = lambda state: ((state['charge_density'] / state['elementary_charge']) - state['doping_profile']),
law_test = lambda state: (((state['elementary_charge'] * (state['doping_profile'] - state['electron_density']))) - (state['charge_density'])),
used_quantities = ['charge_density' ,'electron_density' ,'doping_profile' ,'elementary_charge']
)
self.laws['gauss_law'] = Law(
parent = 'http://mathhub.info/MitM/Modelss?VanRoosbrockEg',
name = 'gauss_law',
charge_density = lambda state: divergence(state['displacement'], self.space),
solvables = ['charge_density' ,'displacement'],
law_test = lambda state: ((divergence(state['displacement'], self.space)) - (state['charge_density'])),
used_quantities = ['charge_density' ,'displacement']
)
self.laws['permitivity_law'] = Law(
parent = 'http://mathhub.info/MitM/Modelss?VanRoosbrockEg',
name = 'permitivity_law',
absolute_permittivity = lambda state: (state['electric_constant'] * state['relative_permittivity']),
relative_permittivity = lambda state: (state['absolute_permittivity'] / state['electric_constant']),
solvables = ['absolute_permittivity' ,'relative_permittivity' ,'electric_constant'],
electric_constant = lambda state: (state['absolute_permittivity'] / state['relative_permittivity']),
law_test = lambda state: (((state['electric_constant'] * state['relative_permittivity'])) - (state['absolute_permittivity'])),
used_quantities = ['absolute_permittivity' ,'relative_permittivity' ,'electric_constant']
)
def init_computation_steps(self):
self.computation_steps['cycle1'] = ComputationStep(
parent = 'http://mathhub.info/MitM/Modelss?VanRoosbrockEg?cycle1',
name = 'cycle1',
is_connected = True,
number_of_substeps = 5,
compute = lambda state: ((state['absolute_permittivity'] * (- gradient(((((numpy.log((((divergence(state['displacement'], self.space) / state['elementary_charge']) - state['doping_profile']) / state['band_density'])) * (state['boltzmann_constant'] * state['temperature'])) + state['band_energy']) / state['elementary_charge']) + state['quasifermi_potential']), self.space)))),
substeps = [lambda state: (divergence(state['displacement'], self.space)),lambda state: (((state['charge_density'] / state['elementary_charge']) - state['doping_profile'])),lambda state: (((((numpy.log((state['electron_density'] / state['band_density'])) * (state['boltzmann_constant'] * state['temperature'])) + state['band_energy']) / state['elementary_charge']) + state['quasifermi_potential'])),lambda state: ((- gradient(state['electrostatic_potential'], self.space))),lambda state: ((state['absolute_permittivity'] * state['electric_field']))],
law_quantity_pairs = [('gauss_law', 'charge_density'),('charge_density_law', 'electron_density'),('electron_density_law', 'electrostatic_potential'),('electric_field_law', 'electric_field'),('displacement_relation', 'displacement')],
used_quantities = ['quasifermi_potential' ,'elementary_charge' ,'band_energy' ,'temperature' ,'boltzmann_constant' ,'band_density' ,'doping_profile' ,'displacement' ,'absolute_permittivity'],
is_cyclic = False
)