|
[Sponsors] |
Including source term into energy equation - Eulerian Multiphase |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 26, 2014, 17:22 |
Including source term into energy equation - Eulerian Multiphase
|
#1 |
New Member
Luiz Eduardo
Join Date: May 2010
Posts: 19
Rep Power: 16 |
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; } 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 14:04. |
|
May 28, 2014, 09:34 |
|
#2 |
New Member
Luiz Eduardo
Join Date: May 2010
Posts: 19
Rep Power: 16 |
Please, any help is well apreciated.
|
|
October 7, 2015, 23:00 |
|
#3 |
Senior Member
Join Date: Jun 2014
Location: Taiwan
Posts: 100
Rep Power: 12 |
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. |
|
|
|
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 07: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 16:11 |
Problem with Joulebs effect source term in the energy equation | galaad | OpenFOAM Running, Solving & CFD | 0 | January 19, 2006 13:01 |