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

Define mass flow profile with regards to species mass fraction

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 20, 2017, 06:21
Default Define mass flow profile with regards to species mass fraction
  #1
New Member
 
Daniel
Join Date: Oct 2010
Posts: 1
Rep Power: 0
danS is on a distinguished road
Hi!

I am trying to write a UDF for defining a mass flow profile with regards to species mass fraction. I have a constant mass flow with a mass fraction of 1 for the water species at the inlet of the domain (which happens to be a porous zone) and I want to have a mass outlet which removes mass when the mass fraction of water (I have water and air as species) is above 0.1.
The UDF below compiles and runs (depending on the initial conditions), but it seams to not loop over all faces in the face thread. The counter I have in the UDF does not match the number of elements I have on my face thread. It skip about 75% of the faces I have on the thread and I don't understand why?

Also, my steady-state simulation crashes without completing 1 iteration when I initialize the domain with 0 mass fraction water, but it runs fine when I initial the domain with a mass fraction above 0.1. I can't understand why, but my understanding for UDF programming is limited so maybe someone of you might see what is wrong with my code?

#include "udf.h"

DEFINE_PROFILE(mass_flow, thread, in)
{
face_t f;
Thread *c0_thread;
cell_t c0;
int i = 0;
real counter=0.;
real A[ND_ND];

begin_f_loop(f, thread)
{
c0_thread=THREAD_T0(thread);
c0=F_C0(f,thread);
if (C_YI(c0,c0_thread,i) > 0.1)
{
F_AREA(A,f,thread);
F_PROFILE(f,thread,in) = 0.0001*(C_YI(c0,c0_thread,i)-0.1)*NV_MAG(A);
}
else
{
F_PROFILE(f,thread,in) = 0.;
}
counter=counter+1;
}
end_f_loop(f,thread);
Message("%5.15f\t\n",counter);
}

/Daniel
danS 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
Conversion of mass fraction to mole fraction in FLUENT prince_pahariaa FLUENT 0 August 26, 2014 08:08
Problem of simulating of small droplet with radius of 2mm liguifan OpenFOAM Running, Solving & CFD 5 June 3, 2014 02:53
How to define a fixed velocity for a given mass flow rate on inlet mqasimali FLUENT 2 April 12, 2013 17:24
Species mass flow inlet lorenz FLUENT 3 March 15, 2012 07:26
Simulation with UDF for species mass fraction and velocity profile virgy Fluent UDF and Scheme Programming 8 February 7, 2012 04:30


All times are GMT -4. The time now is 20:33.