-
-
March 26, 2021 at 11:01 pm
Muhammad_atif
SubscriberHello,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 -
March 29, 2021 at 3:59 pm
Guilin Sun
Ansys EmployeeHi, It seems your question is not regarding to photonics using Lumerical tools? what software are you using right now?n -
March 29, 2021 at 4:35 pm
Muhammad_atif
SubscriberHi, 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 -
March 29, 2021 at 4:41 pm
Guilin Sun
Ansys Employeeok, we will move this post to the correct forum.n -
March 29, 2021 at 10:36 pm
RK
Ansys EmployeeHello, nIs there a feedback loop to this? What I mean is : If (so and so) conditions are met, then change the velocity? n -
March 29, 2021 at 11:35 pm
Muhammad_atif
SubscriberHI 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 -
March 29, 2021 at 11:38 pm
Muhammad_atif
SubscriberI 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 -
March 30, 2021 at 4:19 am
YasserSelima
SubscriberTo my knowledge, What you are trying is not possible n
-
Viewing 7 reply threads
- You must be logged in to reply to this topic.
Ansys Innovation Space

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
Trending discussions
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
Top Contributors
-
2688
-
2138
-
1355
-
1136
-
462
Top Rated Tags
© 2023 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.