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 Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 3, 2015, 05:55
Default DEFINE_DPM_BC question~
  #1
New Member
 
Tao Ning
Join Date: Mar 2015
Posts: 23
Rep Power: 8
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, 08:34
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,969
Rep Power: 24
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, 23:41
Default
  #3
New Member
 
Tao Ning
Join Date: Mar 2015
Posts: 23
Rep Power: 8
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:58.