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

DEFINE_DPM_BC question~

Register Blogs Community New Posts Updated Threads Search

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

I want to get the average temperature of droplets in an interior in flow zone.
I use DEFINE_DPM_BC macro to get the temperature of each droplets and end the status with PATH_ABORT.
my question is how can I add all the droplets temperature together?
tks alot~
potatoning is offline   Reply With Quote

Old   April 3, 2015, 07:34
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Add two global variables (for example "temperaturesum" and "particlecount"), which you initialize both at one.
Just before you return PATH_ABORT, say
Code:
temperaturesum+=particle->temperature;
particlecount++;
Message("Average temperature until now: %f.\n",temperaturesum/particlecount);
The way to access the particle temperature is probably different than what I wrote here, but I hope you get the basic idea.
pakk is offline   Reply With Quote

Old   April 4, 2015, 22:41
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 pakk View Post
Add two global variables (for example "temperaturesum" and "particlecount"), which you initialize both at one.
Just before you return PATH_ABORT, say
Code:
temperaturesum+=particle->temperature;
particlecount++;
Message("Average temperature until now: %f.\n",temperaturesum/particlecount);
The way to access the particle temperature is probably different than what I wrote here, but I hope you get the basic idea.

Tks for your response~
I have tried this method~it works~
but there‘s another problem
the temsum and count are still adding with the fluent iterations
how can I reset the global variables to zero before every step?
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



All times are GMT -4. The time now is 05:37.