TAGGED: udf-fluent, udf-macro
-
-
May 19, 2021 at 2:07 pmLeeSubscriber
Background
Hello, everyone:
 I want to calculate the area of top surface(ID=10) which is shown in Figure 1, but I encountered some problem and I cannot figure it out.
 For UDF code, I searched previous examples on the internet, but I cannot fully understand the meaning of some syntax.
Problem
(1) UDF problem. I know I should find the target surface and then use the macro called F_AREA and NV_MAG to obtain area, but I don’t know how to realize it?
(2) Understanding of macro problem. The loop macro in UDF code, ‘thread_loop_f’ and ‘begin_f_loop-end_f_loop’, I know the function of these two macros, for example, to my understanding, ‘thread_loop_f(thread, domain) is to loop over thread which contains faces in domain(am I right?), but I do not know why they are here?
(3) After built and loaded UDF file successfully, once I clicked the ‘execute on demand’, error pops out, which is shown in Figure 2, why this happened?
Any help will be appreciated, thank you, I need your help.
Regards,
Excited
May 19, 2021 at 9:13 pmKarthik RemellaAdministratorHello You seem to be using one of the newer releases on Ansys Fluent. You should be able to use the Fluent expressions for this (instead of a UDF). Please look through the following link to see if this helps.
https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v211/en/flu_ug/flu_ug_expression_syntax.html
Also, did your UDF compile right? Where there any error messages?
Karthik
May 24, 2021 at 2:18 pmLeeSubscriberHello, kremella, thanks for your reply:
1.I cannot log in that forum since I do not have account, so, I am unable to get the help;
2. For UDF code, there maybe exist some errors in ÔÇ£the thread_loopÔÇØ, actually, I think it is wrong here, but I cannot find a way to select the target wall to apply the calculation macro, can you give me a hint about that? Thx!
Regards Excited
May 24, 2021 at 2:26 pmKarthik RemellaAdministratorHello Please try and follow these instructions and see if you are able to access the link I shared earlier.
Please see if you can circumvent the UDF approach here using Fluent Expressions.
Karthik
May 25, 2021 at 12:31 pmLeeSubscriberThanks for your kind relpy, although my problem has been resolved. My UDF code is as follows:
#include "udf.h"
DEFINE_ON_DEMAND(Face_area)
{
face_t face;
Thread* thread;
Domain* domain;
domain = Get_Domain(1);
int zone_id = 10;
thread = Lookup_Thread(domain, zone_id);
real NV_VEC(va); /* for storing area vector */
real Area = 0;
begin_f_loop(face, thread)
{
F_AREA(va, face, thread); /* Obtain the area vector */
Area += NV_MAG(va); /* Obtain area magnitude */
}
end_f_loop(face, thread)
#if RP_NODE
Area = PRF_GRSUM1(Area);
#endif
node_to_host_real_1(Area);
#if RP_HOST
Message("Area of top surface is %f\n", Area);
#endif
}
Regards Excited
Viewing 4 reply threads- The topic ‘How to calculate area of particular surface through UDF?’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- Non-Intersected faces found for matching interface periodic-walls
- Script error Code: 800a000d
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Fluent fails with Intel MPI protocol on 2 nodes
- Cyclone (Stairmand) simulation using RSM
- error udf
- Diesel with Ammonia/Hydrogen blend combustion
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Script Error
Top Contributors-
1336
-
591
-
569
-
525
-
366
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-