
[Sponsors] 
May 18, 2009, 07:32 
Diffusion Flux calculation in porous medium

#1 
Member
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 14 
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: 14 
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: 47
Rep Power: 14 
Quote:
I have some questions about your answer:  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: Flux = (porosity*diffusion_coeff*gradient_of_driving force)  Is this definition is also true for UDS varaibles modeled on porous fluid zones? Thank you very much for your answer. 

June 3, 2009, 15:07 

#4 
New Member
mj sharawi
Join Date: May 2009
Posts: 14
Rep Power: 14 
Hi Gemini ,
Regarding the first question, here is the answer: The net flux of some quantity (Phi) = convective_transfer + diffusive_transfer where: diffusive_transfer = porosity*diffusion_coeff*gradient_of_Phi , and this has nothing to do with the velocity formulation = it is valid for both. convective_transfer = u_superficial * density * Phi (or) u_physical * porosity * density * Phi Regarding the second question, our test case was on the diffusion coefficient of the species equations, I thought you were asking about that. But for UDS's it different. Since you are defining your diffusivity you should also multiply it by the porosity or by (1porosity) depending on where this UDS is transported (in the solid or in the fluid phase). Regarding the last question, I don't know the exact answer to be honest, but here are my thoughts: Let's assume the we have a face F_0 at the interface, an adjacent cell C_0 with porosity P_0, and another adjacent cell C_1 with porosity P_1. Here F_0 is supposed to make a discontinuity in the gradient of Phi at each of its sides. the gradient of Phi calculated between centroid of C_0 and center of F_0 multiplied by P_0 should be the term expressing the diffusion into/from cell C_0. Where on the other side of F_0 the diffusion is calculated using the gradient calculated between C_1 and F_0. This way, continuity is held across the interface if those expression are equal. I "guess" it is possible to access the gradient of some quantity as mentioned above (between a specified cell centroid and a specified face center) but I don't have any experience with that. You can see more information about gradients in the User guide: 25.Using the solver > 25.3.Discretization wish you the best, MJ 

June 4, 2009, 07:12 

#5 
Member
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 14 
Dear MJ,
First of all, thank you very much for your answers. Below you can see my code for calculation of net flux into the cells in a specific porous zone which has two neighbour porous fluid zones. In my calculations, I think, I must use C_POR macro since FLUENT automatically multiply Diffusivity of UDS by porosity when solving transport equation. I could not check the validity of results when C_POR used and not used until now. If you have any idea I would be glad to hear. c_face_loop(c, t, i) { f = C_FACE(c,t,i); tf = C_FACE_THREAD(c,t,i);} return net_flux; Regarding the second issue, considering species and/or UDS transport, if my diffusion coefficient is Deff = porosity^1.5 * D, is it true to use Deff = porosity^0.5 * D or Deff = porosity^1.5 * D Or this issue are different for species and UDS transport? Some references in the net are not clear to me? 1. item 1 in following link http://university.fluent.com/forum/v...86d1b68d53be26 2. item 3 in following link http://university.fluent.com/forum/v...86d1b68d53be26 best regards 

June 4, 2009, 13:28 

#6 
New Member
mj sharawi
Join Date: May 2009
Posts: 14
Rep Power: 14 
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, uds0) 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: 47
Rep Power: 14 
Quote:
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.23) 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: 14 
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, uds0) ; and NV_V(grad_vec, =, C_UDSI_G(c, t, uds0)) ; 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, 16:25 

#9 
Member
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 14 
Hi MJ,
I will try your suggestion in a simple 2D case, or in my model and let you know the results. However, in the manual, it says that gamma_f is is the diffusion coefficient at the face. And they approximate face flux as the sum of principal gradient evaluated using cell center values and cross diffusion term which includes the average of the gradients at the two adjacent cells. So, for non,uniform or unstructured grids my aproximation of averaging gradient and diffusion coefficient will have some degree of error. I will think about that. btw, I will write the results when I finished. Let me explain something about implementation for my own species transport equations, I learned that from manual that "UDFs cannot be used to define specific heat properties; specific heat data can be accessed only and not modified in FLUENT." see first blue info mark on: http://hpce.iitm.ac.in/Manuals/Fluen...udf/node43.htm so I think that I cannot model species transport by using UDS since heat capacity of species mixture cannot be user defined. I look this inside the fluent an I cannont hook an UDF to heat capacity. So, what is your opinion about this limitation? What can be the reason for this limitation? Thanks... Gemini 

June 4, 2009, 17:57 

#10 
New Member
mj sharawi
Join Date: May 2009
Posts: 14
Rep Power: 14 
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: 47
Rep Power: 14 
Hello again,
You are absolutely, definitelty correct, but using FLUENT as only uvp 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: 14 
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 usersupplied 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 (1e12) as an order of magnitude smaller than that in the fluid zone (1e11). 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 * 1e11, instead of 1e12 in my visualization. This is probably expected since my UDF would be overriding Fluent's porous diffusivity estimation. On the other hand, when I do not use the UDF, I see a unifrom diffusivity of 1e11 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: 14 
Hi,
In addition to my query above, what is the recommended convergence criteria for monitoring species balance? I use a convergence of 1e03. Also, how do I decide the underrelaxation 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: 14 
Quote:
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 */ Thread *t; /* pointer to a thread */ d = Get_Domain(1); /*domain is already available to your function (via define_adjust argument). */ 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; Thread *tf; f = C_FACE(c,t,i); tf = C_FACE_THREAD(c,t,i); c0 = F_C0(f,tf); c1 = F_C1(f,tf); t0 = THREAD_T0(tf); t1 = THREAD_T1(tf); real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0; F_AREA(A, f, t); if (!BOUNDARY_FACE_THREAD_P(tf)) { /* 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: 14 
Quote:
regards, CJ 

Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Moving mesh  Niklas Wikstrom (Wikstrom)  OpenFOAM Running, Solving & CFD  122  June 15, 2014 06:20 
porous medium and reactions  Valeria  FLUENT  1  July 10, 2009 03:58 
Flux calculation in vertexcentered finite volume.  Martin  Main CFD Forum  3  June 4, 2008 10:04 
Warning 097  AB  Siemens  6  November 15, 2004 04:41 
porous medium  pepa  FLUENT  0  September 8, 2003 17:07 