Skip to content

Commit

Permalink
Add anechoic chamber & pro studio models
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Aug 9, 2024
1 parent fca04ff commit 2e2ac36
Show file tree
Hide file tree
Showing 16 changed files with 394 additions and 27 deletions.
30 changes: 30 additions & 0 deletions data/models/Anechoic/model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"mats_hash": {
"Walls": {
"tris": [
[0, 2, 1],
[0, 3, 2],
[1, 5, 4],
[1, 3, 5]
],
"pts": [
[0.0, 2.0, 0.0],
[9.0, 2.0, 0.0],
[9.0, 2.0, 18.0],
[0.0, 2.0, 18.0],
[18.0, 2.0, 0.0],
[18.0, 2.0, 18.0]
],
"color": [255, 255, 255],
"sides": [1, 1, 1, 1]
}
},
"sources": [{ "name": "S1", "xyz": [9.0, 1.95, 9.0] }],
"receivers": [
{ "name": "R1", "xyz": [9.0, 0.05, 7.0] },
{ "name": "R2", "xyz": [9.0, 0.05, 8.0] },
{ "name": "R3", "xyz": [9.0, 0.05, 9.0] },
{ "name": "R4", "xyz": [9.0, 0.05, 10.0] },
{ "name": "R5", "xyz": [9.0, 0.05, 11.0] }
]
}
1 change: 1 addition & 0 deletions data/models/ProStudio/model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"mats_hash": {"Ceiling": {"tris": [[3, 5, 4], [6, 5, 3], [1, 3, 2], [8, 7, 6], [0, 6, 3], [0, 3, 1], [0, 8, 6]], "pts": [[5.235945801, 7.123926758, 3.5], [7.014450684000001, 2.237524902, 3.5], [6.444097656, 1.014399231, 3.5], [3.79173999, 0.04902, 3.5], [0.969159973, 0.04902, 3.5], [0.014869901999999999, 1.00331012, 3.5], [0.014869901999999999, 6.2033100590000005, 3.5], [1.403930176, 7.368870117, 3.5], [3.532010986, 7.744107909999999, 3.5]], "color": [2, 2, 2], "sides": [1, 1, 1, 1, 1, 1, 1]}, "Floor": {"tris": [[5, 3, 4], [5, 6, 3], [3, 0, 2], [7, 8, 6], [6, 1, 3], [3, 1, 0], [8, 1, 6]], "pts": [[7.014450684000001, 2.237524902, 0.0], [5.235945801, 7.123926758, 0.0], [6.444097656, 1.014399231, 0.0], [3.79173999, 0.04902, 0.0], [0.969159973, 0.04902, 0.0], [0.014869901999999999, 1.00331012, 0.0], [0.014869901999999999, 6.2033100590000005, 0.0], [1.403930176, 7.368870117, 0.0], [3.532010986, 7.744107909999999, 0.0]], "color": [2, 2, 2], "sides": [1, 1, 1, 1, 1, 1, 1]}, "Walls": {"tris": [[0, 1, 2], [0, 2, 3], [4, 0, 3], [4, 3, 5], [4, 5, 6], [7, 4, 6], [8, 7, 6], [8, 6, 9], [8, 9, 10], [11, 8, 10], [12, 11, 10], [13, 11, 12], [14, 13, 12], [14, 12, 15], [14, 15, 16], [17, 14, 16], [1, 17, 16], [1, 16, 2]], "pts": [[7.014450684000001, 2.237524902, 0.0], [5.235945801, 7.123926758, 0.0], [5.235945801, 7.123926758, 3.5], [7.014450684000001, 2.237524902, 3.5], [6.444097656, 1.014399231, 0.0], [6.444097656, 1.014399231, 3.5], [3.79173999, 0.04902, 3.5], [3.79173999, 0.04902, 0.0], [0.969159973, 0.04902, 0.0], [0.969159973, 0.04902, 3.5], [0.014869901999999999, 1.00331012, 3.5], [0.014869901999999999, 1.00331012, 0.0], [0.014869901999999999, 6.2033100590000005, 3.5], [0.014869901999999999, 6.2033100590000005, 0.0], [1.403930176, 7.368870117, 0.0], [1.403930176, 7.368870117, 3.5], [3.532010986, 7.744107909999999, 3.5], [3.532010986, 7.744107909999999, 0.0]], "color": [255, 255, 255], "sides": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}}, "sources": [{"name": "S1", "xyz": [0.85, 6.7, 1.4]}], "receivers": [{"name": "R1", "xyz": [2.9, 5.5, 1.2]}, {"name": "R2", "xyz": [3.8, 1.0, 1.2]}]}
83 changes: 83 additions & 0 deletions data/models/ProStudio/model.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Created by FreeCAD <https://www.freecad.org>
v 7014.450684 2237.524902 0.000000 173 181 189
v 5235.945801 7123.926758 0.000000 173 181 189
v 5235.945801 7123.926758 3500.000000 173 181 189
v 7014.450684 2237.524902 3500.000000 173 181 189
v 6444.097656 1014.399231 0.000000 173 181 189
v 6444.097656 1014.399231 3500.000000 173 181 189
v 3791.739990 49.020000 3500.000000 173 181 189
v 3791.739990 49.020000 0.000000 173 181 189
v 969.159973 49.020000 0.000000 173 181 189
v 969.159973 49.020000 3500.000000 173 181 189
v 14.869902 1003.310120 3500.000000 173 181 189
v 14.869902 1003.310120 0.000000 173 181 189
v 14.869902 6203.310059 3500.000000 173 181 189
v 14.869902 6203.310059 0.000000 173 181 189
v 1403.930176 7368.870117 0.000000 173 181 189
v 1403.930176 7368.870117 3500.000000 173 181 189
v 3532.010986 7744.107910 3500.000000 173 181 189
v 3532.010986 7744.107910 0.000000 173 181 189
vn 0.939693 0.342020 0.000000
vn 0.939693 0.342020 -0.000000
vn 0.906308 -0.422618 0.000000
vn 0.906308 -0.422618 0.000000
vn 0.342020 -0.939693 0.000000
vn 0.342020 -0.939693 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn -0.707107 -0.707107 0.000000
vn -0.707107 -0.707107 0.000000
vn -1.000000 -0.000000 0.000000
vn -1.000000 0.000000 0.000000
vn -0.642788 0.766044 -0.000000
vn -0.642788 0.766044 0.000000
vn -0.173648 0.984808 0.000000
vn -0.173648 0.984808 0.000000
vn 0.342020 0.939693 -0.000000
vn 0.342020 0.939693 -0.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 -0.000000 -1.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 -0.000000 -1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
f 1//1 2//1 3//1
f 1//2 3//2 4//2
f 5//3 1//3 4//3
f 5//4 4//4 6//4
f 5//5 6//5 7//5
f 8//6 5//6 7//6
f 9//7 8//7 7//7
f 9//8 7//8 10//8
f 9//9 10//9 11//9
f 12//10 9//10 11//10
f 13//11 12//11 11//11
f 14//12 12//12 13//12
f 15//13 14//13 13//13
f 15//14 13//14 16//14
f 15//15 16//15 17//15
f 18//16 15//16 17//16
f 2//17 18//17 17//17
f 2//18 17//18 3//18
f 12//19 8//19 9//19
f 12//20 14//20 8//20
f 8//21 1//21 5//21
f 15//22 18//22 14//22
f 14//23 2//23 8//23
f 8//24 2//24 1//24
f 18//25 2//25 14//25
f 7//26 11//26 10//26
f 13//27 11//27 7//27
f 4//28 7//28 6//28
f 17//29 16//29 13//29
f 3//30 13//30 7//30
f 3//31 7//31 4//31
f 3//32 17//32 13//32
24 changes: 24 additions & 0 deletions data/models/ProStudio/model_ceiling.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Created by FreeCAD <https://www.freecad.org>
v 5235.945801 7123.926758 3500.000000 173 181 189
v 7014.450684 2237.524902 3500.000000 173 181 189
v 6444.097656 1014.399231 3500.000000 173 181 189
v 3791.739990 49.020000 3500.000000 173 181 189
v 969.159973 49.020000 3500.000000 173 181 189
v 14.869902 1003.310120 3500.000000 173 181 189
v 14.869902 6203.310059 3500.000000 173 181 189
v 1403.930176 7368.870117 3500.000000 173 181 189
v 3532.010986 7744.107910 3500.000000 173 181 189
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
f 4//1 6//1 5//1
f 7//2 6//2 4//2
f 2//3 4//3 3//3
f 9//4 8//4 7//4
f 1//5 7//5 4//5
f 1//6 4//6 2//6
f 1//7 9//7 7//7
24 changes: 24 additions & 0 deletions data/models/ProStudio/model_floor.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Created by FreeCAD <https://www.freecad.org>
v 7014.450684 2237.524902 0.000000 173 181 189
v 5235.945801 7123.926758 0.000000 173 181 189
v 6444.097656 1014.399231 0.000000 173 181 189
v 3791.739990 49.020000 0.000000 173 181 189
v 969.159973 49.020000 0.000000 173 181 189
v 14.869902 1003.310120 0.000000 173 181 189
v 14.869902 6203.310059 0.000000 173 181 189
v 1403.930176 7368.870117 0.000000 173 181 189
v 3532.010986 7744.107910 0.000000 173 181 189
vn 0.000000 0.000000 -1.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 -0.000000 -1.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 -0.000000 -1.000000
f 6//1 4//1 5//1
f 6//2 7//2 4//2
f 4//3 1//3 3//3
f 8//4 9//4 7//4
f 7//5 2//5 4//5
f 4//6 2//6 1//6
f 9//7 2//7 7//7
55 changes: 55 additions & 0 deletions data/models/ProStudio/model_walls.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Created by FreeCAD <https://www.freecad.org>
v 7014.450684 2237.524902 0.000000 173 181 189
v 5235.945801 7123.926758 0.000000 173 181 189
v 5235.945801 7123.926758 3500.000000 173 181 189
v 7014.450684 2237.524902 3500.000000 173 181 189
v 6444.097656 1014.399231 0.000000 173 181 189
v 6444.097656 1014.399231 3500.000000 173 181 189
v 3791.739990 49.020000 3500.000000 173 181 189
v 3791.739990 49.020000 0.000000 173 181 189
v 969.159973 49.020000 0.000000 173 181 189
v 969.159973 49.020000 3500.000000 173 181 189
v 14.869902 1003.310120 3500.000000 173 181 189
v 14.869902 1003.310120 0.000000 173 181 189
v 14.869902 6203.310059 3500.000000 173 181 189
v 14.869902 6203.310059 0.000000 173 181 189
v 1403.930176 7368.870117 0.000000 173 181 189
v 1403.930176 7368.870117 3500.000000 173 181 189
v 3532.010986 7744.107910 3500.000000 173 181 189
v 3532.010986 7744.107910 0.000000 173 181 189
vn 0.939693 0.342020 0.000000
vn 0.939693 0.342020 -0.000000
vn 0.906308 -0.422618 0.000000
vn 0.906308 -0.422618 0.000000
vn 0.342020 -0.939693 0.000000
vn 0.342020 -0.939693 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn -0.707107 -0.707107 0.000000
vn -0.707107 -0.707107 0.000000
vn -1.000000 -0.000000 0.000000
vn -1.000000 0.000000 0.000000
vn -0.642788 0.766044 -0.000000
vn -0.642788 0.766044 0.000000
vn -0.173648 0.984808 0.000000
vn -0.173648 0.984808 0.000000
vn 0.342020 0.939693 -0.000000
vn 0.342020 0.939693 -0.000000
f 1//1 2//1 3//1
f 1//2 3//2 4//2
f 5//3 1//3 4//3
f 5//4 4//4 6//4
f 5//5 6//5 7//5
f 8//6 5//6 7//6
f 9//7 8//7 7//7
f 9//8 7//8 10//8
f 9//9 10//9 11//9
f 12//10 9//10 11//10
f 13//11 12//11 11//11
f 14//12 12//12 13//12
f 15//13 14//13 13//13
f 15//14 13//14 16//14
f 15//15 16//15 17//15
f 18//16 15//16 17//16
f 2//17 18//17 17//17
f 2//18 17//18 3//18
2 changes: 1 addition & 1 deletion data/models/Studio/model.json

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions run_3d.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ root_dir="$(cd "$(dirname "$0")" && pwd)"
python_dir="$root_dir/src/python"
engine_exe="$root_dir/build/src/cpp/main_3d/pffdtd_3d"

sim_name="Modes"
sim_name="ProStudio"
sim_setup="${sim_name}_cpu.py"
sim_model_gen="${sim_name}_model.py"
sim_dir="$root_dir/data/sim_data/$sim_name/cpu"

model_dir="$root_dir/data/models/$sim_name"
materials_dir="$root_dir/data/materials"

fmin=20
fmin=10
fmax=800

# Delete old sim
Expand All @@ -35,8 +35,9 @@ $engine_exe

# Post-process
cd "$python_dir"
python -m sim3d.process_outputs --data_dir="$sim_dir" --fcut_lowpass "$fmax" --N_order_lowpass=8 --symmetric --fcut_lowcut $fmin --N_order_lowcut=4 --air_abs_filter="none" --save_wav --plot
# python -m analysis.response --fmin=$fmin --fmax="$fmax" ../../data/sim_data/$sim_name/cpu/R001_out_normalised.wav
# python -m analysis.t60 --fmin=$fmin --fmax="$fmax" --target=0.25 ../../data/sim_data/$sim_name/cpu/R001_out_normalised.wav
python -m sim3d.process_outputs --data_dir="$sim_dir" --fcut_lowpass "$fmax" --N_order_lowpass=8 --symmetric --fcut_lowcut "$fmin" --N_order_lowcut=4 --air_abs_filter="modal" --save_wav --plot
python -m analysis.response --fmax=0.0 ../../data/sim_data/$sim_name/cpu/R001_out_normalised.wav ../../data/sim_data/$sim_name/cpu/R002_out_normalised.wav
python -m analysis.t60 --fmin=$fmin --fmax="$fmax" --target=0.25 ../../data/sim_data/$sim_name/cpu/R001_out_normalised.wav
python -m analysis.waterfall ../../data/sim_data/$sim_name/cpu/R001_out_normalised.wav
# python -m analysis.t60 --data_dir="$sim_dir" --fmin=$fmin --fmax="$fmax" --target=0.25
python -m analysis.room_modes --data_dir="$sim_dir" --fmin=$fmin --fmax=$fmax --modes=20
# python -m analysis.room_modes --data_dir="$sim_dir" --fmin=$fmin --fmax=$fmax --modes=20
27 changes: 27 additions & 0 deletions src/python/Anechoic_cpu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from sim_setup import sim_setup

sim_setup(
model_json_file='../../data/models/Anechoic/model.json',
mat_folder='../../data/materials',
source_num=1,
insig_type='impulse',
diff_source=True,
mat_files_dict={
# 'Floor': 'floor_wood.h5',
'Walls': 'concrete_painted.h5',
},
duration=0.5,
Tc=20,
rh=50,
fcc_flag=False,
PPW=12.0,
fmax=1000.0,
save_folder='../../data/sim_data/Anechoic/cpu',
save_folder_gpu='../../data/sim_data/Anechoic/gpu',
draw_vox=True,
draw_backend='polyscope',
compress=0,
rot_az_el=[0, 0],
bmax=[18.0, 2.0, 18.0],
bmin=[0, 0, 0],
)
26 changes: 26 additions & 0 deletions src/python/ProStudio_cpu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from sim_setup import sim_setup

sim_setup(
model_json_file='../../data/models/ProStudio/model.json',
mat_folder='../../data/materials',
source_num=1,
insig_type='impulse',
diff_source=True,
mat_files_dict={
'Ceiling': 'absorber_8000_200mm_gap_100mm.h5',
'Floor': 'floor_wood.h5',
'Walls': 'absorber_8000_200mm_gap_100mm.h5',
},
duration=1.6,
Tc=20,
rh=50,
fcc_flag=False,
PPW=10.5,
fmax=800.0,
save_folder='../../data/sim_data/ProStudio/cpu',
save_folder_gpu='../../data/sim_data/ProStudio/gpu',
draw_vox=True,
draw_backend='polyscope',
compress=0,
rot_az_el=[0, 0],
)
67 changes: 67 additions & 0 deletions src/python/ProStudio_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import json
import pathlib


def load_surface_mesh(obj_file):
with open(obj_file) as f:
lines = [line.rstrip() for line in f]

tris = []
pts = []

for line in lines:
if not "vn " in line:
if "v " in line:
parts = line.split(" ")
parts = parts[1:4]
parts = [float(part)/1000.0 for part in parts]
pts.append(parts)
if "f " in line:
parts = line.split(" ")
parts = parts[1:4]
parts = [int(part.split("/")[0])-1 for part in parts]
tris.append(parts)

return pts, tris


def main():
model_dir = pathlib.Path("../../data/models/ProStudio")
ceiling_pts, ceiling_tris = load_surface_mesh(model_dir/'model_ceiling.obj')
floor_pts, floor_tris = load_surface_mesh(model_dir/'model_floor.obj')
walls_pts, walls_tris = load_surface_mesh(model_dir/'model_walls.obj')

root = {
"mats_hash": {
"Ceiling": {
"tris": ceiling_tris,
"pts": ceiling_pts,
"color": [2, 2, 2],
"sides": [1]*len(ceiling_tris)
},
"Floor": {
"tris": floor_tris,
"pts": floor_pts,
"color": [2, 2, 2],
"sides": [1]*len(floor_tris)
},
"Walls": {
"tris": walls_tris,
"pts": walls_pts,
"color": [255, 255, 255],
"sides": [1]*len(walls_tris)
},
},
"sources": [{"name": "S1", "xyz": [0.85, 6.7, 1.4]}],
"receivers": [
{"name": "R1", "xyz": [2.9, 5.5, 1.2]},
{"name": "R2", "xyz": [3.8, 1.0, 1.2]},
]
}

model_file = model_dir/'model.json'
with open(model_file, "w") as f:
json.dump(root, f)


main()
Loading

0 comments on commit 2e2ac36

Please sign in to comment.