|
[Sponsors] |
December 3, 2023, 06:10 |
Access the value in UDMI
|
#1 |
New Member
Canh Doan
Join Date: Sep 2023
Posts: 12
Rep Power: 3 |
Hi everyone,
I am using UDMI to save the value of temperature at cell 1 as "C_UDMI(c,t,0) = C_T(c,t)". However, I want to bring this value to a different cell for example cell 2. How can I do it? I am working in Windows so I cannot use the read/write file. Thank you. |
|
December 4, 2023, 02:35 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
your question doesn't make any sense
to use Code:
C_UDMI(c,t,0) = C_T(c,t) the way you define it could give you temperature at 1 specific cell (finite volume) or at the whole domain (in case you are using cell/thread loop) Code:
I am working in Windows so I cannot use the read/write file. read ansys fluent customization manual to get more info on cell/thread structure, you may find there examples of udf
__________________
best regards ****************************** press LIKE if this message was helpful |
|
December 4, 2023, 03:23 |
|
#3 |
New Member
Canh Doan
Join Date: Sep 2023
Posts: 12
Rep Power: 3 |
Thank you Alexander for your reply,
I found it in the UDF guide book, they said "DEFINE_RW_FILE cannot be used in UDFs that are executed on Windows systems." https://www.afs.enea.it/project/nept...udf/node29.htm |
|
December 4, 2023, 03:39 |
|
#4 |
New Member
Canh Doan
Join Date: Sep 2023
Posts: 12
Rep Power: 3 |
I had another question, this is my code:
#include "udf.h" double AA[2500]; DEFINE_ADJUST(adjust_intensity_to_global_value_2, d) { cell_t c; Thread *t; face_t f; real xc[ND_ND]; real xx, yy; int i,j,m,n, count; for(i = 0; i<100; i++) { for(j = 0; j<25; j++) { thread_loop_c(t,d) { begin_c_loop(c,t) { C_CENTROID(xc,c,t); xx = xc[0]; yy = xc[1]; m = (xx+0.05)/0.001; n = yy/0.001; if(m == i && n == j) { count = 24*i+j; AA[count] = 1000*(1-i*0.01); printf("adjust %d\n", count); } } end_c_loop(c,t) } } } } DEFINE_DOM_SOURCE(dom2,c,t,ni,nb,emission,in_scatt ering,abs_coeff,scat_coeff) { Domain *d; face_t f; real xc[ND_ND]; real xx, yy; int i,j,m,n,count; d = Get_Domain(1); C_CENTROID(xc,c,t); xx = xc[0]; yy = xc[1]; m = (xx+0.05)/0.001; n = yy/0.001; count = 24*m+n; C_STORAGE_R_XV(c,t,SV_DO_IRRAD,0) = AA[count]; printf("dom2\n"); } and this is my domain with the 2D mesh of 25 rows and 100 columns, total 2500 cells: I tried to use a DEFINE_ADJUST to assign the intensity to a global variable matrix AA[24*i+j], and after that, I used a DEFINE_DOM_SOURCE to assign the value from global matrix AA[24*(i-1)+j] to the current intensity. The problem I face now is when running the simulation, I found that Fluent runs a few cells in "DEFINE_ADJUST" and next run to DEFINE_DOM_SOURCRE and return. Totally 17 times and it is not follow the order of i and j. (I checked by print out "adjust" when run DEFINE_ADJUST and "dom" when run DEFINE_DOM_SOURCE). As you see in my code, Fluent should run the DEFINE_ADJUST first, assign intensity to 2500 values in AA array first. After that it will run the DEFINE_DOM_SOURCE to take the data from AA array. Can you guide me to overcome this? I want to finish looping over 2500 cells in DEFINE_ADJUST first and next is run the DEFINE_DOM_SOURCE. |
|
December 4, 2023, 03:40 |
|
#5 | |
New Member
Canh Doan
Join Date: Sep 2023
Posts: 12
Rep Power: 3 |
Quote:
|
||
Tags |
access udmi value, udf, udmi |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[DesignModeler] DesignModeler Scripting: How to get Full Command Access | ANT | ANSYS Meshing & Geometry | 53 | February 16, 2020 16:13 |
Why is access to turbulence fields provided as const? | mrishi | OpenFOAM Programming & Development | 3 | January 23, 2020 13:51 |
UDMI and DEFINE_EXECUTE_AT_END | MsRuby | Fluent UDF and Scheme Programming | 2 | July 2, 2018 03:43 |
Is there a way to access the gradient limiter in Fluent ? | CFDYourself | FLUENT | 1 | February 16, 2016 06:49 |
How to access first derivative of Udmi??? | Asghari | FLUENT | 1 | October 23, 2006 07:23 |