CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for viscous resistance for porous media with time variable (http://www.cfd-online.com/Forums/fluent-udf/94746-udf-viscous-resistance-porous-media-time-variable.html)

benson621 November 24, 2011 04:16

UDF for viscous resistance for porous media with time variable
 
Hello,

i am a new ansys fluent user, but i am now very urgent to demonstrate a flow in porous material. i have a viscous resistance of 5e12 + 2e12 t + 4e9 t^2 (given). but i have no idea to write a UDF to enter this kind of viscous resistance (with time variable), the place i enter the parameter can only allow me to put in a single constant value.

May i ask the easy tutorial for writing the UDF for viscous resistance of 5e12 + 2e12 t + 4e9 t^2?
or some nice guys can even write it to me?

Thank You so much.

I have tried to write this, but error: line 9:invalid type for binary expression: int * pointer to structure.
Quote:

#include "udf.h"

DEFINE_PROFILE(porosity_function, t, nv)
{
cell_t c;
begin_c_loop(c,t)
C_PROFILE(c,t,nv) = 5000000000000+2000000000000*t+4000000000*t*t ;
end_c_loop(c,t)
}

Amir November 24, 2011 07:25

Hi,

t is not time here! this is thread index. so replace this:

Code:

#include "udf.h"

DEFINE_PROFILE(porosity_function, t, nv)
{
cell_t c;
real time=CURRENT_TIME;
begin_c_loop(c,t)
{
C_PROFILE(c,t,nv) = 5000000000000+2000000000000*time+4000000000*pow(time,2);
}
end_c_loop(c,t)
}

Bests,

benson621 November 24, 2011 11:59

Quote:

Originally Posted by Amir (Post 333419)
Hi,

t is not time here! this is thread index. so replace this:

Code:

#include "udf.h"

DEFINE_PROFILE(porosity_function, t, nv)
{
cell_t c;
real time=CURRENT_TIME;
begin_c_loop(c,t)
{
C_PROFILE(c,t,nv) = 5000000000000+2000000000000*time+4000000000*pow(time,2);
}
end_c_loop(c,t)
}

Bests,

i will have try with this. thank you so much


All times are GMT -4. The time now is 13:41.