CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

Source Term

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 16, 2017, 09:40
Default Source Term
  #1
New Member
 
Hooman
Join Date: Jan 2016
Posts: 18
Rep Power: 3
hooman.esl is on a distinguished road
hi every body,
I am simulating hydrate dissociation in porous media.
I have written a code using DEFINE_SOURCE for mass generation of methane and hydrate consumption(for when the pressure is below the equilibrium pressure).
I compiled it successfully, but I have a problem:

i start the simulation with deltat of 1e-05 for time step and it is converging every 4 or 5 iterations but when i want to increase the time step to 1e-04 the message of reverse flow appears and influence all the result.
what should i do? because i want to run the simulation for 40 min.

here is my code:
Quote:
#include "udf.h"
#define deltaE 77330.0 // activation energy (j/kmol)
#define mwg 16. // molecular weight (kg/kmol)
#define mwh 119.5 // molecular weight (kg/kmol)
#define R 8.314 // gas constant
#define ahs 300000. // m^-1
#define phi 0.181 // porosity
#define Kd 8.06 // intrinsic dissociation constant (kmol/pa.s.m2)

/****************************************source term for methane generation**************************************** ****/

DEFINE_SOURCE(Gas_Generation,c,t,dS,eqn)
{
real source, mg, sh, T, P, Pe, Kb;
T = C_T(c, t);
P = C_P(c, t);
Pe = pow(10, (0.0342 * (T - 273.15) + 0.0005 * pow((T - 273.15),2) + 6.4804));
if (P < Pe)
{
Kb = Kd * exp(-deltaE / (R * T));
mg = Kb * mwg * ahs * phi * sh * (Pe - P);
source = mg; // it is a positive term
dS[eqn] =-1* Kb * mwg * ahs * phi * sh ;
}
else
{
source = 0;
dS[eqn] =0;
}
return source;
}
/*************************************source term for hydrate consumption*************************************** ***/

DEFINE_SOURCE(Hydrate_Consumption,c,t,dS,eqn)
{
real source, mg, sh, T, P, Pe, Kb;
T = C_T(c, t);
P = C_P(c, t);
Pe = pow(10, (0.0342 * (T - 273.15) + 0.0005 * pow((T - 273.15),2) + 6.4804));
if (P < Pe)
{
Kb = Kd * exp(-deltaE / (R * T));
mg = Kb * mwg * ahs *phi * sh * (Pe - P);
source = -1* mwh * (Kb * mwg * ahs *phi * sh * (Pe - P)) / mwg;
dS[eqn] = mwh * (Kb * mwg * ahs *phi * sh ) / mwg;
}
else
{
source = 0;
dS[eqn] =0;
}
return source;
}

Last edited by hooman.esl; July 17, 2017 at 03:41.
hooman.esl is offline   Reply With Quote

Reply

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
Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 17:34
Source Term due to evaporation in energy transport equation styleworker OpenFOAM Programming & Development 2 September 3, 2014 21:24
Swak4FOAM 0.2.3 / OF2.2.x installation error FerdiFuchs OpenFOAM Installation 27 April 16, 2014 15:14
build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Installation 14 April 23, 2013 13:59
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 11, 2000 03:43


All times are GMT -4. The time now is 19:39.