Changes to package structure and config module. Added ability to choose E or H fields in snapshots.

这个提交包含在:
Craig Warren
2019-07-05 10:57:22 +01:00
父节点 4d061c4b1b
当前提交 abffb2e433
共有 33 个文件被更改,包括 2369 次插入2035 次删除

查看文件

@@ -40,22 +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'
# 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']
# 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']
# 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[6]]
# testmodels = [testmodels[6]]
testresults = dict.fromkeys(testmodels)
path = '/rxs/rx1/'
@@ -68,7 +68,7 @@ for i, model in enumerate(testmodels):
# Run model
inputfile = os.path.join(basepath, model + os.path.sep + model + '.in')
api(inputfile, gpu=[None])
api(inputfile, gpu=None)
# Special case for analytical comparison
if model == 'hertzian_dipole_fs_analytical':
@@ -80,12 +80,12 @@ for i, model in enumerate(testmodels):
outputstest = list(filetest[path].keys())
# Arrays for storing time
floattype = filetest[path + outputstest[0]].dtype
float_or_double = filetest[path + outputstest[0]].dtype
timetest = np.linspace(0, (filetest.attrs['Iterations'] - 1) * filetest.attrs['dt'], num=filetest.attrs['Iterations']) / 1e-9
timeref = timetest
# Arrays for storing field data
datatest = np.zeros((filetest.attrs['Iterations'], len(outputstest)), dtype=floattype)
datatest = np.zeros((filetest.attrs['Iterations'], len(outputstest)), dtype=float_or_double)
for ID, name in enumerate(outputstest):
datatest[:, ID] = filetest[path + str(name)][:]
if np.any(np.isnan(datatest[:, ID])):
@@ -117,18 +117,18 @@ for i, model in enumerate(testmodels):
# 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
float_or_doubleref = fileref[path + outputsref[0]].dtype
float_or_doubletest = filetest[path + outputstest[0]].dtype
# Arrays for storing time
timeref = np.zeros((fileref.attrs['Iterations']), dtype=floattyperef)
timeref = np.zeros((fileref.attrs['Iterations']), dtype=float_or_doubleref)
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.zeros((filetest.attrs['Iterations']), dtype=float_or_doubletest)
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)
datatest = np.zeros((filetest.attrs['Iterations'], len(outputstest)), dtype=floattypetest)
dataref = np.zeros((fileref.attrs['Iterations'], len(outputsref)), dtype=float_or_doubleref)
datatest = np.zeros((filetest.attrs['Iterations'], len(outputstest)), dtype=float_or_doubletest)
for ID, name in enumerate(outputsref):
dataref[:, ID] = fileref[path + str(name)][:]
datatest[:, ID] = filetest[path + str(name)][:]