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

Why this udf is not working????

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 27, 2011, 01:38
Default Why this udf is not working????
  #1
New Member
 
deepak
Join Date: Sep 2011
Location: india
Posts: 8
Rep Power: 5
dkb_bg is on a distinguished road
Hi all,
Plz help me
I have written this udf for density a function of pressure.i am woking on narrow diameter pipe and woking fluid is r134a single phase. since pressure is changing across the pipe so i want to change density with press. but fluent is showing follwing error
I am taking press inlet and press outlet



*UDF for liquid density*/
#include"udf.h"

DEFINE_PROPERTY(fluid_density,cell,thread)
{
real density;
real pressure = C_P(cell,thread);
density =1e-10*pressure*pressure-0.000*pressure+1385;
return density;
}



Error:
FLUENT 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.
dkb_bg is offline   Reply With Quote

Old   December 27, 2011, 10:52
Default
  #2
Senior Member
 
duri
Join Date: May 2010
Posts: 130
Rep Power: 7
duri is on a distinguished road
The is no error in you UDF I checked it with fluent 6.3 as interpreted UDF in 64bit machine. Something else is causing the trouble.
why are you using 0.0*pressure it makes nosense, it could add some machine error (values like 1e-45) and this could cause problem in 32bit machine.
duri is offline   Reply With Quote

Old   December 29, 2011, 19:28
Default
  #3
Senior Member
 
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 180
Rep Power: 7
ComputerGuy is on a distinguished road
Deepak,

While you can define whatever density you want, C_P(cell,thread) won't return the absolute pressure, which I think you're looking for. Consequently, I think you're getting a density approaching zero, which is probably throwing the error. Additionally, the second term in your formula (0.000*pressure+1385) will *never* be anything but zero, given that you're multiplying by zero.

Verify that you're using the proper calculation for density (more specifically, for pressure), and then let us know.

Best,
ComputerGuy
ComputerGuy is offline   Reply With Quote

Reply

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
Simulation with UDF for species mass fraction and velocity profile virgy Fluent UDF and Scheme Programming 8 February 7, 2012 05:30
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
compiling my UDF Seyed Farid Hosseinizadeh FLUENT 22 February 14, 2006 11:19
DEFINE_ON_DEMAND UDF: How to declare A[ND_ND], etc jx FLUENT 1 November 6, 2003 18:23


All times are GMT -4. The time now is 09:35.