|
[Sponsors] |
December 4, 2023, 07:06 |
Multiple DEFINE_ADJUST in a running time
|
#1 |
New Member
Canh Doan
Join Date: Sep 2023
Posts: 12
Rep Power: 3 |
Hi everyone,
I am running a problem with 2 DEFINE_ADJUST. 1st DEFINE_ADJUST collects data and assigns it to a global variable array. 2nd DEFINE_ADJUST takes the data from the global variable array and assigns it to fluent. Code:
DEFINE_ADJUST(adjust_absorb_coe_to_global_matrix_bb, d) { cell_t c; Thread *t; face_t f; real xc[ND_ND]; real xx, yy; int i,j,m,n, count; d = Get_Domain(1); thread_loop_c(t,d) { if(THREAD_ID(t) == 2) { begin_f_loop(f,t) { F_CENTROID(xc,f,t); xx = xc[0]; yy = xc[1]; m = (xx+0.05)/0.001; n = yy/0.001; count = 24*m+n; BB[count] = C_ABS_COEFF(c,t); printf("Global array BB[%d] = %f\n", count, BB[count]); } end_f_loop(f,t) } } } DEFINE_ADJUST(adjust_cal_intensity_depend_on_bb, d) { int i,j,m,n, count; i = 0; for(j = 0; j<25; j++) { AA[24*i+j] = 1000; printf("AA[%d] = %f\n", 24*i+j, AA[24*i+j]); } for(i = 0; i<100; i++) { for(j = 0; j<25; j++) { if(i == 0) { AA[24*i+j] = AA[24*i+j]; printf("AA[%d] = %f\n", 24*i+j, AA[24*i+j]); } else { AA[24*i+j] = AA[24*(i-1)+j] * (1 - BB[24*(i-1)+j]); printf("AA[%d] = %f\n", 24*i+j, AA[24*i+j]); } } } } I found that these two functions run as follows: ADJUST-1 run, assign ~150 values, and then ADJUST-2 run. This process repeats 17 times. I cannot understand why this happened. What I expect is ADJUST-1 runs one time, assign 2500 value, and then ADJUST-2 run one time and get data. |
|
December 5, 2023, 02:22 |
|
#2 |
New Member
Canh Doan
Join Date: Sep 2023
Posts: 12
Rep Power: 3 |
The problem is solved.
The loop ran 16 times because I set the parallel solver as 16. After that my system worked well. |
|
Tags |
define_adjust, loop over cells, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
laplacianFoam with source term | Herwig | OpenFOAM Running, Solving & CFD | 17 | November 19, 2019 14:47 |
Floating point exception error | lpz_michele | OpenFOAM Running, Solving & CFD | 53 | October 19, 2015 03:50 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
Micro Scale Pore, icoFoam | gooya_kabir | OpenFOAM Running, Solving & CFD | 2 | November 2, 2013 14:58 |
mixerVesselAMI2D's mass is not balancing | sharonyue | OpenFOAM Running, Solving & CFD | 6 | June 10, 2013 10:34 |