Fluids

Fluids

Can I simulate multiple velocities at same time step in transient simulation?

    • Muhammad_atif
      Subscriber
      Hello,nI am running a transient simulation (using ANSYS2020R2) to study the effect of deflector position on the drag force of a tractor-trailer. I have written a UDF with CG_MOTION macro to rotate the deflector up and down which is working fine so far.nMy next task is to rotate the deflector lets say, 1 degree (1st-time step) and before moving it to 2 degrees, I want to see the effect of different velocities (e.g 40 to 60mph) at this time step. I also want to see the effect of changing the yaw angle (0,10,20,30 degree etc.) when deflector is at 1 degree. Once all the yaw angles and velocities are solved for the first-time step then I want to change the angle of the deflector to 2 degrees (by changing to the next time step) and perform the same calculations again.nOne way of doing is creating a separate project for each yaw angle and run multiple analysis which is a very hectic and time-consuming process.nI was wondering if there is a way to do it with UDF. Take one velocity and run a defined number of iteration to reach convergence then change velocity for the same time step and deflector position, and iterate again. once all velocities are done, change time to the next time step (which will change deflector to 2 degrees) and perform same velocity calculations again.nAny suggestion on how this can be achieved?nCan we actually change velocity at a one-time step and iterate it again and again for different 3 4 velocities and then move to the next time step and repeat same calculations?nI hope my question is making sense to you.n
    • Guilin Sun
      Ansys Employee
      Hi, It seems your question is not regarding to photonics using Lumerical tools? what software are you using right now?n
    • Muhammad_atif
      Subscriber
      Hi, I am sorry I was in Fluid and I was meant to post in fluid but somehow it came into photonics and I could not delete the post or change the category. nI am using ANSYS.n
    • Guilin Sun
      Ansys Employee
      ok, we will move this post to the correct forum.n
    • RK
      Ansys Employee
      Hello, nIs there a feedback loop to this? What I mean is : If (so and so) conditions are met, then change the velocity? n
    • Muhammad_atif
      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
    • Muhammad_atif
      Subscriber
      I have tried the second code and total time is still changing with every next time step. Apparently that if-else statement is not working. Any suggestion? Again what I want is to simulate 5 differnt inlet velocities at each time step before it change to next time step!n
    • YasserSelima
      Subscriber
      To my knowledge, What you are trying is not possible n
Viewing 7 reply threads
  • You must be logged in to reply to this topic.