Since it's not possible to debug the code while it's running in the CFX solver, I would add write statements to either write to a file or to the console. I would monitor the expressions in question to see what is happening near and when the solver crashes. This will give a better idea of what's happening in the code.