你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
PML comparison updated to use API
这个提交包含在:
@@ -18,7 +18,6 @@
|
||||
|
||||
import itertools
|
||||
import logging
|
||||
import os
|
||||
from operator import add
|
||||
from pathlib import Path
|
||||
|
||||
@@ -39,9 +38,9 @@ colors = itertools.cycle(colorIDs)
|
||||
lines = itertools.cycle(('--', ':', '-.', '-'))
|
||||
markers = ['o', 'd', '^', 's', '*']
|
||||
|
||||
basepath = Path(__file__).parent
|
||||
parts = Path(__file__).parts
|
||||
path = 'rxs/rx1/'
|
||||
refmodel = 'pml_3D_pec_plate_ref'
|
||||
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]
|
||||
@@ -50,8 +49,8 @@ fig, ax = plt.subplots(subplot_kw=dict(xlabel='Iterations', ylabel='Error [dB]')
|
||||
|
||||
for x, model in enumerate(testmodels):
|
||||
# Open output file and read iterations
|
||||
fileref = h5py.File(basepath.joinpath(refmodel, '.h5'), 'r')
|
||||
filetest = h5py.File(basepath.joinpath(model, '.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())
|
||||
@@ -66,7 +65,7 @@ for x, model in enumerate(testmodels):
|
||||
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
|
||||
# print('Data type: {}'.format(floattypetest))
|
||||
# logger.info(f'Data type: {floattypetest}')
|
||||
|
||||
# Arrays for storing time
|
||||
# timeref = np.zeros((fileref.attrs['Iterations']), dtype=floattyperef)
|
||||
@@ -106,7 +105,7 @@ for x, model in enumerate(testmodels):
|
||||
# Print maximum error value
|
||||
start = 210
|
||||
maxerrors.append(f': {np.amax(datadiffs[start::, 1]):.1f} [dB]')
|
||||
print(f'{model}: Max. error {maxerrors[x]}')
|
||||
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)
|
||||
|
@@ -1,34 +0,0 @@
|
||||
#title: Response from an elongated thin PEC plate
|
||||
#domain: 0.051 0.126 0.026
|
||||
#dx_dy_dz: 0.001 0.001 0.001
|
||||
#time_window: 2100
|
||||
#time_step_stability_factor: 0.99
|
||||
|
||||
################################################
|
||||
## PML parameters
|
||||
## CFS (alpha, kappa, sigma)
|
||||
## sigma_max = (0.8 * (m + 1)) / (z0 * d * np.sqrt(er * mr))
|
||||
## z0 = 376.73, d = 0.001
|
||||
################################################
|
||||
|
||||
#pml_cells: 10
|
||||
|
||||
#############
|
||||
## CFS PML ##
|
||||
#############
|
||||
#python:
|
||||
import numpy as np
|
||||
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2018.2823864
|
||||
smax = 1.1 * ((4 + 1) / (150 * np.pi * 0.001))
|
||||
print('#pml_cfs: constant forward 0.05 0.05 quartic forward 1 8 quartic forward 0 {}'.format(smax))
|
||||
#end_python:
|
||||
|
||||
#waveform: gaussiandotnorm 1 9.42e9 mypulse
|
||||
#hertzian_dipole: z 0.013 0.013 0.014 mypulse
|
||||
#rx: 0.038 0.114 0.013
|
||||
|
||||
#plate: 0.013 0.013 0.013 0.038 0.113 0.013 pec
|
||||
|
||||
geometry_view: 0 0 0 0.051 0.126 0.026 0.001 0.001 0.001 pml_3D_pec_plate_f f
|
||||
geometry_view: 0 0 0 0.051 0.126 0.026 0.001 0.001 0.001 pml_3D_pec_plate_n n
|
@@ -1,34 +0,0 @@
|
||||
#title: Response from an elongated thin PEC plate
|
||||
#domain: 0.051 0.126 0.026
|
||||
#dx_dy_dz: 0.001 0.001 0.001
|
||||
#time_window: 2100
|
||||
#time_step_stability_factor: 0.99
|
||||
|
||||
################################################
|
||||
## PML parameters
|
||||
## CFS (alpha, kappa, sigma)
|
||||
## sigma_max = (0.8 * (m + 1)) / (z0 * d * np.sqrt(er * mr))
|
||||
## z0 = 376.73, d = 0.001
|
||||
################################################
|
||||
|
||||
#pml_cells: 10
|
||||
|
||||
################################################
|
||||
## 1st order (default) HORIPML - Standard PML ##
|
||||
################################################
|
||||
#python:
|
||||
import numpy as np
|
||||
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2011.2180344
|
||||
smax = 0.7 * ((4 + 1) / (150 * np.pi * 0.001))
|
||||
print('#pml_cfs: constant forward 0 0 quartic forward 1 12 quartic forward 0 {}'.format(smax))
|
||||
#end_python:
|
||||
|
||||
#waveform: gaussiandotnorm 1 9.42e9 mypulse
|
||||
#hertzian_dipole: z 0.013 0.013 0.014 mypulse
|
||||
#rx: 0.038 0.114 0.013
|
||||
|
||||
#plate: 0.013 0.013 0.013 0.038 0.113 0.013 pec
|
||||
|
||||
geometry_view: 0 0 0 0.051 0.126 0.026 0.001 0.001 0.001 pml_3D_pec_plate_f f
|
||||
geometry_view: 0 0 0 0.051 0.126 0.026 0.001 0.001 0.001 pml_3D_pec_plate_n n
|
@@ -1,37 +0,0 @@
|
||||
#title: Response from an elongated thin PEC plate
|
||||
#domain: 0.051 0.126 0.026
|
||||
#dx_dy_dz: 0.001 0.001 0.001
|
||||
#time_window: 2100
|
||||
#time_step_stability_factor: 0.99
|
||||
|
||||
################################################
|
||||
## PML parameters
|
||||
## CFS (alpha, kappa, sigma)
|
||||
## sigma_max = (0.8 * (m + 1)) / (z0 * d * np.sqrt(er * mr))
|
||||
## z0 = 376.73, d = 0.001
|
||||
################################################
|
||||
|
||||
#pml_cells: 10
|
||||
|
||||
#######################
|
||||
## 2nd order HORIPML ##
|
||||
#######################
|
||||
#python:
|
||||
import numpy as np
|
||||
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2018.2823864
|
||||
smax1 = 0.275 / (150 * np.pi * 0.001)
|
||||
smax2 = 2.75 / (150 * np.pi * 0.001)
|
||||
a0 = 0.07
|
||||
print('#pml_cfs: constant forward 0 0 constant forward 1 1 sextic forward 0 {}'.format(smax1))
|
||||
print('#pml_cfs: sextic forward {} {} cubic forward 1 8 quadratic forward 0 {}'.format(a0, a0 + smax1, smax2))
|
||||
#end_python:
|
||||
|
||||
#waveform: gaussiandotnorm 1 9.42e9 mypulse
|
||||
#hertzian_dipole: z 0.013 0.013 0.014 mypulse
|
||||
#rx: 0.038 0.114 0.013
|
||||
|
||||
#plate: 0.013 0.013 0.013 0.038 0.113 0.013 pec
|
||||
|
||||
geometry_view: 0 0 0 0.051 0.126 0.026 0.001 0.001 0.001 pml_3D_pec_plate_f f
|
||||
geometry_view: 0 0 0 0.051 0.126 0.026 0.001 0.001 0.001 pml_3D_pec_plate_n n
|
@@ -1,36 +0,0 @@
|
||||
#title: Response from an elongated thin PEC plate
|
||||
#domain: 0.051 0.126 0.026
|
||||
#dx_dy_dz: 0.001 0.001 0.001
|
||||
#time_window: 2100
|
||||
#time_step_stability_factor: 0.99
|
||||
|
||||
################################################
|
||||
## PML parameters
|
||||
## CFS (alpha, kappa, sigma)
|
||||
## sigma_max = (0.8 * (m + 1)) / (z0 * d * np.sqrt(er * mr))
|
||||
## z0 = 376.73, d = 0.001
|
||||
################################################
|
||||
|
||||
#pml_cells: 10
|
||||
|
||||
######################
|
||||
## 1st order MRIPML ##
|
||||
######################
|
||||
#pml_formulation: MRIPML
|
||||
|
||||
#python:
|
||||
import numpy as np
|
||||
|
||||
# Parameters from Antonis' MATLAB script (M3Dparams.m)
|
||||
smax = 1.1 * ((4 + 1) / (150 * np.pi * 0.001))
|
||||
print('#pml_cfs: constant forward 0.05 0.05 quartic forward 1 8 quartic forward 0 {}'.format(smax))
|
||||
#end_python:
|
||||
|
||||
#waveform: gaussiandotnorm 1 9.42e9 mypulse
|
||||
#hertzian_dipole: z 0.013 0.013 0.014 mypulse
|
||||
#rx: 0.038 0.114 0.013
|
||||
|
||||
#plate: 0.013 0.013 0.013 0.038 0.113 0.013 pec
|
||||
|
||||
geometry_view: 0 0 0 0.051 0.126 0.026 0.001 0.001 0.001 pml_3D_pec_plate_f f
|
||||
geometry_view: 0 0 0 0.051 0.126 0.026 0.001 0.001 0.001 pml_3D_pec_plate_n n
|
@@ -1,39 +0,0 @@
|
||||
#title: Response from an elongated thin PEC plate
|
||||
#domain: 0.051 0.126 0.026
|
||||
#dx_dy_dz: 0.001 0.001 0.001
|
||||
#time_window: 2100
|
||||
#time_step_stability_factor: 0.99
|
||||
|
||||
################################################
|
||||
## PML parameters
|
||||
## CFS (alpha, kappa, sigma)
|
||||
## sigma_max = (0.8 * (m + 1)) / (z0 * d * np.sqrt(er * mr))
|
||||
## z0 = 376.73, d = 0.001
|
||||
################################################
|
||||
|
||||
#pml_cells: 10
|
||||
|
||||
######################
|
||||
## 2nd order MRIPML ##
|
||||
######################
|
||||
#pml_formulation: MRIPML
|
||||
|
||||
#python:
|
||||
import numpy as np
|
||||
|
||||
# Parameters from http://dx.doi.org/10.1109/TAP.2018.2823864
|
||||
smax1 = 0.65 * ((4 + 1) / (150 * np.pi * 0.001))
|
||||
smax2 = 0.65 * ((2 + 1) / (150 * np.pi * 0.001))
|
||||
print('#pml_cfs: quadratic reverse 0 0.15 quartic forward 1 12 quartic forward 0 {}'.format(smax1))
|
||||
print('#pml_cfs: linear reverse 0 0.8 constant forward 0 0 quadratic forward 0 {}'.format(smax2))
|
||||
#end_python:
|
||||
|
||||
|
||||
#waveform: gaussiandotnorm 1 9.42e9 mypulse
|
||||
#hertzian_dipole: z 0.013 0.013 0.014 mypulse
|
||||
#rx: 0.038 0.114 0.013
|
||||
|
||||
#plate: 0.013 0.013 0.013 0.038 0.113 0.013 pec
|
||||
|
||||
geometry_view: 0 0 0 0.051 0.126 0.026 0.001 0.001 0.001 pml_3D_pec_plate_f f
|
||||
geometry_view: 0 0 0 0.051 0.126 0.026 0.001 0.001 0.001 pml_3D_pec_plate_n n
|
在新工单中引用
屏蔽一个用户