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

Fluent UDF for thermal NOx

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 18, 2014, 10:32
Default Fluent UDF for thermal NOx
  #1
New Member
 
Lars Schwarzer
Join Date: Apr 2013
Posts: 8
Rep Power: 5
larsschwarzer is on a distinguished road
Hi everyone,
I have been trying to write a UDF to manipulate rate coefficients for the thermal (Zeldovich) NO-mechanism. A first test version simply uses the rate coefficients given in the Fluent Theory Guide - to make sure the UDF does what it is supposed to do. After some effort I managed to compile the UDF (big thanks to this Forum!). When I set up my case and start the calculation, Fluent goes busy for several minutes/hours, then returns with an error:

Divergence detected in AMG-Solver: pollutant-0

As I understand, this has something to do with the input parameters of the UDF, i.e. the syntax is correct, but some of the computed values are causing stability issues. I am using the same settings as I would using the built-in Fluent NOx calculation (which of course work fine).

As the error message does not really point to the problem, here are some questions:
1) Has anyone ever encountered the same problem?
2) Does the DEFINE_NOX_RATE macro require parallelization? There is no information on that in the manual.
3) I found an old post here,
http://www.cfd-online.com/Forums/fluent/44944-nox-udf.html
Some of the commands seem to be replaced in the current version of Fluent but the code can be easily adapted. I've been specifically wondering about the if-clause:

Code:
#define SMALL_N 1.e-6
...
rf = rr = 0.0;
s2 = s3 = 0.0;
s1 = kf2*MOLECON(NOx, O2);

if (s1 < SMALL_N) {
   rf = 2.*o_eq*kf1*MOLECON(NOx, N2);
   rr = 0.0;
}
else {
   s2 = 1.+ kf3*oh_eq/s1;
   s3 = s1 + kr1*MOLECON(NOx, NO)/s2;
   rf = 2.*o_eq*kf1*MOLECON(NOx, N2)*s1/s3;
   rr = 2.*o_eq*kr1*MOLECON(NOx, NO)*kr2*MOLECON(NOx, NO)/s3;
}

NOx->fwdrate += rf;
NOx->revrate += -rr;
-- does this in any way relate to stability of the solver? The formally correct rates are in the 'else' part. It looks to me as if Fluent is having trouble when dividing a small number by another small value, and that this is being addressed here. I have tried adding this to my code, but the output does not change.

Any help or thoughts on the matter would be appreciated.

Lars

p.s.:
Using Ansys Fluent 15.0 with 3d, double precision solver on parallel Windows 64-bit machine. I can make the UDF-Code available if that would help.
larsschwarzer is offline   Reply With Quote

Old   July 18, 2014, 08:39
Default ... an update
  #2
New Member
 
Lars Schwarzer
Join Date: Apr 2013
Posts: 8
Rep Power: 5
larsschwarzer is on a distinguished road
For those who happen to stumble on this post - I could meanwhile solve some of my problems:

The NOx-Macro does not require special considerations for parallelization, it works 'as is'.

I tried manipulating the value of "SMALL_N" and set it to prohibitively high values, which cancelled most NO production but led to more stability. (The error disappeared).
What was more effevtive was reducing the under-relaxation factor (finding a suitable value is rather alchemy than science to me...) for 'pollutant no' and changing the solution method from second to first order. The UDF runs now, but it's extremely slow.

Does anybody know if the built-in model works with pre-calculated values for NO production from a look-up table?

Enjoy your weekend,
Lars
larsschwarzer is offline   Reply With Quote

Reply

Tags
define_nox_rate, divergence, nox, parallel, udf

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
solving a conduction problem in FLUENT using UDF Avin2407 Fluent UDF and Scheme Programming 1 March 13, 2015 03:02
fluent udf, saving data in udf mohsen zendehbad Fluent UDF and Scheme Programming 13 March 21, 2014 16:36
Two questions on Fluent UDF Steven Fluent UDF and Scheme Programming 4 September 20, 2013 16:30
UDF for Viscoelastic Fow in Fluent skris2009 FLUENT 2 September 19, 2011 23:59
fluent UDF external library lapack problem Rick FLUENT 0 May 7, 2008 10:16


All times are GMT -4. The time now is 02:40.