CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   How to determine some calculations in UDS function (http://www.cfd-online.com/Forums/fluent/43322-how-determine-some-calculations-uds-function.html)

 Le January 13, 2007 15:25

How to determine some calculations in UDS function

I would like to know how to calculate some cases as follows: 1. In unsteady state, we can calculate the previous time step value by using C_UDSI_M1(c,t,i). But for steady state, if I want to calculate the new value of UDS by using the old value (it means the value in previous iteration). How can I determine the old value? For example, I want to have: C_UDSI(c,t,i)_new = anpha*C_UDSI(c,t,i)new+(1-alpha)*C_UDSI_M1(c,t,i)old.

2. If I have two values of UDS like C_UDSI(c,t,1) and C_UDSI(c,t,2). I want to compare two value by using a subtract, for example e = C_UDSI(c,t,1) - C_UDSI(c,t,2) If e is smaller than a given value, then the program will stop (condition statement). How can I implement the condition? (Actually, I want to know where I write some statements for this).

I highly appreciate your help. Thank,

 Sujith S Nair January 14, 2007 14:46

Re: How to determine some calculations in UDS func

I hope this will work. Activate 2 user defined memories, UDM. Use the macro Define_Adjust, first assign UDM2= UDM1, then assign udm 1 with uds. Define adjust is called at every iterations. So in the previous iteration result will be available at udm2.

best wishes, Sujith S Nair

 Le January 14, 2007 18:15

Re: How to determine some calculations in UDS func

Thank for your idea. I did like that. I use two UDS functions which are defined the same. For example: UDS1= a+b UDS2= (a+b)*alpha+UDS1*(1-alpha) Run two UDS every iteration, with alpha is relaxation factor (alpha < 1). Then for new iteration, UDS2 is new value and UDS1 is old value. But when I run the program, it showed me that the number is NOT available (floating point). Could you tell me more obviously about what you are talking about. Thanks

 Sujith January 15, 2007 11:06

Re: How to determine some calculations in UDS func

I was not suggesting UDS, It is UDM , user defiend memory. define->user-defined->Memory. activate 2 udms. You can get the value of UDS at previous iteration using a DEFINE_EXECUTE_AT_END macro. Inside the DEFINE_EXECUTE_AT_END macro do the following operations in the same order. 1.UDM0= UDM1. 2. UDM1= UDS0. Now you have the value of UDS present iteration in UDM1 and previous iteration in UDM0. 3. The value of the UDS0 can be modified UDS0 = F( UDM0, UDM1) 4. Assign the new UDS0 value to the UDM1.

second qn regarding e= UDS2-UDS1, you can define a custom field function and monitor it.

 Le January 15, 2007 17:52

Re: How to determine some calculations in UDS func

Thanks. It seems to be right what you was talking about. It is very useful for me.

Regards,

 All times are GMT -4. The time now is 03:27.