CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF for transient pressure outlet boundary from data array (https://www.cfd-online.com/Forums/fluent/153642-udf-transient-pressure-outlet-boundary-data-array.html)

nathanblank May 31, 2015 08:21

UDF for transient pressure outlet boundary from data array
 
I'm trying to simulate flow through an engine airbox with four intake runners. From 1D engine simulation software, I have generated arrays of pressure [Pa] at each intake runner ever 5 deg of crank angle (about 9.8e-5 second time steps) for 720 deg of rotation. The data looks something like this

0 88972.9
5 95712.1
10 102007
15 107885 and so on to 720...

I would like to use this data as pressure outlet boundary conditions in a transient simulation. A separate one for each of the four intake runners.

From what I've gathered, this requires a UDF to read in the array. Unfortunately I know NOTHING about C programming - don't even know what "program" you use to write it, or if you just use Notepad? I'm fairly well versed in MATLAB, but it's obviously different. I've seen the examples, for using a function to apply the BC (shown below), but I'd like to read a data array. I would really appreciate the help if someone could show me how to do this?

/************************************************** ********************
unsteady.c UDF for specifying a transient pressure profile boundary condition ************************************************** *********************/
#include "udf.h"

DEFINE_PROFILE(unsteady_pressure, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = 101325.0 + 5.0*sin(10.*t);
}
end_f_loop(f, thread)
}

jpina June 1, 2015 03:09

Dear nathanblank,

I'm currently facing the same problem.

My only idea is to fit a polynomial and use it in each time step. I mean, for time step one the boundary condition is the polynomial one; for time step two, the boundary condition is the polynomial two, etc.

However, I don't feel very comfortable with my idea since precision is lost when fitting curves to experimental data.

I will keep an eye on this thread and please, if you solve or you have some idea concerning to your (our) problem, please share it here.


All times are GMT -4. The time now is 09:46.