I'm coming back to k-wave after a pause of several years, and ran into a problem that may be trivial (hopefully). I used the example_ivp_axisymmetric_simulation.m script, and wanted to just double the spatial resolution in each direction:
Nup = 2; % upsampling factor
Nx = 128 * Nup; % number of grid points in the axial (x) direction
Ny = 64 * Nup; % number of grid points in the radial (y) direction
dx = 0.1e-3/Nup; % grid point spacing in the axial (x) direction [m]
dy = 0.1e-3/Nup; % grid point spacing in the radial (y) direction [m]
kgrid = kWaveGrid(Nx, dx, Ny, dy);
% define the properties of the propagation medium
medium.sound_speed = 1500 * ones(Nx, Ny); % [m/s]
medium.sound_speed(Nx/2:end, :) = 1800; % [m/s]
medium.density = 1000 * ones(Nx, Ny); % [kg/m^3]
medium.density(Nx/2:end, :) = 1200; % [kg/m^3]
% create initial pressure distribution in the shape of a disc - this is
% generated on a 2D grid that is doubled in size in the radial (y)
% direction, and then trimmed so that only half the disc is retained
source.p0 = 10 * makeDisc(Nx, 2 * Ny, Nx/4 + 8, Ny + 1, 5*Nup);
source.p0 = source.p0(:, Ny + 1:end);
% define a Cartesian sensor mask with points in the shape of a circle
sensor.mask = makeCartCircle(40 * dx * Nup, 50);
% remove points from sensor mask where y < 0
sensor.mask(:, sensor.mask(2, :) < 0) = [];
% run the simulation using the axisymmetric code
sensor_data = kspaceFirstOrderAS(kgrid, medium, source, sensor);
The output waveform is changed quite significantly, into something closer to a 'sawtooth' wave, and the timing of the arrivals also seem to be 'off'. Perhaps I need to tweak the time-step or something, but should this not happen automatically?