CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

Including source term into energy equation - Eulerian Multiphase

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

LinkBack Thread Tools Display Modes
Old   May 26, 2014, 16:22
Default Including source term into energy equation - Eulerian Multiphase
New Member
Luiz Eduardo
Join Date: May 2010
Posts: 19
Rep Power: 9
DudaAPD is on a distinguished road
Hi all,

I am trying to include the term V.Grad[P] --> (u.dp/dx + y.dp/dy) as a source into the energy equation when solving with Eulerian Multiphase model. I am a newbie to UDFs, hence any help is well apreciated

So far I came up with the following (considering that once I have something working I will still need to implement it in parallel):

#include "udf.h"
#include "mem.h"
#include "sg_mphase.h"

DEFINE_SOURCE (VGradP, c, t, dS, eqn)
  Thread *thread_gas, *thread_liq, *superthread;
  Thread *mix_thread=THREAD_SUPER_THREAD(superthread);
  real source, x_liq_vel, x_gas_vel, y_liq_vel, y_gas_vel;
  real p_op;

  thread_liq = THREAD_SUB_THREAD(mix_thread,0);
  thread_gas = THREAD_SUB_THREAD(mix_thread,1);

  x_liq_vel = C_U(c,thread_liq);
  y_liq_vel = C_V(c,thread_liq);
  x_gas_vel = C_U(c,thread_gas);
  y_gas_vel = C_V(c,thread_gas);
  dS[eqn] = 0;

  source = x_liq_vel*C_P_G(c,thread_liq)[0] + y_liq_vel*C_P_G(c,thread_liq)[1];
  return source;
The case is 2D, axi-symetric, pipe for Liquid with constant density or compressible liquid (primary phase) and compressible gas (ideal gas or another real gas model) as secondary phase.

Since I have a compressible gas, Fluent tells me to use the operating density with value = 0, so that it calculates the densities with the real Absolute Pressure, i.e. it won't subtract the column pressure g*Rho_0*h. Therefore, I need somehow to guarantee that my UDF is actually using the right pressure for the calculations.

I am not sure if I will have to work with "Data Access Macros", such as area, face, centroids, etc.

Hopefully, the code above (I know it is wrong), gives an idea of what I have in mind for the UDF.

Thank you in advance for your time,

Last edited by DudaAPD; May 27, 2014 at 13:04.
DudaAPD is offline   Reply With Quote

Old   May 28, 2014, 08:34
New Member
Luiz Eduardo
Join Date: May 2010
Posts: 19
Rep Power: 9
DudaAPD is on a distinguished road
Please, any help is well apreciated.
DudaAPD is offline   Reply With Quote

Old   October 7, 2015, 22:00
Join Date: Jun 2014
Location: Taiwan
Posts: 89
Rep Power: 5
SJSW is on a distinguished road
Is it OK to compile the UDF file?

I don't know what 0 and 1 mean in
thread_liq = THREAD_SUB_THREAD(mix_thread,0);
thread_gas = THREAD_SUB_THREAD(mix_thread,1);

It seems 0 and 1 are zone ID and they are not defined?
I mean that one can type any number, but the UDF doesn't know what it is.
SJSW is offline   Reply With Quote


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
Trouble compiling utilities using source-built OpenFOAM Artur OpenFOAM Programming & Development 14 October 29, 2013 11:59
High Energy Domain Imbalance Due to Energy Equation Source Term r.mojtaba CFX 0 September 1, 2013 06:58
Smagorinsky term in SGS kinetic energy equation Ivan Main CFD Forum 3 January 21, 2013 16:22
Source term energy equation for reactive flows DaIN Main CFD Forum 0 October 6, 2011 15:11
Problem with Joulebs effect source term in the energy equation galaad OpenFOAM Running, Solving & CFD 0 January 19, 2006 13:01

All times are GMT -4. The time now is 06:16.