|
[Sponsors] |
June 20, 2015, 04:12 |
UDF defining transient boundary condition
|
#1 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
Hello,
I'm trying to develop a UDF for defining the fluid velocity in the inlet boundary condition. However, the velocity is transient, and at each time step the velocity profile is defined by a polynomial. For example: v(time_step_0)=-1.0988e4x^2-27x-0.0155 v(time_step_1)=-8.82e3x^2-18.93x-0.01 etc. I have a matrix of coefficients where each column suits to the polynomial's coefficients of each time step. I would appreciate some orientation concerning to how to develop the UDF. Thanks a lot! |
|
June 23, 2015, 11:31 |
|
#2 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
Someone could give me a hint?
|
|
June 23, 2015, 11:41 |
|
#3 | |
New Member
Join Date: Jun 2015
Posts: 7
Rep Power: 10 |
You need to define an UDF, a C code for example and define it in fluent. Your scripts needs to look like something like this:
Quote:
|
||
June 23, 2015, 11:54 |
|
#4 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
Hi Llume!
Maybe I didn't explain myself correctly. I have a polynomial for each time step, I do not have a function v=f(position,time)! My aim is to develop a UDF where: - At time step 1: v= 2x^2+3x+1 - At time step 2: v=4x^2+4x+1 - At time step 3: v= ... Thanks! |
|
June 23, 2015, 12:00 |
|
#5 |
New Member
Join Date: Jun 2015
Posts: 7
Rep Power: 10 |
The process would be the same, you need only to use an "if" to check at which timestep the simulation is and change the way the condition is evaluated accordingly, you can check the subsection "Fluent UDF and Scheme Programming" of this forum to see other examples.
This post has an UDF that could be a good starting point for you: http://www.cfd-online.com/Forums/flu...llel-mode.html |
|
July 8, 2015, 12:23 |
|
#6 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
Hello everybody,
finally I have succed on the UDF development. I copy here the UDF with the aim to help somebody in the future: /************************************************** ************* ******** UDF for specifying steady-state velocity profile boundary condition ************************************************** ************** ********/ #include "udf.h" DEFINE_PROFILE(unsteady_velocity_profile, t, i) { double coef_matrix[3][4]; face_t f; int j; double xy[ND_ND]; int curr_ts; /*Manually copied data from MATLAB, must be automatized*/ coef_matrix[0][0]=-1.0988E4; coef_matrix[1][0]=26.53; coef_matrix[2][0]=0.; coef_matrix[0][1]=-8.83E3; coef_matrix[1][1]=-18.9; coef_matrix[2][1]=-0.01; coef_matrix[0][2]=-6.65E3; coef_matrix[1][2]=-11.33; coef_matrix[2][2]=-0.0047; coef_matrix[0][3]=-4.49E3; coef_matrix[1][3]=-3.74; coef_matrix[2][3]=7.33E-4; begin_f_loop(f, t) { curr_ts = N_TIME; F_CENTROID(xy,f,t); F_PROFILE(f,t,i)=-(coef_matrix[0][curr_ts]*(xy[1]+4E- 6)*(xy[1]+4E-6)+coef_matrix[1][curr_ts]*(xy[1]+4E- 6)+coef_matrix[2][curr_ts]); } end_f_loop(f, t) } Each column of the matrix is a time step and each row is a polynomial's coefficient. See you. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wind turbine simulation | Saturn | CFX | 58 | July 3, 2020 01:13 |
Define_profile UDF for Transient Heat flux boundary condition | Amoljoshi | Fluent UDF and Scheme Programming | 2 | June 20, 2018 21:55 |
Using Transient Boundary condition | raamek | FLUENT | 1 | September 23, 2014 11:00 |
UDF for inhomogenous Neumann boundary condition | akhilesh | Fluent UDF and Scheme Programming | 3 | December 24, 2012 11:14 |
transient simulation of a rotating rectangle | icesniffer | CFX | 1 | August 8, 2009 07:25 |