Updates for version 3.1.0 - Big Smoke. These updates are predominately to enable gprMax to be run on GPUs using NVIDIA CUDA.

这个提交包含在:
Craig Warren
2017-06-19 16:24:08 +01:00
父节点 939a6322a1
当前提交 3c8e5bab1b
共有 41 个文件被更改,包括 3282 次插入73 次删除

查看文件

@@ -215,6 +215,52 @@ class MagneticDipole(Source):
Hz[i, j, k] -= updatecoeffsH[ID[G.IDlookup[componentID], i, j, k], 4] * self.waveformvaluesM[iteration] * (1 / (G.dx * G.dy * G.dz))
def gpu_initialise_src_arrays(sources, G):
"""Initialise arrays on GPU for source coordinates/polarisation, other source information, and source waveform values.
Args:
sources (list): List of sources of one class, e.g. HertzianDipoles.
G (class): Grid class instance - holds essential parameters describing the model.
Returns:
srcinfo1_gpu (int): numpy array of source cell coordinates and polarisation information.
srcinfo2_gpu (float): numpy array of other source information, e.g. length, resistance etc...
srcwaves_gpu (float): numpy array of source waveform values.
"""
import pycuda.gpuarray as gpuarray
srcinfo1 = np.zeros((len(sources), 4), dtype=np.int32)
srcinfo2 = np.zeros((len(sources)), dtype=floattype)
srcwaves = np.zeros((len(sources), G.iterations), dtype=floattype)
for i, src in enumerate(sources):
srcinfo1[i, 0] = src.xcoord
srcinfo1[i, 1] = src.ycoord
srcinfo1[i, 2] = src.zcoord
if src.polarisation == 'x':
srcinfo1[i, 3] = 0
elif src.polarisation == 'y':
srcinfo1[i, 3] = 1
elif src.polarisation == 'z':
srcinfo1[i, 3] = 2
if src.__class__.__name__ == 'HertzianDipole':
srcinfo2[i] = src.dl
srcwaves[i, :] = src.waveformvaluesJ
elif src.__class__.__name__ == 'VoltageSource':
srcinfo2[i] = src.resistance
srcwaves[i, :] = src.waveformvaluesJ
elif src.__class__.__name__ == 'MagneticDipole':
srcwaves[i, :] = src.waveformvaluesM
srcinfo1_gpu = gpuarray.to_gpu(srcinfo1)
srcinfo2_gpu = gpuarray.to_gpu(srcinfo2)
srcwaves_gpu = gpuarray.to_gpu(srcwaves)
return srcinfo1_gpu, srcinfo2_gpu, srcwaves_gpu
class TransmissionLine(Source):
"""
A transmission line source is a one-dimensional transmission