TAGGED: array, cell-zone-conditions, coordinate, temperature, udf
-
-
May 18, 2023 at 12:13 pmSelawe97Subscriber
Hello 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 pmRobForum Moderator
Why 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 pmSelawe97Subscriber
Dear 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 pmRobForum Moderator
Not 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 pmSelawe97Subscriber
Thanks
-
-
- The topic ‘get the temperature difference from different zones using UDF’ is closed to new replies.
- How do I get my hands on Ansys Rocky DEM
- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Fluent fails with Intel MPI protocol on 2 nodes
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Cyclone (Stairmand) simulation using RSM
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Script Error
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- convergence issue for transonic flow
-
1507
-
599
-
597
-
591
-
366
© 2025 Copyright ANSYS, Inc. All rights reserved.