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

Error in compiling a Volume Reaction Rate UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 6, 2018, 21:04
Post Error in compiling a Volume Reaction Rate UDF
  #1
New Member
 
Henrique Coutinho
Join Date: Aug 2018
Posts: 3
Rep Power: 8
henriqcoutinho is on a distinguished road
Hi everyone,

I have tried to compile a UDF that I have written for a specific volume reaction rate for enzyme inactivation in foods.

I don't know why, but Fluent suddenly stops after I push the button "build" in the panel.

I also tried to interpret the UDF, instead of compile it, but in this case, the following message appears on the screen: "Error: ... line 17: structure reference not implemented". I can't see the error in the source file.

I would be glad if someone could give some tips to solve my problem. The UDF is presented below:

#include "udf.h"

#define DREF1 2.184e3
#define DREF2 7.353e1
#define AA 7.796e-1
#define Z1 4.63
#define Z2 1.0e2
#define TREF 3.5315e2

DEFINE_VR_RATE(user_rate, c, t, r, mole_weight, species_mf, rr)
{
real temper=C_T(c,t);
real D1 = DREF1*pow(10.0,((TREF-temper)/Z1));
real D2 = DREF2*pow(10.0,((TREF-temper)/Z2));
real s1 = species_mf[0];
real mw1 = mole_weight[0];
if(STREQ(r->name,"reaction-1")){
*rr=-AA*(2.3026/D1)*s1/mw1-(1-AA)*(2.3026/D2)*s1/mw1;
}
}
henriqcoutinho is offline   Reply With Quote

Old   August 7, 2018, 03:45
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Your line
Code:
DEFINE_VR_RATE(user_rate, c, t, r, mole_weight, species_mf, rr)
has seven arguments.
In the Fluent help:
Quote:
DEFINE_VR_RATE (name,c,t,r,mw,yi,rr,rr_t)

has eight arguments.
So you missed something in your definition of your udf...
pakk is offline   Reply With Quote

Old   August 7, 2018, 08:00
Default
  #3
New Member
 
Henrique Coutinho
Join Date: Aug 2018
Posts: 3
Rep Power: 8
henriqcoutinho is on a distinguished road
Thanks for your reply!

I think this is not the problem. The last argument in the macro is "rr_t", which is used for turbulent reaction flow, I guess! And this is not the case.

I think it has to to with "STREQ", but I have seen many examples of this, and I could not figure out what is wrong.

Now, I try to compile it, and some "nmake" error appears...
henriqcoutinho is offline   Reply With Quote

Old   August 7, 2018, 08:56
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
While it might not cause your current problem, it is wrong, and you should fix it. Just add another argument...


I tried to compile your UDF, and it worked perfectly.


Do you have this problem only with this UDF, or with all UDfs that you try to compile?
pakk is offline   Reply With Quote

Old   August 7, 2018, 13:57
Default
  #5
New Member
 
Henrique Coutinho
Join Date: Aug 2018
Posts: 3
Rep Power: 8
henriqcoutinho is on a distinguished road
I tried with another UDF but the same happened again. What is the Fluent and Visual Studio version that you use?
henriqcoutinho 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
Fluent UDF urgent! Variable reaction rate natantyt Fluent UDF and Scheme Programming 8 October 17, 2021 04:35
UDF code help solve reaction rate equation palm oil zirkov Fluent UDF and Scheme Programming 0 February 13, 2017 11:34
Error:surface reaction rate UDF in 2D porous media Ludaer Fluent UDF and Scheme Programming 2 December 15, 2016 08:49
Unit of rate in udf of a surface reaction borhan_sd@yahoo.com Fluent UDF and Scheme Programming 0 June 11, 2013 04:28
[blockMesh] non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 06:42


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