CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   i need a help! thanks (https://www.cfd-online.com/Forums/fluent/62692-i-need-help-thanks.html)

zhipengfeng March 17, 2009 08:01

i need a help! thanks
 
hello,guys .I want to compute force and moment on one face by parrallel udf , who can help me rewrite this udf and thank you very much:
#include "udf.h"
#include "mem.h"
#include "f_Wall.h"
#include "unsteady.h"
#include "stdlib.h"
#include "stdio.h"
DEFINE_EXECUTE_AT_END(execute_at_end)
{
int time_N;
real f_car1[3],m_car1[3],x_cg_car1[3];
#if !RP_HOST
face_t f;
cell_t c;
real current_time=RP_Get_Real("flow-time");
time_N=RP_Get_Integer("time-step");
#endif

#if !RP_NODE
FILE *fp1,*fp2,*fp3,*fp4,*fp5,*fp6;
#endif


Domain *domain=Get_Domain(1);
Thread *car1=Lookup_Thread(domain,7);
/* current_time=CURRENT_TIME;*/
real velocity=40;
real x_car1=772.7;
/*----------------------------------*/
f_car1[0]=0.0;
f_car1[1]=0.0;
f_car1[2]=0.0;
m_car1[0]=0.0;
m_car1[1]=0.0;
m_car1[2]=0.0;

x_cg_car1[0]=0;
x_cg_car1[1]=188.2;
x_cg_car1[2]=-1.3;
x_cg_car1[0]=x_car1+velocity*(current_time);
Compute_Force_And_Moment (domain,car1,x_cg_car1,f_car1,m_car1,TRUE);

/*-------------------------------------------------------------------------------*/
#if !RP_NODE
fp1=fopen("car1_Fx.txt","a+");
fprintf(fp1, "%15.4f\t%d\n", f_car1[0],time_N);
fclose(fp1);
fp2=fopen("car1_Fy.txt","a+");
fprintf(fp2, "%15.4f\t%d\n", f_car1[1],time_N);
fclose(fp2);
fp3=fopen("car1_Fz.txt","a+");
fprintf(fp3, "%15.4f\t%d\n", f_car1[2],time_N);
fclose(fp3);
fp4=fopen("car1_Mx.txt","a+");
fprintf(fp4, "%15.4f\t%d\n", m_car1[0],time_N);
fclose(fp4);
fp5=fopen("car1_My.txt","a+");
fprintf(fp5, "%15.4f\t%d\n", m_car1[1],time_N);
fclose(fp5);
fp6=fopen("car1_Mz.txt","a+");
fprintf(fp6, "%15.4f\t%d\n", m_car1[2],time_N);
fclose(fp6);
#endif
}


All times are GMT -4. The time now is 09:37.