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

problematic source term in UDS

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 25, 2009, 11:42
Default problematic source term in UDS
  #1
Member
 
Akour
Join Date: May 2009
Posts: 79
Rep Power: 8
ak6g08 is on a distinguished road
Hello everyone,

I have posted a similar question as this previously, but no one has gotten back, so Ill be more detailed, could somebody please provide some assistance...

I have 2 PDEs which I am trying to solve using UDSs

PDE of scalar 1 (V) : 0=electric_diff*d/dx_i(dV/dx_i)+(density*Q)/e

PDE of scalar 2 (Q) : 0=spcharge_diff*d/dx_i(dQ/dx_i)+(density^2*Q^2*K)/e+density*k*(dV/Dx_i)*(dQ/DX_i)

I am having a very big problem with the term in bold, which I have implemented as a source term..defined in my UDF shown below as

DEFINE_SOURCE(spcharge_lin,c,t,dS,eqn):

The problem is that when I turn this term on, the solution diverges in very few iterations, it doesnt seem possible to get convergence even with tiny relaxation factors (.0001)...does someone have an idea as to why this may be happening?

The UDF is shown below:


#include "udf.h"
#include "sg.h"

static real kappa = .00000003;
static real epsilon = .00000000000855;


/*source of scalar 1 (V)*/
DEFINE_SOURCE(electric_source,c,t,dS,eqn)
{
dS[eqn] = 0;
return (C_R(c,t)*C_UDSI(c,t,1)/epsilon);
}

/*diffusivity of scalar 1*/
DEFINE_DIFFUSIVITY(electric_diff, c, t, i)
{
return 3.54;
}

/*problematic source of scalar 2 (Q)*/
DEFINE_SOURCE(spcharge_lin,c,t,dS,eqn)
{

real source,source_a,source_b;

source_a = C_R(c,t)*kappa*C_UDSI_G(c,t,0)[0]*C_UDSI_G(c,t,1)[0];

source_b = C_R(c,t)*kappa*C_UDSI_G(c,t,0)[1]*C_UDSI_G(c,t,1)[1];

source=source_a+source_b;

dS[eqn] = 0;

return source;

}

/*OK source of scalar 2*/
DEFINE_SOURCE(spcharge_quad,c,t,dS,eqn)
{
real source;
source = -(pow(C_R(c,t),2)*pow(C_UDSI(c,t,1),2)*kappa)/epsilon;
dS[eqn] = -(2*pow(C_R(c,t),2)*C_UDSI(c,t,1)*kappa)/epsilon;
return source;
}

/*diffusivity of scalar 2*/
DEFINE_DIFFUSIVITY(spcharge_diff, c, t, i)
{
return kappa / 40;
}
ak6g08 is offline   Reply With Quote

Old   July 10, 2009, 11:38
Default
  #2
New Member
 
Join Date: Jul 2009
Posts: 7
Rep Power: 8
_Greg_ is on a distinguished road
Hi,

dS[eqn] = 0 means that FLUENT treats your source term explicitly and it could cause divergence problems.

If you specify the derivative of your source term, FLUENT may treat your source term with an explicit and implicit part and this could help convergence.

good luck,
_Greg_ is offline   Reply With Quote

Old   July 12, 2009, 15:57
Default
  #3
Member
 
Akour
Join Date: May 2009
Posts: 79
Rep Power: 8
ak6g08 is on a distinguished road
hi,

thanks for your reply greg...however I am solving for scalar Q, and my source term has a dQ/dX term so i dont think I can specify the derivative of that (with respect to Q)...so I am not sure what the problem is...
__________________
akour
ak6g08 is offline   Reply With Quote

Old   July 15, 2009, 09:30
Default UDF with C_H_G "access violation"
  #4
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 8
louiza is on a distinguished road
Hello,

I am solving the energy equation with the enthalpy formulation. I would like to add a source term via UDF that includes the gradient of enthalpy but I get an Access Violation error when I try to use the C_H_G(c,t) macro. "access violation"

I was able to work around the problem by storing enthalpy in a UDS and then calculating the gradient using a C_UDSI_G macro. but a have also message error in compilation.
physics formule is: (dh/dx+dh/dr); deriverd enthalpy axial+ derived enthalpy radial.

please help me

Thank you!
louiza is offline   Reply With Quote

Old   December 25, 2013, 00:36
Default
  #5
New Member
 
xingangzheng
Join Date: Jul 2009
Posts: 11
Rep Power: 8
ustbdynamic is on a distinguished road
Dear ak6g08,
Have you solved your problems?
I have read the similar simulation published in Fuel Processing Technology titled Particulate removal via electrostatic precipitators-CFD simulation.
And write a letter to find some consulatings, but no reply.
I wonder wether they have treat the gradients very well in their simulation...



Quote:
Originally Posted by ak6g08 View Post
Hello everyone,

I have posted a similar question as this previously, but no one has gotten back, so Ill be more detailed, could somebody please provide some assistance...

I have 2 PDEs which I am trying to solve using UDSs

PDE of scalar 1 (V) : 0=electric_diff*d/dx_i(dV/dx_i)+(density*Q)/e

PDE of scalar 2 (Q) : 0=spcharge_diff*d/dx_i(dQ/dx_i)+(density^2*Q^2*K)/e+density*k*(dV/Dx_i)*(dQ/DX_i)

I am having a very big problem with the term in bold, which I have implemented as a source term..defined in my UDF shown below as

DEFINE_SOURCE(spcharge_lin,c,t,dS,eqn):

The problem is that when I turn this term on, the solution diverges in very few iterations, it doesnt seem possible to get convergence even with tiny relaxation factors (.0001)...does someone have an idea as to why this may be happening?

The UDF is shown below:


#include "udf.h"
#include "sg.h"

static real kappa = .00000003;
static real epsilon = .00000000000855;


/*source of scalar 1 (V)*/
DEFINE_SOURCE(electric_source,c,t,dS,eqn)
{
dS[eqn] = 0;
return (C_R(c,t)*C_UDSI(c,t,1)/epsilon);
}

/*diffusivity of scalar 1*/
DEFINE_DIFFUSIVITY(electric_diff, c, t, i)
{
return 3.54;
}

/*problematic source of scalar 2 (Q)*/
DEFINE_SOURCE(spcharge_lin,c,t,dS,eqn)
{

real source,source_a,source_b;

source_a = C_R(c,t)*kappa*C_UDSI_G(c,t,0)[0]*C_UDSI_G(c,t,1)[0];

source_b = C_R(c,t)*kappa*C_UDSI_G(c,t,0)[1]*C_UDSI_G(c,t,1)[1];

source=source_a+source_b;

dS[eqn] = 0;

return source;

}

/*OK source of scalar 2*/
DEFINE_SOURCE(spcharge_quad,c,t,dS,eqn)
{
real source;
source = -(pow(C_R(c,t),2)*pow(C_UDSI(c,t,1),2)*kappa)/epsilon;
dS[eqn] = -(2*pow(C_R(c,t),2)*C_UDSI(c,t,1)*kappa)/epsilon;
return source;
}

/*diffusivity of scalar 2*/
DEFINE_DIFFUSIVITY(spcharge_diff, c, t, i)
{
return kappa / 40;
}
ustbdynamic is offline   Reply With Quote

Old   January 4, 2014, 22:38
Default
  #6
New Member
 
CAO Liushuai
Join Date: Apr 2012
Posts: 26
Rep Power: 5
shuai_manlou is on a distinguished road
Quote:
Originally Posted by _Greg_ View Post
Hi,

dS[eqn] = 0 means that FLUENT treats your source term explicitly and it could cause divergence problems.

If you specify the derivative of your source term, FLUENT may treat your source term with an explicit and implicit part and this could help convergence.

good luck,

The gradients should be treated well to help the convergence, I think it is better to be a negetive expression.
shuai_manlou is offline   Reply With Quote

Old   February 10, 2015, 01:19
Default
  #7
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 133
Rep Power: 8
mvee is on a distinguished road
Hi Shuai

I am also facing same problem.
I am not solving UDS but using it to store the value which is solution variable depedent. This is done to have gradient of UDS (C_UDSI_G) in source term. I felt this is not the correct way to achieve it. And in this case linearization is not requried because gradient itselt suggest to be linearlized the function.

Can you suggest better way to calculate gradient of UDS which I am not solving?

ak6g08, you can also share your experience.

Thank you
mvee is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
UDF Scalar Code: HT 1 Greg Perkins FLUENT 8 October 20, 2000 12:40
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 13, 2000 23:03
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 22:22.