This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
from convention import * |
| 4 |
import_convention(globals()) |
| 5 |
|
| 6 |
import fdtd |
| 7 |
|
| 8 |
|
| 9 |
class FDTD(object): |
| 10 |
|
| 11 |
@classmethod |
| 12 |
def next_efield(self, previous_efield, previous_hfield, step = {"time":2, "space":2}): |
| 13 |
|
| 14 |
current_efield = numpy.zeros_like(previous_hfield) |
| 15 |
# print step["time_step"] |
| 16 |
|
| 17 |
for location in current_efield: |
| 18 |
current_efield[location] = previous_efield[location] + (previous_hfield[location+1] - previous_hfield[location-1]) * step["space"] / step["time"] |
| 19 |
# main algorithm |
| 20 |
# half-completed |
| 21 |
return current_efield |
| 22 |
|
| 23 |
|
| 24 |
@classmethod |
| 25 |
def next_hfield(self, previous_efield, step = {"time":2, "space":2}): |
| 26 |
current_hfield |
| 27 |
return current_hfield |
| 28 |
|
| 29 |
|
| 30 |
previous_fieid_array = numpy.zeros(100) |
| 31 |
two_previous_fieldarray = numpy.zeros(100) |
| 32 |
|
| 33 |
print previous_fieid_array |
| 34 |
print FDTD.next_efield(two_previous_fieldarray, two_previous_fieldarray) |