DAE‑safe bounding for CoolProp property calls in Julia

I am building a large DAE-based vapor‑compression refrigeration loop in Julia using DifferentialEquations.jl and CoolProp for thermodynamic properties, and I am running into repeated CoolProp crashes during DAE initialization and Newton iterations. Although the physical solution is valid, the DAE solver temporarily explores nonphysical trial states (negative pressures, NaNs, or extreme enthalpies), which causes CoolProp property calls such as “(P,H)” or saturation queries “(P,Q)” to fail. I have been adding local “effective” projections using isfinite checks, pressure floors, and enthalpy bounds to keep property evaluations in a valid domain, but the challenge is ensuring these guards are applied consistently everywhere without overwriting the DAE state variables or breaking solver convergence. I’m looking for best practices or established patterns for making CoolProp calls DAE‑safe in Julia while preserving correct physics and solver robustness.

2 Likes

I’ve had great success adding a line search to the nonlinear solver, which backtracks (halves the proposed step) if it lands inside an infeasible domain. I’ve done this in my own implementations, but something similar should be possible using DifferentialEquations.jl.

For nominal integration, they have the option isoutofdomain and the other domain callbacks documented here: Frequently Asked Questions · DifferentialEquations.jl.

For initialization, I imagine you would have to change the nonlinear solver, possibly adding a line search. However, it is not transparent how to modify the DAE initialization solver in DifferentialEquations.jl.