How can I overcome problems with recursive CEL in CFX 11.0?



Sometimes the solver fails because CEL expressions are used that cause a solver variable to depend on itself. For example an expression for the pressure on an inlet cannot directly use the density for compressible flows (e.g. with ideal gasses) because the density depends on pressure. In the case of problems with boundary conditions you may get a reasonably meaningful error message such as:

A recursion problem was encountered when evaluating the expression for "Total
Pressure" at the following location: "Inlet". Please carefully check that the
result of your expression does not depend on itself.
GETVAR originally called by subroutine CAL_PRES_BCS
An error has occurred in cfx5solve:

However, in general the solver will just suddenly stop with an MMS error such as:

Details of error:-
----------------
Error detected by routine MAKDAT
CDANAM = Delta CDTYPE = REAL ISIZE = 2670
CRESLT = OLD

Or

Error in subroutine GET_VARVX :
OLD : Problem creating data area

The hint that the problem might be due to recursive CEL is the world OLD. Both types of MMS error message are reporting that the solver cannot create what it expects to be a new data area because the data area already exists.


Some times the fix can be as simple as wrapping the offending variable inside an integrated function. For example an expression for the pressure on an inlet can use the "areaAve(density)@Inlet". However, this trick doesn't always work and there may be instances when you want the actual variable and not the areaAve().

A general method for preventing infinite loop problems in CEL is to replace the offending CEL variable that is causing the problem with an additional scalar variable that is forced to have the same value. This works because when the CEL expression sees an additional variable it just returns the currently stored value without recomputing it.

So, if density was the offending variable, we can create an additional variable that will have the samevalue of density.

ADDITIONAL VARIABLE: CopyOfDensity
Option = Definition
Tensor Type = SCALAR
Units = [kg m^-3]
Variable Type = Specific
END

And then set an equation source in the domain to force CopyOfDensity to be the same as Density. The source coefficient needs to be big enough to force the density values to be the same without being so big that it cause convergence problems.

SUBDOMAIN: Subdomain 1
Coord Frame = Coord 0
Location = <make this the same location as the domain>
SOURCES:EQUATION SOURCE: CopyOfDensity
Option = Source
Source = (Density-CopyOfDensity)* 1000 [kg m^-3 s^-1]
Source Coefficient = -1000 [kg m^-3 s^-1]
END
END

You can test this works by plotting Density and CopyOfDensity in CFX-Post, but when doing the comparison be careful to plot conservative values because Density is an internal solver variable and so may have additional hybrid values set which affect the way post plots values on boudaries.





Show Form
No comments yet. Be the first to add a comment!