|
[Sponsors] |
August 4, 2009, 10:01 |
Udf for pumped outlet - help please
|
#1 |
New Member
Adam R
Join Date: Jul 2009
Posts: 7
Rep Power: 17 |
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) } |
|
August 4, 2009, 15:51 |
|
#2 |
Member
Allan Walsh
Join Date: Mar 2009
Posts: 56
Rep Power: 17 |
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. |
|
August 5, 2009, 00:07 |
|
#3 |
Senior Member
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18 |
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 |
|
August 5, 2009, 09:35 |
|
#4 |
New Member
Adam R
Join Date: Jul 2009
Posts: 7
Rep Power: 17 |
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 |
|
August 5, 2009, 10:29 |
|
#5 |
Senior Member
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18 |
The loop calculates volume flow rate if the face is normal to y velocity.
|
|
|
|
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 17:50 |
UDF for species-mass-fraction gradient at outlet | sisir | FLUENT | 0 | June 9, 2007 03: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 18:55 |
UDF in Fluent to Match Mass Flow at Pressure Outlet | Jonas Larsson | Main CFD Forum | 1 | April 29, 1999 11:44 |