Overhaul of PMLs and introduction of new, optional MRIPML formulation.

这个提交包含在:
Craig Warren
2019-04-12 16:23:55 +01:00
父节点 31aaa94747
当前提交 6e6b712cae
共有 47 个文件被更改,包括 8016 次插入3844 次删除

查看文件

@@ -1,26 +0,0 @@
#title: PMLs
#domain: 0.051 0.126 0.026
#dx_dy_dz: 0.001 0.001 0.001
#time_window: 2100
#pml_cells: 0 0 0 0 0 10
## Built-in 1st order PML
pml_cfs: constant forward 0 0 constant forward 1 1 quartic forward 0 None
## PMLs from http://dx.doi.org/10.1109/TAP.2011.2180344
## Standard PML
pml_cfs: constant forward 0 0 quartic forward 1 11 quartic forward 0 7.427
## CFS PML
pml_cfs: constant forward 0.05 0.05 quartic forward 1 7 quartic forward 0 11.671
## O2 RIPML
#pml_cfs: constant forward 0 0 constant forward 1 1 sextic forward 0 0.5836
#pml_cfs: constant forward 0.05 0.05 cubic forward 1 8 quadratic forward 0 5.8357
#waveform: gaussiandotnorm 1 9.42e9 mypulse
#hertzian_dipole: z 0.013 0.013 0.015 mypulse
#rx: 0.037 0.112 0.015
#box: 0.013 0.013 0.013 0.038 0.113 0.014 pec

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 331 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 330 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 339 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 341 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 317 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 318 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 332 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 330 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 340 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 342 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 316 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 318 KiB

查看文件

@@ -0,0 +1,108 @@
import itertools
from operator import add
import os
import sys
from colorama import init, Fore, Style
init()
import h5py
import matplotlib.pyplot as plt
import numpy as np
# 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"]
colorIDs = ["#79c72e", "#5774ff", "#ff7c2c", "#4b4e80", "#d7004e", "#007545", "#ff83ec"]
#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', '*']
basepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'pml_3D_pec_plate')
path = 'rxs/rx1/'
refmodel = 'pml_3D_pec_plate_ref'
PMLIDs = ['CFS-PML', 'HORIPML-1', 'HORIPML-2', 'MRIPML-1', 'MRIPML-2']
maxerrors = []
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')
for x, model in enumerate(testmodels):
# Get output for model and reference files
fileref = h5py.File(os.path.join(basepath, refmodel + '.out'), 'r')
filetest = h5py.File(os.path.join(basepath, model + '.out'), 'r')
# Get available field output component names
outputsref = list(fileref[path].keys())
outputstest = list(filetest[path].keys())
if outputsref != outputstest:
raise GeneralError('Field output components do not match reference solution')
# Check that type of float used to store fields matches
if filetest[path + outputstest[0]].dtype != fileref[path + outputsref[0]].dtype:
print(Fore.RED + 'WARNING: Type of floating point number in test model ({}) does not match type in reference solution ({})\n'.format(filetest[path + outputstest[0]].dtype, fileref[path + outputsref[0]].dtype) + Style.RESET_ALL)
floattyperef = fileref[path + outputsref[0]].dtype
floattypetest = filetest[path + outputstest[0]].dtype
# print('Data type: {}'.format(floattypetest))
# Arrays for storing time
# timeref = np.zeros((fileref.attrs['Iterations']), dtype=floattyperef)
# 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'])
# 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)
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])):
raise ValueError('Test data contains NaNs')
fileref.close()
filetest.close()
# Diffs
datadiffs = np.zeros(datatest.shape, dtype=np.float64)
for i in range(len(outputstest)):
max = np.amax(np.abs(dataref[:, i]))
datadiffs[:, i] = np.divide(np.abs(datatest[:, i] - dataref[:, i]), max, out=np.zeros_like(dataref[:, i]), where=max != 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'):
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(': {:.1f} [dB]'.format(np.amax(datadiffs[start::, 1])))
print('{}: Max. error {}'.format(model, 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)
ax.set_xticks(np.arange(0, 2200, step=100))
ax.set_xlim([0, 2100])
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')
mylegend = list(map(add, PMLIDs, maxerrors))
legend = ax.legend(mylegend, loc=1, fontsize=14)
frame = legend.get_frame()
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)

查看文件

@@ -0,0 +1,34 @@
#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

查看文件

@@ -0,0 +1,34 @@
#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

查看文件

@@ -0,0 +1,37 @@
#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

查看文件

@@ -0,0 +1,36 @@
#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

查看文件

@@ -0,0 +1,39 @@
#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

查看文件

@@ -0,0 +1,34 @@
#title: Standard PML of response from an elongated thin PEC plate
#domain: 0.201 0.276 0.176
#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.088 0.088 0.089 mypulse
#rx: 0.113 0.189 0.088
#plate: 0.088 0.088 0.088 0.113 0.188 0.088 pec
geometry_view: 0 0 0 0.201 0.276 0.176 0.001 0.001 0.001 pml_3D_pec_plate_ref_f f
geometry_view: 0 0 0 0.201 0.276 0.176 0.001 0.001 0.001 pml_3D_pec_plate_ref_n n

10
tests/models_pmls/pml_off.in 可执行文件
查看文件

@@ -0,0 +1,10 @@
#title: PML test none
#domain: 0.100 0.100 0.100
#dx_dy_dz: 0.001 0.001 0.001
#time_window: 3e-9
#waveform: gaussiandot 1 1e9 myWave
#hertzian_dipole: z 0.050 0.050 0.050 myWave
#rx: 0.070 0.070 0.070
#pml_cells: 0

查看文件

@@ -0,0 +1,26 @@
#title: PML test x0 slab
#domain: 0.100 0.100 0.100
#dx_dy_dz: 0.001 0.001 0.001
#time_window: 3e-9
#waveform: gaussiandot 1 1e9 myWave
#hertzian_dipole: z 0.050 0.050 0.050 myWave
#rx: 0.070 0.070 0.070
#pml_cells: 10 0 0 0 0 0
#pml_formulation: HORIPML
## Built-in 1st order PML
#pml_cfs: constant forward 0 0 constant forward 1 1 quartic forward 0 None
## PMLs from http://dx.doi.org/10.1109/TAP.2011.2180344
## Standard PML
pml_cfs: constant forward 0 0 quartic forward 1 11 quartic forward 0 7.427
## CFS PML
pml_cfs: constant forward 0.05 0.05 quartic forward 1 7 quartic forward 0 11.671
## 2nd order RIPML
pml_cfs: constant forward 0 0 constant forward 1 1 sextic forward 0 0.5836
pml_cfs: constant forward 0.05 0.05 cubic forward 1 8 quadratic forward 0 5.8357

查看文件

@@ -0,0 +1,26 @@
#title: PML test xmax slab
#domain: 0.100 0.100 0.100
#dx_dy_dz: 0.001 0.001 0.001
#time_window: 3e-9
#waveform: gaussiandot 1 1e9 myWave
#hertzian_dipole: z 0.050 0.050 0.050 myWave
#rx: 0.070 0.070 0.070
#pml_cells: 0 0 0 10 0 0
#pml_formulation: HORIPML
## Built-in 1st order PML
#pml_cfs: constant forward 0 0 constant forward 1 1 quartic forward 0 None
## PMLs from http://dx.doi.org/10.1109/TAP.2011.2180344
## Standard PML
pml_cfs: constant forward 0 0 quartic forward 1 11 quartic forward 0 7.427
## CFS PML
pml_cfs: constant forward 0.05 0.05 quartic forward 1 7 quartic forward 0 11.671
## 2nd order RIPML
pml_cfs: constant forward 0 0 constant forward 1 1 sextic forward 0 0.5836
pml_cfs: constant forward 0.05 0.05 cubic forward 1 8 quadratic forward 0 5.8357

查看文件

@@ -0,0 +1,26 @@
#title: PML test y0 slab
#domain: 0.100 0.100 0.100
#dx_dy_dz: 0.001 0.001 0.001
#time_window: 3e-9
#waveform: gaussiandot 1 1e9 myWave
#hertzian_dipole: z 0.050 0.050 0.050 myWave
#rx: 0.070 0.070 0.070
#pml_cells: 0 10 0 0 0 0
#pml_formulation: HORIPML
## Built-in 1st order PML
#pml_cfs: constant forward 0 0 constant forward 1 1 quartic forward 0 None
## PMLs from http://dx.doi.org/10.1109/TAP.2011.2180344
## Standard PML
pml_cfs: constant forward 0 0 quartic forward 1 11 quartic forward 0 7.427
## CFS PML
pml_cfs: constant forward 0.05 0.05 quartic forward 1 7 quartic forward 0 11.671
## 2nd order RIPML
pml_cfs: constant forward 0 0 constant forward 1 1 sextic forward 0 0.5836
pml_cfs: constant forward 0.05 0.05 cubic forward 1 8 quadratic forward 0 5.8357

查看文件

@@ -0,0 +1,26 @@
#title: PML test ymax slab
#domain: 0.100 0.100 0.100
#dx_dy_dz: 0.001 0.001 0.001
#time_window: 3e-9
#waveform: gaussiandot 1 1e9 myWave
#hertzian_dipole: z 0.050 0.050 0.050 myWave
#rx: 0.070 0.070 0.070
#pml_cells: 0 0 0 0 10 0
#pml_formulation: HORIPML
## Built-in 1st order PML
#pml_cfs: constant forward 0 0 constant forward 1 1 quartic forward 0 None
## PMLs from http://dx.doi.org/10.1109/TAP.2011.2180344
## Standard PML
pml_cfs: constant forward 0 0 quartic forward 1 11 quartic forward 0 7.427
## CFS PML
pml_cfs: constant forward 0.05 0.05 quartic forward 1 7 quartic forward 0 11.671
## 2nd order RIPML
pml_cfs: constant forward 0 0 constant forward 1 1 sextic forward 0 0.5836
pml_cfs: constant forward 0.05 0.05 cubic forward 1 8 quadratic forward 0 5.8357

查看文件

@@ -0,0 +1,26 @@
#title: PML test z0 slab
#domain: 0.100 0.100 0.100
#dx_dy_dz: 0.001 0.001 0.001
#time_window: 3e-9
#waveform: gaussiandot 1 1e9 myWave
#hertzian_dipole: z 0.050 0.050 0.050 myWave
#rx: 0.070 0.070 0.070
#pml_cells: 0 0 10 0 0 0
#pml_formulation: HORIPML
## Built-in 1st order PML
#pml_cfs: constant forward 0 0 constant forward 1 1 quartic forward 0 None
## PMLs from http://dx.doi.org/10.1109/TAP.2011.2180344
## Standard PML
pml_cfs: constant forward 0 0 quartic forward 1 11 quartic forward 0 7.427
## CFS PML
pml_cfs: constant forward 0.05 0.05 quartic forward 1 7 quartic forward 0 11.671
## 2nd order RIPML
pml_cfs: constant forward 0 0 constant forward 1 1 sextic forward 0 0.5836
pml_cfs: constant forward 0.05 0.05 cubic forward 1 8 quadratic forward 0 5.8357

查看文件

@@ -0,0 +1,26 @@
#title: PML test zmax slab
#domain: 0.100 0.100 0.100
#dx_dy_dz: 0.001 0.001 0.001
#time_window: 3e-9
#waveform: gaussiandot 1 1e9 myWave
#hertzian_dipole: z 0.050 0.050 0.050 myWave
#rx: 0.070 0.070 0.070
#pml_cells: 0 0 0 0 0 10
#pml_formulation: HORIPML
## Built-in 1st order PML
#pml_cfs: constant forward 0 0 constant forward 1 1 quartic forward 0 None
## PMLs from http://dx.doi.org/10.1109/TAP.2011.2180344
## Standard PML
pml_cfs: constant forward 0 0 quartic forward 1 11 quartic forward 0 7.427
## CFS PML
pml_cfs: constant forward 0.05 0.05 quartic forward 1 7 quartic forward 0 11.671
## 2nd order RIPML
pml_cfs: constant forward 0 0 constant forward 1 1 sextic forward 0 0.5836
pml_cfs: constant forward 0.05 0.05 cubic forward 1 8 quadratic forward 0 5.8357

查看文件

@@ -40,18 +40,22 @@ from tests.analytical_solutions import hertzian_dipole_fs
"""
basepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'models_')
basepath += 'basic'
# basepath += 'basic'
# basepath += 'advanced'
basepath += 'pmls'
# List of available basic test models
testmodels = ['hertzian_dipole_fs_analytical', '2D_ExHyHz', '2D_EyHxHz', '2D_EzHxHy', 'cylinder_Ascan_2D', 'hertzian_dipole_fs', 'hertzian_dipole_hs', 'hertzian_dipole_dispersive', 'magnetic_dipole_fs', 'pmls']
# testmodels = ['hertzian_dipole_fs_analytical', '2D_ExHyHz', '2D_EyHxHz', '2D_EzHxHy', 'cylinder_Ascan_2D', 'hertzian_dipole_fs', 'hertzian_dipole_hs', 'hertzian_dipole_dispersive', 'magnetic_dipole_fs', 'pmls']
# List of available advanced test models
# testmodels = ['antenna_GSSI_1500_fs', 'antenna_MALA_1200_fs']
# List of available PML models
testmodels = ['pml_x0', 'pml_y0', 'pml_z0', 'pml_xmax', 'pml_ymax', 'pml_zmax', 'pml_3D_pec_plate']
# Select a specific model if desired
testmodels = testmodels[:-1]
# testmodels = [testmodels[0]]
# testmodels = testmodels[:-1]
testmodels = [testmodels[6]]
testresults = dict.fromkeys(testmodels)
path = '/rxs/rx1/'
@@ -63,7 +67,8 @@ for i, model in enumerate(testmodels):
testresults[model] = {}
# Run model
api(os.path.join(basepath, model + os.path.sep + model + '.in'), gpu=None)
inputfile = os.path.join(basepath, model + os.path.sep + model + '.in')
api(inputfile, gpu=[None])
# Special case for analytical comparison
if model == 'hertzian_dipole_fs_analytical':
@@ -76,8 +81,7 @@ for i, model in enumerate(testmodels):
# Arrays for storing time
floattype = filetest[path + outputstest[0]].dtype
timetest = np.zeros((filetest.attrs['Iterations']), dtype=floattype)
timetest = np.arange(0, filetest.attrs['dt'] * filetest.attrs['Iterations'], filetest.attrs['dt']) / 1e-9
timetest = np.linspace(0, (filetest.attrs['Iterations'] - 1) * filetest.attrs['dt'], num=filetest.attrs['Iterations']) / 1e-9
timeref = timetest
# Arrays for storing field data
@@ -118,9 +122,9 @@ for i, model in enumerate(testmodels):
# Arrays for storing time
timeref = np.zeros((fileref.attrs['Iterations']), dtype=floattyperef)
timeref = np.arange(0, fileref.attrs['dt'] * fileref.attrs['Iterations'], fileref.attrs['dt']) / 1e-9
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.arange(0, filetest.attrs['dt'] * filetest.attrs['Iterations'], filetest.attrs['dt']) / 1e-9
timetest = np.linspace(0, (filetest.attrs['Iterations'] - 1) * filetest.attrs['dt'], num=filetest.attrs['Iterations']) / 1e-9
# Arrays for storing field data
dataref = np.zeros((fileref.attrs['Iterations'], len(outputsref)), dtype=floattyperef)