# UDF for viscous resistance for porous media with time variable

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

November 24, 2011, 04:16
UDF for viscous resistance for porous media with time variable
#1
New Member

Join Date: Oct 2011
Posts: 14
Rep Power: 13
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) }

Last edited by benson621; November 24, 2011 at 04:42.

 November 24, 2011, 07:25 #2 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 735 Blog Entries: 1 Rep Power: 22 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, __________________ Amir

November 24, 2011, 11:59
#3
New Member

Join Date: Oct 2011
Posts: 14
Rep Power: 13
Quote:
 Originally Posted by Amir 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