Hi,
I am trying to save input file and run it on C++ (as suggested in the manual) in hope for reducing some calculation time. However, when I run kspaceFirstOrder3D with optional input 'savetodisk', I get a following message.
"Error using kspaceFirstOrder_inputChecking (line 34)
The output field_data has been deprecated. Please use sensor.record = {'p_final'}
(etc) to return the final pressure field."
I am a little lost here as to how I should solve this issue. I really would appreciate if you could give me a guidance.
I am using multi element UT in a heterogeneous medium(with a ball in the medium using a makeBall function).
Below is the code I used FYI,
% set the size of the perfectly matched layer (PML)
PML_X_SIZE = 20; % [grid points]
PML_Y_SIZE = 10; % [grid points]
PML_Z_SIZE = 10; % [grid points]
% set total number of grid points not including the PML
Nx = 168 - 2*PML_X_SIZE; % [grid points]
Ny = 84 - 2*PML_Y_SIZE; % [grid points]
Nz = 84 - 2*PML_Z_SIZE; % [grid points]
% set desired grid size in the x-direction not including the PML
x = 0.75/2/1000; % [m]Nx
% calculate the spacing between the grid points
dx = x; % [m]
dy = dx; % [m]
dz = dx; % [m]
% create the k-space grid
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);
scalef = 1.0667;
% =========================================================================
% DEFINE THE MEDIUM PARAMETERS
% =========================================================================
if hetero
% define the properties of the propagation medium
medium.sound_speed = 2000*ones(Nx,Ny,Nz) ; % [m/s] 2nd
medium.sound_speed(1:round(Nx/scalef),:,:) = 1000 ; % [m/s] 1st 101
medium.density = 5000*ones(Nx,Ny,Nz); % [kg/m^3] 2nd
medium.density(1:round(Nx/scalef),:,:) = 1134 ; % [kg/m^3] 1st
medium.alpha_coeff = 0.001*ones(Nx,Ny,Nz); % [dB/(MHz^y cm)] 2nd
medium.alpha_coeff(1:round(Nx/scalef),:,:)=0.011083 ; % [dB/(MHz^y cm)] 1st
medium.alpha_power = 1.05;
medium.BonA = 6; %6 , 0 ussed
else
% define the properties of the propagation medium
medium.sound_speed = 1000*ones(Nx,Ny,Nz) ; % [m/s] 2nd
medium.density = 1134*ones(Nx,Ny,Nz); % [kg/m^3] 2nd
medium.alpha_coeff = 0.011083*ones(Nx,Ny,Nz); % [dB/(MHz^y cm)] 2nd
medium.alpha_power = 1.05;
medium.BonA = 6; %6
end
% create the time array
t_end = 175e-6; % [s]
kgrid.t_array = makeTime(kgrid, medium.sound_speed, [], t_end);
% =========================================================================
% Flaw Characteristics
% =========================================================================
if void_inclusion
%void_size = 0.75*10/1000; %% in grid points
%object = makeSphere(round(Nx/scalef), Ny/2, Nz/2, void_size);
%center_pos = [round(Nx/2), Ny/2, Nz/2];
scattering_map = randn([Nx,Ny,Nz]);
scattering_c0 = 1000 + 25 + 75*scattering_map;
scattering_c0(scattering_c0 > 1600) = 2600;
scattering_c0(scattering_c0 < 1400) = 100;
scattering_rho0 = (scattering_c0/100)*7747;
flaw = makeBall(Nx,Ny,Nz,Nx/scalef,Ny/2,Nz/2,3,0); % last argument "1" is for plotting
medium.sound_speed(flaw == 1) = scattering_c0(flaw == 1);; % m/s steel ball
medium.density(flaw == 1) = scattering_rho0(flaw == 1);;
end
% =========================================================================
% DEFINE THE SOURCE
% =========================================================================
% define properties of the input signal
source_strength = 20e6; % [Pa]
tone_burst_freq = 2.25e6; % [Hz]
tone_burst_cycles = 3;
% create the input signal using toneBurst
%input_signal = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);
input_signal = toneBurst(1/(1*kgrid.dt), tone_burst_freq, tone_burst_cycles);
% scale the source magnitude by the source_strength divided by the
% impedance (the source is assigned to the particle velocity)
input_signal = (source_strength./(1000*1134)).*input_signal;
% =========================================================================
% DEFINE THE ULTRASOUND TRANSDUCER
% =========================================================================
% physical properties of the transducer
transducer.number_elements = 16; % total number of transducer elements
transducer.element_width = 2; % width of each element [grid points/voxels]
transducer.element_length = 32; % length of each element [grid points/voxels]
transducer.element_spacing = 0; % spacing (kerf width) between the elements [grid points/voxels]
transducer.radius = inf; % radius of curvature of the transducer [m]
% calculate the width of the transducer in grid points
transducer_width = transducer.number_elements*transducer.element_width ...
+ (transducer.number_elements - 1)*transducer.element_spacing;
% use this to position the transducer in the middle of the computational grid
transducer.position = round([1, Ny/2 - transducer_width/2, Nz/2 - transducer.element_length/2]);
% properties used to derive the beamforming delays
transducer.sound_speed = 1000; % sound speed [m/s]
transducer.focus_distance = 28/1000; % focus distance [m]
transducer.elevation_focus_distance = 28/1000; % focus distance in the elevation plane [m]
transducer.steering_angle = 0; % steering angle [degrees]
% apodization
transducer.transmit_apodization = 'Hanning';
transducer.receive_apodization = 'Rectangular';
% define the transducer elements that are currently active
number_active_elements = 16;
transducer.active_elements = ones(transducer.number_elements, 1);
%transducer.active_elements = zeros(transducer.number_elements, 1);
%transducer.active_elements(21:52) = 1;
% append input signal used to drive the transducer
transducer.input_signal = input_signal;
% create the transducer using the defined settings
transducer = makeTransducer(kgrid, transducer);
% print out transducer properties
transducer.properties;
if run_simulation
% =========================================================================
% RUN THE SIMULATION
% =========================================================================
% set the input settings
input_args = {'DisplayMask', transducer.active_elements_mask, ...
'PMLInside', false, 'PlotPML', false, 'PMLSize', [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE], ...
'DataCast', DATA_CAST, 'PlotScale', [-source_strength/7, source_strength/7]};
% run the simulation
%[sensor_data] = kspaceFirstOrder3D(kgrid, medium, transducer, transducer, input_args{:});
filename = 'kwave_input_data.h5';
[sensor_data,p_final] = kspaceFirstOrder3D(kgrid, medium, transducer, transducer,'SaveToDisk',filename, input_args{:});