TAGGED: udf
-
-
May 3, 2024 at 5:11 pmMaria Sanchez FarranSubscriber
Hello,
I need to calculate the area of all faces within a given domain. This was my approach:- I looked into the ANSYS UDF MANUAL and I found a code that outputs the location of the centroids of the cells (page 225).Â
- I adapted this code for outputting the area of each face within a domain but I receive a Segmentation fault.Â
- I debugged the code and the issue occurs when the code runs into the F_AREA(A,f,t) macro.
- FYI - I am not running in parallel.
 The problematic code is shown below. I would appreciate if you give me any advice on this.
-
May 7, 2024 at 1:43 pmRobForum Moderator
I don't think you've defined A correctly, https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v241/en/flu_udf/flu_udf_ModelSpecificDEFINE.html%23flu_udf_sec_ex_beam_directionÂ
-
May 7, 2024 at 3:21 pmMaria Sanchez FarranSubscriber
Hi Rob,
Thank you for replying - do I first need to register for me to access your answer?
-
May 7, 2024 at 3:30 pmRobForum Moderator
No, click on Help in Fluent, and paste the link into the browser that opens. The solvers have a token/cookie/biscuit that bypasses the security check.Â
-
May 7, 2024 at 6:29 pmMaria Sanchez FarranSubscriber
Hi Rob,
Thank you for your answer. I was able to read the link you provided in Fluent.Â
Regarding the definition of A, I realized the following:
- the UDF example you provided defines A as: real A[3]
- my UDF defines it as: real NV_VEC(A)
I am not sure if this is the issue (would it make a difference?).
If that is indeed the issue, I replaced the definition to "real A[3]" but I again receive the segmentation fault error.
Thank you!
Â
-
May 8, 2024 at 10:18 amRobForum Moderator
Looking here  https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v241/en/flu_udf/flu_udf_DPMDEFINE.html the example uses real A[ND_ND] and F_AREA[A,f,t] Â
In your code, the face loop calls F_AREA[A,f,t]Â but doesn't look to do anything with it other than print.Â
We're not able to offer debugging advice, and you're already on the right track by using comments to find the problem. F_AREA is used in several of the examples, search F_AREA and see what else you find.Â
-
May 8, 2024 at 5:45 pmMaria Sanchez FarranSubscriber
Thank you for your comments, Rob.Â
Regarding the face loop, it is true that F_AREA[A,f,t] in the code doesn't do anything. It just prints because I can't get over the segmentation fault issue. I have looked through the examples using F_AREA and checked for syntax errors, and also looked at previous posts in the forum.Â
I understand that you cannot provide debugging advice. However, I followed your suggestion and I am now using the UDF that appears in the manual "Global Summation of Pressure on a Face Zone and its Area Average Computation". I am testing it in a parallel simulation, and I am having again the same issue.
Here are the highlights:
- I did not modify the code, except changing the surface_thread_id for the one that is relevant to my simulation.
- I get segmentation fault when including the F_AREA and the PRINCIPAL_FACE_P conditional inside the face loop. The code runs ok if I just place a message withing the face loop. I show below three alternatives of the face loop that I have tried so far.
- The problem is not with F_AREA only but if I modify the code for F_CENTROID it will give me the same problem.
- The problem is beyond F_AREA and I wonder what is wrong with the face loop.
1.face loop WITH segmentation fault (original loop from the code)begin_f_loop(face,thread)if (PRINCIPAL_FACE_P(face,thread)){F_AREA(area,face,thread);total_area += NV_MAG(area);total_force += NV_MAG(area)*F_P(face,thread);}end_f_loop(face,thread)Â2. Removed the conditional and the code still gives segmentation fault.begin_f_loop(face,thread)Â Â F_AREA(area,face,thread);Â Â total_area += NV_MAG(area);Â Â total_force += NV_MAG(area)*F_P(face,thread);Âend_f_loop(face,thread)3. Code runs OK with a message inside the loop.
begin_f_loop(face,thread)
Message("I am inside the loop\n");
end_f_loop(face,thread)ÂÂÂ -
May 9, 2024 at 8:46 amRobForum Moderator
The other difference being the "area" definition. How is that defined?
-
May 13, 2024 at 6:01 pmMaria Sanchez FarranSubscriber
Hi Rob,
Than you for helping me out.
- I was trying to get information on the interior faces but I realized that the zone-id I was using in the code did not allow me to do that. I was using a zone-id that belongs to the "Cell Zone Conditions". From what I understand now, these zones only store cell information as opposed to information on interior faces. Is this correct?
- If I instead use the respective zone id that is listed in the "Boundary Conditions/Internals", I can get information on the interior faces and there is no segmentation fault. The code runs.
- I want to determine the flux that goes into each cell of a porous media. Would it be possible to loop over cells and then over the faces of each cell? The reason why I ask this is because the zone-id for cells is separate than for faces so I am not sure how to approach this task.
-
May 16, 2024 at 1:31 pmRobForum Moderator
Interior faces should also have an ID, click on the surface in the GUI and in the Boundary Conditions Task Page you should see an ID. F_AREA is for facet data (surface) and C_stuff is for volumes.Â
For flux into a porous zone I'd look at the bounding surface (interior) rather than the cells. You can loop over cells and then facets on a cell to find a boundary but that can be very inefficient as that loop may be called every iteration/timestep depending on the code.Â
-
- You must be logged in to reply to this topic.
- RSS is disabled.
- Speed up simulation in HFSS
- ANSYS Mechanical won’t open and stays on Blank Gray Screen (Path environment va)
- ansys fluent error when opening it “unexpected license problem”
- Elastic Licensing DNS gateway changes
- Ansys 2024 R1 – The installation completed with warnings/errors.
- Workbench license error
- Poor quality mesh at trailing edge for 3d wing
- LS-Dyna Beam elements outputs
- Not find helic___[]_.tgz file
-
441
-
199
-
194
-
162
-
142
© 2024 Copyright ANSYS, Inc. All rights reserved.