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

Udf for pumped outlet - help please

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 4, 2009, 09:01
Default Udf for pumped outlet - help please
  #1
New Member
 
Adam R
Join Date: Jul 2009
Posts: 7
Rep Power: 7
Adammada is on a distinguished road
I am trying to make a pump to represent a constant volume pump (using a pressure outlet and varying preassure at outlet with read volume flow rate at the face to a chive a pre determined value). I have come up with the following UDF which causes this error when I initilize

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.
Error Object: ()

Udf:
#include "udf.h"
#include "mem.h"
DEFINE_PROFILE(pumpt,thread,position)
{
face_t f;

Thread *t;

real NV_VEC(a);

real area = 0.000506;

real vdotreq = 0.1;

real po = 101325;

real vtemp = 0;

real uf = 1000;

begin_f_loop(f, thread)
{
F_AREA(a,f,t);
vtemp = (F_V(f,t)*NV_MAG(a)) + vtemp;

}
end_f_loop(f, thread)

begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = po * 1 - ((vdotreq-vtemp)*uf);
}
end_f_loop(f, thread)
}

I have a feeling it is related to the vtemp = (F_V(f,t) as it does not have the error when it is removed. Thanks in advance for the help. A second version is below without the first loop.

Adam


or

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

Thread *t;

real area = 0.000506;

real vreq = 0.1;

real vdotreq = vreq * area;

real po = 101325;

real uf = 1000;

real vt = F_V(f,t);

real vdot = vt * area;

begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = po * 1 - ((vdotreq-vdot)*uf);
}
end_f_loop(f, thread)
}
Adammada is offline   Reply With Quote

Old   August 4, 2009, 14:51
Default
  #2
Member
 
Allan Walsh
Join Date: Mar 2009
Posts: 55
Rep Power: 8
Allan Walsh is on a distinguished road
Usually an access_violation is caused when you try and access a variable that you don't have access to (due to an error in your code).
Why don't you just use the fan (pump) boundary condition and avoid the problems that go along with UDFs.
Allan Walsh is offline   Reply With Quote

Old   August 4, 2009, 23:07
Default
  #3
Member
 
Micael Boulet
Join Date: Mar 2009
Location: Quebec, Canada
Posts: 95
Rep Power: 9
Micael is on a distinguished road
This loop has a bug:

begin_f_loop(f, thread)
{
F_AREA(a,f,t);
vtemp = (F_V(f,t)*NV_MAG(a)) + vtemp;
}
end_f_loop(f, thread)

You loop on "thread", but then put "t" as argument. What do you expect "t" to be? Another thread zone? Anyway, this argument should be consistent, use one or the other.

What this loop intends to do?

Have a good day.

MicaŽl
Micael is offline   Reply With Quote

Old   August 5, 2009, 08:35
Default
  #4
New Member
 
Adam R
Join Date: Jul 2009
Posts: 7
Rep Power: 7
Adammada is on a distinguished road
Thanks Micael it now initializes. This loop is meant to add up the area x y velocity of every thread in the face - to give a total volume flow rate for the face - will it do that?
Allan - the fan boundary allows a constant pressure or pressure drop I can't see how to get it to provide a constant volume in a multi phase situation. It may be the case that a constant negative pressure provides a constant volume but I don't want to find the pressure manually for each case hence the udf.

Adam
Adammada is offline   Reply With Quote

Old   August 5, 2009, 09:29
Default
  #5
Member
 
Micael Boulet
Join Date: Mar 2009
Location: Quebec, Canada
Posts: 95
Rep Power: 9
Micael is on a distinguished road
The loop calculates volume flow rate if the face is normal to y velocity.
Micael 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
UDF Defining VOF Free Surface at Outlet Alex Fluent UDF and Scheme Programming 13 August 8, 2012 16:50
UDF for species-mass-fraction gradient at outlet sisir FLUENT 0 June 9, 2007 02:40
VOF Outlet boundary condition in cfd - ace JM Main CFD Forum 0 December 15, 2006 09:07
UDF Hydrostatic Pressure Outlet Bridget FLUENT 0 May 16, 2006 17:55
UDF in Fluent to Match Mass Flow at Pressure Outlet Jonas Larsson Main CFD Forum 1 April 29, 1999 10:44


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