|
[Sponsors] |
February 3, 2011, 12:32 |
UDF - accessing face variable problem
|
#1 |
New Member
Ján
Join Date: Mar 2010
Location: Slovakia
Posts: 24
Rep Power: 16 |
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? |
|
February 6, 2011, 03:21 |
|
#2 |
Member
Byron Smith R J
Join Date: Mar 2009
Location: India
Posts: 46
Rep Power: 17 |
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) } |
|
February 9, 2011, 05:08 |
|
#3 |
New Member
Ján
Join Date: Mar 2010
Location: Slovakia
Posts: 24
Rep Power: 16 |
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) } |
|
|
|
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 07:51 |
UDF: exporting a variable between two DEFINE function | Carlo | FLUENT | 3 | August 19, 2009 13:21 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 12:55 |
Accessing Solver Variable for UDF | CFDtoy | FLUENT | 0 | May 9, 2006 20:29 |
the problem of UDF | zzb | FLUENT | 2 | April 5, 2006 06:36 |