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

DEFINE_ON_DEMAND UDF: How to declare A[ND_ND], etc

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 5, 2003, 14:34
Default DEFINE_ON_DEMAND UDF: How to declare A[ND_ND], etc
  #1
jx
Guest
 
Posts: n/a
Hi, all,

I am trying to implement a UDF to calculate the mean temperature at the downstream boundary of a periodic boundary pairs.

First I'll explain reasons why I need to use this UDF:

1. It is not suitable to monitor an exist surface (I don't like this term as it confused me a bit at the beginning. In FLUENT, it can be a two-dimensional surface, a point, or a line, or even a three-dimensional geometry! May I here suggest FLUENT to use some other term, like "monitored zone", "monitored geometry", "monitored item", or something else less confused?), because the exist periodic boundary pair contains two boundaries but I am just interest in the downstream one.

2. It is not possible to create a new surface (a plane co-planed the downstream boundary), because in my case, I have both solid and fluid portions within that plane. The available approach to create a plane surface (or quadric surface) will result in a plane covered both the solid and fluid portions. Well, although I actually need the mean temperature at that plane, the actual calculations for mean temperature would be different from fluid to solid (facet average for solid and mass-weighted average for fluid). Hence I should create seperate plane surfaces to monitor them if I go this way, which is practically impossible. (at least I am not aware of. If somebody has an idea, please let me know. thanks!)

3. It is not good to use other DEFINE macros like DEFINE_EXCUTE_AT_END, because I only need to compute the mean temperature after convergence, not at every iteration step. Additionally if I use the surface monitor technique above-mentioned, I always get redundant information at every iteration step. Not a big problem though.

Therefore I choose to use the excute-on-demand UDF to do the job.

As the domain id and boundary face id are not passed by the solver to the UDF. I need to initialize them in the UDF. My questions here come:

1. How can I get boundary face id within the UDF? I know I can get the domain id with Get_Domain(1) function. Is there a similiar function for boundary surface?

2. How should I declare the facet area vector? I don't see a sample in FLUENT manuals. I tried "real A[ND_ND]" to declare it but I got "segmentation violation" error when excuting the UDF.

That's all for the moment. And many thanks for your suggestions.

jx
  Reply With Quote

Old   November 6, 2003, 18:23
Default Re: DEFINE_ON_DEMAND UDF: How to declare A[ND_ND],
  #2
jx
Guest
 
Posts: n/a
I actually searched the archive of this forum, and just after I posted this, I found some UDF samples using "real A[ND_ND]" to declare the area vector. So I get the answer for my second question somehow. The segmentation violation error must be caused by something else.

But the first question remains unanswered.

I tried the following:

1.

d=Get_Domain(a);

thread_loop_f(f,d)

{

begin_f_loop(f, t)

{

/*judge if the face is the boundary facet and do some calculations in this loop*/

}

end_f_loop

}

2.

d=Get_Domain(1);

thread_loop_c(t,d)

{

begin_f_loop(f, t)

{

/*judge if the face is the boundary facet and do some calculations in this loop*/

}

end_f_loop

}

However, both the above attempts failed and I found only the interior facets were taken into account in above UDF loops. So how I can make the boundary facet identifiers available in excute-on-demand UDF?

In addition, I see DEFINE_PROFILE UDF receives the boundary identifier passed by the solver. But this is the case only after I hook the UDF to a specific boundary. So it is not a good solution for me. Natuarally I set my boundarys periodic and let FLUENT handle the job, otherwise I have to mess around with all interpolations (my mesh would later be all tetrahedral).

Anybody has a suggestion, please?

Thanks,

jx

  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
How to declare a prism block in the blockMeshDict file callega OpenFOAM Pre-Processing 6 June 1, 2015 13:38
Sgimpi pere OpenFOAM 27 September 24, 2011 08:57
Ld_library_path scottneh OpenFOAM 9 November 21, 2009 10:15
how to declare pointscalarfield keishawillstone OpenFOAM Running, Solving & CFD 5 September 1, 2009 11:15
How to declare a symmetric tensor or calculate Huke formula haibinli OpenFOAM Running, Solving & CFD 0 July 28, 2006 11:24


All times are GMT -4. The time now is 17:59.