# Design a parameterized wave speed function

Hello SciML community,

I am a new user of some of the packages in this ecosystem in search of some guidance of how to efficiently write code which models the behavior of acoustic waves in two dimensions. So far I have constructed a PDESystem which is governed by the acoustic wave equation:

``````Dtt(u(x, y, t)) ~ C(x, y, t)^2 * (Dxx(u(x, y, t)) + Dyy(u(x, y, t)))
``````

Where `C(x, y, t)` is a function which determines the speed of the wave across the spatial domain and in time. For an undisturbed wave this function would simply be `(x, y, t) -> 1.0`. However I would like to simulate several cylindrical scatterers in this system. For rigid scatterers the wave speed within `(x-x_xpos) ^ 2 + (y - ypos) ^2 < r ^ 2` should be zero for each non overlapping scatterer.

A constraint of the problem I am attempting to solve is that the scatterers move in the spacial dimension over a period of time. For example I would like the scatterers to start at an initial location and travel to a defined location over the timespan of the solution. At the end of the simulation I would like to define a new final location and have those scatterers move there.

I have played around with defining the initial and final locations of the scatterers using parameters and remaking the problem repeatedly:

``````M = 2
@parameters x_pos[1:M], y_pos[1:M]
@parameters x_pos_f[1:M], y_pos_f[1:M]
@parameters T[1:2]

function C(x, y, t)
c = wavespeed
t_norm = (t - T) / (T - T)

for i in 1:M
c = IfElse.ifelse((x - x_pos[i] - (x_pos_f[i] - x_pos[i]) * t_norm) ^ 2 + (y - y_pos[i] - (y_pos_f[i] - y_pos[i]) * t_norm) ^ 2 < radii[i] ^ 2, 0.0, c)
end

return c
end
``````

TLDR question: How to better represent a wave speed function which is parameterized so that the initial and final locations of obstacles can be updated while integrating this differential equation in time.

I am sure there is a cleaner, more efficient, and overall better way to do accomplish my goal. I would appreciate any help or guidance anyone could offer me in this task.

Thank You