March 29, 2021 at 11:35 pm
Subscriber
HI this was my original code to move the deflector which is quite simple to understand I believe. n#include udf.hn#define freq 0.1n#define angular_freq 2.0*3.1416*freqn#define max_angle 11.0*3.1416/180n#define n 5nDEFINE_CG_MOTION(deflector1, dt, vel, cg_omega, time, dtime)nint i=0;nif (i < n)n{nreal omega;n omega=max_angle*angular_freq*cos(angular_freq*time);nvel[0]=0.0;nvel[1]=0.0;nvel[2]=0.0;ncg_omega[0] = 0.0;ncg_omega[1] = 0.0;ncg_omega[2] = omega;n}nnArray I took your advice and I tried to come up with if else feedback loop. I am not sure if its gonna work. I am not good in programming but I have basic understanding of C language. Here is the code: I am looking for your suggestions how can I change velocity at inlet now?n#include udf.hn#define freq 0.1n#define angular_freq 2.0*3.1416*freqn#define max_angle 11.0*3.1416/180n#define n 5nDEFINE_CG_MOTION(deflector1, dt, vel, cg_omega, time, dtime)nint i=0;nif (i < n)n{nreal omega;n omega=max_angle*angular_freq*cos(angular_freq*time);nvel[0]=0.0;nvel[1]=0.0;nvel[2]=0.0;ncg_omega[0] = 0.0;ncg_omega[1] = 0.0;ncg_omega[2] = omega;nntime=time-0.01; / I believe this will return time to its previous state and I would be able to change velocity n times at the same time step. I am not sure if it is gonna work but I will try.n}nelsen{n time=time+0.01;n}n