def compute_enriched_elements_new_pseudo(self, delta_t): """ Compute the new artificial viscosity of the enriched_cells :param delta_t: time_step """ mask = self.enriched if not mask.any(): return # Left part : density_left = self.density.current_value[mask] density_left_new = self.density.new_value[mask] sound_velocity_left = self.sound_velocity.current_value[mask] size_left = self.left_part_size.new_value[mask] pseudo_left = OneDimensionCell.compute_pseudo( delta_t, density_left, density_left_new, size_left, sound_velocity_left, self.data.numeric.a_pseudo, self.data.numeric.b_pseudo) # Right part : density_right = self.enr_density.current_value[mask] density_right_new = self.enr_density.new_value[mask] sound_velocity_right = self.enr_sound_velocity.current_value[mask] size_right = self.right_part_size.new_value[mask] pseudo_right = OneDimensionCell.compute_pseudo( delta_t, density_right, density_right_new, size_right, sound_velocity_right, self.data.numeric.a_pseudo, self.data.numeric.b_pseudo) self.pseudo.new_value[mask] = pseudo_left self.enr_artificial_viscosity.new_value[mask] = pseudo_right
def test_compute_pseudo(self): """ Test of compute_pseudo class method """ rho_new = np.array([8500., 3500, 2175]) rho_old = np.array([8700., 3200, 2171]) new_size = np.array([0.025, 0.01, 0.005]) sound_speed = np.array([4400, 3200, 1140]) delta_t = 1.2e-08 pseudo_a, pseudo_b = 1.2, 0.25 result = OneDimensionCell.compute_pseudo(delta_t, rho_old, rho_new, new_size, sound_speed, pseudo_a, pseudo_b) np.testing.assert_allclose(result, [0.00000000e+00, 2.25427729e+13, 2.00897590e+09])