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

Setting up a UDF to monitor UDS mass fraction

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 15, 2019, 14:58
Default Setting up a UDF to monitor UDS mass fraction
  #1
New Member
 
MCKoz
Join Date: Apr 2018
Posts: 9
Rep Power: 8
dinknflicka is on a distinguished road
Hi all,

I am attempting to write a UDF to describe the decrease in a species mass fraction value and am needing a bit of guidance. The mass fraction will be described by first order kinetics, where I have experimentally determined a k constant. I understand that i basically need to use the DEFINE_SOURCE macro to create a 'sink'. I have written some code, but am getting an error that says not enough parameters for macro DEFINE_SOURCE. Here is my code so far...

#include "udf.h"

DEFINE_SOURCE(cell_death,c,t,i)
{
real source;
real k;
k=0.0000108840

source=-k*C_UDSI(c,t,0);

return source;
}

so I basically want to describe the rate of decrease is the species as
dN/dt= -0.0000108840 * (local concentration). I have a UDS set up with an inlet mass fraction and have the index set correctly, I'm just needing some guidance on what I'm missing to make this UDF work and describe the species mass fraction properly.

I would greatly appreciate any help that you all can offer.

Best
dinknflicka is offline   Reply With Quote

Old   January 15, 2019, 21:17
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
From ansys fluent customization manual
macro looks like
Code:
DEFINE_SOURCE (name, c, t, dS, eqn)
example
Code:
/*******************************************************************/
UDF for specifying an x-momentum source term in a spatially
dependent porous media
*******************************************************************/
#include "udf.h"
#define C2 100.0
DEFINE_SOURCE(xmom_source,c,t,dS,eqn)
{
real x[ND_ND];
real con, source;
C_CENTROID(x,c,t);
con = C2*0.5*C_R(c,t)*x[1];
source = -con*fabs(C_U(c, t))*C_U(c,t);
dS[eqn] = -2.*con*fabs(C_U(c,t));
return source;
}
best regards
AlexanderZ is offline   Reply With Quote

Reply

Tags
fluent - udf

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simulation with UDF for species mass fraction and velocity profile virgy Fluent UDF and Scheme Programming 8 February 7, 2012 05:30
setting mass fraction...pliz help vickrenz FLUENT 0 August 27, 2009 02:18
PB: Saving mass fraction of species on two points with an udf biget.a FLUENT 2 July 23, 2009 04:06
Warning 097- AB Siemens 6 November 15, 2004 05:41
UDF for Species mass fraction Rahul FLUENT 0 September 20, 2002 05:22


All times are GMT -4. The time now is 04:26.