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

UDF - accessing face variable problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 3, 2011, 11:32
Default UDF - accessing face variable problem
  #1
New Member
 
Ján
Join Date: Mar 2010
Location: Slovakia
Posts: 24
Rep Power: 16
argeus is on a distinguished road
Hi all,
really appreciate your help. Im trying to create a UDF for velocity inlet. UDF was interpreted without any problems. Problem is, that Im just not able to access data from appropriate boundary condition (fatal signal, access violation) which I need in my equations.
Problematic part of UDF:

DEFINE_PROFILE(velocity_inlet, thread, index)
{
real x[ND_ND];
double y;
face_t f;
Thread *tf;
ro = 1.225;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
y = x[1];

density= F_R(f,tf);

F_PROFILE(f, thread, index) = equation;
}
end_f_loop(f,thread)
}

Using Data_Valid_P() function, initialization, or if-loop function didnt help (probably my syntax was incorrect). What should I do?
argeus is offline   Reply With Quote

Old   February 6, 2011, 02:21
Default
  #2
Member
 
Byron Smith R J
Join Date: Mar 2009
Location: India
Posts: 46
Rep Power: 17
byronsmith is on a distinguished road
hai,
to access the face boundary, you need to include the thread identifier. use Lookup_thread(d,Zone_ID) where the zone ID is obtained from the boundary conditions panel. try these

DEFINE_PROFILE(velocity_inlet, thread, index)
{
real x[ND_ND];
double y;
face_t f;
int Zone_ID=--- ;
Thread *tf=Lookup_Thread(d,Zone_ID);
Thread *tf;
real ro = 1.225;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
y = x[1];

density= F_R(f,tf);

F_PROFILE(f, thread, index) = equation;
}
end_f_loop(f,thread)
}
byronsmith is offline   Reply With Quote

Old   February 9, 2011, 04:08
Smile
  #3
New Member
 
Ján
Join Date: Mar 2010
Location: Slovakia
Posts: 24
Rep Power: 16
argeus is on a distinguished road
Thank you very much for your help, now it works..)
Complete version of solution looks like (if someone interested in):

DEFINE_PROFILE(velocity_inlet, thread, index)
{
real x[ND_ND];
double y;
face_t f;
Thread *tf;
int Zone_ID=--- ;
real density;
Domain *domain;
domain = Get_Domain(1);
tf=Lookup_Thread(d,Zone_ID);

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
y = x[1];

density= F_R(f,tf);

F_PROFILE(f, thread, index) = equation;
}
end_f_loop(f,thread)
}
argeus is offline   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
UDF extern variable - mean time moment coefficient enry Fluent UDF and Scheme Programming 0 November 14, 2009 06:51
UDF: exporting a variable between two DEFINE function Carlo FLUENT 3 August 19, 2009 12:21
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 11:55
Accessing Solver Variable for UDF CFDtoy FLUENT 0 May 9, 2006 19:29
the problem of UDF zzb FLUENT 2 April 5, 2006 05:36


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