Compute force and moment in your UDF

YasserSelimaYasserSelima Member Posts: 4


As I see many questions regarding calculating force and/or moment on a rigid body, I would like to share my experience with a non-documented function defined in wall.h. The function is Compute_Force_And_Moment . For some mysterious reason, the function is not documented in the UDF manual .. but the theory guide includes the equations for calculating the force and moment on a wall.

First you need to get the domain .. only one domain in single phase. If you have two phase flow, calling this with domain(2) will get the forces of the fluid defined as domain (2) ... (3) for the forces of fluid defined in domain 3. I tested this and the sum is equal to the mixture domain force (domain 1). Get the domain by:

Domain *d = Get_Domain(1);  

Then get the pointer on the thread you want to calculate force/ moment on. "ID" is an integer which you get from the boundary conditions. Say turbine_wall, you will find its id number listed

Thread *t_object = Lookup_Thread(d, ID);

now make placeholders for the variables

double force[ND_ND], moment[ND_ND], cg[ND_ND];

Now call the function ... TRUE is when you call it by HOST and NODES ... FALSE when you call it by NODES only.

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

now force[0] , force[1] and force[2] if you have 3D, are the forces in the x, y and z directions.

same for moment[0] .... etc.


This discussion has been closed.