How to debug dt<dt_min?

Hey guys,

I have been running into trouble with instability. Could someone help me take a look and let me know why it happens and how to get around it please? Thanks!

I’m simulating a 2D TFM with chemical reaction CO2+n ML–>PR, where n is a positive integer. I set the reaction rate as rate=k * c_CO2 * c_ML**n. Namely the reaction rate is linearly correlated to the concentration of CO2 concentration and ML concentration to the nth power.

The simulation ran just fine with n=1, but I started having problems after I set n=2 or higher. When n=2, MFiX finished the first 8 seconds of simulation and ran into the dt<dt_min problem, where dt_min is 1e-10. As I set n=3 and 4, it couldn’t start at all and I had errors like “Negative void fraction detected” and “Negative gas density detected” at the beginning of the simulation. Does anyone know why this happens? I was confused because although I changed the concentration of reactants in the IC, it shouldn’t have negative void fraction or gas density.

I attached my files here. To run the simulations I used this command line:
build_mfixsolver --batch --dmp

mpirun -np 16 ./mfixsolver -f td_jelly_roll_s4.mfx NODESI=4 NODESJ=4

Here are the files I used for different simulations.
n=1
td_jelly_roll_s1.mfx (26.0 KB)
usr_rates.f (2.8 KB)

n=2
usr_rates.f (2.7 KB)
td_jelly_roll_s2.mfx (26.0 KB)

n=4
td_jelly_roll_s4.mfx (26.0 KB)
usr_rates.f (2.7 KB)

Any input is appreciated!

Thanks,
Jack

@jack7z I’m running the N=1 case in serial mode and am seeing this message:

mfix - WARNING - The sum of mass fractions is not equal to one.
mfix - WARNING - The sum of mass fractions is not equal to one.

If you can fix this, the negative void fraction problem may clear up.

Note, in the GUI this is being reported as a “Message” rather than a “Warning” (I will fix this), but if you don’t use GUI it’s easy to lose track of warnings and errors coming from the solver - the GUI tries to make these more visible by presenting a total error count and popup message dialog:

shot-2021-05-20_09-35-44

I think the first step is to try to get the job running cleanly in serial mode before attempting DMP, starting with N==1

– Charles

Thank you Charles. I saw the message in the GUI now. I noticed that the error happened at time=0.1, and I did not see anything unbalanced in my IC or BC. Does it mean it started without any sum of mass fractions problem but as the simulation went on it there was an error?

INFO check_data_30.f:372

Time = 0.10303

Warning: The sum of mass fractions is not equal to one.

Statistics of sum of gas species mass fraction

Minimum sum of X_g= 0.99723

Maximum sum of X_g= 1.0145

Sum of X_g No of Cells Distribution

<0.9 0 0.0000

0.9 - 0.99 0 0.0000

0.99 - 0.999 111 0.76132E-01

0.999 - 0.9999 154 0.10562

0.9999 - 1.0001 1162 0.79698

1.0001 - 1.001 7 0.48011E-02

1.001 - 1.01 17 0.11660E-01

1.01 - 1.1 7 0.48011E-02

.> 1.1 0 0.0000

End of report.

Hi Charles,

Sorry I’m still very confused about this error. My initial condition was correct so it seems there was something wrong with my reaction that caused the problem. I tried to figure out if it was the reaction or the diffusion that caused it so I set the reaction rate coefficient k to 0, which means there is effectively no reaction happening. However, I still got the error in the message although fewer cells were not in the 0.9999 - 1.0001 range. So do you have any suggestion on how to debug this please? Thanks!

Jack

Your reaction rate is very large with n=4. I put some print statements and got a value of c_ML=60, so a power or 1,2 and 4 will give rates that are orders of magnitude apart. Is k independent of n?

To debug this kind of simulation, I usually turn off reactions. If this runs fine, then I gradually add reactions (if there are more than one), to identify which one is the issue. It is usually necessary to simplify the model so it runs quickly in serial. If you don’t have access to a debugging tool, you can simply put print statements in the code to check the value of some variables.

1 Like

Thank you so much Jeff! I tried reducing k 10,000 times for n=4, and it’s working now.

Could you also share with me how you printed out the value of c_ML? Did you use print in Fortran or was there something in the GUI that shows it?

Thanks,
Jack

@jack7z -
write(*,*) in FORTRAN is always helpful, but of course it requires you to rebuild the solver.

Additionally, you could monitor_rrate keyword and plot the monitor value in the GUI, which doesn’t require recompilation and gives you a nice plot (or vtk_rrate for a VTK visualisation)

– Charles

2 Likes

Hi jeff,
I want to know how to turn off the chemical reaction, because the chemical reaction rate needs to be set up solver, if you deselect the component transport equation, there will be an error.
@jeff.dietiker

You can disable individual reactions by clicking on the check mark next to the reaction
shot-2021-11-11_07-41-11-0-0