k-Wave User Forum » Topic: Thermoacoustic simulation
http://www.k-wave.org/forum/topic/thermoacoustic-simulation
Support for the k-Wave MATLAB toolboxen-USWed, 02 Dec 2020 03:44:20 +0000http://bbpress.org/?v=1.0.2<![CDATA[Search]]>q
http://www.k-wave.org/forum/search.php
bencox on "Thermoacoustic simulation"
http://www.k-wave.org/forum/topic/thermoacoustic-simulation#post-45
Wed, 08 Sep 2010 21:52:11 +0000bencox45@http://www.k-wave.org/forum/<p>Dear Xiong, </p>
<p>If all of your source elements are varying in time in the same way, ie. if they all have the same input, then source.p need only contain one time series, not one for every sensor element in sensor.mask. Will that help reduce the size of it?</p>
<p>If you're going to convolve the output with your time-varying input, then do you just need a single 1 in source.p? </p>
<p>We've been running some examples this week and think there may sometimes be a scaling issue with the time-varying pressure input, so if it looks wrong then please let us know. We're planning to fix it and write an example for a time varying thermoacoustic source for the next beta release, which we hope will be the end of next week.</p>
<p>I hope you can get your example to work.</p>
<p>Kind regards,</p>
<p>Ben
</p>xiong on "Thermoacoustic simulation"
http://www.k-wave.org/forum/topic/thermoacoustic-simulation#post-44
Wed, 08 Sep 2010 00:33:24 +0000xiong44@http://www.k-wave.org/forum/<p>Dear Ben,</p>
<p>Now I know how to change t_array and dt. Thank you.</p>
<p>I planned to use the time-varying source. But the array of source.p has a very big size which cannot be handled by my computer memory. I have to change to assuming a delta function first and then do convolution. You siad k-wave will multiply each sample of the time-varying source.p by the timestep dt. So</p>
<p>source.p = Gruneisen coefficient * H1;</p>
<p>H1 is the sampled version of my known time varying H1(t). How to set source.p0? Just times the Gruneisen coefficient with H1? If this is right, how can an arbitrarily sampled H1 give the correct results?</p>
<p>Thank you.</p>
<p>Best regards,</p>
<p>Xiong
</p>bencox on "Thermoacoustic simulation"
http://www.k-wave.org/forum/topic/thermoacoustic-simulation#post-43
Mon, 06 Sep 2010 08:32:35 +0000bencox43@http://www.k-wave.org/forum/<p>Dear Xiong,</p>
<p>I tend to do it this way:</p>
<p>[kgrid.t_array dt] = makeTime(kgrid, medium.sound_speed);<br />
kgrid.t_array = kgrid.t_array(1:1000);</p>
<p>or </p>
<p>[kgrid.t_array dt] = makeTime(kgrid, medium.sound_speed);<br />
kgrid.t_array = (0:999)*dt;</p>
<p>Of course, you don't have to use makeTime at all, you could just write:</p>
<p>dt = 1e-8; %or whatever you want here<br />
kgrid.t_array = (0:999)*dt;</p>
<p>The advantage of using makeTime is that dt is chosen to satisfy a certain CFL stability condition. CFL = 0.3 by default, but for greater accuracy you could adjust it:</p>
<p>cfl = 0.1;<br />
[kgrid.t_array dt] = makeTime(kgrid, medium.sound_speed,cfl);</p>
<p>This will return a smaller time step dt. Hope this helps,</p>
<p>Ben
</p>xiong on "Thermoacoustic simulation"
http://www.k-wave.org/forum/topic/thermoacoustic-simulation#post-42
Fri, 03 Sep 2010 23:49:32 +0000xiong42@http://www.k-wave.org/forum/<p>Dear Ben,</p>
<p>Thanks for your quick reply.</p>
<p>This time I just have one quick quiestion. I want to make some change to the length of "t_array" and value of "dt" defined by "makeTime". Since my model is 3D, the t_array set by your code is too long and takes very long time in both Photoacoustic Simulation and Photoacoustic Image Reconstruction. I tried to make t_array=t_array(1:1000), but it does not work. The parameters printed to the command line still show "time steps: 2020". How can I do this?</p>
<p>Thank you.</p>
<p>Best regards.</p>
<p>Xiong
</p>bencox on "Thermoacoustic simulation"
http://www.k-wave.org/forum/topic/thermoacoustic-simulation#post-41
Thu, 02 Sep 2010 09:48:30 +0000bencox41@http://www.k-wave.org/forum/<p>Dear Xiong,</p>
<p>Your question has made me think of a few points. I hope they’re helpful.</p>
<p>1) k-Wave will apply the time integration that you mention automatically. It will multiply each sample of the time-varying source.p by the timestep dt. I think you therefore just need to write:</p>
<p>source.p = Gruneisen coefficient * H1;</p>
<p>where this H1 is the sampled version of your known time varying H1(t). See comment (3) below about checking the amplitude is correct.</p>
<p>2) Just to clear up a possible confusion. I said in my last post that "if your EM pulse is Gaussian, then the pressure source will be the time derivative of a Gaussian". That is not true for k-Wave. The source term for the underlying wave equation is the time derivative, but that is taken care of in the code. The input source.p should be the actual shape of the EM pulse you are simulating. For instance, take the example "Point Source In A Homogeneous Propagation Medium Example" as a starting point, comment out the definition of the sinusoidal source and replace it with a Gaussian. Note the time offset.</p>
<p>% define a time varying photoacoustic Gaussian pulse<br />
% with the Gaussian normalised so its integral sum(gaussian)*dt = 1<br />
source_mag = 1;<br />
gruneisen = 0.11;<br />
pulsewidth = 1e-6;<br />
t_offset = 5e-6;<br />
gaussian = exp(-((kgrid.t_array-t_offset)/pulsewidth).^2)/(pulsewidth*sqrt(pi));<br />
source.p = source_mag*gruneisen*gaussian;</p>
<p>Also adjust the following line to make sure the plot scaling is sensible:</p>
<p>[sensor_data p_final] = kspaceFirstOrder2D(kgrid, medium, source, sensor,... 'PlotScale',[-1e4 1e4]);</p>
<p>Just to be tidy, you might also want to delete the instructions that "plot the final wave-field".</p>
<p>3) It might be a good idea to check that you are getting the amplitude you expect by putting in a plane source (so there’s no geometrical spreading). Adjusting the above example a little:</p>
<p>% define a line of source elements to generate a plane wave<br />
source.p_mask = zeros(Nz, Nx);<br />
source.p_mask(Nz/2, :) = 1;</p>
<p>Also set PMLAlpha to turn off the PML at the sides so the plane wave remains truly plane:</p>
<p>[sensor_data p_final] = kspaceFirstOrder2D(kgrid, medium, source, sensor,... 'PlotScale',[-7e4 7e4],'PMLAlpha',[0 4]);</p>
<p>4) Final thing. There’s a bug, which we hope to fix for the next release, which means that if you want quantitatively accurate results when you are using a time-varying source you should set dx = dz to be equal. </p>
<p>Kind regards,</p>
<p>Ben
</p>xiong on "Thermoacoustic simulation"
http://www.k-wave.org/forum/topic/thermoacoustic-simulation#post-40
Wed, 01 Sep 2010 23:39:50 +0000xiong40@http://www.k-wave.org/forum/<p>Ben,</p>
<p>Please ignore my last post. I made some mistakes in it. The following is the correct one.</p>
<p>I think using the time varying pressure source can deal with my project. But I still have a problem with the setting of "source.p". Because the source (known) for my TAI is the "heat energy deposited per unit volume and per unit time (let's note it by H1)", I need to transfer it to pressure. From the paper you mentioned I know how to relate the "initial pressure" with the "heat deposited per unit volume (let's note it by H2)" for a delta funtion pulse. But for a time varying long pulse, how to get the time varying pressure which is to be used by "source.p"? I plan to use the following way to do it. Please take a look at it and tell me if it is right.</p>
<p>Take a 1us electromagnetic source as an example. I can get the time varying electric field E at all spatical points. Then the H1 is obtained by</p>
<p>H1(x,y,z,t) = 0.5 * conductivity(x,y,z) * (E(x,y,z,t))^2</p>
<p>Assume the "dt" set by function "makeTime" is 10ns and the stress confinement is satisfied for a 10ns pulse for my accuracy requirement, divide the 1us pulse into 100 equal parts or 100 shorter pulses (10 ns). The 100 10ns pulses heat the tissue one by one. The initial pressure for each 10ns pulse is got by</p>
<p>p0(x,y,z,m) = Gruneisen coefficient(x,y,z) * H2(x,y,z,m)<br />
(m means the mth 10ns pulse, m=1,2,...,100)</p>
<p>The H2(x,y,z,m) is calculated by time integration of H1(x,y,z,t,m) in the 10ns (from 10*(m-1) ns to 10*m ns). The first 100 terms of source.p will be p0(x,y,z,m) (m from 1 to 100). The rest terms of source.p are 0.</p>
<p>Please tell me if this is right and you are very welcome to give any other suggestions.</p>
<p>Thank you for your time.</p>
<p>Xiong
</p>xiong on "Thermoacoustic simulation"
http://www.k-wave.org/forum/topic/thermoacoustic-simulation#post-39
Wed, 01 Sep 2010 22:25:15 +0000xiong39@http://www.k-wave.org/forum/<p>Dear Ben,</p>
<p>Thanks for your reply.</p>
<p>I think using the time varying pressure source can deal with my project. But I still have a problem with the setting of "source.p". Because the source (known) for my TAI is the "heat energy deposited per unit volume and per unit time (let's note it by H1)", I need to transfer it to pressure. From the paper you mentioned I know how to relate the "initial pressure" with the "heat deposited per unit volume (let's note it by H2)" for a delta funtion pulse. But for a time varying long pulse, how to get the time varying pressure which is to be used by "source.p"? I plan to use the following way to do it. Please take a look at it and tell me if it is right.</p>
<p>Take a 1us electromagnetic source as an example. I can get the time varying electric field E at all spatical points. Then the H1 is obtained by</p>
<p>H1(x,y,z,t) = 0.5 * conductivity(x,y,z) * (E(x,y,z,t))^2</p>
<p>Divide the 1us pulse into 100 equal parts or 100 short pulses (10 ns). The 100 10ns pulses heat the tissue one by one. Thus, the stress confinement is satisfied in each 10ns pulse for my accuracy requirement. The initial pressure for each 10ns pulse is got by</p>
<p>p0(x,y,z,m) = Gruneisen coefficient(x,y,z) * H2(x,y,z,m)<br />
(m means the mth 10ns pulse, m=1,2,...,100)</p>
<p>The H2(x,y,z,m) is calculated by time integration of H1(x,y,z,t,m) in the 10ns (from 10*(m-1) ns to 10*m ns). The 3D k-wave code is then run for 100 times for all the 10ns pulses to get the pressure(x,y,z,t,m). Finally the total pressure(x,y,z,t) is obtained by properly combining all of the pressure(x,y,z,t,m).</p>
<p>Please tell me if this is right and if you have any other suggestions.</p>
<p>Thank you for your time.</p>
<p>Xiong
</p>bencox on "Thermoacoustic simulation"
http://www.k-wave.org/forum/topic/thermoacoustic-simulation#post-36
Wed, 11 Aug 2010 09:41:09 +0000bencox36@http://www.k-wave.org/forum/<p>Dear Xiong Wang,</p>
<p>Thank you for raising these points. </p>
<p>1) The current version of k-Wave models acoustic pressure propagation, so the initial condition must be given as a pressure. In photoacoustics it is normal to relate the initial acoustic pressure distribution to the absorbed energy density (the heat deposited per unit volume) by the Grueneisen parameter. In other words, the increase in temperature due to the absorbed EM pulse and the accompanying increase in pressure are related via a thermodynamic identity (see Section IIA in our paper <a href="http://www.k-wave.org/papers/2005-Cox-JASA.pdf" rel="nofollow">http://www.k-wave.org/papers/2005-Cox-JASA.pdf</a> ).</p>
<p>2) The heating pulse (the absorbed EM pulse) can be treated as a delta function in time as long as the pulse duration is much shorter than the charateristic acoustic travel time, ie. it is much less than d/c where d is a charateristic length of the absorbing region and c is the speed of sound. Under this assumption, the problem reduces to an initial value problem (IVP) and so setting an initial acoustic pressure is appropriate.</p>
<p>There are two ways to deal with longer pulses which don't satisfy this 'stress confinement condition':<br />
a) You could run the model using an initial condition (ie. assuming an EM pulse that is a delta function in time) and convolve the actual pulse shape with the time series output afterwards.<br />
b) Alternatively, you could use a time-varying pressure source. How to do this in k-Wave is described (for a sine wave source) in this example <a href="http://www.k-wave.org/documentation/example_us_homogeneous_medium.php" rel="nofollow">http://www.k-wave.org/documentation/example_us_homogeneous_medium.php</a>, which is also in the Toolbox. You would just need to change the shape of the pulse you are using to whatever temporal shape you think your pulse has. When a thermoacoustically generated acoustic pressure is included as a source term, it has the form of the time derivative of the absorbed energy density. So if your EM pulse is Gaussian, then the pressure source will be the time derivative of a Gaussian.</p>
<p>3) There is one more thing to note. The equations that k-Wave is based on (linear acoustics) assume that thermal conduction can be neglected. This is reasonable when heat diffusion takes place on a much longer time scale than acoustic propagation, ie. when the thermal relaxation time >> d/c where d is a characteristic length of the absorbing region, and c is the speed of sound. If this is not the case then the temperature and pressure fluctuations become coupled and the current version of k-Wave can't model that.</p>
<p>I hope that helps - good luck with your modelling,</p>
<p>Ben
</p>xiong on "Thermoacoustic simulation"
http://www.k-wave.org/forum/topic/thermoacoustic-simulation#post-35
Fri, 06 Aug 2010 23:27:29 +0000xiong35@http://www.k-wave.org/forum/<p>I am doing thermoacoustic research, which is quite similar to photoacoustic. I would like to try k-wave for my project. But I have the following two questions.</p>
<p>1. In thermoacoustic simulation, the initial value for solving the differential equations is the absorbed heat (not pressure). How to set such initial condition?</p>
<p>2. The duration of the source pulse (microwave pulse) sometimes cannot be ignored. Take 1 us pulse as an example. The acoustic wave is generated continously and starts to propagate in the first 1 us. Thus the initial condition should be properly set in the first 1 us. Is it possible to use k-wave to do this?</p>
<p>Thank you very much.</p>
<p>Xiong Wang
</p>