Thank you for your response and suggestion. I have checked and verified that the value of xtemp is not being assigned zero at any point in the code. I also tried by adding smaller number in the denominator. Therefore, division by zero is not the issue here.
As mentioned, I have found that modifying the value of P or R2 resolves the crashing issue, but it results in a rectangular spray pattern rather than the desired spherical shape. I am hoping to find a solution that allows me to keep the original values of P and R2 while achieving the desired spherical shape. I was wondering if it might be possible to obtain a user routine for a flat fan nozzle in order to define injection region?
If you have any other suggestions or insights, please let me know.