CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

Energy Source Term for Sub-Region

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 14, 2016, 13:07
Post Energy Source Term for Sub-Region
  #1
New Member
 
Join Date: Jan 2016
Posts: 3
Rep Power: 2
Solmyr89 is on a distinguished road
Hello, I'm using ANSYS v15. for my masters thesis and I have the following problem:

My thesis is about the Multiphase-Euler-Approach to simulate granular flows under different conditions (yeah, I know DEM would be more efficient but that is what my prof wanted me to do).
I have already finished most of my workload but I simply cannot complete my last problem:

A box is filled with the 2 granular phases as shown in the little paint picture I attached (vf means volume fraction). I want to set the energy source term to be in a very specific area that is heated - so NOT for all the cells inside a certain phase, in fact the area of the energy source term should not be linked to the phases at all. I should be able to fill my box however I want to and the area of the box where I want to modify the energy source term should not be affected by it.
I have already tried everything I know. I simply cannot get the energy source term to be set ONLY for that area and to remain unchanged for everything else.

I'm NOT asking you to solve my problem, but i just want to know if what I want to do is even doable? Can the energy source term be changed only for a certain area or is it always globally? Like it was with my previous simulations where I changed the gravity for the second phase globally.

Is it possible to have a little area where the energy source term is changed? How should I construct the UDF? Because nothing I try is working.

Thanks in advance, I hope I was able to explain my problem properly
Attached Images
File Type: png Masters thesis explanation.png (10.1 KB, 9 views)

Last edited by Solmyr89; January 14, 2016 at 16:18.
Solmyr89 is offline   Reply With Quote

Old   January 14, 2016, 17:37
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 706
Rep Power: 9
`e` is on a distinguished road
Including an energy source term dependent on location should be straightforward using the DEFINE_SOURCE macro. Have a read of the section in the UDF manual (there's a description, example and steps on hooking the macro to your cell zone).

The DEFINE_SOURCE macro is called for each cell and therefore you could use a conditional statement to apply a local energy source. For example:

Code:
#include "udf.h" // UDFs require this header file

DEFINE_SOURCE(local_energy_source,c,t,dS,eqn)
{
    real x[ND_ND]; // array of cell coordinates
    real source = 0.; // default the source term to zero

    C_CENTROID(x,c,t); // retrieves the cell coordinates
    dS[eqn] = 0.; // derivative of source term

    if (x[0] > 0.5) // only if this cell belongs in the domain where x > 0.5 m
    {
        source = 1.; // non-zero source [generation-rate/volume e.g. W/m^3]
    }

    return source; // source is returned to solver
}
`e` is offline   Reply With Quote

Old   January 15, 2016, 05:09
Default
  #3
New Member
 
Join Date: Jan 2016
Posts: 3
Rep Power: 2
Solmyr89 is on a distinguished road
Thank you e for your code ,
I already tried that but what happens is this:

Fluent goes into the if statement, looks if there are cells with x coordinates >0.5 and then applies the source term to ALL cells, not only to the cells with x coordinates above 0.5.
This is why I was asking, because I can't find the solution to my problem. It seems like the source term can only be applied globally ... or am I just very stupid and doing something very wrong?
Solmyr89 is offline   Reply With Quote

Old   January 15, 2016, 18:29
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 706
Rep Power: 9
`e` is on a distinguished road
As I mentioned above, the source term is applied on a cell-by-cell basis. The DEFINE_SOURCE macro is called for each cell and returns a source term for that specific cell (with the cell index c).

Try the UDF I posted above and set the local source term to a very high value to make the temperature field peak in this local region (you may need to modify the conditional statement for your domain).
`e` is offline   Reply With Quote

Old   January 16, 2016, 05:31
Default
  #5
New Member
 
Join Date: Jan 2016
Posts: 3
Rep Power: 2
Solmyr89 is on a distinguished road
Thank you very much for your patience. I just figured out my mistake.
When I used UDFs before this last problem, I modified the viscosity and gravity of each phase and I was used to working with absolute values. But as you pointed out the expression should be in W/m so I just divided the source term by the volume of each cell .... it works just fine now. Thank you =)
Solmyr89 is offline   Reply With Quote

Reply

Tags
energy, fluent, locally, source, udf

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 21:53
Source Term due to evaporation in energy transport equation styleworker OpenFOAM Programming & Development 2 September 3, 2014 21:24
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 11:32
UDF Scalar Code: HT 1 Greg Perkins FLUENT 8 October 20, 2000 12:40
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 13, 2000 23:03


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