# problematic source term in UDS

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

 June 25, 2009, 11:42 problematic source term in UDS #1 Member   Akour Join Date: May 2009 Posts: 79 Rep Power: 9 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; }

 July 10, 2009, 11:38 #2 New Member   Join Date: Jul 2009 Posts: 7 Rep Power: 9 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,

 July 12, 2009, 15:57 #3 Member   Akour Join Date: May 2009 Posts: 79 Rep Power: 9 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

 July 15, 2009, 09:30 UDF with C_H_G "access violation" #4 New Member   hameurlaine Join Date: Jul 2009 Posts: 27 Rep Power: 9 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!

December 25, 2013, 00:36
#5
New Member

xingangzheng
Join Date: Jul 2009
Posts: 11
Rep Power: 9
Dear ak6g08,
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 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; }

January 4, 2014, 22:38
#6
New Member

CAO Liushuai
Join Date: Apr 2012
Posts: 26
Rep Power: 6
Quote:
 Originally Posted by _Greg_ 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.

 February 10, 2015, 01:19 #7 Senior Member   Vaze Join Date: Jun 2009 Posts: 146 Rep Power: 9 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

 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 hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24 jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51 Greg Perkins FLUENT 8 October 20, 2000 12:40 Greg Perkins FLUENT 0 October 13, 2000 23:03 Greg Perkins FLUENT 0 October 11, 2000 03:43

All times are GMT -4. The time now is 14:55.