CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (

N.P October 20, 2006 11:18

Dear CFX users,

I am using 2 additional variables in CFX-10 and i am solving them as transport equations. I would like to apply lower limits on them so that i.e.

NumberDensity >= 1 (#/m3) and Area >= Area of a single particle i.e. 5e-19 (m2/m3)

Is there a way that i can do something like that in CEL ? I have tried to use the step function and multiply it with the negative source terms of those 2 variables but it had no effect (as the actual problem is because them 2 variables are transported and hence the software needs something to tell it what are the limims for those variables.)

Do i have to use user Fortran? If thats the case could you please provide me with an example as it will be impossible to find out on my own how to do this.

Cheers, NP

opaque October 20, 2006 12:16

Dear N.P.

Why do you need limiters on a transported equation? The equation itself should produce bounded variables to satisfy the physics..

Are you triying to limit the numerics? How come is the variable getting out of bounds? Do you have source/sinks in your AV equation? A general advection+diffusion equation w/o sources should produce results bounded by the boundary conditions unless some numerics issue ocurrs.

I am puzzled..


N.P October 20, 2006 12:33

Dear Opaque ,

My problem is a reactive flow in a pipe (similar to one of the tutorials). The CFD calculations and the species calculations are solved properly to very low RMS (<1e-9). Then i have created 2 additional variables . The first variable is accounting for the NumberDensity of particles through nucleation [#/m3 or #/kg of fluid] and the second is the overall particle area [m2/m3 or m2/kg of fluid]. I am solving them as a single phase flow and the 2 additional variables do not effect the other CFD variables. In the source terms for those 2 add. variables there are some negative terms accounting for other physical processes like agglomeration and sintering. My problem is that the equations are not solved properly and that is because once the negative sources are dominant the solution takes very unrealistic values ie. NumberDensity<<1 . I want to create a limiter so that i will be able to limit the lower end of the additional variables. Is there a way i can do this in CEL ?

I have used a step function in order to nulify the effect of the negative sources terms once the variables are below my limits (i.e. N<=1) but this doesnt stop the variables from transporting across the domain and dropping even below 1. I need 1 to be my lowest end i.e we cant have 1/2 of a particle.

Cheers and thanks for your time,


opaque October 20, 2006 12:49

Dear N.P.

The problem is with your source term, not the equation nor the solution algorithm.. You must linearize and control your source terms such that the solution is physically bounded.

You want something like

If your source is negative, ie. sink

Source Coeff = YourSource /max(tolerance,YourAv-YourAvMin)

Source Coefficient = Source Coeff*(YourAv-YourAvMin)

As you can see, the source is multiplied by 1, unless it changes sign.. In that case, the source coefficient becomes very large (based on the tolerance) and prevent the solution to go unbounded from below..

You can work out the upper bounding for the case the source is positive.. How do you do that in CEL? Perhaps a combination of the Fortran sign function, and the CEL step function..

Good luck,


Robin October 20, 2006 13:53

You can mimick the Fortran 'sign' function in CEL.

By definition, the Fortran 'sign' funtion gives you:

CASE 1: If y &ge; 0 then

sign(x,y) = abs(x) , CASE 2: If y < 0 then

sign(x,y) = - abs(x)

I.e 'sign(x,y) returns the absolute value of x with the sign of y. To do this in CEL write an expression as:

sign xy = abs(x)*y/abs(y)

Regards, Robin

Zaktatir December 1, 2011 08:47

it is little bit old but opaque what do you mean with limiting the AV by means of that source coefficient

All times are GMT -4. The time now is 21:38.