CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Fluent wall motion specified in the form of array of velocity with corresponding time (https://www.cfd-online.com/Forums/fluent-udf/219779-fluent-wall-motion-specified-form-array-velocity-corresponding-time.html)

DesmondM. August 8, 2019 10:15

Fluent wall motion specified in the form of array of velocity with corresponding time
 
I want to simulate a piston moving in a chamber.

I have the velocity of the piston as an array with corresponding time.
vel = [time1 vel1
time2 vel2
time3 vel3
...]

How can i specify this as a udf?
What precaution I need to follow when defining my time step here and in fluent while solving.

Thanks

AlexanderZ August 8, 2019 21:18

ansys fluent customization manual
start with DEFINE_CG_MOTION macro

regarding your table:
you may make 2 arrays:
time = {time1, time2, ... ,timen}
velocity = {vel1,vel2,...,veln}
size of arrays shoulb be same in this approach

check time and define velocity according to your time
part of code you may use
Code:

temp_time = CURRENT_TIME;
for (i=1;i<(sizeof(time)/sizeof(time[0]);i++)
{
if (temp_time>time[i-1] and temp_time<time[i])
  velocity = vel[i-1];
}

best regards


All times are GMT -4. The time now is 08:55.