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

Including source term into energy equation - Eulerian Multiphase

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 26, 2014, 16:22
Default Including source term into energy equation - Eulerian Multiphase
  #1
New Member
 
Luiz Eduardo
Join Date: May 2010
Posts: 19
Rep Power: 15
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):

Code:
#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;

  if (NNULLP (THREAD_STORAGE(t,SV_P_G)))
  
  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
Default
  #2
New Member
 
Luiz Eduardo
Join Date: May 2010
Posts: 19
Rep Power: 15
DudaAPD is on a distinguished road
Please, any help is well apreciated.
DudaAPD is offline   Reply With Quote

Old   October 7, 2015, 22:00
Default
  #3
Senior Member
 
Join Date: Jun 2014
Location: Taiwan
Posts: 100
Rep Power: 11
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

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
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 10: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 15: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 12:01


All times are GMT -4. The time now is 20:43.