@@ -71,7 +71,7 @@ def __init__(
71
71
FDTD accuracy.
72
72
'''
73
73
74
- self .part_data = partitions
74
+ self .partitions = partitions
75
75
self .fdtd_acc = fdtd_acc
76
76
77
77
# 2D FDTD coefficents calculation. Normalize FDTD coefficents with space divisions and speed of sound.
@@ -92,28 +92,28 @@ def handle_interface(self, interface_data: InterfaceData2D):
92
92
InterfaceData instance. Determines which two partitions pass sound waves to each other.
93
93
'''
94
94
if interface_data .direction == Direction2D .X :
95
- p_left = self .part_data [interface_data .part1_index ].pressure_field [:, - self .INTERFACE_SIZE :]
96
- p_right = self .part_data [interface_data .part2_index ].pressure_field [:, :self .INTERFACE_SIZE ]
95
+ p_left = self .partitions [interface_data .part1_index ].pressure_field [:, - self .INTERFACE_SIZE :]
96
+ p_right = self .partitions [interface_data .part2_index ].pressure_field [:, :self .INTERFACE_SIZE ]
97
97
98
98
# Calculate new forces transmitted into room
99
99
pressures_along_y = np .hstack ((p_left , p_right ))
100
100
new_forces_from_interface_y = np .matmul (pressures_along_y , self .FDTD_COEFFS_Y )
101
101
102
102
# Add everything together
103
- self .part_data [interface_data .part1_index ].new_forces [:, - self .INTERFACE_SIZE :] += new_forces_from_interface_y [:, :self .INTERFACE_SIZE ]
104
- self .part_data [interface_data .part2_index ].new_forces [:, :self .INTERFACE_SIZE ] += new_forces_from_interface_y [:, - self .INTERFACE_SIZE :]
103
+ self .partitions [interface_data .part1_index ].new_forces [:, - self .INTERFACE_SIZE :] += new_forces_from_interface_y [:, :self .INTERFACE_SIZE ]
104
+ self .partitions [interface_data .part2_index ].new_forces [:, :self .INTERFACE_SIZE ] += new_forces_from_interface_y [:, - self .INTERFACE_SIZE :]
105
105
106
106
elif interface_data .direction == Direction2D .Y :
107
- p_top = self .part_data [interface_data .part1_index ].pressure_field [- self .INTERFACE_SIZE :, :]
108
- p_bot = self .part_data [interface_data .part2_index ].pressure_field [:self .INTERFACE_SIZE , :]
107
+ p_top = self .partitions [interface_data .part1_index ].pressure_field [- self .INTERFACE_SIZE :, :]
108
+ p_bot = self .partitions [interface_data .part2_index ].pressure_field [:self .INTERFACE_SIZE , :]
109
109
110
110
# Calculate new forces transmitted into room
111
111
pressures_along_x = np .vstack ((p_top , p_bot ))
112
112
new_forces_from_interface_x = np .matmul (self .FDTD_COEFFS_X , pressures_along_x )
113
113
114
114
# Add everything together
115
- self .part_data [interface_data .part1_index ].new_forces [- self .INTERFACE_SIZE :, :] += new_forces_from_interface_x [:self .INTERFACE_SIZE , :]
116
- self .part_data [interface_data .part2_index ].new_forces [:self .INTERFACE_SIZE , :] += new_forces_from_interface_x [- self .INTERFACE_SIZE :, :]
115
+ self .partitions [interface_data .part1_index ].new_forces [- self .INTERFACE_SIZE :, :] += new_forces_from_interface_x [:self .INTERFACE_SIZE , :]
116
+ self .partitions [interface_data .part2_index ].new_forces [:self .INTERFACE_SIZE , :] += new_forces_from_interface_x [- self .INTERFACE_SIZE :, :]
117
117
118
118
119
119
class Interface2DLooped ():
@@ -144,7 +144,7 @@ def __init__(
144
144
FDTD accuracy.
145
145
'''
146
146
147
- self .part_data = partitions
147
+ self .partitions = partitions
148
148
149
149
# 2D FDTD coefficents calculation. Normalize FDTD coefficents with space divisions and speed of sound.
150
150
fdtd_coeffs_not_normalized : np .ndarray = FiniteDifferences .get_laplacian_matrix (fdtd_order , fdtd_acc )
@@ -164,28 +164,28 @@ def handle_interface(self, interface_data: InterfaceData2D):
164
164
Contains data which two partitions are involved, and in which direction the sound will travel.
165
165
'''
166
166
if interface_data .direction == Direction2D .X :
167
- for y in range (self .part_data [interface_data .part1_index ].space_divisions_y ):
167
+ for y in range (self .partitions [interface_data .part1_index ].space_divisions_y ):
168
168
pressure_field_around_interface_y = np .zeros (shape = [2 * self .INTERFACE_SIZE ])
169
- pressure_field_around_interface_y [0 : self .INTERFACE_SIZE ] = self .part_data [interface_data .part1_index ].pressure_field [y , - self .INTERFACE_SIZE : ].copy ()
170
- pressure_field_around_interface_y [self .INTERFACE_SIZE : 2 * self .INTERFACE_SIZE ] = self .part_data [interface_data .part2_index ].pressure_field [y , 0 : self .INTERFACE_SIZE ].copy ()
169
+ pressure_field_around_interface_y [0 : self .INTERFACE_SIZE ] = self .partitions [interface_data .part1_index ].pressure_field [y , - self .INTERFACE_SIZE : ].copy ()
170
+ pressure_field_around_interface_y [self .INTERFACE_SIZE : 2 * self .INTERFACE_SIZE ] = self .partitions [interface_data .part2_index ].pressure_field [y , 0 : self .INTERFACE_SIZE ].copy ()
171
171
172
172
# Calculate new forces transmitted into room
173
173
new_forces_from_interface_y = np .matmul (pressure_field_around_interface_y , self .FDTD_COEFFS_Y )
174
174
175
175
# Add everything together
176
- self .part_data [interface_data .part1_index ].new_forces [y , - self .INTERFACE_SIZE :] += new_forces_from_interface_y [0 :self .INTERFACE_SIZE ]
177
- self .part_data [interface_data .part2_index ].new_forces [y , :self .INTERFACE_SIZE ] += new_forces_from_interface_y [self .INTERFACE_SIZE : self .INTERFACE_SIZE * 2 ]
176
+ self .partitions [interface_data .part1_index ].new_forces [y , - self .INTERFACE_SIZE :] += new_forces_from_interface_y [0 :self .INTERFACE_SIZE ]
177
+ self .partitions [interface_data .part2_index ].new_forces [y , :self .INTERFACE_SIZE ] += new_forces_from_interface_y [self .INTERFACE_SIZE : self .INTERFACE_SIZE * 2 ]
178
178
179
179
180
180
elif interface_data .direction == Direction2D .Y :
181
- for x in range (self .part_data [interface_data .part1_index ].space_divisions_x ):
181
+ for x in range (self .partitions [interface_data .part1_index ].space_divisions_x ):
182
182
pressure_field_around_interface_x = np .zeros (shape = [2 * self .INTERFACE_SIZE ])
183
- pressure_field_around_interface_x [0 : self .INTERFACE_SIZE ] = self .part_data [interface_data .part1_index ].pressure_field [- self .INTERFACE_SIZE : , x ].copy ()
184
- pressure_field_around_interface_x [self .INTERFACE_SIZE : 2 * self .INTERFACE_SIZE ] = self .part_data [interface_data .part2_index ].pressure_field [0 : self .INTERFACE_SIZE , x ].copy ()
183
+ pressure_field_around_interface_x [0 : self .INTERFACE_SIZE ] = self .partitions [interface_data .part1_index ].pressure_field [- self .INTERFACE_SIZE : , x ].copy ()
184
+ pressure_field_around_interface_x [self .INTERFACE_SIZE : 2 * self .INTERFACE_SIZE ] = self .partitions [interface_data .part2_index ].pressure_field [0 : self .INTERFACE_SIZE , x ].copy ()
185
185
186
186
# Calculate new forces transmitted into room
187
187
new_forces_from_interface_x = np .matmul (pressure_field_around_interface_x , self .FDTD_COEFFS_X )
188
188
189
189
# Add everything together
190
- self .part_data [interface_data .part1_index ].new_forces [- self .INTERFACE_SIZE :, x ] += new_forces_from_interface_x [0 :self .INTERFACE_SIZE ]
191
- self .part_data [interface_data .part2_index ].new_forces [:self .INTERFACE_SIZE , x ] += new_forces_from_interface_x [self .INTERFACE_SIZE : self .INTERFACE_SIZE * 2 ]
190
+ self .partitions [interface_data .part1_index ].new_forces [- self .INTERFACE_SIZE :, x ] += new_forces_from_interface_x [0 :self .INTERFACE_SIZE ]
191
+ self .partitions [interface_data .part2_index ].new_forces [:self .INTERFACE_SIZE , x ] += new_forces_from_interface_x [self .INTERFACE_SIZE : self .INTERFACE_SIZE * 2 ]
0 commit comments