Add poynting halves

maybe will remove this later... dunno if it's actually useful
This commit is contained in:
Jan Petykiewicz 2019-07-30 00:33:07 -07:00
parent cf0db63a3f
commit 23d65d6ebb

View File

@ -83,6 +83,7 @@ class Simulation(object):
queue: pyopencl.CommandQueue = None, queue: pyopencl.CommandQueue = None,
float_type: numpy.float32 or numpy.float64 = numpy.float32, float_type: numpy.float32 or numpy.float64 = numpy.float32,
do_poynting: bool = True, do_poynting: bool = True,
do_poynting_halves = False,
do_fieldsrc: bool = False): do_fieldsrc: bool = False):
""" """
Initialize the simulation. Initialize the simulation.
@ -119,6 +120,7 @@ class Simulation(object):
in complexity. in complexity.
* GPU memory requirements are approximately doubled, since S and the intermediate * GPU memory requirements are approximately doubled, since S and the intermediate
products must be stored. products must be stored.
:param do_poynting_halves: TODO DOCUMENT
""" """
if initial_fields is None: if initial_fields is None:
initial_fields = {} initial_fields = {}
@ -202,6 +204,7 @@ class Simulation(object):
'common_header': common_source, 'common_header': common_source,
'pmls': pmls, 'pmls': pmls,
'do_poynting': do_poynting, 'do_poynting': do_poynting,
'do_poynting_halves': do_poynting_halves,
'bloch': bloch_boundaries, 'bloch': bloch_boundaries,
'uniform_dx': uniform_dx, 'uniform_dx': uniform_dx,
} }
@ -227,6 +230,12 @@ class Simulation(object):
if do_poynting: if do_poynting:
self.S = pyopencl.array.zeros_like(self.E) self.S = pyopencl.array.zeros_like(self.E)
S_fields[ptr('S')] = self.S S_fields[ptr('S')] = self.S
if do_poynting_halves:
self.S0 = pyopencl.array.zeros_like(self.E)
self.S1 = pyopencl.array.zeros_like(self.E)
S_fields[ptr('S0')] = self.S0
S_fields[ptr('S1')] = self.S1
J_fields = OrderedDict() J_fields = OrderedDict()
if do_fieldsrc: if do_fieldsrc: