# UDF Define_Source problem

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

 October 7, 2011, 10:43 UDF Define_Source problem #1 New Member   Luke Holsen Join Date: Jun 2011 Posts: 12 Rep Power: 7 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!

 October 7, 2011, 12:45 #2 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 739 Blog Entries: 1 Rep Power: 15 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

 October 7, 2011, 12:50 #3 New Member   Luke Holsen Join Date: Jun 2011 Posts: 12 Rep Power: 7 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.

October 7, 2011, 13:08
#4
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by lholsen08 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

 October 7, 2011, 13:15 #5 New Member   Luke Holsen Join Date: Jun 2011 Posts: 12 Rep Power: 7 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?

October 7, 2011, 13:20
#6
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by lholsen08 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

 October 7, 2011, 13:27 #7 New Member   Luke Holsen Join Date: Jun 2011 Posts: 12 Rep Power: 7 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.

October 7, 2011, 13:31
#8
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by lholsen08 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

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Rizwan Fluent UDF and Scheme Programming 32 May 8, 2015 06:05 zzyan FLUENT 0 November 4, 2010 04:56 july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56 akr FLUENT 3 August 22, 2007 07:14 chiseung FLUENT 4 January 10, 2002 10:58

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