Skip to content

Commit

Permalink
Improve Modes model
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Sep 8, 2024
1 parent b4eca5c commit bcd6727
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
21 changes: 15 additions & 6 deletions data/models/Modes/Modes_model.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
import numpy as np

from pffdtd.sim3d.room_builder import RoomBuilder
from pffdtd.sim3d.constants import SimConstants

S = 0.4
L = 7.00*S
W = 5.19*S
H = 3.70*S

W = 2.0
L = 3.0
H = 4.0

Tc = 20
rh = 50
fcc = False
fmax = 800
ppw = 10.5
constants = SimConstants(Tc=Tc, rh=rh, fmax=fmax,
PPW=ppw, fcc=fcc, verbose=False)
mul = 3.5 if fcc else 2.0
offset = constants.h * mul

room = RoomBuilder(L, W, H)
room.with_colors({
"Ceiling": [200, 200, 200],
"Floor": [151, 134, 122],
"Walls": [255, 255, 255],
})

fmax = 800
ppw = 10.5
dx = 343/(fmax*ppw)
offset = dx*2

room.add_source("S1", [offset, offset, offset])
room.add_receiver("R1", [W-offset, L-offset, H-offset])
Expand Down
2 changes: 1 addition & 1 deletion data/models/Modes/model.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"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], [2.076, 0.0, 0.0], [2.076, 0.0, 1.4800000000000002], [0.0, 0.0, 1.4800000000000002], [0.0, 2.8000000000000003, 0.0], [2.076, 2.8000000000000003, 0.0], [2.076, 2.8000000000000003, 1.4800000000000002], [0.0, 2.8000000000000003, 1.4800000000000002]], "color": [255, 255, 255], "sides": [1, 1, 1, 1, 1, 1, 1, 1]}, "Ceiling": {"tris": [[2, 1, 0], [2, 3, 1]], "pts": [[0, 0, 1.4800000000000002], [0, 2.8000000000000003, 1.4800000000000002], [2.076, 0, 1.4800000000000002], [2.076, 2.8000000000000003, 1.4800000000000002]], "color": [200, 200, 200], "sides": [1, 1]}, "Floor": {"tris": [[0, 1, 2], [1, 3, 2]], "pts": [[0, 0, 0], [0, 2.8000000000000003, 0], [2.076, 0, 0], [2.076, 2.8000000000000003, 0]], "color": [151, 134, 122], "sides": [1, 1]}}, "sources": [{"name": "S1", "xyz": [0.08166666666666667, 0.08166666666666667, 0.08166666666666667]}], "receivers": [{"name": "R1", "xyz": [1.9943333333333335, 2.7183333333333337, 1.3983333333333334]}]}
{"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], [2.0, 0.0, 0.0], [2.0, 0.0, 4.0], [0.0, 0.0, 4.0], [0.0, 3.0, 0.0], [2.0, 3.0, 0.0], [2.0, 3.0, 4.0], [0.0, 3.0, 4.0]], "color": [255, 255, 255], "sides": [1, 1, 1, 1, 1, 1, 1, 1]}, "Ceiling": {"tris": [[2, 1, 0], [2, 3, 1]], "pts": [[0, 0, 4.0], [0, 3.0, 4.0], [2.0, 0, 4.0], [2.0, 3.0, 4.0]], "color": [200, 200, 200], "sides": [1, 1]}, "Floor": {"tris": [[0, 1, 2], [1, 3, 2]], "pts": [[0, 0, 0], [0, 3.0, 0], [2.0, 0, 0], [2.0, 3.0, 0]], "color": [151, 134, 122], "sides": [1, 1]}}, "sources": [{"name": "S1", "xyz": [0.08171428571428571, 0.08171428571428571, 0.08171428571428571]}], "receivers": [{"name": "R1", "xyz": [1.9182857142857144, 2.918285714285714, 3.918285714285714]}]}
22 changes: 11 additions & 11 deletions run_3d.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
root_dir="$(cd "$(dirname "$0")" && pwd)"
engine_exe="$root_dir/build/src/cpp/main_3d/pffdtd_3d"

sim_name="ProStudio"
sim_name="Modes"
sim_setup="${sim_name}_cpu.py"
sim_model_gen="${sim_name}_model.py"
sim_dir="$root_dir/data/sim_data/$sim_name/cpu"
Expand All @@ -32,13 +32,13 @@ python "$sim_setup"
$engine_exe "$sim_dir"

# Post-process
pffdtd sim3d process-outputs --sim_dir="$sim_dir" --fcut_lowpass "$fmax" --order_lowpass=8 --symmetric_lowpass --fcut_lowcut "$fmin" --order_lowcut=4 --air_abs_filter="stokes" --save_wav --plot
pffdtd analysis response --fmin=10 --target="-2.5" --smoothing=$smoothing --fmax=$fmax $sim_dir/R001_out_normalised.wav $sim_dir/R002_out_normalised.wav
pffdtd analysis response --fmin=10 --target="-2.0" --smoothing=$smoothing --fmax=$fmax $sim_dir/R001_out_normalised.wav $sim_dir/R003_out_normalised.wav
pffdtd analysis response --fmin=10 --target="-1.5" --smoothing=$smoothing --fmax=$fmax $sim_dir/R001_out_normalised.wav $sim_dir/R004_out_normalised.wav
pffdtd analysis response --fmin=10 --target="-1.0" --smoothing=$smoothing --fmax=$fmax $sim_dir/R001_out_normalised.wav $sim_dir/R005_out_normalised.wav
pffdtd analysis response --fmin=10 --target="-0.5" --smoothing=$smoothing --fmax=$fmax $sim_dir/R001_out_normalised.wav $sim_dir/R006_out_normalised.wav
pffdtd analysis waterfall $sim_dir/R001_out_normalised.wav
pffdtd analysis t60 --fmin=$fmin --fmax="$fmax" --target=0.3 $sim_dir/R001_out_normalised.wav
pffdtd analysis t60 --sim_dir="$sim_dir" --fmin=$fmin --fmax="$fmax" --target=0.25
pffdtd analysis room-modes --sim_dir="$sim_dir" --fmin=$fmin --fmax=$fmax --num_modes=20
pffdtd sim3d process-outputs --sim_dir="$sim_dir" --fcut_lowpass "$fmax" --order_lowpass=8 --symmetric_lowpass --fcut_lowcut "$fmin" --order_lowcut=4 --air_abs_filter="none" --save_wav --plot
# pffdtd analysis response --fmin=10 --target="-2.5" --smoothing=$smoothing --fmax=$fmax $sim_dir/R001_out_normalised.wav $sim_dir/R002_out_normalised.wav
# pffdtd analysis response --fmin=10 --target="-2.0" --smoothing=$smoothing --fmax=$fmax $sim_dir/R001_out_normalised.wav $sim_dir/R003_out_normalised.wav
# pffdtd analysis response --fmin=10 --target="-1.5" --smoothing=$smoothing --fmax=$fmax $sim_dir/R001_out_normalised.wav $sim_dir/R004_out_normalised.wav
# pffdtd analysis response --fmin=10 --target="-1.0" --smoothing=$smoothing --fmax=$fmax $sim_dir/R001_out_normalised.wav $sim_dir/R005_out_normalised.wav
# pffdtd analysis response --fmin=10 --target="-0.5" --smoothing=$smoothing --fmax=$fmax $sim_dir/R001_out_normalised.wav $sim_dir/R006_out_normalised.wav
# pffdtd analysis waterfall $sim_dir/R001_out_normalised.wav
# pffdtd analysis t60 --fmin=$fmin --fmax="$fmax" --target=0.3 $sim_dir/R001_out_normalised.wav
# pffdtd analysis t60 --sim_dir="$sim_dir" --fmin=$fmin --fmax="$fmax" --target=0.25
pffdtd analysis room-modes --sim_dir="$sim_dir" --fmin=$fmin --fmax=$fmax --num_modes=20 --width=2.0 --length=3.0 --height=4.0

0 comments on commit bcd6727

Please sign in to comment.