TONY ARHUR
Subscriber

#include "udf.h"
#include "motion.h"

DEFINE_CG_MOTION(rotating_screws, dt, vel, omega, time, dtime)
{
    Thread *t;
    cell_t c;
    real omega_z1 = 300 * 2 * M_PI / 60;  // Rotational speed for screw in rad/s
    real omega_z2 = 200 * 2 * M_PI / 60;  // Rotational speed for screw-2 in rad/s

    /* Loop over all cell threads */
    c_thread_loop_c (t, dt)
    {
        /* Loop over all cells in the cell thread */
        begin_c_loop (c, t)
        {
            /* Update the rotation of the cell centroid based on the angular velocity for screw */
            C_CENTROID(c, t)[0] += omega_z1 * dt * (C_NORMAL(c, t)[1] * (C_CENTROID(c, t)[2] - 0.0) 
                                                 - C_NORMAL(c, t)[2] * (C_CENTROID(c, t)[1] - 0.0));
            C_CENTROID(c, t)[1] += omega_z1 * dt * (C_NORMAL(c, t)[2] * (C_CENTROID(c, t)[0] - 0.0) 
                                                 - C_NORMAL(c, t)[0] * (C_CENTROID(c, t)[2] - 0.0));
            C_CENTROID(c, t)[2] += omega_z1 * dt * (C_NORMAL(c, t)[0] * (C_CENTROID(c, t)[1] - 0.0) 
                                                 - C_NORMAL(c, t)[1] * (C_CENTROID(c, t)[0] - 0.0));
            
            /* Update the rotation of the cell centroid based on the angular velocity for screw-2 */
            C_CENTROID(c, t)[0] += omega_z2 * dt * (C_NORMAL