CFD Online Logo CFD Online URL
Home > Forums > FLUENT

Initialization error

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

LinkBack Thread Tools Display Modes
Old   December 3, 2012, 15:46
Default Initialization error
New Member
Join Date: Oct 2012
Posts: 8
Rep Power: 5
CMA is on a distinguished road
Hi all, I am trying to write a UDF for my inlet boundary condition. I want the temperature of this inlet face to be updated at every time step to a new value that is calculated based on a formula that includes the temperature of my outflow boundary. That means, I set an inlet tube fluid temperature, and then after a few iterations (up to 60s) the temperature of my outflow boundary at the outlet of my tube is taken (in this case 283 K because I am setting everything around my tube and my inlet to be at 283 C for the first 60 s) and my new inlet temperature is calculated. With this new inlet temperature, a new outlet temperature is produced and then my UDF calculates a new inlet again and so on.
When I interpret my UDF everything works fine with no error. But as soon as I choose a boundary or all zones in the drop down list in the initialization window, I get an ACCESS VIOLATION error.

Here is my UDF:

#include "udf.h"

DEFINE_PROFILE(Inlettemp, thread, i)
real t=RP_Get_Real("flow-time");
face_t f;
face_t face;
int ID = 4;
/* Zone ID for Outflow zone from Boundary Conditions panel */
Domain *domain; /* domain is declared as a variable */
Thread *outlet_thread = Lookup_Thread(domain, ID);
real tempa=0.0;
real totalarea=0.0;
real avetempa=0.0;
real A[ND_ND];

if(t<=60){F_PROFILE(face, thread, i)=283.0;}

else if(t>60)
/* Loop over faces in a face thread to get the information stored on faces and calculate the area average temperature on Outlet. */
/* F_T gets face temperature. += causes all face temperatures to be added together. */

totalarea += F_AREA(A,f,outlet_thread);
tempa += F_AREA(A,f,outlet_thread)*F_T(f,outlet_thread);

avetempa = tempa/totalarea;

begin_f_loop(face, thread)
F_PROFILE(face, thread, i) = avetempa + 30*200/(0.561*4182);
end_f_loop(face, thread)
CMA is offline   Reply With Quote


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
Native ParaView Reader Bugs tj22 OpenFOAM Paraview & paraFoam 268 November 12, 2015 15:21
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) Yogini Fluent UDF and Scheme Programming 7 October 3, 2012 07:24
checking the system setup and Qt version vivek070176 OpenFOAM Installation 22 June 1, 2010 12:34
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50
user defined function cfduser CFX 0 April 29, 2006 10:58

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