CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

A udf question~

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 7, 2015, 00:10
Default A udf question~
  #1
New Member
 
Tao Ning
Join Date: Mar 2015
Posts: 23
Rep Power: 11
potatoning is on a distinguished road
Hi~

I have defined the global variations in the udf, and I want to reset the value of variations to zero after every fluent step.
how to achieve this?

tks a lot~
potatoning is offline   Reply With Quote

Old   April 7, 2015, 20:04
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Could you include the UDF code you're asking about?
`e` is offline   Reply With Quote

Old   April 7, 2015, 22:20
Default
  #3
New Member
 
Tao Ning
Join Date: Mar 2015
Posts: 23
Rep Power: 11
potatoning is on a distinguished road
Quote:
Originally Posted by `e` View Post
Could you include the UDF code you're asking about?
I set 2 global variables in udf, and they are used to accumulate the results of source.
After each iteration of fluent step, the new results are added to the old one.
so I want to reset the global variables to zero for the new step.
simple code as:

static real Sesum=0.;

DEFINE_SOURCE(engergy,c,t,dS,eqn)
{
real se=0.;
se=C_T(c,t);
Sesum+=se;
return se;
}
potatoning is offline   Reply With Quote

Old   April 7, 2015, 22:45
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
The User-defined ADJUST hook is executed at the start of each iteration before the transport equations are solved. For example, to reset a variable to zero at each iteration:

Code:
DEFINE_ADJUST(my_adjust,d)
{
    a_global_variable=0.;
}
`e` is offline   Reply With Quote

Old   April 7, 2015, 22:52
Default
  #5
New Member
 
Tao Ning
Join Date: Mar 2015
Posts: 23
Rep Power: 11
potatoning is on a distinguished road
Quote:
Originally Posted by `e` View Post
The User-defined ADJUST hook is executed at the start of each iteration before the transport equations are solved. For example, to reset a variable to zero at each iteration:

Code:
DEFINE_ADJUST(my_adjust,d)
{
    a_global_variable=0.;
}
tks a lot~
I'll try~
potatoning is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 08:26
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 07:12
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 22:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03


All times are GMT -4. The time now is 16:45.