UDF defining transient boundary condition

 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 20, 2015, 04:12 UDF defining transient boundary condition #1 Senior Member   Jordi Pina Join Date: Mar 2015 Posts: 157 Rep Power: 3 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: 3 Someone could give me a hint?

June 23, 2015, 11:41
#3
New Member

Join Date: Jun 2015
Posts: 7
Rep Power: 3
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:
but you need to specify also a dependency on the position of the center of the faces where you want to specify the inlet condition if you wish to do so. To understand the code and how to modify it to include this you should refer to the UDF manual.

 June 23, 2015, 11:54 #4 Senior Member   Jordi Pina Join Date: Mar 2015 Posts: 157 Rep Power: 3 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: 3 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: 3 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.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Saturn CFX 45 February 8, 2016 05:42 raamek FLUENT 1 September 23, 2014 11:00 Amoljoshi Fluent UDF and Scheme Programming 1 May 9, 2014 11:17 akhilesh Fluent UDF and Scheme Programming 3 December 24, 2012 12:14 icesniffer CFX 1 August 8, 2009 07:25

All times are GMT -4. The time now is 11:15.