你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 23:14:03 +08:00
Added a pre-commit config file and reformatted all the files accordingly by using it.
这个提交包含在:
@@ -28,41 +28,45 @@ import numpy as np
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Create/setup plot figure
|
||||
#colors = ['#E60D30', '#5CB7C6', '#A21797', '#A3B347'] # Plot colours from http://tools.medialab.sciences-po.fr/iwanthue/index.php
|
||||
#colorIDs = ["#62a85b", "#9967c7", "#b3943f", "#6095cd", "#cb5c42", "#c95889"]
|
||||
# colors = ['#E60D30', '#5CB7C6', '#A21797', '#A3B347'] # Plot colours from http://tools.medialab.sciences-po.fr/iwanthue/index.php
|
||||
# colorIDs = ["#62a85b", "#9967c7", "#b3943f", "#6095cd", "#cb5c42", "#c95889"]
|
||||
colorIDs = ["#79c72e", "#5774ff", "#ff7c2c", "#4b4e80", "#d7004e", "#007545", "#ff83ec"]
|
||||
#colorIDs = ["#ba0044", "#b2d334", "#470055", "#185300", "#ff96b1", "#3e2700", "#0162a9", "#fdb786"]
|
||||
# colorIDs = ["#ba0044", "#b2d334", "#470055", "#185300", "#ff96b1", "#3e2700", "#0162a9", "#fdb786"]
|
||||
colors = itertools.cycle(colorIDs)
|
||||
# for i in range(2):
|
||||
# next(colors)
|
||||
lines = itertools.cycle(('--', ':', '-.', '-'))
|
||||
markers = ['o', 'd', '^', 's', '*']
|
||||
lines = itertools.cycle(("--", ":", "-.", "-"))
|
||||
markers = ["o", "d", "^", "s", "*"]
|
||||
|
||||
parts = Path(__file__).parts
|
||||
path = 'rxs/rx1/'
|
||||
basename = 'pml_3D_pec_plate'
|
||||
PMLIDs = ['CFS-PML', 'HORIPML-1', 'HORIPML-2', 'MRIPML-1', 'MRIPML-2']
|
||||
path = "rxs/rx1/"
|
||||
basename = "pml_3D_pec_plate"
|
||||
PMLIDs = ["CFS-PML", "HORIPML-1", "HORIPML-2", "MRIPML-1", "MRIPML-2"]
|
||||
maxerrors = []
|
||||
testmodels = ['pml_3D_pec_plate_' + s for s in PMLIDs]
|
||||
testmodels = ["pml_3D_pec_plate_" + s for s in PMLIDs]
|
||||
|
||||
fig, ax = plt.subplots(subplot_kw=dict(xlabel='Iterations', ylabel='Error [dB]'), figsize=(20, 10), facecolor='w', edgecolor='w')
|
||||
fig, ax = plt.subplots(
|
||||
subplot_kw=dict(xlabel="Iterations", ylabel="Error [dB]"), figsize=(20, 10), facecolor="w", edgecolor="w"
|
||||
)
|
||||
|
||||
for x, model in enumerate(testmodels):
|
||||
# Open output file and read iterations
|
||||
fileref = h5py.File(Path(*parts[:-1], basename, basename + '_ref.h5'), 'r')
|
||||
filetest = h5py.File(Path(*parts[:-1], basename, basename + str(x + 1) + '.h5'), 'r')
|
||||
fileref = h5py.File(Path(*parts[:-1], basename, basename + "_ref.h5"), "r")
|
||||
filetest = h5py.File(Path(*parts[:-1], basename, basename + str(x + 1) + ".h5"), "r")
|
||||
|
||||
# Get available field output component names
|
||||
outputsref = list(fileref[path].keys())
|
||||
outputstest = list(filetest[path].keys())
|
||||
if outputsref != outputstest:
|
||||
logger.exception('Field output components do not match reference solution')
|
||||
logger.exception("Field output components do not match reference solution")
|
||||
raise ValueError
|
||||
|
||||
# Check that type of float used to store fields matches
|
||||
if filetest[path + outputstest[0]].dtype != fileref[path + outputsref[0]].dtype:
|
||||
logger.warning(f'Type of floating point number in test model ({filetest[path + outputstest[0]].dtype}) '
|
||||
f'does not match type in reference solution ({fileref[path + outputsref[0]].dtype})\n')
|
||||
logger.warning(
|
||||
f"Type of floating point number in test model ({filetest[path + outputstest[0]].dtype}) "
|
||||
f"does not match type in reference solution ({fileref[path + outputsref[0]].dtype})\n"
|
||||
)
|
||||
floattyperef = fileref[path + outputsref[0]].dtype
|
||||
floattypetest = filetest[path + outputstest[0]].dtype
|
||||
# logger.info(f'Data type: {floattypetest}')
|
||||
@@ -72,19 +76,19 @@ for x, model in enumerate(testmodels):
|
||||
# timeref = np.linspace(0, (fileref.attrs['Iterations'] - 1) * fileref.attrs['dt'], num=fileref.attrs['Iterations']) / 1e-9
|
||||
# timetest = np.zeros((filetest.attrs['Iterations']), dtype=floattypetest)
|
||||
# timetest = np.linspace(0, (filetest.attrs['Iterations'] - 1) * filetest.attrs['dt'], num=filetest.attrs['Iterations']) / 1e-9
|
||||
timeref = np.zeros((fileref.attrs['Iterations']), dtype=floattyperef)
|
||||
timeref = np.linspace(0, (fileref.attrs['Iterations'] - 1), num=fileref.attrs['Iterations'])
|
||||
timetest = np.zeros((filetest.attrs['Iterations']), dtype=floattypetest)
|
||||
timetest = np.linspace(0, (filetest.attrs['Iterations'] - 1), num=filetest.attrs['Iterations'])
|
||||
timeref = np.zeros((fileref.attrs["Iterations"]), dtype=floattyperef)
|
||||
timeref = np.linspace(0, (fileref.attrs["Iterations"] - 1), num=fileref.attrs["Iterations"])
|
||||
timetest = np.zeros((filetest.attrs["Iterations"]), dtype=floattypetest)
|
||||
timetest = np.linspace(0, (filetest.attrs["Iterations"] - 1), num=filetest.attrs["Iterations"])
|
||||
|
||||
# Arrays for storing field data
|
||||
dataref = np.zeros((fileref.attrs['Iterations'], len(outputsref)), dtype=floattyperef)
|
||||
datatest = np.zeros((filetest.attrs['Iterations'], len(outputstest)), dtype=floattypetest)
|
||||
dataref = np.zeros((fileref.attrs["Iterations"], len(outputsref)), dtype=floattyperef)
|
||||
datatest = np.zeros((filetest.attrs["Iterations"], len(outputstest)), dtype=floattypetest)
|
||||
for ID, name in enumerate(outputsref):
|
||||
dataref[:, ID] = fileref[path + str(name)][:]
|
||||
datatest[:, ID] = filetest[path + str(name)][:]
|
||||
if np.any(np.isnan(datatest[:, ID])):
|
||||
logger.exception('Test data contains NaNs')
|
||||
logger.exception("Test data contains NaNs")
|
||||
raise ValueError
|
||||
|
||||
fileref.close()
|
||||
@@ -94,18 +98,20 @@ for x, model in enumerate(testmodels):
|
||||
datadiffs = np.zeros(datatest.shape, dtype=np.float64)
|
||||
for i in range(len(outputstest)):
|
||||
maxi = np.amax(np.abs(dataref[:, i]))
|
||||
datadiffs[:, i] = np.divide(np.abs(datatest[:, i] - dataref[:, i]), maxi, out=np.zeros_like(dataref[:, i]), where=maxi != 0) # Replace any division by zero with zero
|
||||
datadiffs[:, i] = np.divide(
|
||||
np.abs(datatest[:, i] - dataref[:, i]), maxi, out=np.zeros_like(dataref[:, i]), where=maxi != 0
|
||||
) # Replace any division by zero with zero
|
||||
|
||||
# Calculate power (ignore warning from taking a log of any zero values)
|
||||
with np.errstate(divide='ignore'):
|
||||
with np.errstate(divide="ignore"):
|
||||
datadiffs[:, i] = 20 * np.log10(datadiffs[:, i])
|
||||
# Replace any NaNs or Infs from zero division
|
||||
datadiffs[:, i][np.invert(np.isfinite(datadiffs[:, i]))] = 0
|
||||
|
||||
# Print maximum error value
|
||||
start = 210
|
||||
maxerrors.append(f': {np.amax(datadiffs[start::, 1]):.1f} [dB]')
|
||||
logger.info(f'{model}: Max. error {maxerrors[x]}')
|
||||
maxerrors.append(f": {np.amax(datadiffs[start::, 1]):.1f} [dB]")
|
||||
logger.info(f"{model}: Max. error {maxerrors[x]}")
|
||||
|
||||
# Plot diffs (select column to choose field component, 0-Ex, 1-Ey etc..)
|
||||
ax.plot(timeref[start::], datadiffs[start::, 1], color=next(colors), lw=2, ls=next(lines), label=model)
|
||||
@@ -114,16 +120,16 @@ for x, model in enumerate(testmodels):
|
||||
ax.set_yticks(np.arange(-160, 0, step=20))
|
||||
ax.set_ylim([-160, -20])
|
||||
ax.set_axisbelow(True)
|
||||
ax.grid(color=(0.75,0.75,0.75), linestyle='dashed')
|
||||
ax.grid(color=(0.75, 0.75, 0.75), linestyle="dashed")
|
||||
|
||||
mylegend = list(map(add, PMLIDs, maxerrors))
|
||||
legend = ax.legend(mylegend, loc=1, fontsize=14)
|
||||
frame = legend.get_frame()
|
||||
frame.set_edgecolor('white')
|
||||
frame.set_edgecolor("white")
|
||||
frame.set_alpha(0)
|
||||
|
||||
plt.show()
|
||||
|
||||
# Save a PDF/PNG of the figure
|
||||
#fig.savefig(basepath + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||
#fig.savefig(savename + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
|
||||
# fig.savefig(basepath + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||
# fig.savefig(savename + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
|
||||
|
@@ -20,112 +20,162 @@ dxdydz = gprMax.Discretisation(p1=(dl, dl, dl))
|
||||
time_window = gprMax.TimeWindow(iterations=2100)
|
||||
tssf = gprMax.TimeStepStabilityFactor(f=0.99)
|
||||
|
||||
waveform = gprMax.Waveform(wave_type='gaussiandotnorm', amp=1, freq=9.42e9, id='mypulse')
|
||||
hertzian_dipole = gprMax.HertzianDipole(polarisation='z',
|
||||
p1=(0.013, 0.013, 0.014),
|
||||
waveform_id='mypulse')
|
||||
waveform = gprMax.Waveform(wave_type="gaussiandotnorm", amp=1, freq=9.42e9, id="mypulse")
|
||||
hertzian_dipole = gprMax.HertzianDipole(polarisation="z", p1=(0.013, 0.013, 0.014), waveform_id="mypulse")
|
||||
rx = gprMax.Rx(p1=(0.038, 0.114, 0.013))
|
||||
|
||||
plate = gprMax.Plate(p1=(0.013, 0.013, 0.013),
|
||||
p2=(0.038, 0.113, 0.013), material_id='pec')
|
||||
plate = gprMax.Plate(p1=(0.013, 0.013, 0.013), p2=(0.038, 0.113, 0.013), material_id="pec")
|
||||
|
||||
gv1 = gprMax.GeometryView(p1=(0, 0, 0),
|
||||
p2=(x, y, z),
|
||||
dl=(dl, dl, dl),
|
||||
filename=Path(*parts[:-1], f'{parts[-1]}_n'),
|
||||
output_type='n',)
|
||||
gv2 = gprMax.GeometryView(p1=(0, 0, 0),
|
||||
p2=(x, y, z),
|
||||
dl=(dl, dl, dl),
|
||||
filename=Path(*parts[:-1], f'{parts[-1]}_f'),
|
||||
output_type='f',)
|
||||
gv1 = gprMax.GeometryView(
|
||||
p1=(0, 0, 0),
|
||||
p2=(x, y, z),
|
||||
dl=(dl, dl, dl),
|
||||
filename=Path(*parts[:-1], f"{parts[-1]}_n"),
|
||||
output_type="n",
|
||||
)
|
||||
gv2 = gprMax.GeometryView(
|
||||
p1=(0, 0, 0),
|
||||
p2=(x, y, z),
|
||||
dl=(dl, dl, dl),
|
||||
filename=Path(*parts[:-1], f"{parts[-1]}_f"),
|
||||
output_type="f",
|
||||
)
|
||||
|
||||
pmls = {'CFS-PML': {'pml': gprMax.PMLProps(formulation='HORIPML', thickness=10),
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2018.2823864
|
||||
'pml_cfs': [gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
alphascalingdirection='forward',
|
||||
alphamin=0.05, alphamax=0.05,
|
||||
kappascalingprofile='quartic',
|
||||
kappascalingdirection='forward',
|
||||
kappamin=1, kappamax=8,
|
||||
sigmascalingprofile='quartic',
|
||||
sigmascalingdirection='forward',
|
||||
sigmamin=0,
|
||||
sigmamax=1.1 * ((4 + 1) / (150 * np.pi * dl)))]},
|
||||
'HORIPML-1': {'pml': gprMax.PMLProps(formulation='HORIPML', thickness=10),
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2011.2180344
|
||||
'pml_cfs': [gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
alphascalingdirection='forward',
|
||||
alphamin=0, alphamax=0,
|
||||
kappascalingprofile='quartic',
|
||||
kappascalingdirection='forward',
|
||||
kappamin=1, kappamax=12,
|
||||
sigmascalingprofile='quartic',
|
||||
sigmascalingdirection='forward',
|
||||
sigmamin=0,
|
||||
sigmamax=0.7 * ((4 + 1) / (150 * np.pi * dl)))]},
|
||||
'HORIPML-2': {'pml': gprMax.PMLProps(formulation='HORIPML', thickness=10),
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2018.2823864
|
||||
'pml_cfs': [gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
alphascalingdirection='forward',
|
||||
alphamin=0, alphamax=0,
|
||||
kappascalingprofile='constant',
|
||||
kappascalingdirection='forward',
|
||||
kappamin=1, kappamax=1,
|
||||
sigmascalingprofile='sextic',
|
||||
sigmascalingdirection='forward',
|
||||
sigmamin=0,
|
||||
sigmamax=0.275 / (150 * np.pi * dl)),
|
||||
gprMax.PMLCFS(alphascalingprofile='sextic',
|
||||
alphascalingdirection='forward',
|
||||
alphamin=0.07, alphamax=0.07 + (0.275 / (150 * np.pi * dl)),
|
||||
kappascalingprofile='cubic',
|
||||
kappascalingdirection='forward',
|
||||
kappamin=1, kappamax=8,
|
||||
sigmascalingprofile='quadratic',
|
||||
sigmascalingdirection='forward',
|
||||
sigmamin=0,
|
||||
sigmamax=2.75 / (150 * np.pi * dl))]},
|
||||
'MRIPML-1': {'pml': gprMax.PMLProps(formulation='MRIPML', thickness=10),
|
||||
# Parameters from Antonis' MATLAB script (M3Dparams.m)
|
||||
'pml_cfs': [gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
alphascalingdirection='forward',
|
||||
alphamin=0.05, alphamax=0.05,
|
||||
kappascalingprofile='quartic',
|
||||
kappascalingdirection='forward',
|
||||
kappamin=1, kappamax=8,
|
||||
sigmascalingprofile='quartic',
|
||||
sigmascalingdirection='forward',
|
||||
sigmamin=0,
|
||||
sigmamax=1.1 * ((4 + 1) / (150 * np.pi * dl)))]},
|
||||
'MRIPML-2': {'pml': gprMax.PMLProps(formulation='MRIPML', thickness=10),
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2018.2823864
|
||||
'pml_cfs': [gprMax.PMLCFS(alphascalingprofile='quadratic',
|
||||
alphascalingdirection='reverse',
|
||||
alphamin=0, alphamax=0.15,
|
||||
kappascalingprofile='quartic',
|
||||
kappascalingdirection='forward',
|
||||
kappamin=1, kappamax=12,
|
||||
sigmascalingprofile='quartic',
|
||||
sigmascalingdirection='forward',
|
||||
sigmamin=0,
|
||||
sigmamax=0.65 * ((4 + 1) / (150 * np.pi * dl))),
|
||||
gprMax.PMLCFS(alphascalingprofile='linear',
|
||||
alphascalingdirection='reverse',
|
||||
alphamin=0.07, alphamax=0.8,
|
||||
kappascalingprofile='constant',
|
||||
kappascalingdirection='forward',
|
||||
kappamin=0, kappamax=0,
|
||||
sigmascalingprofile='quadratic',
|
||||
sigmascalingdirection='forward',
|
||||
sigmamin=0,
|
||||
sigmamax=0.65 * ((2 + 1) / (150 * np.pi * dl)))]}
|
||||
}
|
||||
pmls = {
|
||||
"CFS-PML": {
|
||||
"pml": gprMax.PMLProps(formulation="HORIPML", thickness=10),
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2018.2823864
|
||||
"pml_cfs": [
|
||||
gprMax.PMLCFS(
|
||||
alphascalingprofile="constant",
|
||||
alphascalingdirection="forward",
|
||||
alphamin=0.05,
|
||||
alphamax=0.05,
|
||||
kappascalingprofile="quartic",
|
||||
kappascalingdirection="forward",
|
||||
kappamin=1,
|
||||
kappamax=8,
|
||||
sigmascalingprofile="quartic",
|
||||
sigmascalingdirection="forward",
|
||||
sigmamin=0,
|
||||
sigmamax=1.1 * ((4 + 1) / (150 * np.pi * dl)),
|
||||
)
|
||||
],
|
||||
},
|
||||
"HORIPML-1": {
|
||||
"pml": gprMax.PMLProps(formulation="HORIPML", thickness=10),
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2011.2180344
|
||||
"pml_cfs": [
|
||||
gprMax.PMLCFS(
|
||||
alphascalingprofile="constant",
|
||||
alphascalingdirection="forward",
|
||||
alphamin=0,
|
||||
alphamax=0,
|
||||
kappascalingprofile="quartic",
|
||||
kappascalingdirection="forward",
|
||||
kappamin=1,
|
||||
kappamax=12,
|
||||
sigmascalingprofile="quartic",
|
||||
sigmascalingdirection="forward",
|
||||
sigmamin=0,
|
||||
sigmamax=0.7 * ((4 + 1) / (150 * np.pi * dl)),
|
||||
)
|
||||
],
|
||||
},
|
||||
"HORIPML-2": {
|
||||
"pml": gprMax.PMLProps(formulation="HORIPML", thickness=10),
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2018.2823864
|
||||
"pml_cfs": [
|
||||
gprMax.PMLCFS(
|
||||
alphascalingprofile="constant",
|
||||
alphascalingdirection="forward",
|
||||
alphamin=0,
|
||||
alphamax=0,
|
||||
kappascalingprofile="constant",
|
||||
kappascalingdirection="forward",
|
||||
kappamin=1,
|
||||
kappamax=1,
|
||||
sigmascalingprofile="sextic",
|
||||
sigmascalingdirection="forward",
|
||||
sigmamin=0,
|
||||
sigmamax=0.275 / (150 * np.pi * dl),
|
||||
),
|
||||
gprMax.PMLCFS(
|
||||
alphascalingprofile="sextic",
|
||||
alphascalingdirection="forward",
|
||||
alphamin=0.07,
|
||||
alphamax=0.07 + (0.275 / (150 * np.pi * dl)),
|
||||
kappascalingprofile="cubic",
|
||||
kappascalingdirection="forward",
|
||||
kappamin=1,
|
||||
kappamax=8,
|
||||
sigmascalingprofile="quadratic",
|
||||
sigmascalingdirection="forward",
|
||||
sigmamin=0,
|
||||
sigmamax=2.75 / (150 * np.pi * dl),
|
||||
),
|
||||
],
|
||||
},
|
||||
"MRIPML-1": {
|
||||
"pml": gprMax.PMLProps(formulation="MRIPML", thickness=10),
|
||||
# Parameters from Antonis' MATLAB script (M3Dparams.m)
|
||||
"pml_cfs": [
|
||||
gprMax.PMLCFS(
|
||||
alphascalingprofile="constant",
|
||||
alphascalingdirection="forward",
|
||||
alphamin=0.05,
|
||||
alphamax=0.05,
|
||||
kappascalingprofile="quartic",
|
||||
kappascalingdirection="forward",
|
||||
kappamin=1,
|
||||
kappamax=8,
|
||||
sigmascalingprofile="quartic",
|
||||
sigmascalingdirection="forward",
|
||||
sigmamin=0,
|
||||
sigmamax=1.1 * ((4 + 1) / (150 * np.pi * dl)),
|
||||
)
|
||||
],
|
||||
},
|
||||
"MRIPML-2": {
|
||||
"pml": gprMax.PMLProps(formulation="MRIPML", thickness=10),
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2018.2823864
|
||||
"pml_cfs": [
|
||||
gprMax.PMLCFS(
|
||||
alphascalingprofile="quadratic",
|
||||
alphascalingdirection="reverse",
|
||||
alphamin=0,
|
||||
alphamax=0.15,
|
||||
kappascalingprofile="quartic",
|
||||
kappascalingdirection="forward",
|
||||
kappamin=1,
|
||||
kappamax=12,
|
||||
sigmascalingprofile="quartic",
|
||||
sigmascalingdirection="forward",
|
||||
sigmamin=0,
|
||||
sigmamax=0.65 * ((4 + 1) / (150 * np.pi * dl)),
|
||||
),
|
||||
gprMax.PMLCFS(
|
||||
alphascalingprofile="linear",
|
||||
alphascalingdirection="reverse",
|
||||
alphamin=0.07,
|
||||
alphamax=0.8,
|
||||
kappascalingprofile="constant",
|
||||
kappascalingdirection="forward",
|
||||
kappamin=0,
|
||||
kappamax=0,
|
||||
sigmascalingprofile="quadratic",
|
||||
sigmascalingdirection="forward",
|
||||
sigmamin=0,
|
||||
sigmamax=0.65 * ((2 + 1) / (150 * np.pi * dl)),
|
||||
),
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
scenes = []
|
||||
for k, v in pmls.items():
|
||||
scene = gprMax.Scene()
|
||||
title = gprMax.Title(name=fn.with_suffix('').name + '_' + k)
|
||||
title = gprMax.Title(name=fn.with_suffix("").name + "_" + k)
|
||||
scene.add(title)
|
||||
scene.add(domain)
|
||||
scene.add(dxdydz)
|
||||
@@ -137,8 +187,8 @@ for k, v in pmls.items():
|
||||
# scene.add(gv1)
|
||||
# scene.add(gv2)
|
||||
|
||||
scene.add(v['pml'])
|
||||
for pml_cfs in v['pml_cfs']:
|
||||
scene.add(v["pml"])
|
||||
for pml_cfs in v["pml_cfs"]:
|
||||
scene.add(pml_cfs)
|
||||
|
||||
scenes.append(scene)
|
||||
|
@@ -20,42 +20,47 @@ dxdydz = gprMax.Discretisation(p1=(dl, dl, dl))
|
||||
time_window = gprMax.TimeWindow(iterations=2100)
|
||||
tssf = gprMax.TimeStepStabilityFactor(f=0.99)
|
||||
|
||||
waveform = gprMax.Waveform(wave_type='gaussiandotnorm', amp=1, freq=9.42e9, id='mypulse')
|
||||
hertzian_dipole = gprMax.HertzianDipole(polarisation='z',
|
||||
p1=(0.088, 0.088, 0.089),
|
||||
waveform_id='mypulse')
|
||||
waveform = gprMax.Waveform(wave_type="gaussiandotnorm", amp=1, freq=9.42e9, id="mypulse")
|
||||
hertzian_dipole = gprMax.HertzianDipole(polarisation="z", p1=(0.088, 0.088, 0.089), waveform_id="mypulse")
|
||||
rx = gprMax.Rx(p1=(0.113, 0.189, 0.088))
|
||||
|
||||
plate = gprMax.Plate(p1=(0.088, 0.088, 0.088),
|
||||
p2=(0.113, 0.188, 0.088), material_id='pec')
|
||||
plate = gprMax.Plate(p1=(0.088, 0.088, 0.088), p2=(0.113, 0.188, 0.088), material_id="pec")
|
||||
|
||||
gv1 = gprMax.GeometryView(p1=(0, 0, 0),
|
||||
p2=(x, y, z),
|
||||
dl=(dl, dl, dl),
|
||||
filename=Path(*parts[:-1], f'{parts[-1]}_n'),
|
||||
output_type='n',)
|
||||
gv2 = gprMax.GeometryView(p1=(0, 0, 0),
|
||||
p2=(x, y, z),
|
||||
dl=(dl, dl, dl),
|
||||
filename=Path(*parts[:-1], f'{parts[-1]}_f'),
|
||||
output_type='f',)
|
||||
gv1 = gprMax.GeometryView(
|
||||
p1=(0, 0, 0),
|
||||
p2=(x, y, z),
|
||||
dl=(dl, dl, dl),
|
||||
filename=Path(*parts[:-1], f"{parts[-1]}_n"),
|
||||
output_type="n",
|
||||
)
|
||||
gv2 = gprMax.GeometryView(
|
||||
p1=(0, 0, 0),
|
||||
p2=(x, y, z),
|
||||
dl=(dl, dl, dl),
|
||||
filename=Path(*parts[:-1], f"{parts[-1]}_f"),
|
||||
output_type="f",
|
||||
)
|
||||
|
||||
pml = gprMax.PMLProps(formulation='HORIPML', thickness=10)
|
||||
pml = gprMax.PMLProps(formulation="HORIPML", thickness=10)
|
||||
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2018.2823864
|
||||
pml_cfs = gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
alphascalingdirection='forward',
|
||||
alphamin=0.05, alphamax=0.05,
|
||||
kappascalingprofile='quartic',
|
||||
kappascalingdirection='forward',
|
||||
kappamin=1, kappamax=8,
|
||||
sigmascalingprofile='quartic',
|
||||
sigmascalingdirection='forward',
|
||||
sigmamin=0,
|
||||
sigmamax=1.1 * ((4 + 1) / (150 * np.pi * dl)))
|
||||
pml_cfs = gprMax.PMLCFS(
|
||||
alphascalingprofile="constant",
|
||||
alphascalingdirection="forward",
|
||||
alphamin=0.05,
|
||||
alphamax=0.05,
|
||||
kappascalingprofile="quartic",
|
||||
kappascalingdirection="forward",
|
||||
kappamin=1,
|
||||
kappamax=8,
|
||||
sigmascalingprofile="quartic",
|
||||
sigmascalingdirection="forward",
|
||||
sigmamin=0,
|
||||
sigmamax=1.1 * ((4 + 1) / (150 * np.pi * dl)),
|
||||
)
|
||||
|
||||
scene = gprMax.Scene()
|
||||
title = gprMax.Title(name=fn.with_suffix('').name + '_ref')
|
||||
title = gprMax.Title(name=fn.with_suffix("").name + "_ref")
|
||||
scene.add(title)
|
||||
scene.add(domain)
|
||||
scene.add(dxdydz)
|
||||
|
@@ -17,83 +17,88 @@ domain = gprMax.Domain(p1=(x, y, z))
|
||||
dxdydz = gprMax.Discretisation(p1=(dl, dl, dl))
|
||||
time_window = gprMax.TimeWindow(time=3e-9)
|
||||
|
||||
waveform = gprMax.Waveform(wave_type='gaussian', amp=1, freq=1e9, id='mypulse')
|
||||
hertzian_dipole = gprMax.HertzianDipole(polarisation='z',
|
||||
p1=(0.050, 0.050, 0.050),
|
||||
waveform_id='mypulse')
|
||||
waveform = gprMax.Waveform(wave_type="gaussian", amp=1, freq=1e9, id="mypulse")
|
||||
hertzian_dipole = gprMax.HertzianDipole(polarisation="z", p1=(0.050, 0.050, 0.050), waveform_id="mypulse")
|
||||
rx = gprMax.Rx(p1=(0.070, 0.070, 0.070))
|
||||
|
||||
# PML cases
|
||||
thick = 10 # thickness
|
||||
cases = {'off': {'x0': 0, 'y0': 0, 'z0': 0, 'xmax': 0, 'ymax': 0, 'zmax':0},
|
||||
'x0': {'x0': thick, 'y0': 0, 'z0': 0, 'xmax': 0, 'ymax': 0, 'zmax':0},
|
||||
'y0': {'x0': 0, 'y0': thick, 'z0': 0, 'xmax': 0, 'ymax': 0, 'zmax':0},
|
||||
'z0': {'x0': 0, 'y0': 0, 'z0': thick, 'xmax': 0, 'ymax': 0, 'zmax':0},
|
||||
'xmax': {'x0': 0, 'y0': 0, 'z0': 0, 'xmax': thick, 'ymax': 0, 'zmax':0},
|
||||
'ymax': {'x0': 0, 'y0': 0, 'z0': 0, 'xmax': 0, 'ymax': thick, 'zmax':0},
|
||||
'zmax': {'x0': 0, 'y0': 0, 'z0': 0, 'xmax': 0, 'ymax': 0, 'zmax': thick}}
|
||||
thick = 10 # thickness
|
||||
cases = {
|
||||
"off": {"x0": 0, "y0": 0, "z0": 0, "xmax": 0, "ymax": 0, "zmax": 0},
|
||||
"x0": {"x0": thick, "y0": 0, "z0": 0, "xmax": 0, "ymax": 0, "zmax": 0},
|
||||
"y0": {"x0": 0, "y0": thick, "z0": 0, "xmax": 0, "ymax": 0, "zmax": 0},
|
||||
"z0": {"x0": 0, "y0": 0, "z0": thick, "xmax": 0, "ymax": 0, "zmax": 0},
|
||||
"xmax": {"x0": 0, "y0": 0, "z0": 0, "xmax": thick, "ymax": 0, "zmax": 0},
|
||||
"ymax": {"x0": 0, "y0": 0, "z0": 0, "xmax": 0, "ymax": thick, "zmax": 0},
|
||||
"zmax": {"x0": 0, "y0": 0, "z0": 0, "xmax": 0, "ymax": 0, "zmax": thick},
|
||||
}
|
||||
|
||||
# PML formulation
|
||||
pml_type = gprMax.PMLProps(formulation='HORIPML')
|
||||
pml_type = gprMax.PMLProps(formulation="HORIPML")
|
||||
|
||||
## Built-in 1st order PML
|
||||
pml_cfs = gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
alphascalingdirection='forward',
|
||||
alphamin=0, alphamax=0,
|
||||
kappascalingprofile='constant',
|
||||
kappascalingdirection='forward',
|
||||
kappamin=1, kappamax=1,
|
||||
sigmascalingprofile='quartic',
|
||||
sigmascalingdirection='forward',
|
||||
sigmamin=0, sigmamax=None)
|
||||
pml_cfs = gprMax.PMLCFS(
|
||||
alphascalingprofile="constant",
|
||||
alphascalingdirection="forward",
|
||||
alphamin=0,
|
||||
alphamax=0,
|
||||
kappascalingprofile="constant",
|
||||
kappascalingdirection="forward",
|
||||
kappamin=1,
|
||||
kappamax=1,
|
||||
sigmascalingprofile="quartic",
|
||||
sigmascalingdirection="forward",
|
||||
sigmamin=0,
|
||||
sigmamax=None,
|
||||
)
|
||||
|
||||
## PMLs from http://dx.doi.org/10.1109/TAP.2011.2180344
|
||||
## Standard PML
|
||||
# pml_cfs = gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
# alphascalingdirection='forward',
|
||||
# pml_cfs = gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
# alphascalingdirection='forward',
|
||||
# alphamin=0, alphamax=0,
|
||||
# kappascalingprofile='quartic',
|
||||
# kappascalingdirection='forward',
|
||||
# kappamin=1, kappamax=11,
|
||||
# sigmascalingprofile='quartic',
|
||||
# sigmascalingdirection='forward',
|
||||
# kappascalingprofile='quartic',
|
||||
# kappascalingdirection='forward',
|
||||
# kappamin=1, kappamax=11,
|
||||
# sigmascalingprofile='quartic',
|
||||
# sigmascalingdirection='forward',
|
||||
# sigmamin=0, sigmamax=7.427)
|
||||
|
||||
## CFS PML
|
||||
# pml_cfs = gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
# alphascalingdirection='forward',
|
||||
# pml_cfs = gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
# alphascalingdirection='forward',
|
||||
# alphamin=0.05, alphamax=0.05,
|
||||
# kappascalingprofile='quartic',
|
||||
# kappascalingdirection='forward',
|
||||
# kappamin=1, kappamax=7,
|
||||
# sigmascalingprofile='quartic',
|
||||
# sigmascalingdirection='forward',
|
||||
# kappascalingprofile='quartic',
|
||||
# kappascalingdirection='forward',
|
||||
# kappamin=1, kappamax=7,
|
||||
# sigmascalingprofile='quartic',
|
||||
# sigmascalingdirection='forward',
|
||||
# sigmamin=0, sigmamax=11.671)
|
||||
|
||||
## 2nd order RIPML
|
||||
# pml_cfs1 = gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
# alphascalingdirection='forward',
|
||||
# pml_cfs1 = gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
# alphascalingdirection='forward',
|
||||
# alphamin=0, alphamax=0,
|
||||
# kappascalingprofile='constant',
|
||||
# kappascalingdirection='forward',
|
||||
# kappamin=1, kappamax=1,
|
||||
# sigmascalingprofile='sextic',
|
||||
# sigmascalingdirection='forward',
|
||||
# kappascalingprofile='constant',
|
||||
# kappascalingdirection='forward',
|
||||
# kappamin=1, kappamax=1,
|
||||
# sigmascalingprofile='sextic',
|
||||
# sigmascalingdirection='forward',
|
||||
# sigmamin=0, sigmamax=0.5836)
|
||||
# pml_cfs2 = gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
# alphascalingdirection='forward',
|
||||
# pml_cfs2 = gprMax.PMLCFS(alphascalingprofile='constant',
|
||||
# alphascalingdirection='forward',
|
||||
# alphamin=0.05, alphamax=0.05,
|
||||
# kappascalingprofile='cubic',
|
||||
# kappascalingdirection='forward',
|
||||
# kappamin=1, kappamax=8,
|
||||
# sigmascalingprofile='quadratic',
|
||||
# sigmascalingdirection='forward',
|
||||
# kappascalingprofile='cubic',
|
||||
# kappascalingdirection='forward',
|
||||
# kappamin=1, kappamax=8,
|
||||
# sigmascalingprofile='quadratic',
|
||||
# sigmascalingdirection='forward',
|
||||
# sigmamin=0, sigmamax=5.8357)
|
||||
|
||||
scenes = []
|
||||
for k, v in cases.items():
|
||||
scene = gprMax.Scene()
|
||||
title = gprMax.Title(name=fn.with_suffix('').name + '_' + k)
|
||||
title = gprMax.Title(name=fn.with_suffix("").name + "_" + k)
|
||||
scene.add(title)
|
||||
scene.add(domain)
|
||||
scene.add(dxdydz)
|
||||
@@ -102,11 +107,11 @@ for k, v in cases.items():
|
||||
scene.add(hertzian_dipole)
|
||||
scene.add(rx)
|
||||
|
||||
pml = gprMax.PMLProps(formulation='HORIPML', **v)
|
||||
pml = gprMax.PMLProps(formulation="HORIPML", **v)
|
||||
scene.add(pml)
|
||||
scene.add(pml_cfs)
|
||||
|
||||
scenes.append(scene)
|
||||
|
||||
# Run model
|
||||
gprMax.run(scenes=scenes, n=len(cases), geometry_only=False, outputfile=fn)
|
||||
gprMax.run(scenes=scenes, n=len(cases), geometry_only=False, outputfile=fn)
|
||||
|
在新工单中引用
屏蔽一个用户