|
[Sponsors] |
temperature difference from different zones using UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 18, 2023, 09:45 |
temperature difference from different zones using UDF
|
#1 |
New Member
Mohammad
Join Date: Sep 2022
Posts: 12
Rep Power: 4 |
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 loops Code:
(begin_c_loop(c01,ft1) Code:
begin_c_loop(c02,ft2)) Code:
(begin_c_loop(c, t)) 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(HTC, 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) } Thanks |
|
Tags |
array, cell zones, collect data, temperature difference |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Saturation temperature UDF for evaporation-condensation | obiscolly50 | Fluent UDF and Scheme Programming | 1 | June 20, 2021 11:08 |
Heat flux as a function of wall temperature using UDF | Piquero | FLUENT | 2 | May 7, 2021 13:02 |
UDF problem- time dependent temperature at inlet | kaeran | FLUENT | 1 | June 16, 2015 22:48 |
UDF for variable temperature with time | CaglarCoskun | Fluent UDF and Scheme Programming | 8 | January 15, 2014 10:15 |
Inlet won't apply UDF and has temperature at 0K! | tccruise | Fluent UDF and Scheme Programming | 2 | September 14, 2012 07:08 |