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

UDF function diverging

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 22, 2009, 09:23
Default UDF function diverging
  #1
Member
 
Akour
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.

3. MOMENTUM SOURCES


#include "udf.h"

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

DEFINE_SOURCE(ymom_source,c,t,dS,eqn)
{
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
AK
ak6g08 is offline   Reply With Quote

Old   December 23, 2013, 06:05
Default
  #2
Member
 
xingangzheng
Join Date: Jul 2009
Posts: 40
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

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


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