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/)
-   -   Finding Lift force in CG motion UDF (https://www.cfd-online.com/Forums/fluent-udf/255536-finding-lift-force-cg-motion-udf.html)

nahian_masud April 15, 2024 18:12

Finding Lift force in CG motion UDF
 
Is there any way to find the lift force in CG motion udf? I need to to use in the vertical velocity. Here is the code I have written so far. The 2D airfoil is flapping, so I described a flapping motion. The airfoil has boundary ID of 7. now I use Compute_Force_and_Moment macro to find lift force and use it in the vertical velocity.*
The problem is, it says floating point error after 2 or 3 time steps ( residuals goes super high and simulation stops), but if i dont use the compute force and moment macro, the flapping only works well. I need to find the lift force anyhow to get the transational velocity. can anyone help me please?



#include "udf.h"
DEFINE_CG_MOTION(paperfreq,dt,vel,omega,time,dtime )
{
Thread *t;*
face_t f;
/* get moment or force */
Domain *d = Get_Domain(1); /* for single phase flow*/

Thread *t_object = Lookup_Thread(d, 7); /* you get Boundary_ID from the boundary condition panel in Fluent*/
real force[ND_ND], moment[ND_ND], cg[ND_ND]; /*initialise*/

Compute_Force_And_Moment (d,t_object,cg,force,moment,TRUE);

*/* force components of surface "Boundary_ID" real force_y = force[1];*/

real w,a, pi;*
pi = 3.14159265;*
a = (pi*15)/180; /*pitch amplitude*/*
w = 0.62832; /*angular velocity*/**
/*defining the flapping motion*/*
omega[2]=-a*2*pi*2.97*cos(2*pi*2.97*time); /*pitching motion*/
vel[1]= force[1]*dtime/0.0116;

}

The code above shows the error with very high residuals. But the bottom code works just fine,

#include "udf.h"
DEFINE_CG_MOTION(paperfreq,dt,vel,omega,time,dtime )
{
Thread *t;*
face_t f;
real w,a, pi;*
pi = 3.14159265;*
a = (pi*15)/180; /*pitch amplitude*/*
w = 0.62832; /*angular velocity*/**
/*defining the flapping motion*/*
omega[2]=-a*2*pi*2.97*cos(2*pi*2.97*time); /*pitching motion*/

}


All times are GMT -4. The time now is 20:10.