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

UDF to calculate torque in 2D blade

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   November 22, 2020, 22:06
Default UDF to calculate torque in 2D blade
  #1
New Member
 
ijama
Join Date: Oct 2020
Posts: 2
Rep Power: 0
ijama is on a distinguished road
Hello,

I would like to seek help on making udf to calculate the torque (from pressure and viscous force) acting on a 2D blade. I know that the value can be easily obtained using Monitor but I need to get the torque value for each time-step so I can use it to adjust the angular velocity later(not in the code yet). I keep on getting error on line 30 "NV_S(force_v, =, F_STORAGE_R_NV(f,t,SV_WALL_SHEAR),*,-1.0);".

I pasted the code below, thank you in advance for your help.

# include "udf.h"

DEFINE_EXECUTE_AT_END(torque_time)
{
Domain *d = Get_Domain(1);
Thread *t = Lookup_Thread(d,5);
face_t f;
real NV_VEC(A);
real NV_VEC(force_p);
real NV_VEC(force_v);
real NV_VEC(torque_p);
real NV_VEC(torque_v);
real x[ND_ND];
real NV_VEC(radius);
real NV_VEC(torque_final);
real tor;
NV_S(force_p,= ,0.0);
NV_S(force_v,=,0.0);
NV_S(torque_final,=,0.0);
NV_S(torque_p,=,0.0);
NV_S(torque_v,=,0.0);

begin_f_loop(f,t)
{
F_AREA(A,f,t);
F_CENTROID(x,f,t);
NV_S(force_p,= , F_AREA(A,f,t), * , F_P(f,t));
NV_D(radius,= ,x[0],x[1],x[2]);
NV_CROSS(torque_p,radius,force_p);
NV_S(force_v, =, F_STORAGE_R_NV(f,t,SV_WALL_SHEAR),*,-1.0);
NV_CROSS(torque_v,radius,force_v);

NV_VV(torque_final,= ,torque_final,+, torque_p,+,torque_v);
tor= NV_MAG(torque_final);
}
end_f_loop(f,t)

printf("Torque is = %g", tor );
}
ijama is offline   Reply With Quote

 


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF for multiphase species transport (calculate the thread face temperature and press sajaalrifai Fluent Multiphase 10 March 5, 2020 11:01
sharing code to calculate PMV, PPD and PD in fluent using UDF simon02200059 Fluent UDF and Scheme Programming 2 June 24, 2019 01:02
How to calculate number density in breakup rate UDF? masoud.ravan Fluent UDF and Scheme Programming 0 April 4, 2018 03:56
How to calculate torque of the shaft for turbines in CFD fluent simulation ? jeevmech FLUENT 0 September 24, 2016 23:30
UDF to calculate phase-averaged turbulence variables in a periodic flow ShuangqingXu Fluent UDF and Scheme Programming 0 October 26, 2011 23:48


All times are GMT -4. The time now is 20:24.