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

Source Term

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 16, 2017, 09:40
Default Source Term
  #1
New Member
 
Hooman
Join Date: Jan 2016
Posts: 19
Rep Power: 10
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


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
Source Term due to evaporation in energy transport equation styleworker OpenFOAM Programming & Development 3 September 7, 2022 03:09
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 17:34
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error FerdiFuchs OpenFOAM Community Contributions 27 April 16, 2014 15:14
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 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 08:31.