|
[Sponsors] |
November 22, 2020, 23:06 |
UDF to calculate torque in 2D blade
|
#1 |
New Member
ijama
Join Date: Oct 2020
Posts: 2
Rep Power: 0 |
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 ); } |
|
November 23, 2020, 02:58 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Make sure to compile it ("build"), not interpret.
|
|
November 23, 2020, 09:21 |
|
#3 |
New Member
ijama
Join Date: Oct 2020
Posts: 2
Rep Power: 0 |
||
November 24, 2020, 01:55 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
And which error do you see exactly when you compile?
|
|
|
|
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 12:01 |
sharing code to calculate PMV, PPD and PD in fluent using UDF | simon02200059 | Fluent UDF and Scheme Programming | 2 | June 24, 2019 02:02 |
How to calculate number density in breakup rate UDF? | masoud.ravan | Fluent UDF and Scheme Programming | 0 | April 4, 2018 04:56 |
How to calculate torque of the shaft for turbines in CFD fluent simulation ? | jeevmech | FLUENT | 0 | September 25, 2016 00:30 |
UDF to calculate phase-averaged turbulence variables in a periodic flow | ShuangqingXu | Fluent UDF and Scheme Programming | 0 | October 27, 2011 00:48 |