|
[Sponsors] |
UDF ramping inlet velocity for steady simulation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 7, 2024, 11:12 |
UDF ramping inlet velocity for steady simulation
|
#1 | |
New Member
F. Lang
Join Date: Sep 2019
Location: Germany
Posts: 3
Rep Power: 7 |
Hello everyone,
I am trying to define a UDF to ramp up an inlet velocity for a steady simulation after a set amount of iterations. However I am getting a parse error when trying to access the iteration number via nres: Code:
int current_iter = (nres == 0) ? (0) : ((int) count2[nres - 1]); Quote:
Thanks Full UDF-code below: Code:
/****************************************************************** UDF for specifying ramping velocity profile BC *******************************************************************/ #include "udf.h" DEFINE_PROFILE(velocity_magnitude, t, i) { real start_velocity,end_velocity; int ramp_start,ramp_end; real line_slope,line_intercept; face_t f; start_velocity=0.0; // starting & end velocity [m/s] end_velocity=10.0; ramp_start=10; // ramp start & end timestep [-] ramp_end=1000; int current_iter = (nres == 0) ? (0) : ((int) count2[nres - 1]); // current iteration line_slope = (end_velocity-start_velocity)/(ramp_end-ramp_start); line_intercept = start_velocity-line_slope*ramp_start; begin_f_loop(f,t) { if (current_iter<ramp_start) // velocity before ramp [m/s] { F_PROFILE(f,t,i) = 0.0; } else if (current_iter>=ramp_start && current_iter<=ramp_end) // ramping velocity { F_PROFILE(f,t,i) = line_slope*current_iter+line_intercept; } else { F_PROFILE(f,t,i) = end_velocity; } } end_f_loop(f,t) } |
||
June 21, 2024, 18:33 |
|
#2 |
New Member
hasnaa hasnaa
Join Date: Jun 2024
Posts: 5
Rep Power: 2 |
I am doing a CFD study on an electric car.
Currently, I am in the setup phase. I tried to integrate solar radiation using a function in the "User Defined" interface with C code. I tried to use the "Interpreted" extension, but I still encounter an error. When I try to use the "Compiled" extension, another error occurs. Can you send me an example of a udf function that you have already used in your studies and that can be used in ansys? Thank you in advance for your he |
|
Tags |
fluent - udf, inlet bc, velocity bc |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ramping velocity inlet for ship simulation | antoineh | OpenFOAM Running, Solving & CFD | 6 | July 5, 2024 05:44 |
Problem using UDF for velocity inlet | panasonic18 | Fluent UDF and Scheme Programming | 2 | June 13, 2018 03:59 |
Udf to measure radius of inlet as it changes - FSI simulation | DamR | Fluent UDF and Scheme Programming | 0 | December 28, 2016 03:54 |
3D velocity inlet UDF | zumaqiong | Fluent UDF and Scheme Programming | 2 | October 24, 2016 05:44 |
UDF: Change boundary condition. Velocity inlet to pressure inlet at time "t" | jpina | FLUENT | 10 | April 11, 2015 15:19 |