|
[Sponsors] |
Error with UDF in Fluent - UDF for parabolic developed velocity profile. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 4, 2021, 11:11 |
Error with UDF in Fluent - UDF for parabolic developed velocity profile.
|
#1 |
New Member
Arun Prasath M
Join Date: Mar 2021
Posts: 1
Rep Power: 0 |
Hello there,
I want to give a developed velocity profile at an inlet through a UDF for my problem. I'm using ANSYS 19.2 version and I couldn't find an option to enter expressions directly. So, I've written an UDF function which is supposed to provided a developed velocity profile at inlet instead of a uniform one. I'm not successful. I'm getting errors. I'm attaching all the necessary details. I need help. Please, go through the UDF code and the formula i'm using. Please, let me know if I'm doing anything wrong. Thanks. This is the formula I'm using for developed parabolic velocity at inlet. I found it through a tutorial. (https://youtu.be/LF06grv299A?t=449). Please, Let me know If I'm using wrong formula. Please, give me some more information for this formula. v = v_max*[1-((x^2 + y^2)/R^2)] (Image is also attached) Where R = Radius of the pipe r = Distance from the central axis UDF Code Code:
/*********************************************************************** vprofile.c ************************************************************************/ #include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; real y; face_t f; begin_f_loop(f,thread) { F_CENTROID(x, f, thread); F_PROFILE(f, thread, position) = 2.53*(1-((x*x+y*y)/(0.00775*0.00775))); } end_f_loop(f, thread) } Attached... Code:
cpp -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/main" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/addon-wrapper" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/io" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/species" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/pbns" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/numerics" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/sphysics" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/storage" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/mphase" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/bc" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/models" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/material" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/amg" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/util" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/mesh" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/udf" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/ht" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dx" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/turbulence" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/parallel" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/etc" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/ue" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dpm" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dbns" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/PRIME/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/multiport/src" -I. -DUDFCONFIG_H="<udfconfig-host.h>" "D:/Ansys pro/Agarwal et al/Test UDF/vprofile_new.c" Error: D:/Ansys pro/Agarwal et al/Test UDF/vprofile_new.c: line 18: parse error. cpp -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/main" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/addon-wrapper" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/io" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/species" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/pbns" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/numerics" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/sphysics" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/storage" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/mphase" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/bc" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/models" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/material" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/amg" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/util" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/mesh" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/udf" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/ht" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dx" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/turbulence" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/parallel" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/etc" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/ue" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dpm" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dbns" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/PRIME/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/SRM/AppData/Local/Temp/udfconfig-11380-node0.h>" "C:/Users/SRM/AppData/Local/Temp/vprofile_new.c.11380.0.c" Error: C:/Users/SRM/AppData/Local/Temp/vprofile_new.c.11380.0.c: line 18: parse error. cpp -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/main" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/addon-wrapper" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/io" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/species" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/pbns" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/numerics" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/sphysics" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/storage" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/mphase" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/bc" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/models" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/material" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/amg" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/util" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/mesh" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/udf" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/ht" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dx" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/turbulence" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/parallel" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/etc" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/ue" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dpm" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dbns" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/PRIME/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/SRM/AppData/Local/Temp/udfconfig-968-node1.h>" "C:/Users/SRM/AppData/Local/Temp/vprofile_new.c.968.1.c" Error: C:/Users/SRM/AppData/Local/Temp/vprofile_new.c.968.1.c: line 18: parse error. cpp -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/main" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/addon-wrapper" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/io" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/species" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/pbns" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/numerics" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/sphysics" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/storage" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/mphase" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/bc" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/models" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/material" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/amg" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/util" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/mesh" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/udf" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/ht" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dx" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/turbulence" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/parallel" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/etc" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/ue" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dpm" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dbns" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/PRIME/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/SRM/AppData/Local/Temp/udfconfig-3432-node2.h>" "C:/Users/SRM/AppData/Local/Temp/vprofile_new.c.3432.2.c" Error: C:/Users/SRM/AppData/Local/Temp/vprofile_new.c.3432.2.c: line 18: parse error. cpp -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/main" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/addon-wrapper" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/io" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/species" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/pbns" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/numerics" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/sphysics" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/storage" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/mphase" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/bc" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/models" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/material" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/amg" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/util" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/mesh" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/udf" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/ht" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dx" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/turbulence" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/parallel" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/etc" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/ue" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dpm" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/src/dbns" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/PRIME/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/SRM/AppData/Local/Temp/udfconfig-12804-node3.h>" "C:/Users/SRM/AppData/Local/Temp/vprofile_new.c.12804.3.c" Error: C:/Users/SRM/AppData/Local/Temp/vprofile_new.c.12804.3.c: line 18: parse error. Last edited by Arun_Prasath_M; April 4, 2021 at 11:21. Reason: added an image reference |
|
October 20, 2022, 21:46 |
|
#2 | |
New Member
Demetrio Pérez Vigueras
Join Date: Apr 2021
Posts: 1
Rep Power: 0 |
Quote:
If in F_PROFILE(f, thread, position) = 2.53*(1-((x*x+y*y)/(0.00775*0.00775))); want to use the x and y coordinates, then get them from the vector x by x=x[0], y=y[0]. #include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, position) { real cen[ND_ND]; real x,y,z; face_t f; begin_f_loop(f,thread) { F_CENTROID(cen, f, thread); x=cen[0]; y=cen[1]; z=cen[2]; F_PROFILE(f, thread, position) = 2.53*(1-((x*x+y*y)/(0.00775*0.00775))); } end_f_loop(f, thread) } |
||
Tags |
fluent - udf, parabolic profile, parabolic velocity, udf and programming |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for inlet velocity profile | Bollonga | Fluent UDF and Scheme Programming | 4 | June 29, 2021 05:40 |
UDF - Inlet Velocity Profile (Ansys Fluent) | vinayak4399 | Fluent UDF and Scheme Programming | 3 | August 25, 2020 15:15 |
Velocity profile reading in Fluent | mkpm | FLUENT | 0 | July 28, 2016 03:12 |
UDF error - parabolic velocity profile - 3D turbine | Zaqie | Fluent UDF and Scheme Programming | 9 | June 25, 2016 20:08 |
Patch fully developed velocity and turbulence profile over full domain | Teumde | FLUENT | 2 | June 29, 2015 14:47 |