|
[Sponsors] |
a udf of rotating by DEFINE_ZONE_MOTION & Compute_Force_And_Moment:access violation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 6, 2015, 08:55 |
a udf of rotating by DEFINE_ZONE_MOTION & Compute_Force_And_Moment:access violation
|
#1 |
New Member
ender
Join Date: May 2015
Posts: 1
Rep Power: 0 |
Hi everyone,
I want to simulate a turbine's rotation in free stream and write the udf as below: #include "udf.h" #include "f_wall.h" static real theta=0.0; static real omega_calc=0.0; int flag=0; DEFINE_ZONE_MOTION(turbinemotion,omega,axis,origin ,velocity,time,dtime) { const real inertia =1.38; Domain *small=Get_Domain(3); Thread *face_rotor=Lookup_Thread(small,9); real force_rotor[ND_ND],moment_rotor[ND_ND]; real point_rotor[ND_ND]; real axis_rotor[3]={0.0, 0.0, 1.0}; /* shaft axis directional vector */ real torque_rotor; real torque,domega,omega_prev,omega_dot,omega_out,power ; FILE *fd; int i; for(i=0;i<=ND_ND;i++) { force_rotor[i]=0; moment_rotor[i]=0; point_rotor[i]=0; } Message ("\npoint2 %f\n ", theta) ; /* Problem occurs on the line below */ Compute_Force_And_Moment(small,face_rotor,point_ro tor,force_rotor,moment_rotor,1); Message ("\npoint3 %f\n ", theta) ; torque_rotor=NV_DOT(moment_rotor,axis_rotor); torque=torque_rotor; domega=dtime*torque/inertia; omega_dot=torque/inertia; omega_prev=omega_calc; omega_calc=omega_calc + domega; omega_out=omega_calc; theta=theta+0.5*dtime*(omega_prev+omega_calc); power=torque*omega_out; Message ("\npoint4 %f\n ", theta) ; N3V_D (velocity,=,0.0,0.0,0.0); N3V_D(axis,=,0.0,0.0,1.0); if ( flag !=N_TIME) { fd=fopen("data.txt","a+"); if(flag==0) { fprintf(fd,"time torque omega theta power\n"); } flag=N_TIME; fprintf(fd," %g %g %g %g %g\n",CURRENT_TIME,torque,omega_out,theta,power); fclose(fd); } Message ("\nomega: %f\n ", omega_out) ; Message ("\n---------------------------------------\n"); *omega=omega_out; } This udf can be compiled by fluent. When I run the simulation an 'access violation' error occured as shown in attached. Now I can confirm that the problem is on the function Compute_Force_And_Moment (see udf /* Problem occurs on the line below */ ), but I don't know how to correct it. Can anybody give me some suggestions? Thanks in advance. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
udf access violation | seanread | Fluent UDF and Scheme Programming | 8 | April 3, 2024 12:05 |
UDF for pitching and rotating airfoil | guidofrate | Fluent UDF and Scheme Programming | 0 | November 20, 2014 08:32 |
UDF segmentation violation error | be89 | Fluent UDF and Scheme Programming | 1 | December 21, 2012 03:07 |
Dynamic mesh for rotating wall - UDF ? | Tobard | FLUENT | 1 | April 28, 2011 18:00 |
UDF Access violation | therandomestname | FLUENT | 0 | April 15, 2011 17:31 |