# Diffusion Flux calculation in porous medium

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

 May 18, 2009, 07:32 Diffusion Flux calculation in porous medium #1 Member   Join Date: Mar 2009 Location: Istanbul, Turkiye Posts: 45 Rep Power: 9 Hi, I have a problem in my simulations which leads to violation of mass conservastion when I tried to calculate divergence of flux, in porous medium. I ended up with this question: In a porous fluid zone which one is true for diffusive flux in FLUENT? a) Flux = (porosity*diffusion_coeff*gradient_of_driving force) b) Flux = (diffusion_coeff*gradient_of_driving force) thanks for your help... Last edited by gemini; May 19, 2009 at 12:30.

 June 3, 2009, 13:06 #2 New Member   mj sharawi Join Date: May 2009 Posts: 14 Rep Power: 9 Hi Gemini , First of all sorry for the LATE reply. Anyway, the correct diffusion term is the first one, but you don't need to worry about that because it is taken care of already in fluent. So, all you need to give is the coefficient. We have done some test cases to verify this, and also called Fluent and they confirmed that. Hope this helps. Regards, MJ

June 3, 2009, 14:09
#3
Member

Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 45
Rep Power: 9
Quote:
 Originally Posted by mj_no7 Hi Gemini , First of all sorry for the LATE reply. Anyway, the correct diffusion term is the first one, but you don't need to worry about that because it is taken care of already in fluent. So, all you need to give is the coefficient. We have done some test cases to verify this, and also called Fluent and they confirmed that. Hope this helps. Regards, MJ
Hi MJ,

- Is your answer is true for physical velocity formulation or superficial velocity formulation or both?

- Can you briefly describe your test case so I can reproduce it, (if it is possible)

- In a specific problem I have to make some calculation in which net flux of some quantity into a CV is calculated and it is divided by volume of that CV. so the accumulation of that variable per unit volume then calculated. The question is that: In my domain there are two zones that have different porosities. So in my net flux calculation, definition of flux is very important for the cells located on two sides of the the interface between these fluid zones, Am I right? So, is it true to use flux definition you stated as:

- Is this definition is also true for UDS varaibles modeled on porous fluid zones?

 June 4, 2009, 13:28 #6 New Member   mj sharawi Join Date: May 2009 Posts: 14 Rep Power: 9 Hi Gemini , First of all, I want to clarify something here and I am sorry if I didn't put it straight in my reply. For a UDS the diffusion coefficient is NOT multiplied by the porosity in Fluent, so you have to multiply it yourself. Whereas for species transport, the diffusion coefficient used in Fluent of each species IS multiplied by the porosity and you don't need to modify anything. I think this answers your last question. Now for your UDF, the main part (inside the "if" statement and its "else") is not so clear for me, but I recommend that you consult someone who has experience with discretization in the control volume approach. What I was talking about in my previous reply was how to define Gamma: gamma_face = C_POR(c,t)*C_UDSI_DIFF(c,t, uds-0) and not an averaged one like the one you defined. This applies also for the way you define "grad_vector". Again, maybe you should ask someone with experience in this particular issue. Wish you the best, and sorry I couldn't be much of a help. regards, MJ

June 4, 2009, 13:59
#7
Member

Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 45
Rep Power: 9
Quote:
 Originally Posted by mj_no7 Hi Gemini , First of all, I want to clarify something here and I am sorry if I didn't put it straight in my reply. For a UDS the diffusion coefficient is NOT multiplied by the porosity in Fluent, so you have to multiply it yourself. Whereas for species transport, the diffusion coefficient used in Fluent of each species IS multiplied by the porosity and you don't need to modify anything. I think this answers your last question. Now for your UDF, the main part (inside the "if" statement and its "else") is not so clear for me, but I recommend that you consult someone who has experience with discretization in the control volume approach. What I was talking about in my previous reply was how to define Gamma: gamma_face = C_POR(c,t)*C_UDSI_DIFF(c,t, uds-0) and not an averaged one like the one you defined. This applies also for the way you define "grad_vector". Again, maybe you should ask someone with experience in this particular issue. Wish you the best, and sorry I couldn't be much of a help. regards, MJ
Hi MJ,

Your first paragraph is what I was looking for, your explanation is very important to me because UDF manual of FLUENT does not give this kind of critical information about the solver.

For second paragraph of you, I am tried to calculate the face flux value according to the definition of FLUENT on unstructured grid explained below

3.2.5 Connectivity Macros http://hpce.iitm.ac.in/Manuals/Fluent_6.3/fluent6.3/help/html/udf/node92.htm

In this page eqn (3.2-3) gives face flux of any quantity and it has gamma_face value (diffusivity at the face). So, the simplest way to evaluate the face value of the diffusivity is the arithmetic average. This is true for gradient also. Since, I do not know any person who has this kind of experience to discuss such an issue, thus, I have to solve this problem alone

Lastly, I would like to thank you again so much for your comments in this thread and other threads in this forum. (Now, I am working on feasibility of writing my own species transport model using UDSs)

Best regards,

Gemini

 June 4, 2009, 14:36 #8 New Member   mj sharawi Join Date: May 2009 Posts: 14 Rep Power: 9 Hi Gemini , I've taken a look at the manual that you posted up there. If you can see Fig3.2.2 , the gradient is defined in the cell not on the face. I still think it is worth it to try to define: gamma_face = C_POR(c,t)*C_UDSI_DIFF(c,t, uds-0) ; and NV_V(grad_vec, =, C_UDSI_G(c, t, uds-0)) ; instead of the averaged ones. Try doing that and make some simple test case. Then, you can compare both implementations. Let me know about the result if you get something interesting. Good luck, MJ

 June 4, 2009, 17:57 #10 New Member   mj sharawi Join Date: May 2009 Posts: 14 Rep Power: 9 Hi Gemini , This heat capacity issue was very annoying to everyone. The reason why Fluent doesn't allow us to access Cp by a UDF is because enthalpy (which is needed in the convective term of energy equation) is defined as the integration of Cp over temperature. So, if we define our Cp as a UDF they can't know what the enthalpy is for some temperature. Now the good news is, and finally, in the most recent version of Fluent (12.0.16) they included a new macro "DEFINE_SPECIFIC_HEAT" where this macro calculates the specific heat and the corresponding enthalpy as well. But, to be honest we haven't tried this macro yet and I'm not sure if it has any further limitations. now, if you HAVE TO find something around this problem in fluent 6, the only way we could think of is to disable the energy equation and implement it as another UDS (you want to shoot me now, I know ). This way you can set the diffusion coefficient as the thermal conductivity, and define a user defined convective flux term to define your own heat capacity (too complicated now). If have any other ideas, please share it here. We have been strugling with such problems for a while. Maybe the next problem that you could face is how to add the effect of radiation ? this will be waaaay much harder if you need it. Good luck Regards, MJ

 June 4, 2009, 20:11 #11 Member   Join Date: Mar 2009 Location: Istanbul, Turkiye Posts: 45 Rep Power: 9 Hello again, You are absolutely, definitelty correct, but using FLUENT as only u-v-p flow solver does not look sound to me . If I implement energy and species transport via UDSs combined with my own UDSs, then my CFD software choice become completely wrong. Because my first aim to select FLUENT was reducing the time for modeling studies in order to spent more time for integrating CFD solver with DFO (CONDOR etc.). But, due to limitations that I faced up time to time, I had to leave optimization with DFO in order to investigate the tricks that needed to overcome the drawbacks of FLUENT. This is so boring for me On the other hand there is a open source alternative named OpenFOAM, did you know this software? can I implement the things we just discussed? I installed it and run for cavity example but I could not solve its language yet. Do you suggest OpenFOAM? best wishes Gemini

 July 7, 2009, 22:26 #12 New Member   Vivek Join Date: Apr 2009 Posts: 7 Rep Power: 9 Dear mj_sharawi and gemini, Your discussion has helped me a lot in solving my own "diffusion in a porous zone" queries. Specifically, I was exactly looking for confirmation that Fluent does multiply the porous zone porosity with the user-supplied mass diffusivity (Dm), and that the user does not need to give a separate input -- ie Dp = Dm * porosity. However, effective porosity in a porous zone is defined as Dp = Dm * porosity / (tortuosity) So should I use a UDF to input the porous zone diffusivity as (Dm / tortuosity), so that Fluent would then correctly estimate Dp = (Dm / tortuosity) * porosity ? I have been using a UDF to specify the porous zone diffusivity (1e-12) as an order of magnitude smaller than that in the fluid zone (1e-11). When I display the diffusion coefficients in the two zones, I see that i get back what I input via the UDF. However, I do not see that Fluent has used my supplied porosity (0.6) info in its porous zone diffusivity. That is, I should have seen a porous zone diffusivity of 0.6 * 1e-11, instead of 1e-12 in my visualization. This is probably expected since my UDF would be over-riding Fluent's porous diffusivity estimation. On the other hand, when I do not use the UDF, I see a unifrom diffusivity of 1e-11 in both zones. Why does this happen? My simulation zone consists of a fluid zone and a porous zone, with an interior surface separating the two. Thanks, Vivek

 July 8, 2009, 21:15 #13 New Member   Vivek Join Date: Apr 2009 Posts: 7 Rep Power: 9 Hi, In addition to my query above, what is the recommended convergence criteria for monitoring species balance? I use a convergence of 1e-03. Also, how do I decide the under-relaxation factor for species balance? I keep varying it from 0.2 through 0.5, depending on the rate of convergence per time step. And the choice of time step is another issue altogether!! Thanks, Vivek

October 7, 2010, 17:22
#14
Member

CJ
Join Date: Jun 2009
Posts: 34
Rep Power: 9
Quote:
Dear,

I have a question, probably it is very easy for u, if I have got a cell ID , source[0], I want to get the flux of faces of this cell, "just for this cell" , it is structured grid, could u help check what is wrong with my code, Thanks a lot!!

DEFINE_ON_DEMAND(get_mf)
{
Domain *d; /*pointer to the collection of all cells' threads (stored information) */
/* declare domain pointer since it is not passed as an argument to the DEFINE macro */
cell_t c; /* cell identifier */
mf=0.0;
int i=0.0;

/************try to get neighbouring faces of the cell********************************************** ***/

/* If face lies at domain boundary, use face values; */
/* If face lies IN the domain, use average of adjacent cells. */

c_face_loop(c, t, i)

{
face_t f;
f = C_FACE(c,t,i);
c0 = F_C0(f,tf);
c1 = F_C1(f,tf);
real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;
F_AREA(A, f, t);

{
/* c0 is current cell*/
if (c0 == source[0])
{

NV_DS(psi_vec, =, C_U(c,t),C_V(c,t),C_W(c,t),*,1.0);
NV_DS(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1),*,1.0);
flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */

}
else
{

NV_DS(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),*,1.0);
NV_DS(psi_vec, +=, C_U(c,t),C_V(c,t),C_W(c,t),*,1.0);
flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */

}
}
}

}

hereby density is 1.0;

October 7, 2010, 17:23
#15
Member

CJ
Join Date: Jun 2009
Posts: 34
Rep Power: 9
Quote:
 Originally Posted by mj_no7 Hi Gemini , First of all, I want to clarify something here and I am sorry if I didn't put it straight in my reply. For a UDS the diffusion coefficient is NOT multiplied by the porosity in Fluent, so you have to multiply it yourself. Whereas for species transport, the diffusion coefficient used in Fluent of each species IS multiplied by the porosity and you don't need to modify anything. I think this answers your last question. Now for your UDF, the main part (inside the "if" statement and its "else") is not so clear for me, but I recommend that you consult someone who has experience with discretization in the control volume approach. What I was talking about in my previous reply was how to define Gamma: gamma_face = C_POR(c,t)*C_UDSI_DIFF(c,t, uds-0) and not an averaged one like the one you defined. This applies also for the way you define "grad_vector". Again, maybe you should ask someone with experience in this particular issue. Wish you the best, and sorry I couldn't be much of a help. regards, MJ
hopefully I also can get your help as well,MJ! Thanks in advance!

regards,

CJ

 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 Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20 Valeria FLUENT 1 July 10, 2009 03:58 Martin Main CFD Forum 3 June 4, 2008 10:04 AB CD-adapco 6 November 15, 2004 05:41 pepa FLUENT 0 September 8, 2003 17:07

All times are GMT -4. The time now is 04:50.