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

What's wrong with my UDF?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 22, 2001, 12:36
Default What's wrong with my UDF?
  #1
olivia
Guest
 
Posts: n/a
Hi everybody:

This article is a little too long. I would like to thank you first if you are so insterested to go throuth it.

I want to solve heat and moisture transfer analysis.
This problem is the heat tranfer in conjunction with moisture transfer. This is a 3-D problem. The solution domain is cube of dense bale.
The governing equation is following for 1-D:

dM / dt = Dm * d^2 m / dx^2
dT / dt = alpha * d^2 T / dx^2 + 1 / Cp * dM / dt * Lg

M : is the moisture
t : time
Dm : moisture diffusivity
T : temperature
alpha = thermal diffusivity
Cp : specific heat at constant pressure
Lg = L * (1 + 8.31 * exp(-0.436 * m)
L = 2440

The boundary conditions are
at surface
M = (Mi - Me)* exp(-Km * t) + Me
Km : moisture sorption rate, Km = 1.83e-4

T = 45 deg C

The initial condition
T = 18 deg C
M = 0.85 both T and M is uniform.

I want to solve this problem with Fluent v.5.5. I add an user-scalar transport equation to solve the moisture. Then determine the time derivative of moisture and substitute it into the energy equation as the source term. I employed the UDF function to do my
job. However I encountered some problem. The compilation of UDF is ok, but something is wrong in excution. The error message is as follow :

Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
:
:
Error Object: ()

I woundered that there is some bugs in my UDF codes.
Maybe it is due to wrong type of passed argument or incorrect usages of some subroutine. I hope that somebody help me to debug my codes. My code is as follow :

#include "udf.h"
#define rho 1000
#define l 2440.0
#define mi 100.0
#define me 50.0
#define km 1.83e-4
#define el 1.0
DEFINE_UDS_UNSTEADY(uds_unsteady, cell, thread, i, apu, su)

{
float time_step, vol, phi_old, phi_curr;

time_step= RP_Get_Real("physical-time-step");

vol = C_VOLUME(cell,thread);

phi_old = C_STORAGE_R(cell,thread,SV_UDSI_M1(i));

phi_curr = C_UDSI(cell,thread,i);

*apu = -rho*vol*phi_curr/time_step; /*central coefficient part*/

*su = rho*vol*phi_old/time_step; /*source term part*/

}

DEFINE_SOURCE(usr_ensource, cell, thread, ds, eqn)
{
real source;

float lg,A,phi_curr,phi_old,time_diff,vol,time_step;

time_step= RP_Get_Real("physical-time-step");

vol = C_VOLUME(cell,thread);

phi_old = C_STORAGE_R(cell,thread,SV_UDSI_M1(0));

phi_curr = C_UDSI(cell,thread,0);

time_diff = (phi_curr - phi_old) / time_step;

/* uscl = C_UDSI(cell,thread,0); */

lg = el * ( 1.0 + 8.31 * exp(-1.0 * 0.436 * phi_curr) );

A=1.0/0.5*lg;

source = A * time_diff * vol * rho;

ds[eqn] = 0.0;

return source;
}

DEFINE_PROFILE(usr_bndry, thread, position)
{
face_t f;

begin_f_loop(f,thread);
{
real flow_time = RP_Get_Real("flow-time");
F_PROFILE(f,thread,position) = (mi - me) * exp( - 1.0 * km * flow_time) + me;
}
end_f_loop(f,thread);
}



Thanks again
  Reply With Quote

Old   June 23, 2001, 18:06
Default Re: What's wrong with my UDF?
  #2
John C. Chien
Guest
 
Posts: n/a
(1). Why not try to write a finite-difference code for this set of parabolic differential equations. (2). Most numerical method books should give you some schemes to start with. (a good reference book is: Applied Numerical Methods by Carnaham,Luther, Wilkes)
  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
parse error while interpreting udf Kristin Fluent UDF and Scheme Programming 3 March 15, 2012 07:43
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
I need UDF help. S.Whitney FLUENT 0 October 15, 2007 12:29
what's wrong with the UDF major FLUENT 6 March 3, 2005 07:39
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03


All times are GMT -4. The time now is 05:29.