From d66745c4ac5d55d8a93267ec255f81e58c5f5a96 Mon Sep 17 00:00:00 2001 From: Tobias Hienzsch Date: Tue, 16 Jul 2024 02:14:07 +0200 Subject: [PATCH] Test model rotation in Modes model --- data/models/Modes/model.json | 59 +++++++++++++++++++++++++++++++++++- src/python/Modes_cpu.py | 1 + src/python/Modes_viz.py | 15 ++++----- src/python/sim_setup.py | 55 ++++++++++++++++----------------- 4 files changed, 95 insertions(+), 35 deletions(-) diff --git a/data/models/Modes/model.json b/data/models/Modes/model.json index fdd192a..de9a3fa 100644 --- a/data/models/Modes/model.json +++ b/data/models/Modes/model.json @@ -1 +1,58 @@ -{"mats_hash": {"Walls": {"tris": [[0, 1, 2], [0, 2, 3], [6, 5, 4], [7, 6, 4], [0, 3, 4], [7, 4, 3], [5, 2, 1], [2, 5, 6]], "pts": [[0.0, 0.0, 0.0], [4.671, 0.0, 0.0], [4.671, 0.0, 3.33], [0.0, 0.0, 3.33], [0.0, 6.3, 0.0], [4.671, 6.3, 0.0], [4.671, 6.3, 3.33], [0.0, 6.3, 3.33]], "color": [255, 255, 255], "sides": [1, 1, 1, 1, 1, 1, 1, 1]}, "Ceiling": {"tris": [[2, 1, 0], [2, 3, 1]], "pts": [[0, 0, 3.33], [0, 6.3, 3.33], [4.671, 0, 3.33], [4.671, 6.3, 3.33]], "color": [200, 200, 200], "sides": [1, 1]}, "Floor": {"tris": [[0, 1, 2], [1, 3, 2]], "pts": [[0, 0, 0], [0, 6.3, 0], [4.671, 0, 0], [4.671, 6.3, 0]], "color": [151, 134, 122], "sides": [1, 1]}}, "sources": [{"name": "S1", "xyz": [0.22499999999999998, 0.22499999999999998, 0.22499999999999998]}], "receivers": [{"name": "R1", "xyz": [4.446000000000001, 6.075, 3.105]}]} +{ + "mats_hash": { + "Walls": { + "tris": [ + [0, 1, 2], + [0, 2, 3], + [6, 5, 4], + [7, 6, 4], + [0, 3, 4], + [7, 4, 3], + [5, 2, 1], + [2, 5, 6] + ], + "pts": [ + [0.0, 0.0, 0.0], + [4.671, 0.0, 0.0], + [4.671, 0.0, 3.33], + [0.0, 0.0, 3.33], + [0.0, 6.3, 0.0], + [4.671, 6.3, 0.0], + [4.671, 6.3, 3.33], + [0.0, 6.3, 3.33] + ], + "color": [255, 255, 255], + "sides": [1, 1, 1, 1, 1, 1, 1, 1] + }, + "Ceiling": { + "tris": [ + [2, 1, 0], + [2, 3, 1] + ], + "pts": [ + [0, 0, 3.33], + [0, 6.3, 3.33], + [4.671, 0, 3.33], + [4.671, 6.3, 3.33] + ], + "color": [200, 200, 200], + "sides": [1, 1] + }, + "Floor": { + "tris": [ + [0, 1, 2], + [1, 3, 2] + ], + "pts": [ + [0, 0, 0], + [0, 6.3, 0], + [4.671, 0, 0], + [4.671, 6.3, 0] + ], + "color": [151, 134, 122], + "sides": [1, 1] + } + }, + "sources": [{ "name": "S1", "xyz": [0.3, 0.3, 0.3] }], + "receivers": [{ "name": "R1", "xyz": [4.371, 6.0, 3.0300000000000002] }] +} diff --git a/src/python/Modes_cpu.py b/src/python/Modes_cpu.py index 954bc32..5ba0d2a 100644 --- a/src/python/Modes_cpu.py +++ b/src/python/Modes_cpu.py @@ -20,4 +20,5 @@ save_folder='../../data/sim_data/Modes/cpu', save_folder_gpu='../../data/sim_data/Modes/gpu', compress=0, + rot_az_el=[0, 0], ) diff --git a/src/python/Modes_viz.py b/src/python/Modes_viz.py index 2c2666c..2bd201c 100644 --- a/src/python/Modes_viz.py +++ b/src/python/Modes_viz.py @@ -1,5 +1,6 @@ from sim_setup import sim_setup +# will draw 'voxelization' (spheres are active boundary nodes, cubes rigid boundary nodes) sim_setup( model_json_file='../../data/models/Modes/model.json', mat_folder='../../data/materials', @@ -7,21 +8,21 @@ insig_type='dhann30', # for viz diff_source=False, mat_files_dict={ - 'Ceiling': 'absorber_8000_200mm.h5', - 'Floor': 'absorber_8000_200mm.h5', - 'Walls': 'absorber_8000_200mm.h5', + 'Ceiling': 'concrete_painted.h5', + 'Floor': 'concrete_painted.h5', + 'Walls': 'concrete_painted.h5', }, - duration=0.1, # duration in seconds + duration=0.1, Tc=20, rh=50, - fcc_flag=True, - PPW=7.7, # for 2% phase velocity error at fmax + fcc_flag=False, + PPW=10.5, fmax=500.0, save_folder='../../data/sim_data/Modes/viz', # can run python from here compress=0, draw_vox=True, - # will draw 'voxelization' (spheres are active boundary nodes, cubes rigid boundary nodes) draw_backend='mayavi', + rot_az_el=[0, 0] ) # then run with python and 3D visualization: diff --git a/src/python/sim_setup.py b/src/python/sim_setup.py index 5bfb9bb..c523be2 100644 --- a/src/python/sim_setup.py +++ b/src/python/sim_setup.py @@ -27,33 +27,34 @@ from air_abs.get_air_absorption import get_air_absorption def sim_setup( - #the following are required but using None default so not positional - insig_type=None, #sig type (see sig_comms.py) - fmax=None, #fmax for simulation (to set grid spacing) - PPW=None, #points per wavelength (also to set grid spacing) - save_folder=None, #where to save .h5 files - model_json_file=None, #json export of model - mat_folder=None, #folder where to find .h5 DEF coefficients for wal impedances - mat_files_dict=None, #dict to link up materials to .h5 mat files - duration=None, #duration to simulate, in seconds - #the following are not required - Tc=20, #temperature in deg C (sets sound speed) - rh=50, #relative humidity of air (configures air absorption post processing) - source_num=1, #1-based indexing, source to simulate (in sources.csv) - save_folder_gpu=None, #folder to save gpu-prepared .h5 data (sorted and rotated and FCC-folded) - #save_folder_cpu=None, - draw_vox=False, #draw voxelization - draw_backend='mayavi', #default, 'polyscope' better for larger grids - diff_source=False, #use this for single precision runs - fcc_flag=False, #to use FCC scheme - bmin=None, #to set custom scene bounds (useful for open scenes) - bmax=None, #to set custom scene bounds (useful for open scenes) - Nvox_est=None, #to manually set number of voxels (for ray-tri intersections) for voxelization - Nh=None, #to set voxel size in grid pacing (for ray-tri intersections) - Nprocs=None, #number of processes for multiprocessing, defaults to 80% of cores - compress=None, #GZIP compress for HDF5, 0 to 9 (fast to slow) - rot_az_el=[0.,0.], #to rotate the whole scene (including sources/receivers) -- to test robustness of scheme - ): + # The following are required but using None default so not positional + insig_type=None, #sig type (see sig_comms.py) + fmax=None, #fmax for simulation (to set grid spacing) + PPW=None, #points per wavelength (also to set grid spacing) + save_folder=None, #where to save .h5 files + model_json_file=None, #json export of model + mat_folder=None, #folder where to find .h5 DEF coefficients for wal impedances + mat_files_dict=None, #dict to link up materials to .h5 mat files + duration=None, #duration to simulate, in seconds + + # The following are not required + Tc=20, #temperature in deg C (sets sound speed) + rh=50, #relative humidity of air (configures air absorption post processing) + source_num=1, #1-based indexing, source to simulate (in sources.csv) + save_folder_gpu=None, #folder to save gpu-prepared .h5 data (sorted and rotated and FCC-folded) + #save_folder_cpu=None, + draw_vox=False, #draw voxelization + draw_backend='mayavi', #default, 'polyscope' better for larger grids + diff_source=False, #use this for single precision runs + fcc_flag=False, #to use FCC scheme + bmin=None, #to set custom scene bounds (useful for open scenes) + bmax=None, #to set custom scene bounds (useful for open scenes) + Nvox_est=None, #to manually set number of voxels (for ray-tri intersections) for voxelization + Nh=None, #to set voxel size in grid pacing (for ray-tri intersections) + Nprocs=None, #number of processes for multiprocessing, defaults to 80% of cores + compress=None, #GZIP compress for HDF5, 0 to 9 (fast to slow) + rot_az_el=[0.,0.], #to rotate the whole scene (including sources/receivers) -- to test robustness of scheme +): assert Tc is not None assert rh is not None assert source_num > 0