TAGGED: array, cell-zone-conditions, coordinate, temperature, udf
-
-
May 18, 2023 at 12:13 pm
Selawe97
SubscriberHello Dears,
My problem is I am using a UDF code to collect temperature values at different cell zones (solid region and fluid region). I am saving temperature values in arrays (as shown in the code) by looping over them and using them later to get the temperature difference to use it in a formula for the fluid cell zone.
in (c0_array[n]) and (c1_array[n]) the data was saved as I want in the first two loopsCode:(begin_c_loop(c01,ft1)
and
Code:begin_c_loop(c02,ft2))
, and they saved correctly, but when I loop them inside the third loop
Code:(begin_c_loop(c, t))
to receive the data saved in the first two loops the values of (c0_array[n]) in the third loop are saved correctly as I want, but for (c1_array[n]) the data became chaotic and disorganized! so why do I get something like that?
knowing both zones are coincided and have the same number of cells. and I have to use the define profile macro.Code:#include "udf.h" #include "mem.h" DEFINE_PROFILE(Heat_Transfer_Coeff, t, position) { Domain* domain = Get_Domain(1); Thread* ft1 = Lookup_Thread(domain, 2); Thread* ft2 = Lookup_Thread(domain, 4); cell_t c, c01, c02; Thread* t01, t02; int n; real c0_array[10000], c1_array[10000]; n = 0; begin_c_loop(c01, ft1) { C_UDMI(c01, ft1, 0) = C_T(c01, ft1); c0_array[n] = C_T(c01, ft1); C_UDMI(c01, ft1, 1) = c0_array[n]; n++; } end_c_loop(c01, ft1) n = 0; begin_c_loop(c02, ft2) { C_UDMI(c02, ft2, 2) = C_T(c02, ft2); c1_array[n] = C_T(c02, ft2); C_UDMI(c02, ft2, 3) = c1_array[n]; n++; } end_c_loop(c02, ft2) n = 0; begin_c_loop(c, t) { C_UDMI(c, t, 4) = c0_array[n]; // or C_UDMI(c,t,2)= c0_array[n] - c1_array[n]; C_UDMI(c, t, 5) = c1_array[n]; C_PROFILE(c, t, position) = C_UDMI(c, t, 4)-C_UDMI(c, t, 5); C_UDMI(c, t, 6) = C_PROFILE(c, t, position); n++; } end_c_loop(c, t) }
Your help is appreciated,
Thanks -
May 18, 2023 at 3:54 pm
Rob
Ansys EmployeeWhy would the cell order be the same for both mesh blocks? Fluent stores and loops over the cell ID, not the location.
-
May 18, 2023 at 4:19 pm
Selawe97
SubscriberDear Thanks for your response,
so, can you please guide me on how to store the temperature values of both cell zones and subtract them to get the temperature difference between them?
-
May 18, 2023 at 4:31 pm
Rob
Ansys EmployeeNot without breaking the rules that staff must abide by. It's doable but not easy. Start with figuring out where the cells are, and go from there.
-
May 18, 2023 at 6:08 pm
Selawe97
SubscriberThanks
-
-
- 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.

Ansys Blog
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.
- 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
- Difference between K-epsilon and K-omega Turbulence Model
- The solver failed with a non-zero exit code of : 2
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error: Received signal SIGSEGV
-
5326
-
3311
-
2471
-
1308
-
1016
© 2023 Copyright ANSYS, Inc. All rights reserved.