fluent的UDF,计算得到

Torque acting on a shaft is always an important quantity user often wants to caculate and monitor from a simulation. Fluent postprocessing REPORT panel allows users to report moment of the face acting on a face around a specified point. If a shaft is aligned with any of the X, Y or Z coordinates, then the torque acting on the shaft will be the same as the moment reported for the alligned axis. If the shaft is not aligned with any coordinates, user has to do some hand calculations. First, user must choose a moment center (any point that axis os the shaft passes through), then calculate torque using dot product of two vectors (the moment vector reported in the fluent console window and the shaft directional vector).

作用在轴上的扭矩一直是一个重要的量,用户经常想通过仿真来计算和监测。流畅的后处理报告面板允许用户报告脸部在指定点周围作用的瞬间。如果轴与任何X, Y或Z坐标对齐,那么作用在轴上的扭矩将与报告的已对齐轴的力矩相同。如果轴没有与任何坐标对齐,用户必须手工计算。首先,用户必须选择一个力矩中心(轴通过的任何点),然后使用两个矢量的点积(在fluent控制台窗口报告的力矩矢量和轴方向矢量)计算扭矩。

For many pump applications, as rotor rotates, the openning of the flow passage is changing as well. As a result, flow rate, torque and force acting on a rotor will change with time. During unsteady simulations, user often wants to monitor torque and force, and want to save such information in a file for future postprocessing.

对于许多泵的应用,当转子旋转时,流道的开度也会发生变化。因此,作用在转子上的流量、扭矩和力会随时间而变化。在非定常模拟过程中,用户往往希望监测扭矩和力,并希望将这些信息保存在文件中,以备将来进行后处理。

For such purpose, if the shaft is aligned with any coordinates, user can use Solve/Monitor/Force Monitor panel to monitor or save force or moment. For each force or moment, user has to define a separate monitor. If shafe is not alighed with coordinates or user wants to extract all force/moment information into a data file for any future use, the following udf can be used:

为此,如果轴与任何坐标对齐,用户可以使用Solve/Monitor/Force Monitor面板来监控或节省力或力矩。对于每个力或力矩,用户必须定义一个单独的监视器。如果shafe没有与坐标对齐,或者用户希望将所有力/力矩信息提取到一个数据文件中以备将来使用,可以使用以下udf:


/* the following udf will calculate force and torque acting on a shaft and write out all the information in a data file */

#include "udf.h"
#include "f_wall.h"
int flag=0;

DEFINE_ADJUST(adjust_torque, domain)
{
Thread *face_rotor,*face_inlet,*face_outlet;
face_t f;
FILE *fp;
real force_rotor[3],moment_rotor[3];
real point_rotor[3]={0.0, 0.0, 0.0}; /* Any point at shaft axis */
real axis_rotor[3] = {-3.42020143, 0.0, 9.3969262}; /* shaft axis directional vector */
real mag_rotor,torque_rotor,flowrate_inlet,flowrate_outlet;

face_rotor = Lookup_Thread(domain,NUM1); /* NUM1 is the rotor face ID number, can be found in the Define/Boundary Condition panel */
face_inlet = Lookup_Thread(domain,NUM2); /* NUM2 is the inlet face ID number, can be found in the Define/Boundary Condition panel */
face_outlet = Lookup_Thread(domain,NUM3); /* NUM3 is the outlet face ID number, can be found in the Define/Boundary Condition panel */

if ( flag !=N_TIME)
{

fp=fopen("report.dat","a+");
if(flag==0)
{
fprintf(fp,"time inlet_flow_rate outlet_flow_rate torque_rotor F_x F_y F_z n");
}
flag=N_TIME;

/* calcaulate torque/force acting on rotors */

Compute_Force_And_Moment (domain, face_rotor, point_rotor, force_rotor, moment_rotor,1);

mag_rotor = NV_MAG(axis_rotor);
NV_S (axis_rotor, *=, 1.0/mag_rotor);
torque_rotor = NV_DOT(moment_rotor, axis_rotor);

/* calculate the inelt and outlet mass flow rate */

flowrate_inlet = 0.0;
flowrate_outlet = 0.0;

begin_f_loop(f, face_inlet)
{
flowrate_inlet += F_FLUX(f, face_inlet);
}
end_f_loop(f, face_inlet)

begin_f_loop(f, face_outlet)
{
flowrate_outlet += F_FLUX(f, face_outlet);
}
end_f_loop(f, face_outlet)

fprintf(fp," %gt%gt%gt%gt%gt%gt%gt%gt%gt%gt%gn",CURRENT_TIME,flowrate_inlet,flowrate_outlet,
torque_rotor,force_rotor[0],force_rotor[1],force_rotor[2]);
Message(" time=%ft (s)",CURRENT_TIME);
Message(" force on the rotor=%ft%ft%fn",force_rotor[0],force_rotor[1],force_rotor[2]);
Message(" Moment on the rotor=%ft%ft%fn",moment_rotor[0],moment_rotor[1],moment_rotor[2]);
Message(" Torque on upper rotor=%fn",torque_rotor);
Message(" mass flow rate at inlet =%fn",flowrate_inlet);
Message(" mass flow rate at outlet =%fn",flowrate_outlet);
fclose(fp);
}

}

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值