# Source Term

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

July 16, 2017, 09:40
Source Term
#1
New Member

Hooman
Join Date: Jan 2016
Posts: 18
Rep Power: 3
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.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post tlcoons OpenFOAM Installation 13 April 20, 2016 17:34 styleworker OpenFOAM Programming & Development 2 September 3, 2014 21:24 FerdiFuchs OpenFOAM Installation 27 April 16, 2014 15:14 mcathela OpenFOAM Installation 14 April 23, 2013 13:59 Greg Perkins FLUENT 0 October 11, 2000 03:43

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