forked from jan/opencl_fdtd
rename lib
This commit is contained in:
parent
c1750e9fde
commit
0d91f0d43e
7
fdtd.py
7
fdtd.py
@ -8,10 +8,10 @@ import sys
|
||||
import time
|
||||
|
||||
import numpy
|
||||
import lzma
|
||||
import lzma
|
||||
import dill
|
||||
|
||||
from fdtd.simulation import Simulation
|
||||
from opencl_fdtd import Simulation
|
||||
from masque import Pattern, shapes
|
||||
import gridlock
|
||||
import pcgen
|
||||
@ -133,7 +133,7 @@ def main():
|
||||
def field_source(i):
|
||||
t0 = i * sim.dt - delay
|
||||
return numpy.sin(w * t0) * numpy.exp(-alpha * t0**2)
|
||||
|
||||
|
||||
with open('sources.c', 'w') as f:
|
||||
f.write(sim.sources['E'])
|
||||
f.write('\n==========================================\n')
|
||||
@ -172,5 +172,6 @@ def main():
|
||||
d['S'] = unvec(sim.S.get())
|
||||
dill.dump(d, f)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
1
opencl_fdtd/__init__.py
Normal file
1
opencl_fdtd/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .simulation import Simulation, type_to_C
|
@ -152,7 +152,7 @@ class Simulation(object):
|
||||
S_fields[ptr('oS')] = self.oS
|
||||
S_fields[ptr('S')] = self.S
|
||||
else:
|
||||
S_fields = OrderedDict()
|
||||
S_fields = OrderedDict()
|
||||
|
||||
'''
|
||||
PML
|
||||
@ -167,7 +167,7 @@ class Simulation(object):
|
||||
p0 = numpy.exp(-(sigma + alpha) * dt)
|
||||
p1 = sigma / (sigma + alpha) * (p0 - 1)
|
||||
return p0, p1
|
||||
|
||||
|
||||
xen, xep, xhn, xhp = (numpy.arange(1, pml_thickness + 1, dtype=float_type)[::-1] for _ in range(4))
|
||||
xep -= 0.5
|
||||
xhn -= 0.5
|
||||
@ -190,7 +190,7 @@ class Simulation(object):
|
||||
for ne, nh in zip(*psi_names):
|
||||
pml_e_fields[ptr(ne)] = pyopencl.array.zeros(self.queue, tuple(psi_shape), dtype=self.arg_type)
|
||||
pml_h_fields[ptr(nh)] = pyopencl.array.zeros(self.queue, tuple(psi_shape), dtype=self.arg_type)
|
||||
|
||||
|
||||
self.pml_e_fields = pml_e_fields
|
||||
self.pml_h_fields = pml_h_fields
|
||||
|
Loading…
Reference in New Issue
Block a user