Runge-Kutta question



Hi,
I am stuck with what first seemed a straightforward Runge-Kutta (4th
order) integration of an ODE of the form dT/dp=C(p,T) T used to
describe an adiabat; T and p are temperature and pressure,
respectively, and C(p,T) are p,T-dependent material parameters. The
problem seems to arise when I try to introduce phase transitions,
which induce kinks in the adiabat, i.e. T is continuous, but its
derivative is not, although the jumps are not always large. I can
calculate how dT/dp has to be modified in the regions of phase
transformation, which are of finite and sometimes substantial width,
but the kinks are of course there and cause the solution to misbehave
in various ways, depending on how narrow the region is. Is there a
recommended way of dealing with such kinks, or in other words, do I
have to integrate piecewise, and how do I do that best?
Thanks,
Tom

.