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

UDF Define_Source problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 7, 2011, 10:43
Default UDF Define_Source problem
  #1
New Member
 
Luke Holsen
Join Date: Jun 2011
Posts: 12
Rep Power: 14
lholsen08 is on a distinguished road
I have a Souce term which should be generating a constant value. However it appears that the value is only generating the value at one side of the cell zone. This is the first UDF and C++ code I have written so I probably missed something simple.

#include "udf.h"
/************************************************** ****************************************
This UDF calculates Source Terms for the Lumen, Endothelium, Vascular Wall, and Tissue Layer
************************************************** ******************************************/
/*** Species numbers ***/
#define Oxygen 0
#define NO 1
/************************************************** ****************************************
Endothelium
Source Terms: NO Generation and O2 Consumption
************************************************** ******************************************/
/*** Define Variables for Calculation ***/
#define RNOmax 0.000054 /*Maximum eNOS Production Rate (54 uM/s )->(M/s)*/
#define KmeNOS 4.7 /*Michaelis-Menten reaction kinetics term (4.7 Torr)*/
#define AlphaT .00000134 /*Solubility Coefficient (M/Torr)*/

DEFINE_SOURCE( Endothelium_NOGen, c, t, dS, eqn)
{
real con, concNO;
concNO=(((RNOmax) *C_UDSI(c,t,Oxygen))/(C_UDSI(c,t,Oxygen)+(KmeNOS)));
return concNO;
}

DEFINE_SOURCE( Endothelium_Oxygencons, c, t, dS, eqn)
{
real con, concOxy;
concOxy=((-1)*((RNOmax)*C_UDSI(c,t,Oxygen))/(C_UDSI(c,t,Oxygen)+(KmeNOS)))/AlphaT;
return concOxy;
}


Any help would be great. Thanks!
lholsen08 is offline   Reply With Quote

Old   October 7, 2011, 12:45
Default
  #2
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Dear Luke,

Probably, you've hooked this UDF to one of your zones. You have to hook it to any fluid/solid zone which you want to be included in equations there. Otherwise check validity of your UDSs, maybe there aren't defined for some zones or aren't solved there.

Bests,
__________________
Amir
Amir is offline   Reply With Quote

Old   October 7, 2011, 12:50
Default
  #3
New Member
 
Luke Holsen
Join Date: Jun 2011
Posts: 12
Rep Power: 14
lholsen08 is on a distinguished road
I guess it is linked to the Cell zone but thats the only zone I want it to run in. So when I opened the Cell zone conditions that is where I applied the source term. It should be using the Concentration of the UDS defined as C_UDSI(c,t,Oxygen). Isthat not what I was supposed to do?

It appears it does not continue to run throught the cell zone just the left side.
lholsen08 is offline   Reply With Quote

Old   October 7, 2011, 13:08
Default
  #4
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by lholsen08 View Post
I guess it is linked to the Cell zone but thats the only zone I want it to run in. So when I opened the Cell zone conditions that is where I applied the source term. It should be using the Concentration of the UDS defined as C_UDSI(c,t,Oxygen). Isthat not what I was supposed to do?

It appears it does not continue to run throught the cell zone just the left side.
If you hooked it just for a specific zone, it will be added to that specific cells when solving an equation. I don't know want do you want to do exactly, but you can solve an equation in a whole domain but set some source terms in specific zones.
__________________
Amir
Amir is offline   Reply With Quote

Old   October 7, 2011, 13:15
Default
  #5
New Member
 
Luke Holsen
Join Date: Jun 2011
Posts: 12
Rep Power: 14
lholsen08 is on a distinguished road
Ok, I want that equation to be solved for every cell in that specific cell zone. I am looking at thevariable macros and maybe instead of C_UDSI for cell field it should be F_UDSI for face field?
lholsen08 is offline   Reply With Quote

Old   October 7, 2011, 13:20
Default
  #6
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by lholsen08 View Post
Ok, I want that equation to be solved for every cell in that specific cell zone. I am looking at thevariable macros and maybe instead of C_UDSI for cell field it should be F_UDSI for face field?
Ok, you want to solve that equation in a specific zone so you need source term for that specific zone and you have to be aware of boundary values of your variable near that zone which you can use fixed values in fluent or a UDF to set that in other zone.
__________________
Amir
Amir is offline   Reply With Quote

Old   October 7, 2011, 13:27
Default
  #7
New Member
 
Luke Holsen
Join Date: Jun 2011
Posts: 12
Rep Power: 14
lholsen08 is on a distinguished road
Right. I set this UDF as the Source term in the Cell Zone. I set a constant value for the C_UDSI(c,t,Oxygen). Even when I used the constant value it was giving me a declining value across the zone. the color contour plot of the UDS looks like the source term is only working on one side of the cell zone.
lholsen08 is offline   Reply With Quote

Old   October 7, 2011, 13:31
Default
  #8
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by lholsen08 View Post
Right. I set this UDF as the Source term in the Cell Zone. I set a constant value for the C_UDSI(c,t,Oxygen). Even when I used the constant value it was giving me a declining value across the zone. the color contour plot of the UDS looks like the source term is only working on one side of the cell zone.
Dear Luke,

It seems that I couldn't clear my idea. You've hooked it just for one side where you want to solve your UDS, so why do you anticipate both side source?
__________________
Amir
Amir 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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 06:05
what's the problem with my udf zzyan FLUENT 0 November 4, 2010 03:56
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56
udf compiling problem akr FLUENT 3 August 22, 2007 07:14
UDF problem chiseung FLUENT 4 January 10, 2002 09:58


All times are GMT -4. The time now is 03:22.