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/)
-   -   calling result of a UDF into current time step (http://www.cfd-online.com/Forums/fluent-udf/99294-calling-result-udf-into-current-time-step.html)

Komon March 30, 2012 16:19

calling result of a UDF into current time step
 
Hi guys,

I would appreciate if anyone could give me just a hint or where to look for how to do the following:

I want to have a UDF, which calculates at time t value of a variable x. The equation is in the following form:

x(t)=x(t-dt)+dx/dt*dt

As this variable depends on its own value at time t-dt, I need to somehow store it in a way that i can later call it. In time t I only need the value of x at time t-dt, not the values of x at all times.

so, is it possible to store a variable calculated with udf for just one time step and then, how to call it into your udf?

I've looked into udf manual and did a little search on the internet, there are ways of storing udf results but I haven't come across anything really useful for me.

Komon April 1, 2012 19:53

Hi again,

I found C_UDMI macro, which is supposed to be used when one wants to store different values from UDF/fluent into memory and use them again.
I used this macro in my udf, but when I check the values of this macro (it is possible to check them under contours dialog box) I can see that the value this macro is giving me for every critical place(where I need it in the calculations) is (-)infinite.

now, I used this macro in the following way:

if (some condition, true at the beggining of simulation)
x=0
else if (some other condition)
x=0
else
acc=pow(C_UDMI(c,t,0),2)*some constants and variables
x = C_UDMI(c,t,0)+acc*dt

C_UDMI(c,t,0)=x

this is it, there are no definitions of what C_UDMI should be at the beggining of simulation, at the very first time step. which bothers me a bit, although C_UDMI cannot be used at the start of simulation because the condition in which it is used is not fulfilled. therefore I would really appreciate if someone would give me a bit of insight if the above use is ok and what might cause such a problem.

just to make it clear-in acc there are no chances of getting a 0 into a denominator or other values which would go into infinitive and then cause C_UDMI go into inf.


All times are GMT -4. The time now is 09:43.