Skip to content

Commit

Permalink
Test model rotation in Modes model
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Jul 16, 2024
1 parent 46a5c2e commit d66745c
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 35 deletions.
59 changes: 58 additions & 1 deletion data/models/Modes/model.json
Original file line number Diff line number Diff line change
@@ -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] }]
}
1 change: 1 addition & 0 deletions src/python/Modes_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
)
15 changes: 8 additions & 7 deletions src/python/Modes_viz.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
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',
source_num=1,
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:
Expand Down
55 changes: 28 additions & 27 deletions src/python/sim_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d66745c

Please sign in to comment.