|
[Sponsors] |
April 7, 2014, 17:01 |
UDF for an oscillating 3d body
|
#1 |
New Member
Join Date: Mar 2014
Posts: 4
Rep Power: 12 |
I am trying to oscillate a 3d body in in the heave direction in Fluent and also read the Force-Time graph.
Here is my UDF: /************3D Body************************/ #include "udf.h" #include "dynamesh_tools.h" #include "sg_mem.h" #include "unsteady.h" real t; real n; real dtm; real m_glob; real x_cg; real f_glob; FILE *fp; /*Velocity vector of the center of gravity*/ static real Omega_CG[2]; static int i; DEFINE_EXECUTE_AT_END(exe_end) { real x_cg[n],f_glob[n],m_glob[n]; Domain *domain=Get_Domain(1); Thread *tf=Lookup_Thread(domain,6); usrloop(n,ND_ND) x_cg[n]=f_glob[n]=m_glob[n]=0; if (!Data_Valid_P()) return; Compute_Force_And_Moment(domain,tf,x_cg,f_glob,m_g lob,TRUE); t+=dtm; fp=fopen("udf.txt","a"); fprintf(fp,"%5f,%.8f\n",t,f_glob[2]); fclose(fp); } DEFINE_CG_MOTION(ssu, dt, cg_vel, cg_omega, time, dtime) { real delta_t; real freq = 2; real amp = 0.1; real omega; real vel; Domain *domain; Thread *tf; omega=2.0*3.143*freq; /* disp=-Asin(omega*t) */ /* vel =-A*omega*cos(omega*t) */ vel=-amp*omega*cos(omega*time); cg_vel[0]=0; cg_vel[1]=0; cg_vel[2]=vel; NV_S (cg_omega, =, 0.0); } I have received a syntax error after loading this UDF. Can someone please tell me what to do or if you can give a a better one. Thanks |
|
Tags |
3d body heave, udf for oscillating |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
water sloshing in oscillating tank (problem using udf Define_ZONE_MOTION) | Tamsu | Fluent UDF and Scheme Programming | 8 | November 24, 2021 01:11 |
Dynamic mesh udf for oscillating wall | QBeast | Fluent UDF and Scheme Programming | 3 | December 17, 2020 03:03 |
error in using a UDF to control the dynamic Mesh of a flexible oscillating Membrane | M201170944 | Fluent UDF and Scheme Programming | 1 | March 3, 2014 08:36 |
6dof udf for flying body | Mahmoud | Fluent UDF and Scheme Programming | 1 | January 21, 2014 04:58 |
fan driven flow, Fan BC validation (getting lost) | soonic | OpenFOAM Running, Solving & CFD | 0 | July 7, 2013 20:16 |