MATLAB: How do i stop pdepe if certain condition is met

MATLABpdepe

Hallo, i am using pdepe to solve Fourier heat equations on a tire. My question is how do i stop the integration before the end of tspan. For Example, i want to know how long it takes, for the solution on one side, to reach a certain temperature and then stop the pdepe. I am currently calculating a certain time frame where i know the temperature drops below the "reference" temperature and then evaluating the time it took afterwards, but this is really time consuming since most of the time only a fraction of my tspan would be enough. Hope i have explained my problem good enough. Thanks in advance.

Best Answer

Use the "Events" property in the options structure.
Search for the string "Event" under
https://de.mathworks.com/help/matlab/ref/pdepe.html
Best wishes
Torsten.