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 computation of total cell volume

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 3, 2024, 19:35
Default UDF for computation of total cell volume
  #1
New Member
 
jack
Join Date: May 2020
Posts: 1
Rep Power: 0
vkgupta1211 is on a distinguished road
Hi
I want to compute the total volume of cells where the secondary phase volume fraction is from 0.5 to 1. I have two fluid zones (ID:29 & 30).

here is the UDF. Compilation is successful, but on running, simulations gets crashed. Can somebody help me?

#include "udf.h"
/* UDF to calculate the total volume of cells with volume fraction between 0.5 and 1 */
DEFINE_ADJUST(sum_vol,d)
{
#if !RP_HOST
Thread *t;
cell_t c;
t=Lookup_Thread(d,30);
Thread **pt=THREAD_SUB_THREADS(t);
Thread *tp=THREAD_SUB_THREAD(t,1);
Domain *sd=DOMAIN_SUB_DOMAIN(d,1);
real total_vol=0.0;
mp_thread_loop_c(t,d,pt)
{
if (FLUID_THREAD_P(t))
{
begin_c_loop(c,t)
{
if ((C_VOF(c,tp)>=0.5) && (C_VOF(c,tp)<=1.0))
total_vol+=C_VOLUME(c,t);
C_UDMI(c,t,0)=total_vol;
}
end_c_loop(c,t)
}
}
Message0("\nNumber of particles trapped on the interface = %d\n\n",total_vol);
#endif
}
vkgupta1211 is offline   Reply With Quote

Reply

Tags
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
Controlling species wall flux using a UDF that checks adjacent cell species conc. ZachFrankman Fluent UDF and Scheme Programming 1 August 10, 2022 04:36
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 18:22
negative cell volume detected while running ANSYS Fluent UDF khushbu.bhavsar92 FLUENT 0 March 27, 2016 23:45
Problem of simulating of small droplet with radius of 2mm liguifan OpenFOAM Running, Solving & CFD 5 June 3, 2014 03:53
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 22:14


All times are GMT -4. The time now is 08:46.