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

Define_source for UDS equation- source term

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2011, 07:14
Red face Define_source for UDS equation- source term
  #1
Member
 
john
Join Date: Nov 2010
Posts: 50
Rep Power: 15
johnwinter is on a distinguished road
Hi All,

I am writing a simple udf to solve electric field. I have two UDS transport equations in the problem. when i run my udf in fluent 6.3.26 i am getting error in this particular source function. it is saying "FLOATING POINT ERROR: Invaled number".

Could anynody please tell me where i went wrong.

E_vec is defined as C_UDSI_G(c,t,0)

DEFINE_SOURCE(ion_source,c,t,dS,eqn)
{
face_t f;
Thread *tf;
int n;
double NV_VEC(E_vec), NV_VEC(A);
double source;
source=0.0;
c_face_loop(c,t,n)
{
f=C_FACE(c,t,n);
tf=C_FACE_THREAD(c,t,n);
F_AREA(A,f,tf);
NV_D(E_vec,=, E_X(c,t), E_Y(c,t), E_Z(c,t));
if(THREAD_TYPE(tf)==THREAD_F_WALL)
{
source=NV_DOT(E_vec,A)*ionmob/NV_MAG(A);
}
}
if( C_UDSI(c,t,0) <0) source=0.0;
else source -= source;
dS[eqn]=source;
source*=C_UDSI(c,t,0);
return source;
}
johnwinter is offline   Reply With Quote

Old   May 19, 2011, 08:32
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
Hi,
to use gradient commands, you have to force FLUENT to preserve gradient data.
solve->set->expert-> ..... (refer to UDF manual)
Amir is offline   Reply With Quote

Old   May 19, 2011, 22:38
Default
  #3
Member
 
john
Join Date: Nov 2010
Posts: 50
Rep Power: 15
johnwinter is on a distinguished road
Hi,

I am already saving the gradient data in user memory using C_UDMI. But still it has problem
johnwinter is offline   Reply With Quote

Old   May 20, 2011, 01:50
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
from UDF manual:
you can prevent the solver from freeing up memory by issuing the text command solve/set/expert and then answering yes to the question Keep temporary solver memory from being freed?. Note that when you do this, all of the gradient data is retained, but the calculation requires more memory to run.
Amir is offline   Reply With Quote

Old   May 23, 2011, 05:08
Default
  #5
Member
 
john
Join Date: Nov 2010
Posts: 50
Rep Power: 15
johnwinter is on a distinguished road
The UDF is working as it is when i hook the source term after one iteration.
johnwinter is offline   Reply With Quote

Old   June 22, 2011, 07:32
Default
  #6
Member
 
john
Join Date: Nov 2010
Posts: 50
Rep Power: 15
johnwinter is on a distinguished road
Hi All,

When i run the simulation with UDS for nagative ions, i am getting negative values in the contour plots. I checked source and flux term for each cell they are all positive values. How come i am getting negative values in the domain?

I guess i am getting nagative values at the nodes?. how to recify it.

Please help

John
johnwinter 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
Source Term on Scalar Transport Equation alessio.nz OpenFOAM Programming & Development 9 January 31, 2011 07:56
gradient source term UDF ak6g08 Fluent UDF and Scheme Programming 0 July 9, 2009 06:37
Stokes equation with source term dak81 OpenFOAM Running, Solving & CFD 0 March 12, 2008 08:41
Source term in the mass balance equation Mehdi BEN HAJ Phoenics 0 January 31, 2007 16:30
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 11, 2000 03:43


All times are GMT -4. The time now is 16:51.