CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Writing UDF for Eulerian model (http://www.cfd-online.com/Forums/fluent-udf/77241-writing-udf-eulerian-model.html)

golriz June 17, 2010 09:29

Writing UDF for Eulerian model
 
Dear all
I have a question about writing UDF for Eulerian model. I need to write some codes for diameter of particles in DEFINE_PROPERTY Macrose. I want to apply a linear changing diameter in my code, but I do not know that the diameter is function of what?(depth or time or ....)
I hope some persons help me in writng this UDF.
Best regards,
Golriz

akm December 16, 2010 02:56

@golriz
did u find a way to code??
i want to change the phase diameter after a certain number of flow time steps.

golriz December 17, 2010 00:54

Hi akm,
Unfortunately, I can not find it!
Regards,

ComputerGuy December 18, 2010 09:53

Phase diameter can be changed according to whatever rules you'd like to impose -- this is a relatively standard Fluent capability. Bubble/droplet diameters are, however, influenced by fairly complex physics. Imagine a single bubble of air rising in a column of water:
  1. Bubble diameter changes according to the density of the air, which is influenced by the ambient pressure and the temperature of the air
  2. If the bubble grows too large, the bubble will subdivide to minimize its surface energy

Now, think about many bubbles in a column. Not only will they undergo some of the things above, but you'd also have to worry about coalescence of the bubbles.

At any rate, below is a code (untested, not checked for syntax errors) which should show geometry dependent bubble behavior.

Code:

DEFINE_PROPERTY(bubble_diam, cell, thread)
{
        real bubble_diam_function_of_height;
        real max_size,min_size;
       
       
        /* Arbitrary physics -- geometry (height) dependent bubbles */
        real xc[ND_ND];
        C_CENTROID(xc,cell,thread);
       
        max_size=1e-1;
        min_size=1e-6;
       
        /* Assumes that the base of the geometry has a y-coordinate 0 */
        /* Assumes that bubbles grow linearly with decreasing depth (unlikely purely linear) */
        /* Assumes that bubbles have a 1 micron diameter at the base of the geometry */
       
        bubble_diam_function_of_height=(1.54244e-08)*xc[1]+1.e-6;
       
       
        if (bubble_diam_function_of_height > max_size)
        {
                bubble_diam_function_of_height = max_size;
        }
        else if (bubble_diam_function_of_height < min_size)
        {
                bubble_diam_function_of_height = min_size;
        }
       
        return bubble_diam_function_of_height;
}

The code assumes growth in the +y direction.

Let me know if this answers your question.

ComputerGuy

golriz December 23, 2010 07:53

Thanks for your answer and Iím sorry for being so late in my reply.
Your code helps me very much, but regarding your explanation I have to mention some points about my modeling:
- In my modeling I have to impose eight diameters for particles (bubbles) in all of the inlet cells. In other words I have different size of particles in one cell.
- The diameters of particle never change with any other things such as temperature or density and only have different size at inlet and also in one cell.
- Inlet cells have completely similar conditions.
Now how can I impose this condition to the model?
Regards,

ComputerGuy December 23, 2010 13:31

Golriz,

If I understand you correctly, you have two phases: let's say air (which makes up the bubbles) and water.

You want to simulate the air phase as a series of 8 separate bubble diameters, which are unaffected by coalescence, breakup, temperature, pressure etc...

I don't know what version of Fluent you're using, but the simplest way to do this (in terms of problem setup, not computation) is the following:

1) Create two fluid materials: air and water, for example.
2) Make the model multiphase, and have 9 phases
3) The primary phase is water
4) The secondary phases (i.e., phases 2-9) are air, with bubble diameters as you'd like. Phase diameters can therefore remain fixed throughout the simulation, and each "phase" or "bubble diameter's" drag/momentum behavior is solved without the need for complex UDFs.
5) The phase fraction (bubble distribution) of every phase can be specified at the inlet


Of course, if you have Fluent 12 (or the appropriate add-on license in Fluent 6), you could simply enable the population balance module and perform a simulation with discrete bin sizes for a single secondary phase (air). It's a little more elegant (and likely computationally less intensive) than the simple solution I've proposed above, but for the physics you're describing, shouldn't be much different in terms of results.

Regards,
ComputerGuy

golriz December 24, 2010 12:37

ComputerGuy,
Thanks again for your solution. You understood me correctly. This way is only time-consuming.
Regards,
Golriz

thanhndb November 3, 2011 06:30

udf code for rosin-rammler distribution
 
Quote:

Originally Posted by ComputerGuy (Post 287699)
Phase diameter can be changed according to whatever rules you'd like to impose -- this is a relatively standard Fluent capability. Bubble/droplet diameters are, however, influenced by fairly complex physics. Imagine a single bubble of air rising in a column of water:
  1. Bubble diameter changes according to the density of the air, which is influenced by the ambient pressure and the temperature of the air
  2. If the bubble grows too large, the bubble will subdivide to minimize its surface energy
Now, think about many bubbles in a column. Not only will they undergo some of the things above, but you'd also have to worry about coalescence of the bubbles.

At any rate, below is a code (untested, not checked for syntax errors) which should show geometry dependent bubble behavior.

Code:

DEFINE_PROPERTY(bubble_diam, cell, thread)
{
    real bubble_diam_function_of_height;
    real max_size,min_size;
 
 
    /* Arbitrary physics -- geometry (height) dependent bubbles */
    real xc[ND_ND];
    C_CENTROID(xc,cell,thread);
 
    max_size=1e-1;
    min_size=1e-6;
 
    /* Assumes that the base of the geometry has a y-coordinate 0 */
    /* Assumes that bubbles grow linearly with decreasing depth (unlikely purely linear) */
    /* Assumes that bubbles have a 1 micron diameter at the base of the geometry */
 
    bubble_diam_function_of_height=(1.54244e-08)*xc[1]+1.e-6;
 
 
    if (bubble_diam_function_of_height > max_size)
    {
        bubble_diam_function_of_height = max_size;
    }
    else if (bubble_diam_function_of_height < min_size)
    {
        bubble_diam_function_of_height = min_size;
    }
 
    return bubble_diam_function_of_height;
}

The code assumes growth in the +y direction.

Let me know if this answers your question.

ComputerGuy

Hi ComputerGuy,

I am also dealing with the Eulerian multiphase model for the solid-gas fluidization. I would like to simulate with the non-uniform distributuon of the solid particles. But I dont know how to write a udf code for the granular diameter distribution such as Rosin-Rammler. So, could you give me some suggestions about that, or if possible could you give a sample code of diameter distribution for the secondary phase in tre Eulerian-granular multiphase model.

Thank you so much in advance!

Thanh


All times are GMT -4. The time now is 22:17.