Troubles with convergence & boundary condition mass inflow

Hello Developers!

I’m working on a project dealing with chemical looping combustion. The current simulation uses the TFM solver in 2D. I’m currently having trouble with convergence and mass inflow errors (i.e., “velocity exceeds limit” errors). I haven’t been able to simulate without reactions (as the errors that might arise when introducing the reactions might be more straightforward). I’ve looked through similar threads about this issue, but none of the provided solutions completely solve my problem. I’d appreciate it if you could take a look and provide some feedback! I will note that some model/simulation parameters are from different literature sources so I don’t have as much leeway in altering those.

Here’s my created “.zip” file:
chemicalloopingcombustion_2024-08-11T173539.433599.zip (1016.2 KB)

You should not be computing the reaction rates if you turned off the reactions. Your simulation runs fine with the default solver. Your reaction rates must be too large and generate too much gas.

Thank you, Jeff! That cleared up my confusion.

One other question, if you don’t mind assisting: upon introducing my reactions slowly to the simulation, I encountered an error pertaining to “float invalid operation in usr_rates_.” The crash happens rather quickly and the source of the problem stems from the “CONV” declaration defined in code - namely,

“CONV = X_s(IJK,isolid,sNiO) /& (X_s(IJK,isolid,sNiO)+
(RO_xs0(isolid,sNiO)/RO_xs0(isolid,sNi))*X_s(IJK,isolid,sNi))”

The line number in the attached usr_rates.f file is ~180. I’ve implemented some print statements around this line of code to see if everything was behaving normally. Based on the output I got, the mass fraction of both sNiO and sNi was 1.000 (which doesn’t make any sense based on the initial conditions I invoked for the simulation, and with no reaction taking place due to the abrupt solver crash), and then both return a value of 0.000 a couple prints later. Likewise, the density values that I input for the solids were not returned when called for a print (the physical parameter RO_xs0()), rather a number on the order of 10^31 was returned for both. Aside from that, CONV returned a value of 1.000 (which makes sense if no solids conversion were to take place) and Xcon = 0.000 (which also makes sense based on the same premise). Any ideas of how I could proceed? I’ve attached some relevant screenshots


You have not defined any of the RO_xs0 (species densities) so they are assigned what MFiX called UNDEFINED=9.87654321E31. These are only needed of you use a variables density model, but if you plan on using them in the UDF, you have to provide values when you define each species.

Hi Jeff. Thank you for the clarification (I realized this shortly before your reply and have implemented the necessary changes). After defining RO_xs0 for all relevant species, however, the declared variable didn’t return the appropriate value when called - this might be something on my end, but for the time being, I defined the densities as parameters within a UDF file. The other error I was running into was likely due to a Boolean condition that I had commented out (i.e., there was a negative field variable or a close equivalent). Upon implementing these changes, I got a partially working model!

However, one of the rates (specifically for the defined “Decompf” reaction) was on the order of 10^26 (this might be attributed to a Boolean condition I invoke to ensure a I don’t run into a divide by zero error, so I may need to increase the threshold value if that’s the case). However, I’m now running into an error that likely has to do with variable declarations within my reaction rates. Specifically, I’m getting the error “float divide by zero in __leq_gmres_mod_MOD_leq_gmres0” around 30 seconds after starting the simulation. This might be attributed to a variable declaration within the reaction rates (i.e., a negative field variable). Any insight?

Here’s an updated “.zip” file with all recorded updates:
clc_main_2024-08-13T142353.947723.zip (1.4 MB)

Update: after adjusting some numerics, discretization schemes, preconditioning for the simulation, and adjusting the meshing, the “float divide by zero in __leq_gmres_mod_MOD_leq_gmres0” error has disappeared. I’m able to simulate with an inert species, which I’m doing to avoid numerical divergence due to the sudden reaction start-up. However, when introducing the fuel gas into the system (which is methane in this instance), the solver crashes and returns “error c0000093 in __leqsol_MOD_dot_product_par”. It appears to be due to the reactions themselves, either the solver crashs (almost) immediately once the simulation is resumed or I get an error pertaining to divergence (which is likely due to the system producing too much gas). During some simulations of just the inert species, a similar error to one of the errors reported above was returned - namely, the “float invalid operation in usr_rates” error pertaining to the CONV declaration.

Hello, have you solved your problem?I had a similar problem.

Hi @wangjinjing,

I’m unsure what problem you’re alluding to here. Still, the convergence issue (namely, the “velocity exceeds limit” error) was resolved by creating a more coarse mesh, and experimenting with the discretization schemes and under relaxation parameters. For some of the other issues I noted above, like defining RO_xs0, I declared variables as, for some reason, my simulation wouldn’t pull the density information I inputted in the GUI. Other errors were solved by experimenting with different conditional evaluations and boolean conditions - mostly ensuring that any field variables in the denominator of complex fractions were greater than a specified limit. Hope this helps

Thank you for your reply, the problem I’m having is an error “float invalid operation”, I adjusted the chemical reaction rate but it didn’t help, I’d like to ask what other parameters you adjusted? Also, what does boolean condition mean?

Hi @wangjinjing,

I’d grab a drink, cause this is going to be a long one!

The error might be occurring due to a variable, either a user-defined variable that’s a function of field variables or just a field variable itself, not being an “appropriate value”. As an example, say you’re calculating a gaseous concentration in your simulation, the concentration could take on a negative number which would likely spit out the “float invalid operation” error - this would either be likely due to a mass fraction or the gas phase density becoming negative (without looking at your code/simulation, I wouldn’t be able to deduce the cause of the error).

In simple terms, all conditional evalutions are, essentially, boolean expressions but not all boolean expressions are conditional evaluations. A boolean expression either returns true or false (e.g., 5>3) while a conditional evaluation evaluates the “condition” of an expression to check if it’s either true or false. IFF (if and only if) the expression is true, say 5>3, then sub-expressions will be computed (this is where an if statement is invoked). If the boolean expression is not true, say 3>5, then the sub-expressions will not be computed. So, a boolean expression is, essentially, inside of a conditional evaluation. Here’s an example from my code:

The first if statement checks the condition of the expression EP_g > ZERO_EP_g - i.e., if the volume fraction of gas is greater than some constant, ZERO_EP_g in this instance, then the sub-expressions are evaluated. If not, the simulation skips over this block of code.

Without looking at your code, I’d recommend invoking a few of these, if you haven’t already, as they allow you to control the flow of your code. Regarding parameters, I didn’t change any of the kinetic parameters of the reactions I’m modeling. Rather, I used print statements:

image

to check (field) variables that are scattered around the code (this helped me debug since I’m operating on Windows). I’m unsure of the complexity of your reaction network, but I’d try making a simpler model if the problem persists. In my case, I created a separate file just for the noncatalytic reactions that are a part of my network to work out some of the kinks in my code. Hope this helps!

Thank you very much for your detailed answer!