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

i need a help! thanks

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 17, 2009, 08:01
Default i need a help! thanks
  #1
New Member
 
fengzhipeng
Join Date: Mar 2009
Posts: 4
Rep Power: 17
zhipengfeng is on a distinguished road
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
}
zhipengfeng is offline   Reply With Quote

Reply

Tags
help me


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



All times are GMT -4. The time now is 17:40.