TAGGED: cell-macro, udf-fluent
August 25, 2021 at 5:30 pmm.shafiee1374Subscriber
I want to find a cell in my domain that contains a specific point. The method I'm using is like this:
//checking whether the point is inside the cell or not
//getting the cell id
Then I want to use this cell identifier in a
DEFINE_ADJUSTmacro to read the velocity of that cell and use it in my calculations.
DEFINE_ADJUSTis a macro that is executed at every iteration of the Ansys Fluent solver, I don't want to include the above code in the
DEFINE_ADJUST. Instead, I want to use it in another source code inside a
DEFINE_EXECUTE_ON_LOADINGmacro and then use the cell id in the main source code that contains the
SO the questions are:
Am I able to do this at all?
And how can I pass the cell id from one source code to another one?
Thanks. ☺️August 26, 2021 at 8:49 amDrAmineAnsys EmployeeThere are some undocumented function to do that. But there are some other ways which are pure C. You check for every cell centroid its distance to one point if it below tolerance you mark the cell and return its cell id. Is not something I can go deep into it or share on this open platform.
August 26, 2021 at 12:47 pmm.shafiee1374SubscriberThanks for your response I know that you can measure the distance of cell centroid and the point and I've already used this method. But my question was about how to pass the cell id from a DEFINE_EXECUTE_ON_LOADING macro to a DEFINE_EXECUTE_ON_LOADING macro?
August 29, 2021 at 10:15 amm.shafiee1374SubscriberHello,
So an update to my problem: I managed to solve it by defining a cell and thread pointer as external global variable in a header file.
then I was able to pass these pointers to other source codes (or macros) by including the mentioned header file.
August 30, 2021 at 11:43 amDrAmineAnsys EmployeeExternal variable or marking A cell Memory with True / 1 and the other with False/0.
May 25, 2022 at 2:34 pmm.shafiee1374SubscriberHi again Recently I wrote a udf for this purpose to find the cell id of the nearest cell to the hub location of a wind turbine. The code is compiled successfully with no errors whatsoever :
But after loading the library into Fluent 19, a long list of errors are shown and then the fluent process crashes for some reason ƒñªÔÇìÔÖé´©Å
I couldn't find any reason behind these errors, since the code looks correct and errors are kind of vague.
How can I fix this?
May 30, 2022 at 7:01 amDrAmineAnsys EmployeeAvoid the defitions on line 2 and 3 and do that inside the define macro. Also worth using globsl C_ID in parallel to get the unique ID of the cell.
Also line 34 is not required.
Also your UDF is not parallelized.
May 30, 2022 at 10:49 amm.shafiee1374SubscriberThe reason I defined thread and cell id above the define macro (line2&3) is that I want them to be global variables so that later I can use them in another source file by using the extern command .
I tried compiling and loading this code using serial mode, and got similar error messages. I didn't know about udf parallelization but I will try and learn it once I'm about to run it in parallel.
Viewing 7 reply threads
Ansys Innovation Space
- You must be logged in to reply to this topic.
Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.
Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.Trending discussions
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
Top Rated Tags
© 2023 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.