CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF function diverging

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

LinkBack Thread Tools Search this Thread Display Modes
Old   June 22, 2009, 08:23
Default UDF function diverging
Join Date: May 2009
Posts: 79
Rep Power: 17
ak6g08 is on a distinguished road
hello all,

I am trying to implement a source term on the x and y momentum equations that equals Q (space charge) x E_i (electric field)

so I have defined two User defined scalars, one for the space charge which is composed of a unsteady function, a diffusivity function and a scalar flux function. All of which I effectively took out of the udf manual so i know there are no mistakes there. The electric field UDS only has a diffusion term (diffusion of the voltage), and a source term which equals Q/epsilon...and I have tested it on its own and it works so no mistakes there. However, Every time I run these two UDSs with the momentum field on (which I need to calculate the scalar flux term in the UDS) the mass conservation residuals diverge, and so I then get a floating point error.

I think the problem is with the gradient of the scalar term, i.e. the source term for x-momentum = -C_R(c,t)*C_UDSI_G(c,t,0)[0]*C_UDSI_G(c,t,1). There is no C_UDSI_RG macro as far as I am aware... please note that the field=-(gradient of the voltage). which is why I need to calculate a gradient of a user defined scalar...

If anyone knows if there is a better way I can implement the user defined gradient macros I would really appreciate it...

Im attaching the momentum source UDFs which I believe are the problem.


#include "udf.h"

real source;
source = -C_R(c,t)*C_UDSI(c,t,1)*C_UDSI_G(c,t,0)[0];
dS[eqn] = 0;
return source;

real source;
source = -C_R(c,t)*C_UDSI(c,t,1)*C_UDSI_G(c,t,0)[1];
dS[eqn] = 0;
return source;

Thanks in advance
ak6g08 is offline   Reply With Quote

Old   December 23, 2013, 05:05
Join Date: Jul 2009
Posts: 39
Rep Power: 17
ustbdynamic is on a distinguished road
Dear ak,
Do you have solved this question. I have meet the same problem as you have meet.
The gradient of the scalar term! How good method you have to treat it?

thank you very much!
ustbdynamic is offline   Reply With Quote


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
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 00:35
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 14:00

All times are GMT -4. The time now is 15:54.