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/)
-   -   Replace time with current timestep (https://www.cfd-online.com/Forums/fluent-udf/237682-replace-time-current-timestep.html)

zeefar July 29, 2021 12:51

Replace time with current timestep
 
Hello,
I am trying to use the timesteps of my steady state solver instead of the time function I used to set my case as a transient one in the code below:
/* flap.c */
/* UDF for specifying a simple harmonic motion*/
/* */
/**********************************************/

#include "udf.h"
#define Freq 0.1
#define angular_freq 2.0*M_PI*Freq
#define tetmax -45.0*M_PI/180

DEFINE_CG_MOTION(shm, dt, cg_vel, cg_omega, time, dtime)
{
real omega;
omega = tetmax*angular_freq*cos(angular_freq*time); /* rotational speed about axis*/

cg_vel[0] = 0.0075 * sin(3.1415927 * time / 5.);
cg_vel[1] = 0.0;
cg_vel[2] = 0.0;

cg_omega[0] = 0.0;
cg_omega[1] = 0.0;
cg_omega[2] = omega;
}

I found this function CURRENT_TIMESTEP in the UDF manual to use the timestep of the solver for my steady state case. However, I have been unable to rework this into my code to replace time with the current timestep function and need help regarding this.

pakk July 29, 2021 14:06

Taking one step back: why are you doing this? What is the goal?

If you find a way to do this, your boundary condition changes during the calculation, so your solution will never converge. Never.

If your goal is to have a simulation that does not converge, there are easier ways to do this...


All times are GMT -4. The time now is 12:19.