你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-06 12:36:51 +08:00
Rationalised some variable names.
这个提交包含在:
@@ -403,32 +403,32 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
|
||||
for source in G.voltagesources:
|
||||
if source.resistance != 0:
|
||||
if source.polarisation == 'x':
|
||||
requirednumID = G.ID[0, source.positionx, source.positiony, source.positionz]
|
||||
requirednumID = G.ID[0, source.xcoord, source.ycoord, source.zcoord]
|
||||
material = next(x for x in G.materials if x.numID == requirednumID)
|
||||
newmaterial = deepcopy(material)
|
||||
newmaterial.ID = material.ID + '+VoltageSource_' + str(source.resistance)
|
||||
newmaterial.numID = len(G.materials)
|
||||
newmaterial.se += G.dx / (source.resistance * G.dy * G.dz)
|
||||
newmaterial.average = False
|
||||
G.ID[0, source.positionx, source.positiony, source.positionz] = newmaterial.numID
|
||||
G.ID[0, source.xcoord, source.ycoord, source.zcoord] = newmaterial.numID
|
||||
elif source.polarisation == 'y':
|
||||
requirednumID = G.ID[1, source.positionx, source.positiony, source.positionz]
|
||||
requirednumID = G.ID[1, source.xcoord, source.ycoord, source.zcoord]
|
||||
material = next(x for x in G.materials if x.numID == requirednumID)
|
||||
newmaterial = deepcopy(material)
|
||||
newmaterial.ID = material.ID + '+VoltageSource_' + str(source.resistance)
|
||||
newmaterial.numID = len(G.materials)
|
||||
newmaterial.se += G.dy / (source.resistance * G.dx * G.dz)
|
||||
newmaterial.average = False
|
||||
G.ID[1, source.positionx, source.positiony, source.positionz] = newmaterial.numID
|
||||
G.ID[1, source.xcoord, source.ycoord, source.zcoord] = newmaterial.numID
|
||||
elif source.polarisation == 'z':
|
||||
requirednumID = G.ID[2, source.positionx, source.positiony, source.positionz]
|
||||
requirednumID = G.ID[2, source.xcoord, source.ycoord, source.zcoord]
|
||||
material = next(x for x in G.materials if x.numID == requirednumID)
|
||||
newmaterial = deepcopy(material)
|
||||
newmaterial.ID = material.ID + '+VoltageSource_' + str(source.resistance)
|
||||
newmaterial.numID = len(G.materials)
|
||||
newmaterial.se += G.dz / (source.resistance * G.dx * G.dy)
|
||||
newmaterial.average = False
|
||||
G.ID[2, source.positionx, source.positiony, source.positionz] = newmaterial.numID
|
||||
G.ID[2, source.xcoord, source.ycoord, source.zcoord] = newmaterial.numID
|
||||
G.materials.append(newmaterial)
|
||||
|
||||
# Initialise arrays for storing temporary values if there are any dispersive materials
|
||||
@@ -496,14 +496,14 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
|
||||
# Adjust position of sources and receivers if required
|
||||
if G.srcstepx > 0 or G.srcstepy > 0 or G.srcstepz > 0:
|
||||
for source in itertools.chain(G.hertziandipoles, G.magneticdipoles, G.voltagesources):
|
||||
source.positionx += (modelrun - 1) * G.srcstepx
|
||||
source.positiony += (modelrun - 1) * G.srcstepy
|
||||
source.positionz += (modelrun - 1) * G.srcstepz
|
||||
source.xcoord += (modelrun - 1) * G.srcstepx
|
||||
source.ycoord += (modelrun - 1) * G.srcstepy
|
||||
source.zcoord += (modelrun - 1) * G.srcstepz
|
||||
if G.rxstepx > 0 or G.rxstepy > 0 or G.rxstepz > 0:
|
||||
for receiver in G.rxs:
|
||||
receiver.positionx += (modelrun - 1) * G.rxstepx
|
||||
receiver.positiony += (modelrun - 1) * G.rxstepy
|
||||
receiver.positionz += (modelrun - 1) * G.rxstepz
|
||||
receiver.xcoord += (modelrun - 1) * G.rxstepx
|
||||
receiver.ycoord += (modelrun - 1) * G.rxstepy
|
||||
receiver.zcoord += (modelrun - 1) * G.rxstepz
|
||||
|
||||
##################################
|
||||
# Main FDTD calculation loop #
|
||||
|
@@ -73,17 +73,17 @@ def process_multicmds(multicmds, G):
|
||||
# Check polarity & position parameters
|
||||
if tmp[0].lower() not in ('x', 'y', 'z'):
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' polarisation must be x, y, or z')
|
||||
positionx = round_value(float(tmp[1])/G.dx)
|
||||
positiony = round_value(float(tmp[2])/G.dy)
|
||||
positionz = round_value(float(tmp[3])/G.dz)
|
||||
xcoord = round_value(float(tmp[1])/G.dx)
|
||||
ycoord = round_value(float(tmp[2])/G.dy)
|
||||
zcoord = round_value(float(tmp[3])/G.dz)
|
||||
resistance = float(tmp[4])
|
||||
if positionx < 0 or positionx >= G.nx:
|
||||
if xcoord < 0 or xcoord >= G.nx:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' x-coordinate is not within the model domain')
|
||||
if positiony < 0 or positiony >= G.ny:
|
||||
if ycoord < 0 or ycoord >= G.ny:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' y-coordinate is not within the model domain')
|
||||
if positionz < 0 or positionz >= G.nz:
|
||||
if zcoord < 0 or zcoord >= G.nz:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' z-coordinate is not within the model domain')
|
||||
if positionx < G.pmlthickness[0] or positionx > G.nx - G.pmlthickness[3] or positiony < G.pmlthickness[1] or positiony > G.ny - G.pmlthickness[4] or positionz < G.pmlthickness[2] or positionz > G.nz - G.pmlthickness[5]:
|
||||
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
|
||||
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.')
|
||||
if resistance < 0:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires a source resistance of zero or greater')
|
||||
@@ -94,9 +94,9 @@ def process_multicmds(multicmds, G):
|
||||
|
||||
v = VoltageSource()
|
||||
v.polarisation= tmp[0]
|
||||
v.positionx = positionx
|
||||
v.positiony = positiony
|
||||
v.positionz = positionz
|
||||
v.xcoord = xcoord
|
||||
v.ycoord = ycoord
|
||||
v.zcoord = zcoord
|
||||
v.resistance = resistance
|
||||
v.waveformID = tmp[5]
|
||||
|
||||
@@ -120,7 +120,7 @@ def process_multicmds(multicmds, G):
|
||||
startstop = ' '
|
||||
|
||||
if G.messages:
|
||||
print('Voltage source with polarity {} at {:g}m, {:g}m, {:g}m, resistance {:.1f} Ohms,'.format(v.polarisation, v.positionx * G.dx, v.positiony * G.dy, v.positionz * G.dz, v.resistance) + startstop + 'using waveform {} created.'.format(v.waveformID))
|
||||
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))
|
||||
|
||||
G.voltagesources.append(v)
|
||||
|
||||
@@ -136,16 +136,16 @@ def process_multicmds(multicmds, G):
|
||||
# Check polarity & position parameters
|
||||
if tmp[0].lower() not in ('x', 'y', 'z'):
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' polarisation must be x, y, or z')
|
||||
positionx = round_value(float(tmp[1])/G.dx)
|
||||
positiony = round_value(float(tmp[2])/G.dy)
|
||||
positionz = round_value(float(tmp[3])/G.dz)
|
||||
if positionx < 0 or positionx >= G.nx:
|
||||
xcoord = round_value(float(tmp[1])/G.dx)
|
||||
ycoord = round_value(float(tmp[2])/G.dy)
|
||||
zcoord = round_value(float(tmp[3])/G.dz)
|
||||
if xcoord < 0 or xcoord >= G.nx:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' x-coordinate is not within the model domain')
|
||||
if positiony < 0 or positiony >= G.ny:
|
||||
if ycoord < 0 or ycoord >= G.ny:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' y-coordinate is not within the model domain')
|
||||
if positionz < 0 or positionz >= G.nz:
|
||||
if zcoord < 0 or zcoord >= G.nz:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' z-coordinate is not within the model domain')
|
||||
if positionx < G.pmlthickness[0] or positionx > G.nx - G.pmlthickness[3] or positiony < G.pmlthickness[1] or positiony > G.ny - G.pmlthickness[4] or positionz < G.pmlthickness[2] or positionz > G.nz - G.pmlthickness[5]:
|
||||
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
|
||||
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.')
|
||||
|
||||
# Check if there is a waveformID in the waveforms list
|
||||
@@ -154,9 +154,9 @@ def process_multicmds(multicmds, G):
|
||||
|
||||
h = HertzianDipole()
|
||||
h.polarisation = tmp[0]
|
||||
h.positionx = positionx
|
||||
h.positiony = positiony
|
||||
h.positionz = positionz
|
||||
h.xcoord = xcoord
|
||||
h.ycoord = ycoord
|
||||
h.zcoord = zcoord
|
||||
h.waveformID = tmp[4]
|
||||
|
||||
if len(tmp) > 5:
|
||||
@@ -179,7 +179,7 @@ def process_multicmds(multicmds, G):
|
||||
startstop = ' '
|
||||
|
||||
if G.messages:
|
||||
print('Hertzian dipole with polarity {} at {:g}m, {:g}m, {:g}m,'.format(h.polarisation, h.positionx * G.dx, h.positiony * G.dy, h.positionz * G.dz) + startstop + 'using waveform {} created.'.format(h.waveformID))
|
||||
print('Hertzian dipole 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))
|
||||
|
||||
G.hertziandipoles.append(h)
|
||||
|
||||
@@ -195,16 +195,16 @@ def process_multicmds(multicmds, G):
|
||||
# Check polarity & position parameters
|
||||
if tmp[0].lower() not in ('x', 'y', 'z'):
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' polarisation must be x, y, or z')
|
||||
positionx = round_value(float(tmp[1])/G.dx)
|
||||
positiony = round_value(float(tmp[2])/G.dy)
|
||||
positionz = round_value(float(tmp[3])/G.dz)
|
||||
if positionx < 0 or positionx >= G.nx:
|
||||
xcoord = round_value(float(tmp[1])/G.dx)
|
||||
ycoord = round_value(float(tmp[2])/G.dy)
|
||||
zcoord = round_value(float(tmp[3])/G.dz)
|
||||
if xcoord < 0 or xcoord >= G.nx:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' x-coordinate is not within the model domain')
|
||||
if positiony < 0 or positiony >= G.ny:
|
||||
if ycoord < 0 or ycoord >= G.ny:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' y-coordinate is not within the model domain')
|
||||
if positionz < 0 or positionz >= G.nz:
|
||||
if zcoord < 0 or zcoord >= G.nz:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' z-coordinate is not within the model domain')
|
||||
if positionx < G.pmlthickness[0] or positionx > G.nx - G.pmlthickness[3] or positiony < G.pmlthickness[1] or positiony > G.ny - G.pmlthickness[4] or positionz < G.pmlthickness[2] or positionz > G.nz - G.pmlthickness[5]:
|
||||
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
|
||||
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.')
|
||||
|
||||
# Check if there is a waveformID in the waveforms list
|
||||
@@ -213,9 +213,9 @@ def process_multicmds(multicmds, G):
|
||||
|
||||
m = MagneticDipole()
|
||||
m.polarisation = tmp[0]
|
||||
m.positionx = positionx
|
||||
m.positiony = positiony
|
||||
m.positionz = positionz
|
||||
m.xcoord = xcoord
|
||||
m.ycoord = ycoord
|
||||
m.zcoord = zcoord
|
||||
m.waveformID = tmp[4]
|
||||
|
||||
if len(tmp) > 5:
|
||||
@@ -238,7 +238,7 @@ def process_multicmds(multicmds, G):
|
||||
startstop = ' '
|
||||
|
||||
if G.messages:
|
||||
print('Magnetic dipole with polarity {} at {:g}m, {:g}m, {:g}m,'.format(m.polarisation, m.positionx * G.dx, m.positiony * G.dy, m.positionz * G.dz) + startstop + 'using waveform {} created.'.format(m.waveformID))
|
||||
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))
|
||||
|
||||
G.magneticdipoles.append(m)
|
||||
|
||||
@@ -254,17 +254,17 @@ def process_multicmds(multicmds, G):
|
||||
# Check polarity & position parameters
|
||||
if tmp[0].lower() not in ('x', 'y', 'z'):
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' polarisation must be x, y, or z')
|
||||
positionx = round_value(float(tmp[1])/G.dx)
|
||||
positiony = round_value(float(tmp[2])/G.dy)
|
||||
positionz = round_value(float(tmp[3])/G.dz)
|
||||
xcoord = round_value(float(tmp[1])/G.dx)
|
||||
ycoord = round_value(float(tmp[2])/G.dy)
|
||||
zcoord = round_value(float(tmp[3])/G.dz)
|
||||
resistance = float(tmp[4])
|
||||
if positionx < 0 or positionx >= G.nx:
|
||||
if xcoord < 0 or xcoord >= G.nx:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' x-coordinate is not within the model domain')
|
||||
if positiony < 0 or positiony >= G.ny:
|
||||
if ycoord < 0 or ycoord >= G.ny:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' y-coordinate is not within the model domain')
|
||||
if positionz < 0 or positionz >= G.nz:
|
||||
if zcoord < 0 or zcoord >= G.nz:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' z-coordinate is not within the model domain')
|
||||
if positionx < G.pmlthickness[0] or positionx > G.nx - G.pmlthickness[3] or positiony < G.pmlthickness[1] or positiony > G.ny - G.pmlthickness[4] or positionz < G.pmlthickness[2] or positionz > G.nz - G.pmlthickness[5]:
|
||||
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
|
||||
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.')
|
||||
if resistance <= 0 or resistance > z0:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires a resistance greater than zero and less than the impedance of free space, i.e. 376.73 Ohms')
|
||||
@@ -275,9 +275,9 @@ def process_multicmds(multicmds, G):
|
||||
|
||||
t = TransmissionLine(G)
|
||||
t.polarisation = tmp[0]
|
||||
t.positionx = positionx
|
||||
t.positiony = positiony
|
||||
t.positionz = positionz
|
||||
t.xcoord = xcoord
|
||||
t.ycoord = ycoord
|
||||
t.zcoord = zcoord
|
||||
t.resistance = resistance
|
||||
t.waveformID = tmp[5]
|
||||
t.calculate_incident_V_I(G)
|
||||
@@ -302,7 +302,7 @@ def process_multicmds(multicmds, G):
|
||||
startstop = ' '
|
||||
|
||||
if G.messages:
|
||||
print('Transmission line with polarity {} at {:g}m, {:g}m, {:g}m, resistance {:.1f} Ohms,'.format(t.polarisation, t.positionx * G.dx, t.positiony * G.dy, t.positionz * G.dz, t.resistance) + startstop + 'using waveform {} created.'.format(t.waveformID))
|
||||
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))
|
||||
|
||||
G.transmissionlines.append(t)
|
||||
|
||||
@@ -316,19 +316,19 @@ def process_multicmds(multicmds, G):
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' has an incorrect number of parameters')
|
||||
|
||||
# Check position parameters
|
||||
positionx = round_value(float(tmp[0])/G.dx)
|
||||
positiony = round_value(float(tmp[1])/G.dy)
|
||||
positionz = round_value(float(tmp[2])/G.dz)
|
||||
if positionx < 0 or positionx >= G.nx:
|
||||
xcoord = round_value(float(tmp[0])/G.dx)
|
||||
ycoord = round_value(float(tmp[1])/G.dy)
|
||||
zcoord = round_value(float(tmp[2])/G.dz)
|
||||
if xcoord < 0 or xcoord >= G.nx:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' x-coordinate is not within the model domain')
|
||||
if positiony < 0 or positiony >= G.ny:
|
||||
if ycoord < 0 or ycoord >= G.ny:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' y-coordinate is not within the model domain')
|
||||
if positionz < 0 or positionz >= G.nz:
|
||||
if zcoord < 0 or zcoord >= G.nz:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' z-coordinate is not within the model domain')
|
||||
if positionx < G.pmlthickness[0] or positionx > G.nx - G.pmlthickness[3] or positiony < G.pmlthickness[1] or positiony > G.ny - G.pmlthickness[4] or positionz < G.pmlthickness[2] or positionz > G.nz - G.pmlthickness[5]:
|
||||
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
|
||||
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.')
|
||||
|
||||
r = Rx(positionx=positionx, positiony=positiony, positionz=positionz)
|
||||
r = Rx(xcoord=xcoord, ycoord=ycoord, zcoord=zcoord)
|
||||
|
||||
# If no ID or outputs are specified, use default i.e Ex, Ey, Ez, Hx, Hy, Hz, Ix, Iy, Iz
|
||||
if len(tmp) == 3:
|
||||
@@ -343,7 +343,7 @@ def process_multicmds(multicmds, G):
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' contains an output type that is not available')
|
||||
|
||||
if G.messages:
|
||||
print('Receiver at {:g}m, {:g}m, {:g}m with output(s) {} created.'.format(r.positionx * G.dx, r.positiony * G.dy, r.positionz * G.dz, ', '.join(r.outputs)))
|
||||
print('Receiver at {:g}m, {:g}m, {:g}m with output(s) {} created.'.format(r.xcoord * G.dx, r.ycoord * G.dy, r.zcoord * G.dz, ', '.join(r.outputs)))
|
||||
|
||||
G.rxs.append(r)
|
||||
|
||||
@@ -378,7 +378,7 @@ def process_multicmds(multicmds, G):
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' the lower z-coordinate {:g}m is not within the model domain'.format(zs))
|
||||
if zf < 0 or zf >= G.nz:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' the upper z-coordinate {:g}m is not within the model domain'.format(zf))
|
||||
if positionx < G.pmlthickness[0] or positionx > G.nx - G.pmlthickness[3] or positiony < G.pmlthickness[1] or positiony > G.ny - G.pmlthickness[4] or positionz < G.pmlthickness[2] or positionz > G.nz - G.pmlthickness[5]:
|
||||
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
|
||||
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.')
|
||||
if xs >= xf or ys >= yf or zs >= zf:
|
||||
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' the lower coordinates should be less than the upper coordinates')
|
||||
@@ -390,7 +390,7 @@ def process_multicmds(multicmds, G):
|
||||
for x in range(xs, xf, dx):
|
||||
for y in range(ys, yf, dy):
|
||||
for z in range(zs, zf, dz):
|
||||
r = Rx(positionx=x, positiony=y, positionz=z)
|
||||
r = Rx(xcoord=x, ycoord=y, zcoord=z)
|
||||
G.rxs.append(r)
|
||||
|
||||
if G.messages:
|
||||
|
@@ -52,13 +52,13 @@ def prepare_output_file(outputfile, G):
|
||||
for srcindex, src in enumerate(srclist):
|
||||
grp = f.create_group('/srcs/src' + str(srcindex + 1))
|
||||
grp.attrs['Type'] = type(src).__name__
|
||||
grp.attrs['Position'] = (src.positionx * G.dx, src.positiony * G.dy, src.positionz * G.dz)
|
||||
grp.attrs['Position'] = (src.xcoord * G.dx, src.ycoord * G.dy, src.zcoord * G.dz)
|
||||
|
||||
# Create group for transmission lines; add positional data, line resistance and line discretisation attributes; initialise arrays for line voltages and currents
|
||||
if G.transmissionlines:
|
||||
for tlindex, tl in enumerate(G.transmissionlines):
|
||||
grp = f.create_group('/tls/tl' + str(tlindex + 1))
|
||||
grp.attrs['Position'] = (tl.positionx * G.dx, tl.positiony * G.dy, tl.positionz * G.dz)
|
||||
grp.attrs['Position'] = (tl.xcoord * G.dx, tl.ycoord * G.dy, tl.zcoord * G.dz)
|
||||
grp.attrs['Resistance'] = tl.resistance
|
||||
grp.attrs['dl'] = tl.dl
|
||||
# Save incident voltage and current
|
||||
@@ -72,7 +72,7 @@ def prepare_output_file(outputfile, G):
|
||||
grp = f.create_group('/rxs/rx' + str(rxindex + 1))
|
||||
if rx.ID:
|
||||
grp.attrs['Name'] = rx.ID
|
||||
grp.attrs['Position'] = (rx.positionx * G.dx, rx.positiony * G.dy, rx.positionz * G.dz)
|
||||
grp.attrs['Position'] = (rx.xcoord * G.dx, rx.ycoord * G.dy, rx.zcoord * G.dz)
|
||||
for output in rx.outputs:
|
||||
grp.create_dataset(output, (G.iterations, ), dtype=floattype)
|
||||
|
||||
@@ -92,23 +92,23 @@ def write_output(f, timestep, Ex, Ey, Ez, Hx, Hy, Hz, G):
|
||||
# For each rx, write field component values at current timestep
|
||||
for rxindex, rx in enumerate(G.rxs):
|
||||
if 'Ex' in rx.outputs:
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Ex'][timestep] = Ex[rx.positionx, rx.positiony, rx.positionz]
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Ex'][timestep] = Ex[rx.xcoord, rx.ycoord, rx.zcoord]
|
||||
if 'Ey' in rx.outputs:
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Ey'][timestep] = Ey[rx.positionx, rx.positiony, rx.positionz]
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Ey'][timestep] = Ey[rx.xcoord, rx.ycoord, rx.zcoord]
|
||||
if 'Ez' in rx.outputs:
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Ez'][timestep] = Ez[rx.positionx, rx.positiony, rx.positionz]
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Ez'][timestep] = Ez[rx.xcoord, rx.ycoord, rx.zcoord]
|
||||
if 'Hx' in rx.outputs:
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Hx'][timestep] = Hx[rx.positionx, rx.positiony, rx.positionz]
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Hx'][timestep] = Hx[rx.xcoord, rx.ycoord, rx.zcoord]
|
||||
if 'Hy' in rx.outputs:
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Hy'][timestep] = Hy[rx.positionx, rx.positiony, rx.positionz]
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Hy'][timestep] = Hy[rx.xcoord, rx.ycoord, rx.zcoord]
|
||||
if 'Hz' in rx.outputs:
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Hz'][timestep] = Hz[rx.positionx, rx.positiony, rx.positionz]
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Hz'][timestep] = Hz[rx.xcoord, rx.ycoord, rx.zcoord]
|
||||
if 'Ix' in rx.outputs:
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Ix'][timestep] = Ix(rx.positionx, rx.positiony, rx.positionz, G.Hy, G.Hz, G)
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Ix'][timestep] = Ix(rx.xcoord, rx.ycoord, rx.zcoord, G.Hy, G.Hz, G)
|
||||
if 'Iy' in rx.outputs:
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Iy'][timestep] = Iy(rx.positionx, rx.positiony, rx.positionz, G.Hx, G.Hz, G)
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Iy'][timestep] = Iy(rx.xcoord, rx.ycoord, rx.zcoord, G.Hx, G.Hz, G)
|
||||
if 'Iz' in rx.outputs:
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Iz'][timestep] = Iz(rx.positionx, rx.positiony, rx.positionz, G.Hx, G.Hy, G)
|
||||
f['/rxs/rx' + str(rxindex + 1) + '/Iz'][timestep] = Iz(rx.xcoord, rx.ycoord, rx.zcoord, G.Hx, G.Hy, G)
|
||||
|
||||
if G.transmissionlines:
|
||||
for tlindex, tl in enumerate(G.transmissionlines):
|
||||
|
@@ -21,16 +21,16 @@ class Rx:
|
||||
|
||||
availableoutputs = ['Ex', 'Ey', 'Ez', 'Hx', 'Hy', 'Hz', 'Ix', 'Iy', 'Iz']
|
||||
|
||||
def __init__(self, positionx=None, positiony=None, positionz=None):
|
||||
def __init__(self, xcoord=None, ycoord=None, zcoord=None):
|
||||
"""
|
||||
Args:
|
||||
positionx (float): x-coordinate of location in model.
|
||||
positiony (float): y-coordinate of location in model.
|
||||
positionz (float): z-coordinate of location in model.
|
||||
xcoord (float): x-coordinate of location in model.
|
||||
ycoord (float): y-coordinate of location in model.
|
||||
zcoord (float): z-coordinate of location in model.
|
||||
"""
|
||||
|
||||
self.ID = None
|
||||
self.outputs = []
|
||||
self.positionx = positionx
|
||||
self.positiony = positiony
|
||||
self.positionz = positionz
|
||||
self.xcoord = xcoord
|
||||
self.ycoord = ycoord
|
||||
self.zcoord = zcoord
|
@@ -28,9 +28,9 @@ class VoltageSource:
|
||||
|
||||
def __init__(self):
|
||||
self.polarisation = None
|
||||
self.positionx = None
|
||||
self.positiony = None
|
||||
self.positionz = None
|
||||
self.xcoord = None
|
||||
self.ycoord = None
|
||||
self.zcoord = None
|
||||
self.start = None
|
||||
self.stop = None
|
||||
self.resistance = None
|
||||
@@ -50,9 +50,9 @@ class VoltageSource:
|
||||
if abstime >= self.start and abstime <= self.stop:
|
||||
# Set the time of the waveform evaluation to account for any delay in the start
|
||||
time = abstime - self.start
|
||||
i = self.positionx
|
||||
j = self.positiony
|
||||
k = self.positionz
|
||||
i = self.xcoord
|
||||
j = self.ycoord
|
||||
k = self.zcoord
|
||||
waveform = next(x for x in G.waveforms if x.ID == self.waveformID)
|
||||
|
||||
if self.polarisation is 'x':
|
||||
@@ -79,9 +79,9 @@ class HertzianDipole:
|
||||
|
||||
def __init__(self):
|
||||
self.polarisation = None
|
||||
self.positionx = None
|
||||
self.positiony = None
|
||||
self.positionz = None
|
||||
self.xcoord = None
|
||||
self.ycoord = None
|
||||
self.zcoord = None
|
||||
self.start = None
|
||||
self.stop = None
|
||||
self.waveformID = None
|
||||
@@ -100,9 +100,9 @@ class HertzianDipole:
|
||||
if abstime >= self.start and abstime <= self.stop:
|
||||
# Set the time of the waveform evaluation to account for any delay in the start
|
||||
time = abstime - self.start
|
||||
i = self.positionx
|
||||
j = self.positiony
|
||||
k = self.positionz
|
||||
i = self.xcoord
|
||||
j = self.ycoord
|
||||
k = self.zcoord
|
||||
waveform = next(x for x in G.waveforms if x.ID == self.waveformID)
|
||||
|
||||
if self.polarisation is 'x':
|
||||
@@ -120,9 +120,9 @@ class MagneticDipole:
|
||||
|
||||
def __init__(self):
|
||||
self.polarisation = None
|
||||
self.positionx = None
|
||||
self.positiony = None
|
||||
self.positionz = None
|
||||
self.xcoord = None
|
||||
self.ycoord = None
|
||||
self.zcoord = None
|
||||
self.start = None
|
||||
self.stop = None
|
||||
self.waveformID = None
|
||||
@@ -141,9 +141,9 @@ class MagneticDipole:
|
||||
if abstime >= self.start and abstime <= self.stop:
|
||||
# Set the time of the waveform evaluation to account for any delay in the start
|
||||
time = abstime - self.start
|
||||
i = self.positionx
|
||||
j = self.positiony
|
||||
k = self.positionz
|
||||
i = self.xcoord
|
||||
j = self.ycoord
|
||||
k = self.zcoord
|
||||
waveform = next(x for x in G.waveforms if x.ID == self.waveformID)
|
||||
|
||||
if self.polarisation is 'x':
|
||||
@@ -166,9 +166,9 @@ class TransmissionLine:
|
||||
"""
|
||||
|
||||
self.polarisation = None
|
||||
self.positionx = None
|
||||
self.positiony = None
|
||||
self.positionz = None
|
||||
self.xcoord = None
|
||||
self.ycoord = None
|
||||
self.zcoord = None
|
||||
self.start = None
|
||||
self.stop = None
|
||||
self.resistance = None
|
||||
@@ -272,9 +272,9 @@ class TransmissionLine:
|
||||
if abstime >= self.start and abstime <= self.stop:
|
||||
# Set the time of the waveform evaluation to account for any delay in the start
|
||||
time = abstime - self.start
|
||||
i = self.positionx
|
||||
j = self.positiony
|
||||
k = self.positionz
|
||||
i = self.xcoord
|
||||
j = self.ycoord
|
||||
k = self.zcoord
|
||||
|
||||
self.update_voltage(time, G)
|
||||
|
||||
@@ -299,9 +299,9 @@ class TransmissionLine:
|
||||
if abstime >= self.start and abstime <= self.stop:
|
||||
# Set the time of the waveform evaluation to account for any delay in the start
|
||||
time = abstime - self.start
|
||||
i = self.positionx
|
||||
j = self.positiony
|
||||
k = self.positionz
|
||||
i = self.xcoord
|
||||
j = self.ycoord
|
||||
k = self.zcoord
|
||||
|
||||
if self.polarisation is 'x':
|
||||
self.current[self.antpos] = Ix(i, j, k, G.Hy, G.Hz, G)
|
||||
|
在新工单中引用
屏蔽一个用户