Hi I am solving a problem involving the expansion and contraction of a bubble in response to a sinusoidal pressure, Pa sin (wt). (Rayleigh Plesset equation)
The formula for pressure of the gas in the bubble during expansion (isothermal expansion - gamma = 1) is different from that during contraction (adiabaic compression - gamma = 1.33).
To change the formula I am using 'EVENTS' to detect the end of contraction (event 1) and end of expansion (event 2).
The bubble starts contracting initially from a radius R0 = 1e-4 m.
The condition used to detect end of contraction is : radial velocity Rdot is negative and increasing to zero
The condition used to detect end of expansion is : radial velocity Rdot is positive and decreasing to zero.
The initial condition is : R0 = 1e-4 and Rdot = 0
------------------- When I run this program I am getting 4 events. I was expecting only 2 (first after compression and second after expansion). Why is this happening ? How can I overcome this ?
Is this method of detecting event correct ? Since the radius never becomes zero I cannot use zero detection of radius as a condition.
The files used are attached :
RP7.m - is the main script file
eventsFuncn1.m is the events function
zdot7.m is the function giving the derivative
THANKS IN ADVANCE