CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   UDF for porosity (

Giacomo July 19, 2007 03:23

UDF for porosity
Hi all. I am new with UDF. I have to simulate the changing in time of the porosity and permeability of a porous media. I wrote a UDF for porosity to be constant (=0.30) and it works:

#include "udf.h"

DEFINE_PROFILE(porosity, t, i) { real x[ND_ND]; cell_t c; real r;





F_PROFILE(c,t,i)=0.30; }

end_c_loop(c,t) }

The probelm is that the evolution in time of porosity should be something like

porosity(t_[i]) = f(porosity(t_[i-1]))

How can I store the porosity value of the previous time step to use it in the next time step? And where can I store it? I tried to create an array to store it, but it didn't work...

I hope I made myself clear... Thanks in advance and regards


Giacomo July 19, 2007 06:21

Re: UDF for porosity
Sorry, I forgot to say that I use FLUENT 6.1.22. Thanks again

sujith July 19, 2007 15:22

Re: UDF for porosity
u can use the User Defined memory in Fluent through Define->User defined->memory. Enable one user defined memory. Initialize the UDM with initial porosity values. In the define profile UDF do the following operations loop over all cells 1. calculate new porosity using the previous value

porosity[t] = f(UDM) 2. Assign the UDM new value of porosity UDM = porosity[t]

Giacomo July 23, 2007 09:23

Re: UDF for porosity
Thanks, sujith. I have allocated two UDM's and now it seems to work. The UDF is the following:

DEFINE_PROFILE(porosity, t, i) { cell_t c; int tm = N_TIME;



if (tm==1)









} } end_c_loop(c,t) }

The problem is that it works only for the 1st and 2nd time step, then it does not update the porosity any more... Why?

Thanks very much


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