Sources now use pre-calculated waveform values that are stored in an array, instead of being calculated on-the-fly.

这个提交包含在:
Craig Warren
2017-02-21 12:49:10 +00:00
父节点 a8df199415
当前提交 a28bea41c1

查看文件

@@ -132,6 +132,8 @@ def process_multicmds(multicmds, G):
v.stop = G.timewindow
startstop = ' '
v.calculate_waveform_values(G)
if G.messages:
print('Voltage source with polarity {} at {:g}m, {:g}m, {:g}m, resistance {:.1f} Ohms,'.format(v.polarisation, v.xcoord * G.dx, v.ycoord * G.dy, v.zcoord * G.dz, v.resistance) + startstop + 'using waveform {} created.'.format(v.waveformID))
@@ -164,7 +166,7 @@ def process_multicmds(multicmds, G):
h = HertzianDipole()
h.polarisation = polarisation
# Set length of dipole to grid size in polaristion direction
# Set length of dipole to grid size in polarisation direction
if h.polarisation == 'x':
h.dl = G.dx
elif h.polarisation == 'y':
@@ -202,6 +204,8 @@ def process_multicmds(multicmds, G):
h.stop = G.timewindow
startstop = ' '
h.calculate_waveform_values(G)
if G.messages:
if G.dimension == '2D':
print('Hertzian dipole is a line source in 2D with polarity {} at {:g}m, {:g}m, {:g}m,'.format(h.polarisation, h.xcoord * G.dx, h.ycoord * G.dy, h.zcoord * G.dz) + startstop + 'using waveform {} created.'.format(h.waveformID))
@@ -266,6 +270,8 @@ def process_multicmds(multicmds, G):
m.stop = G.timewindow
startstop = ' '
m.calculate_waveform_values(G)
if G.messages:
print('Magnetic dipole with polarity {} at {:g}m, {:g}m, {:g}m,'.format(m.polarisation, m.xcoord * G.dx, m.ycoord * G.dy, m.zcoord * G.dz) + startstop + 'using waveform {} created.'.format(m.waveformID))
@@ -307,7 +313,6 @@ def process_multicmds(multicmds, G):
t.ID = t.__class__.__name__ + '(' + str(t.xcoord) + ',' + str(t.ycoord) + ',' + str(t.zcoord) + ')'
t.resistance = resistance
t.waveformID = tmp[5]
t.calculate_incident_V_I(G)
if len(tmp) > 6:
# Check source start & source remove time parameters
@@ -330,6 +335,9 @@ def process_multicmds(multicmds, G):
t.stop = G.timewindow
startstop = ' '
t.calculate_waveform_values(G)
t.calculate_incident_V_I(G)
if G.messages:
print('Transmission line with polarity {} at {:g}m, {:g}m, {:g}m, resistance {:.1f} Ohms,'.format(t.polarisation, t.xcoord * G.dx, t.ycoord * G.dy, t.zcoord * G.dz, t.resistance) + startstop + 'using waveform {} created.'.format(t.waveformID))
@@ -359,19 +367,21 @@ def process_multicmds(multicmds, G):
r.ycoordorigin = ycoord
r.zcoordorigin = zcoord
# If no ID or outputs are specified, use default i.e Ex, Ey, Ez, Hx, Hy, Hz, Ix, Iy, Iz
# If no ID or outputs are specified, use default
if len(tmp) == 3:
r.ID = r.__class__.__name__ + '(' + str(r.xcoord) + ',' + str(r.ycoord) + ',' + str(r.zcoord) + ')'
for key in Rx.defaultoutputs:
r.outputs[key] = np.zeros(G.iterations, dtype=floattype)
else:
r.ID = tmp[3]
# Get allowable outputs
allowableoutputs = Rx.allowableoutputs
# Check and add field output names
for field in tmp[4::]:
if field in Rx.availableoutputs:
if field in allowableoutputs:
r.outputs[field] = np.zeros(G.iterations, dtype=floattype)
else:
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' contains an output type that is not available')
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' contains an output type that is not allowable. Allowable outputs in current context are {}'.format(allowableoutputs))
if G.messages:
print('Receiver at {:g}m, {:g}m, {:g}m with output component(s) {} created.'.format(r.xcoord * G.dx, r.ycoord * G.dy, r.zcoord * G.dz, ', '.join(r.outputs)))