CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Error in compiling a Volume Reaction Rate UDF (https://www.cfd-online.com/Forums/fluent-udf/204985-error-compiling-volume-reaction-rate-udf.html)

henriqcoutinho August 6, 2018 20:04

Error in compiling a Volume Reaction Rate UDF
 
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;
}
}

pakk August 7, 2018 02:45

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...

henriqcoutinho August 7, 2018 07:00

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...

pakk August 7, 2018 07:56

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?

henriqcoutinho August 7, 2018 12:57

I tried with another UDF but the same happened again. What is the Fluent and Visual Studio version that you use?


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