CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   help needed for accessing previous step values (https://www.cfd-online.com/Forums/fluent/177908-help-needed-accessing-previous-step-values.html)

weirdsda September 23, 2016 11:44

help needed for accessing previous step values
 
Hi all:
I have been frustrated for a long time to try to make a UDF with a previous step variable.
I would like to access the previous step value of C_STRAIN_RATE_MAG(c,tc), for the current calculation. I tried UDMI and UDSI_M1 but I could not get it right.

I would really appreciate if anyone knows how to do it?:confused:

kar1209 April 6, 2017 14:42

I am facing problem with previous time step macros
 
I want to provide convective boundary condition at my domain outlet and I am trying to do that by relating the current time step U velocity for the cells in the cell thread on the outlet face with the U velocity of the cells from the previous time step. I tried using the F_U_M1 macro. But I am getting "segmentation error". Can anybody help me?

sbaffini April 7, 2017 04:22

Pretty sure that M1 and M2 variables only exist for cell values, not face ones. You need to save current face variables in a F_UDMI and access at the next time step before updating them. There is a post hanging around about this very specific task (using UDMI to store variables from previous time steps).

kar1209 April 7, 2017 08:17

Accessing previous time step values
 
Thank you so much. I was able to find the thread regarding using UDMs for accessing variable values at previous time steps.

https://www.cfd-online.com/Forums/fl...-used-udf.html

I have one more doubt. I see that in all programs, F_UDMI is used inside the begin_f_loop(). In that case can a UDM location store multiple values corresponding to multiple faces in a face thread?

sbaffini April 7, 2017 08:46

Yes, note that this:

F_UDMI(f,t,i)

is the way F_UDMI is accessed, where f is the local face index, t is the face thread and i is the (i-1)-th F_UDMI variable (i starts at 0).

kar1209 April 7, 2017 08:58

Quote:

Originally Posted by kar1209 (Post 644031)
Thank you so much. I was able to find the thread regarding using UDMs for accessing variable values at previous time steps.

https://www.cfd-online.com/Forums/fl...-used-udf.html

I have one more doubt. I see that in all programs, F_UDMI is used inside the begin_f_loop(). In that case can a UDM location store multiple values corresponding to multiple faces in a face thread?

What I meant to say is that if I want to calculate the value at current time step using value at previous time step and then assign it to the faces using F_PROFILE(), can I use 2 different looping macros - one for calculating the next time step value in the current time step and another looping macro for assigning the values in the next time step?

for example:
Code:

/*for specifying u velocity*/

begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = F_UDMI(1); /*values to be assigned to boundary face in the next time step*/
}
end_f_loop(f,t)
begin_f_loop(f,t)
{
F_UDMI(1) = (.....) + F_U(f,t); /*calculation in the current time step*/
}
end_f_loop(f,t)

The above code is valid only if UDM can store multiple values. Otherwise how do I go around this? Please help.


All times are GMT -4. The time now is 02:15.