CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   2D Forced Roll Damping Simulation using FLUENT (https://www.cfd-online.com/Forums/fluent/197119-2d-forced-roll-damping-simulation-using-fluent.html)

Sunflower_Li December 29, 2017 02:48

2D Forced Roll Damping Simulation using FLUENT
 
Hello everyone,
Now I am working on predicting roll damping of a ship hull section, but now I have some questions. The hull section that I used is the SS5 section of the S60 ship, and the dimension of the hull section was the same with Ikeda's experiments. However, I did not have a good result. I am seeking for help.
On the model section a harmonic roll motion is imposed by moving the complete body and computational mesh at a prescribed period T and amplitude φ0. The structured grids were generated by ICEM. In FLUENT, I used dynamic mesh method. In my case, the 2D midsection mesh zone rotated around the roll axis. There is an interface between stationary zone and rigid moving zone. The following is my UDF code, could please help me find if there is some wrong?

Thanks!

UDF code:

#include"udf.h"
#define freq 0.84
#define ampl 0.175
#define density 998.2
#define GRAVITY 9.81
int id=14;

DEFINE_CG_MOTION(int_block_roll, dt, vel, omega, time, dtime)
{
omega[2] = 2*M_PI*freq*ampl*cos(2*M_PI*freq*time);
}

DEFINE_EXECUTE_AT_END(exe_end)
{
real x_cg[3],m_glob[3],f_glob[3],sita,time,m_plus;
real x[ND_ND],A[ND_ND];
FILE *fp;
Domain *domain=Get_Domain(1);
face_t f;
Thread *tf=Lookup_Thread(domain,id);
time = CURRENT_TIME;
x_cg[0] = 0.0;
x_cg[1] = 0.0;
m_plus=0.0;
sita = ampl*sin(2*M_PI*freq*time);
if(!Data_Valid_P())
return;
Compute_Force_And_Moment(domain,tf,x_cg,f_glob,m_g lob,TRUE);
begin_f_loop(f,tf)
{
F_CENTROID(x,f,tf);
F_AREA(A,f,tf);
if(x[1]<0.0)
m_plus+=density*GRAVITY*x[1]*fabs(x[1]*A[0]-x[0]*A[1]);
}
end_f_loop(f,tf)
m_glob[2]+=m_plus;

#if !RP_NODE
fp=fopen("roll.txt","a");
fprintf(fp,"%f,%f,%f,%f,%f,%f\n",time,sita,f_glob[0],f_glob[1],NV_MAG(f_glob),m_glob[2]);
fclose(fp);
#endif
}


All times are GMT -4. The time now is 21:52.