CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Time-Dependent Viscosity (https://www.cfd-online.com/Forums/fluent-udf/99155-time-dependent-viscosity.html)

Dags March 27, 2012 09:44

Time-Dependent Viscosity
 
I am trying to create a time-dependent viscosity function in the udf. I need it to keep track of particles as soon as they enter the domain. I'm not really too familiar with the creation of udfs or how they work in general. I know how to program in C++, but I need a bit of a refresher. If someone can guide me through it or actually give me a site that can amply guide me through how it works, it would be greatly appreciated.

cryfreer March 29, 2012 03:45

Hi Dags

I am also trying to simulate time-dependent viscosity as you tried. I think I should use the DEFINE_PROPERTY macro to modify viscosity. However, If I hook this UDF to material panel, fluid in the whole domain will change by time, I think. So I think I need to evaluate the time, how long does it takes to move certain point from the inlet boundary. is there any idea?

Here is an example to change viscosity property by time.

-------------------------------------------------------------------------------------
#include "udf.h"
DEFINE_PROPERTY(cell_vis,thread,index)
{
real mu_lam; //define variables
real f_time = RP_Get_Real("flow-time"); //difine f_time to current flow time

mu_lam = ~~ *f_time; //viscosity function vs time

return mu_lam; //returned to the solver
}


All times are GMT -4. The time now is 22:32.