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

UDF for calculate total mass in the model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2016, 07:31
Default UDF for calculate total mass in the model
  #1
New Member
 
Bramantyo
Join Date: May 2016
Location: Java
Posts: 11
Rep Power: 10
brams is on a distinguished road
Hello there

I'm having trouble:
how to calculate the total mass of fluid in the model using UDF, at every time step?

My simulation is transient, with 1 inlet and 1 outlet.

I know that there's a feature in FLUENT (volume integral) option that can measure it easily, but I do need to create it via UDF for iteration purpose

Thanks, any help would be very helpful
brams is offline   Reply With Quote

Old   May 19, 2016, 07:43
Default
  #2
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by brams View Post
Hello there

I'm having trouble:
how to calculate the total mass of fluid in the model using UDF, at every time step?

My simulation is transient, with 1 inlet and 1 outlet.

I know that there's a feature in FLUENT (volume integral) option that can measure it easily, but I do need to create it via UDF for iteration purpose

Thanks, any help would be very helpful
I made this very quick. Gotta be checked and also adapt it to every time step.

This is a on demand macro, but you can change it accordingly to your purpose.

DEFINE_ON_DEMAND(mass)
{
Domain *domain;
Thread *ct;
cell_t c;
domain = Get_Domain(1);
double mass;
thread_loop_c(ct, domain)
{
begin_c_loop(c,ct)
{
mass += C_R(c,ct) * C_VOLUME(c,ct);
}
end_c_loop(c,ct)
}
}
Bruno Machado is offline   Reply With Quote

Old   May 19, 2016, 13:58
Default
  #3
New Member
 
Bramantyo
Join Date: May 2016
Location: Java
Posts: 11
Rep Power: 10
brams is on a distinguished road
Thank you Bruno!

I modified it to Define_Execute_At_End, and it works well, calculate the total mass in the model

But now, I have to calculate the mass of specific phase onl. Since my simulation is consisted of many phases.

What is the additional syntax to get total mass of 1 phase only, not all of phases?

Thank you
brams is offline   Reply With Quote

Reply

Tags
mass, total mass, transient, udf


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
UDF to obtain total mass of species Michael.Z Fluent UDF and Scheme Programming 0 July 21, 2015 22:15
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 06:36
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 15:32
total mass loss/gain--simulating taylor couette flow nwpukaka OpenFOAM Programming & Development 0 February 12, 2014 19:57
UDF for linear PTT model implementation dpitz Fluent UDF and Scheme Programming 1 February 4, 2011 11:08


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