# Define_source for UDS equation- source term

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

 May 19, 2011, 07:14 Define_source for UDS equation- source term #1 Member   john Join Date: Nov 2010 Posts: 50 Rep Power: 8 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; }

 May 19, 2011, 08:32 #2 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 739 Blog Entries: 1 Rep Power: 16 Hi, to use gradient commands, you have to force FLUENT to preserve gradient data. solve->set->expert-> ..... (refer to UDF manual)

 May 19, 2011, 22:38 #3 Member   john Join Date: Nov 2010 Posts: 50 Rep Power: 8 Hi, I am already saving the gradient data in user memory using C_UDMI. But still it has problem

 May 20, 2011, 01:50 #4 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 739 Blog Entries: 1 Rep Power: 16 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.

 May 23, 2011, 05:08 #5 Member   john Join Date: Nov 2010 Posts: 50 Rep Power: 8 The UDF is working as it is when i hook the source term after one iteration.

 June 22, 2011, 07:32 #6 Member   john Join Date: Nov 2010 Posts: 50 Rep Power: 8 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

 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 alessio.nz OpenFOAM Programming & Development 9 January 31, 2011 08:56 ak6g08 Fluent UDF and Scheme Programming 0 July 9, 2009 06:37 dak81 OpenFOAM Running, Solving & CFD 0 March 12, 2008 09:41 Mehdi BEN HAJ Phoenics 0 January 31, 2007 17:30 Greg Perkins FLUENT 0 October 11, 2000 03:43

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