CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF : Chemical Reaction in Catalytic Converter (https://www.cfd-online.com/Forums/fluent/28365-udf-chemical-reaction-catalytic-converter.html)

adhimac March 27, 2001 13:21

UDF : Chemical Reaction in Catalytic Converter
 
dear all,

I'm Adhi, student of Chemical Engineering University of Indonesia in 4th year. Now, I'm learning Fluent in my campuss. I'm trying to solve automotive catalytic converter channel model with chemical reaction in surface. I have made the cas file in order to solve by fluent/UNS solver and I also use User Define Function (UDF) to describe the surface reacion due to the limitation of UNS that cannot support my reaction.

Unfortunatelly, my UDF (written in C language) can not be run correctly by UNS Solver. It's only can read my UDF. I wondering if you may help me to correct my UDF if it's contain error. anybody can help me .... ??? ( I hope one of you have used UDF before....) The error messages are :

------- iter continuity x-velocity y-velocity z-velocity energy co co2 o2 h2 h2o no c3h6 time/iter Error: chip-exec: function "fraksi_gas_co" not found.

Error: Fluent/UNS received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: () ------

One more question, can UDF use function which is contain matrix 2 dimension ? I've tried and fail, UNS can not passing this function correctly. Is there another way .... ?

thank's

regads,

adhimac

adhimac March 27, 2001 15:04

Re: UDF : Chemical Reaction in Catalytic Converter
 
Sorry I Forgot to insert listing of my UDF, I need some advice of my program. Thank's

#include "udf.h"

void awal_X(double *X) {

*X = 1.0;

*(X + 1) = 1.0;

*(X + 2) = 1.0;

*(X + 3) = 1.0;

*(X + 4) = 1.0;

*(X + 5) = 1.0;

*(X + 6) = 1.0; }

void harga_X(double *X) {

awal_X(X);

//process start here }

double fraksi_gas(Cell *cell, int species_index, int implicit) {

#define b0 1.0 #define b1 1.0 #define b2 1.0 #define b3 1.0 #define b4 1.0 #define b5 1.0 #define b6 1.0 #define axav 1.0

double fraksi, laju, X[7]; float dens;

if (implicit)

{

fraksi = 0.0;

} else

{

harga_X(X);

dens = cell_density(cell);

if (species_index == 0) {

laju = 1.0;

fraksi = X[0] + 28.01 * laju /(dens*b0)*axav;

}

else if (species_index == 1){

laju = 1.0;

fraksi = X[1] + 44.01 * laju /(dens*b1)*axav;

}

else if (species_index == 2) {

laju = 1.0;

fraksi = X[2] + 32.0 * laju /(dens*b2)*axav;

}

else if (species_index == 3) {

laju = 1.0;

fraksi = X[3] + 2.0158 * laju /(dens*b3)*axav;

}

else if (species_index == 4) {

laju = 1.0;

fraksi = X[4] + 18.015 * laju /(dens*b4)*axav;

}

else if (species_index == 5) {

laju = 1.0;

fraksi = X[5] + 30.006 * laju /(dens*b5)*axav;

}

else if (species_index == 6) {

laju = 1.0;

fraksi = X[6] + 42.081 * laju /(dens*b6)*axav;

}

} return fraksi; }

double fraksi_gas_CO(Cell *cell, int species_index, int implicit) { return fraksi_gas(cell, 0, implicit); }

double fraksi_gas_CO2(Cell *cell, int species_index, int implicit) { return fraksi_gas(cell, 1, implicit); }

double fraksi_gas_O2(Cell *cell, int species_index, int implicit) { return fraksi_gas(cell, 2, implicit); }

double fraksi_gas_H2(Cell *cell, int species_index, int implicit) { return fraksi_gas(cell, 3, implicit); }

double fraksi_gas_H2O(Cell *cell, int species_index, int implicit) { return fraksi_gas(cell, 4, implicit); }

double fraksi_gas_NO(Cell *cell, int species_index, int implicit) { return fraksi_gas(cell, 5, implicit); }

double fraksi_gas_C3H6(Cell *cell, int species_index, int implicit) { return fraksi_gas(cell, 6, implicit); }



All times are GMT -4. The time now is 04:59.