|
[Sponsors] |
June 21, 2019, 08:19 |
store and access a single value in UDF
|
#1 |
Member
South Yorkshire
Join Date: May 2018
Posts: 33
Rep Power: 8 |
Hi,
I wrote a UDF that determines the position and velocity of a body subjected to lift and drag forces. These variables are updated each time step and depend on their previous v(t-1) and current values v(t). The UDF works as intended when I am running it on fluent. The problem starts when I am trying to restart the simulation after X time steps (i.e. run the simulation for X time step, save the last result, close fluent, load the last saved time step, run the simulation). The velocity value is not saved and goes back to zero when the simulation is restarted. How can I store these values at the last saved time step so I can use them when I restart the simulation? Thanks, |
|
June 23, 2019, 23:05 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
write to file, or use UDMI
best regards |
|
June 24, 2019, 07:45 |
|
#3 |
Member
South Yorkshire
Join Date: May 2018
Posts: 33
Rep Power: 8 |
Thank you Alexander.
At the beginning I didnt want to use UDMI since I found it that saving a constant value on each cell of the body was quite inefficient but at the end I just did it and it works as intended. In any case... for completeness, this is my implementation. Code:
if (load_ini_UDMI_time < ctime) { /*Load UDMI*/ #if !RP_HOST Thread *t,*t0_cell; Domain *d = Get_Domain(1); cell_t c0; face_t f; t = Lookup_Thread(d,zoneID); begin_f_loop(f,t) { if (PRINCIPAL_FACE_P(f,t)) { c0 = F_C0(f,t); t0_cell = THREAD_T0(t); vxRK = C_UDMI(c0,t0_cell,3); vyRK = C_UDMI(c0,t0_cell,4); vx = C_UDMI(c0,t0_cell,5); vy = C_UDMI(c0,t0_cell,6); ax = C_UDMI(c0,t0_cell,7); ay = C_UDMI(c0,t0_cell,8); } } end_f_loop(f,t) #endif node_to_host_real_6(vxRK,vyRK,vx,vy,ax,ay); load_ini_UDMI_time = ctime + 10000; } Regards |
|
Tags |
fluent - udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to solve UDF compilation problems in Fluent. | pakk | Fluent UDF and Scheme Programming | 16 | September 10, 2018 03:48 |
store and access the value in UDM | serene6390 | Fluent UDF and Scheme Programming | 8 | April 16, 2018 02:21 |
udf problem | jane | Fluent UDF and Scheme Programming | 37 | February 20, 2018 05:17 |
UDF to Access Wall Normal Concentration Gradient | Daniel Tanner | Fluent UDF and Scheme Programming | 4 | February 18, 2015 15:35 |
Help on UDF: access to wall shear stress | Zhihua Li | FLUENT | 2 | May 26, 2004 12:55 |