Hi, I've been using k-wave to perform 40Khz airborne ultrasound simulations, and have a need to be able to plot the intensities in the acoustic field. For this purpose, I believe the code would need access to u_non_staggered. I added what I believe is the appropriate parameter set to record:
% define the field parameters to record
sensor.record = {'p', 'p_final', 'u', 'I'};
The presence of 'I' automatically makes a request for u_non_staggered. When running this using the C++ binaries, however, I encounter the error 'ux_non_staggered' doesn't exist - see trace:
Running k-Wave simulation...
start time: 08-Aug-2016 08:49:35
reference sound speed: 343m/s
dt: 500ns, t_end: 1ms, time steps: 2001
input grid size: 236 by 236 by 236 grid points (168.6417 by 168.6417 by 168.6417mm)
maximum supported frequency: 240kHz
expanding computational grid...
computational grid size: 256 by 256 by 256 grid points
precomputation completed in 7.2038s
saving input files to disk...
completed in 3.5143s
--------------------------------
kspaceFirstOrder3D-OMP v1.1
--------------------------------
List of enabled parameters:
Input file /private/tmp/kwave_input_data08-Aug-2016-08-49-35.h5
Output file /private/tmp/kwave_output_data08-Aug-2016-08-49-35.h5
Number of threads 8
Verbose interval[%] 5
Compression level 0
Benchmark flag 0
Benchmark time steps 0
Checkpoint_file
Checkpoint_interval 0
Store p_raw 1
Store p_rms 0
Store p_max 0
Store p_min 0
Store p_max_all 0
Store p_min_all 0
Store p_final 1
Store u_raw 1
Store u_non_staggered_raw 1
Store u_rms 0
Store u_max 0
Store u_min 0
Store u_max_all 0
Store u_min_all 0
Store u_final 0
Copy sensor mask 0
Collection begins at 1
Number of CPU threads: 8
Domain dims: [ 256, 256, 256]
Simulation time steps: 2001
--------------------------------
........ Initialization ........
Memory allocation ..........Done
Data loading................Done
Elapsed time: 0.33s
--------------------------------
.......... Computation .........
FFT plans creation..........Done
Pre-processing phase........Done
Current memory in use: 1900112MB
Elapsed time: 6.51s
-------------------------------------------------------------
....................... Simulation ..........................
Progress...ElapsedTime........TimeToGo......TimeOfTermination
........
-------------------------------------------------------------
Elapsed time: 1967.82s
-------------------------------------------------------------
Post-processing phase.......Done
Elapsed time: 0.32s
--------------------------------
............ Summary ...........
Peak memory in use: 1913592MB
Total execution time: 1975.68s
--------------------------------
End of computation
--------------------------------
Error using h5readc
The HDF5 library encountered an error and produced the following stack trace information:
H5G_loc_find_cb object 'ux_non_staggered' doesn't exist
H5G_traverse_real traversal operator failed
H5G_traverse internal path traversal failed
H5G_loc_find can't find object
H5Dopen2 not found
Error in h5read (line 58)
[data,var_class] = h5readc(Filename,Dataset,start,count,stride);
Error in kspaceFirstOrder3DC (line 462)
sensor_data.ux_non_staggered = h5read(output_filename, '/ux_non_staggered');
Error in uharray (line 301)
sensor_data = kspaceFirstOrder3DC(kgrid, medium, source, sensor, 'PMLInside', false);
As the simulations are quite intensive, I need the C++ code - Matlab alone would be a bit slow for this. The question I have is whether or not this is already supported in the C++ code. If yes, I must be doing something wrong. If not, I'm happy to have a dig around the code to see what I need to modify. I just thought I'd check with people in the know before I go down this route!