CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   Is there a way to set a CEL expression to the density of a material at a temperature? (

audrey July 16, 2012 12:11

Is there a way to set a CEL expression to the density of a material at a temperature?
Ok, I'm new at CEL still and I haven't been finding the Ansys guides overly generous for examples. What I wanted to do was set up an expression for the buoyancy reference density - my simulations involve gas with small temperature differences and convergence is hugely affected by the reference density I set. If the reference density is slightly off, I get backflow and can't get convergence.

What I was hoping to do was to write something of the sort:
Reference_density = Gases.Density@ temperature of 10C
Where Gases is the phase name - but instead of a location, I'd just use a temperature

The expression above is obviously wrong, but is there a way to do this? Or I am barking up the wrong tree?


Danial Q July 16, 2012 17:36

I dont think so that you can write any variable instead of location and another problem could be the exact value of 10C (as u mentioned),what if it never gets 10C ?and it goes like 9.8C or 10.1C .But the other way to do it would be CREATING an expression (i mean setting density as function of T) say "ref den" and put it as Ref.Density option.
I hope it would be helpful..


ghorrocks July 16, 2012 22:55

The simulation should not be changing with reference condition. I think you have another deeper problem which should be resolved and then you can choose any ref condition within a wide range and it will be fine.

Have you tried double precision numerics? Using a fully compressible fluid (eg ideal gas)?

audrey July 17, 2012 07:39

4 Attachment(s)
Thanks for your replies.

Danial Q: I'm not looking for a specific location in the simulation domain to reach 10C. What I want is simply for the reference density to be equal to the density of the material (as defined in the material properties) at 10C which is the inlet temperature that I set.

For the time being, I have set the reference density as:
Reference_density = Gases.areaAve(Density)@Inlet
It seems to do the trick ok. But I will eventually introduce a second phase through the inlet and I wanted to make sure that it wouldn't mess up the reference density.

ghorrocks: I have been using double precision and I am using "Air ideal gas" as a material. I've only been running a thermal energy simulation, though - could this be a problem?

The simulation I'm working on at the moment is a test cases with not heat input or output. I've been struggling with this simulation for quite a while, even though it seems simple enough to me, but now that I used this reference density, I am finally getting convergence without walls being added to the outlets (backflow problems). I'd be quite happy to get a second opinion, however.

I've attached the output file from my simulation, including the CCL for the setup (divided in 2 files, the middle timesteps are missing). I've also included the output file for the run I did with a reference density that was slightly off (I used the density of nitrogen only, not air). The backflow problem wasn't improving after about 20 timesteps, so I stopped the simulation - it may have converged eventually, but I doubt it.

Any comments/suggestions very welcome!


ghorrocks July 17, 2012 19:41

I would not make the reference density a function of the flow. Reference density should be constant. So choose a single numeric value and just use that.

If you use the thermal energy model you are assuming incompressible air. To use compressible air you need to select "Total Energy" as the thermal model.

You are using a laminar flow model. Are you sure of this? This will cause convergence difficulties if the flow is actually turbulent.

If you are getting backflow at outlets then should you move the outlets further away from the region of interest so the boundary conditions are simpler and only have flow in one direction?

audrey July 18, 2012 10:07

1 Attachment(s)
Thanks for your input.

The reference density is constant with the current equation, as the temperature and flow rate through the inlet is constant - but I agree that it's not ideal. What numerical value should I use? How would I select it? The CFX modelling guide suggest the following: "You should specify a Buoyancy Reference Density as an approximate average value of the expected domain density." That is what I tried to do, but as I said in first post, convergence seems very sensitive to the actual value chosen.

I tried a simulation with the total energy model and saw the same convergence issues as with the thermal energy model. I was using thermal energy as a first step, since it is simpler than total energy. What difference would you expect between the two, given that I have very slow gas flow (Mach Number = 5.8208E-05), and thus assuming incompressible flow should bring little error?

I am using a laminar flow model as the Reynolds number is just 6.9067E+02, which is significantly below the range of transitional flow (at least for pipe flows).

As for moving the boundary condition downstream, it is something that I have considered (and tried, actually), but the problem is that the boundary conditions further downstream become even more complicated, with bi-directional flow in one of the outlets. Unless you suggest that I introduce an artificial geometry beyond the current outlets?

I've attached a figure that depicts my geometry, which might help to understand the problem. Essentially, as soon as gas flow near the outlets is influenced by buoyancy forces, I encouter back flow at some of the outlets, since the gas wants to move either straight up or down. In your opinion, is this an issue with the geometry, or with the way the boundary conditions are specified? What would you suggest to improve on this issue?

ghorrocks July 18, 2012 18:54


That is what I tried to do, but as I said in first post, convergence seems very sensitive to the actual value chosen.
Precisely. But the crux of your problem is to eliminate the dependance on the reference condition, not the choice of the "correct" reference condition. Something is making your simulation excessively sensitive to reference condition and this is not good.


What difference would you expect between the two,
In a correctly set up simulation no difference, but your simulation is not correctly set up as you are overly sensitive to the reference condition. This was a suggestion as the buoyancy gets implemented by a very different method (source term versus impicitly from the ideal gas law). This may have given a clue as to what your real problem is.


I am using a laminar flow model as the Reynolds number is just 6.9067E+02
OK, but what is the Rayliegh number? Buoyant flows of sufficiently high Rayliegh number can generate turbulence in a Re=0 flow.


Unless you suggest that I introduce an artificial geometry beyond the current outlets?
Looking at your geometry you are going to have convergence issues with this as the inlet is too close to the step and the outlet is too close to the oriface (In fact it is the oriface). So if the real geometry is too complex then yes, use an abstraction of it. In this case I would simply put runners extending out maybe 10 diameters to let the flow settle out.


What would you suggest to improve on this issue?
The bondary proximity is definitely a major issue with this model. Fix that and try again. But you need to eliminate the sensitivity to reference condition - this may be fixed when you fix the boundary proximity issue but maybe not. One problem at a time.

audrey July 19, 2012 03:56

2 Attachment(s)
Thanks for the suggestions. Could you elaborate/clarify a little on what geometry changes you are proposing? I'm not quite following your answer.

What step are you talking about? Do you mean the smaller diameter of the inlet? That hasn't been causing issues that I know of - but you're suggesting that I elongate that section to 10 inlet diameters (0.122m x 10 = 1.22m)?

As for the orifice, do you mean the back wall at the end of the tube? This is not open to flow.

I'm attaching a figure of the actual process geometry to show what I'm working with (excuse the use of paint...) I've also attached a figure of the new geometry I would use, based on your suggestions (if I understand them correctly). Is this what you meant? My main issue is how to handle the bottom opening, which has gas flowing into the domain at a set flow rate and solids flowing out of the domain. Should I just separate the opening into two areas, one of which becomes an inlet and the other an outlet?

ghorrocks July 19, 2012 06:02

Before you do anything the first thing is to decide what you are trying to achieve with this model. Are you trying to optimise it for solids separation? Or pressure drop? Or heat transfer? Something else? Once you know what you are looking for then you can design a simulation which will capture that what is important, and minimise effort on what is not.

audrey July 19, 2012 06:13

Right. I think I may have been working on sorting out this issue for too long...

Ok, this is what I am trying to do:

I am trying to build a model of a kiln that has solids being heated. The solids will form a bed distinct from the freeboard gas (particle size approx. 10 mm). A lot of similar work has been done before, but because of the difficulty with including solids, people have typically coupled two separate models: one simplified model of the bed of solids (with at times no solid movement included whatsoever), one CFD model of the freeboard.

What I am trying to do with this work is to include both the solids and gas in the same model, because the flow of gas through the particle bed influences both heat transfer and the reactions that take place (heterogeneous reactions instead of homogeneous). So, short answer, heat transfer is what I'm mostly after plus the residence time of gases vs. solids.

So, basically, I don't care too much about the section ahead of the inlet or the section from the outlet onwards. Should I just start with a cylinder having one end as the inlet and the other end as the outlet?

ghorrocks July 19, 2012 07:38

OK, thanks for that. Context always helps.

In that case I think your inlet is OK as is, but you need to improve the outlets. If you do not want to model the real geometry (your drawing suggests all sorts of other stuff happens there so I can understand not modelling it) then just put some straight pipes extending out from the domain about 10 diameters. That should give the flow a bit of time to sort itself out before getting to the outlet.

Looking through your CCL above - the inlet comes in at 10C, but all other walls are adiabatic. So why bother with heat transfer when it is going to always be 10C? I realise this is a simple model befire you add the complex physics later on, but if you include a heat transfer model then you actually need some heat transfer occurring. Can you set the walls to be a representative temperature or heat transfer coefficient?

audrey July 19, 2012 07:51

Yes, I know that there is currently no heat transfer - I was just trying to check whether my simulation results would match the isothermal simulation I did first. The "real" simulation that I am working on next includes heat flux through some of the walls.

But I am encountering backflow again... So I guess I'll give your suggestion of extending the outlets a shot and see if it helps.

All times are GMT -4. The time now is 04:53.