You are correct that xpow is not intended to be modified - it is an accelerated version of the pow function, which makes MFiX simulations run faster. However, even when disabling it I still get an invalid operation. xpow itself is not the problem.
That’s a big mess but I see the exponent 0.2 appears in the expression (N_Re)**0.2 so it appears that N_Re < 0. And the debugger (or print statements) confirms this:
(gdb) print N_re
$2 = -1.2236160342884503
So the question is - how did we get a negative Reynolds number? (It should always be > 0)
The Reynolds number should be calculated from calc_gamma_des.f:142
DP is the characteristic length, SLIP is the particle velocity calculated earlier in file, RO_g is the density, and mu is the viscosity.
I think RO_g and Mu_g are just grabbing the fluid properties and probably aren’t a source of problems.
At a glance, SLIP doesn’t seem like it can return negative values since it is calculating a magnitude and the operations there should handle any negative values.
DP should be calculated from line 121, and similarly should have positive values:
A “simple” solution might be to take the absolute value of the reynolds number before doing operations with it, but that solution seems like it could have the potential to hide other issues in the simulation.
IJK 170 MU 1.8000000000000000E-005
DP 1.6000000000000000E-002 SLIP 1.4521806455795890E-004
RO -9.4793167968789156
So we’ve got a negative fluid density in cell 170.
I agree with your comment that simply taking an absolute value is not a good solution because it will merely hide other problems. We have to figure out where the negative ro (ρ) is coming from.
(Also I wish the original authors had spelled it rho but that’s too much code to change now!!)
Enabling it results in a file ROgErr.log which contains:
One or more cells have reported a negative/NaN gas density (RO_g(IJK)). If
this is a persistent issue, lower keyword UR_FAC(1).
Simulation time: 0.10000E-04
IJK: 170 I: 4 J: 2 K: 4
RO_g: -9.4793 P_g: -0.72207E+06 T_g: 293.15
Unfortunately, lowering the underrelaxation factor UR_FAC(1) does not help unless I bring it all the way down to zero, in which case the run diverges.
Please review your initial condition. Pressure is set to 10135 Pa (about 0.1 atmosphere).
There is only a wall BC (no pressure outlet).
Please try to turn off the reactions (or set the reaction rate to zero). If the reaction rate is too large, it can generate/consume a large amount of gas and make the solution unphysical.
Thanks for the help. I was able to get the model to work. I added a pressure outlet boundary condition along the top of the domain. I also adjusted the particle input file to generate the particle higher up. I’m not sure if the particle can clip through a fixed wall boundary when it is generated by the input file and cause a crash.