CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Need help regarding 6DOF udf with face loop

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 28, 2021, 04:48
Default
  #21
New Member
 
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 7
burhanibrar is on a distinguished road
Quote:
Originally Posted by obscureed View Post
Hi Burhan,
Well done resolving the issues. Just to help people who visit this thread in future, please could you post a working version of your code? Thanks.
Ed
Sure!

/************************************************** *****
SDOF property compiled UDF with external forces/moments
************************************************** *****/
#include "udf.h"

static real acc = 4.631;
static real mass = 5;
static real velocity, vel, area_tot, area[3];




DEFINE_SDOF_PROPERTIES(acce, prop, dt, time, dtime)
{


prop[SDOF_MASS] =5;
prop[SDOF_IXX] = 8.333e-4;
prop[SDOF_IYY] = 4.1667e-3;
prop[SDOF_IZZ] = 5.2e-5;
prop[SDOF_ZERO_TRANS_X] = False;/* boolean, allow translation in x-direction */
prop[SDOF_ZERO_TRANS_Y] = True; /* boolean, suppress translation in y-direction */
prop[SDOF_ZERO_TRANS_Z] = True; /* boolean, suppress translation in z-direction */
prop[SDOF_ZERO_ROT_X] = True; /* boolean, suppress rotation around x-axis */
prop[SDOF_ZERO_ROT_Y] = True; /* boolean, suppress rotation around y-axis */
prop[SDOF_ZERO_ROT_Z] = False; /* boolean, allow rotation around z-axis */


{
#if !RP_HOST

Thread *t;
face_t f;

Domain *domain;
int nid;
domain = THREAD_DOMAIN (DT_THREAD (dt));
nid = THREAD_ID (DT_THREAD (dt));
t = Lookup_Thread (domain, nid);

velocity=0.0;
area_tot=0;

#endif

/*t = DT_THREAD(dt);*/
/*NV_S(A, =,0.0);*/


#if !RP_HOST
begin_f_loop(f, t)
if (PRINCIPAL_FACE_P(f, t))
{
F_AREA(area,f,t);
area_tot += NV_MAG(area);
velocity += F_U(f, t)*NV_MAG(area);
}
end_f_loop(f, t)



/*area_tot=PRF_GRSUM1(noface);
velocity=PRF_GRSUM1(velocity);*/
#if RP_NODE
area_tot = PRF_GRSUM1(area_tot);
velocity = PRF_GRSUM1(velocity);
/*vel = velocity/area_tot;*/

/*Message0("\nV1 %f Area Total %f /n",vel, area_tot);*/
#endif /*RP_NODE*/

#endif /*!RP_HOST*/
/* Pass the node's total area and Velocity to the Host for averaging */
node_to_host_real_2(area_tot,velocity);

#if !RP_NODE
vel = velocity/area_tot;
Message("Total Area: %f (m2)\n",area_tot);
Message("Averaged Velocity of the Guide Rail %f (N)\n",vel);

#endif /* !RP_NODE */
burhanibrar is offline   Reply With Quote

Reply

Tags
6dof, face loop

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF ——wrong on the thread or cell loop? Steve-Tian Fluent UDF and Scheme Programming 2 April 21, 2019 21:39
Fluent UDF for Micro Flow Face Slip Velocity daniel_george_carter Fluent UDF and Scheme Programming 0 May 12, 2013 05:39
UDF for Heat Exchanger model francois louw FLUENT 2 July 16, 2010 02:21
I want to use pressure of 1 face in udf that compiled on other face iman_1844 Fluent UDF and Scheme Programming 3 June 10, 2010 12:55
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 15:57


All times are GMT -4. The time now is 06:59.