CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   the fluent was crashed and disapeared when run UDF (https://www.cfd-online.com/Forums/fluent-udf/147179-fluent-crashed-disapeared-when-run-udf.html)

hongfu2233 January 14, 2015 21:03

the fluent was crashed and disapeared when run UDF
 
#include"udf.h"
real vn=0.0;
FILE * fp;
DEFINE_CG_MOTION(dynamic_cylinder,dt,vel,omega,tim e,dtime)
{
vn=5*sin(5*time);
vel[1]=vn;
omega[2]=2;
}
DEFINE_EXECUTE_AT_END(execute_at_end)
{
int n;
fp=fopen("D:\\temp\\shiyan","a_v");
fprintf(fp,"% E\n",vn);
fclose(fp);
}
i want use the UDF above write a file to record the velocity data, but two problems puzzle me:

1 i have sucessfully compiled the UDF, but when i ran caculation the fluent was crashed, disapeared in the screen.(when i remove the macro DEFINE_EXECUTE_AT_END, the UDF run well)

2 i want the body move in vertical direction and rotate aroud its center simutaneously, but the coordinate of the body center is not (0,0), how should i do ?(2D caculation)
Could anyone can help me? many thanks in advance...

pakk January 15, 2015 06:01

What should the "a_v" do? I have never seen that before, if you want to append use "a".

hongfu2233 January 16, 2015 01:28

Quote:

Originally Posted by pakk (Post 527607)
What should the "a_v" do? I have never seen that before, if you want to append use "a".

thank you very much! pakk, i use "a" and tried again, but the "fatal error" appeares on occasion, sometimes it works well. i donot know y, wish me luck...

pakk January 16, 2015 03:55

Make sure that you don't have the file (D:\\temp\\shiyan) open in a different program. That's all I can say.

hongfu2233 January 18, 2015 03:07

Quote:

Originally Posted by pakk (Post 527779)
Make sure that you don't have the file (D:\\temp\\shiyan) open in a different program. That's all I can say.

Thanks for Ur reminding, pakk. i will check it again.


All times are GMT -4. The time now is 06:28.