We’re putting the final touches on our new badges platform. Badge issuance remains temporarily paused, but all completions are being recorded and will be fulfilled once the platform is live. Thank you for your patience.

Ansys Learning Forum Forums Discuss Simulation Fluids Need help in 6dof udf with a face loop Reply To: Need help in 6dof udf with a face loop

Burhan Ibrar
Subscriber
Hello sdeb thank you so much for your reply and it helped me a lot. But i have a problem where i am using overset model and now what i did that i define the motion on walls and for overset fluid domain i defined relative motion and UDF with only properties e.e mass, rotation and translation. Is this the right way to do it because when i define the same udf with motion on both then i get errors.
2nd thing is that i have attached the code below when i used my calculation for (#if !RP_HOST) and solving it parallel but in results i have variable output 6 times and every variable has a different value. If you can help me to get the one value which should be equal to the one we can see in dynamic mesh window. What i understood from manual that all variable values which i see in console are from different nodes and now i want to let them communicate so get the right value which i do not know yet.
And for writing a file with variables like time and velocity should i also use #if !RP_HOST or #if RP_NODE, etc.?
your help will really appreciated. thank you.

/*******************************************************
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

#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
vel = velocity/area_tot;

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

#endif