|
[Sponsors] |
October 27, 2017, 12:01 |
Fluent UDF varying both in time and space
|
#1 |
New Member
Micah G Bullock
Join Date: May 2016
Location: Houston
Posts: 8
Rep Power: 10 |
Hello all,
I'm planning to study the transient response of turbulence models in pulsatile flow. In order to do so, I would like to set up a UDF boundary condition that varies in both time and space. Initially, my geometry will be a simple 2D channel. I would like to program the following UDF Boundary Condition on the inlet: Pf (x, t) = DeltaP0[1 + a cos(w t + pi/2)]x/L_x where x/L_x is zero at the center line and 1 at the channel wall. I have successfully programmed a UDF Boundary condition dependent on just time, but I don't know how to incorporate the spacial dependency in the code. I have very limited programming experience with C. Does someone on these forums know how to write such a function? Any help would be appreciated. Here is the code I have been using (dime dependent, uniform in space) #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) = 0.00017-0.00017*cos(6.28319*t); } end_f_loop(f, thread) } Thanks in advance! |
|
October 28, 2017, 07:18 |
|
#2 |
Member
Jaesan Yoon
Join Date: Sep 2017
Posts: 36
Rep Power: 9 |
This is part of UDF which I have used before.
x[ND_ND] means spatial variables in grid. If u use that variable correctly, u can present your one DEFINE_SOURCE(zmomu_source, cell, thread, dS, eqn) { /* plasma source constant */ real x[ND_ND]; real source; source = 0; C_CENTROID(x, cell, thread); thrust = 0.02; /* thrust value (N/m) */ /* Plasma region set up */ b_bottom = 0; b_left = 0; rat3 = thrust/0.015; rat4 = thrust/0.015; xmax = 0.005*pow(rat3, 0.33);/*0.001*(0.667e-3*(V+V0) - 1.333);*/ lamda = 1.2*xmax; ymax = 0.0013*pow(rat4, 0.33);/*0.001*(0.167e-3*(V+V0) - 0.333);*/ lmax = 0.02; b_x = 0.3-lmax; check_bottom = b_bottom; check_left = b_left; check_top = b_bottom + ymax; check_right = b_left + xmax; check_minx = b_x; check_maxx = check_minx + lmax; /*xs = b_left;*/ ys = b_bottom; /*C_CENTROID(x, cell, thread);*/ /* Apply source term to region inside the four inequalities */ if ((x[1]>=check_bottom)&&(x[1]<=check_top)&&(x[0]>=check_minx)&&(x[0]<=check_maxx)) { for(i=0; i<=40; i++) { if((x[2]>=(check_left+lamda*i))&&(x[2]<=(check_right+lamda*i))) { A1 = (9.86)/(4*xmax*ymax); xs = check_left + 0.01*i; source = thrust*A1*sin(3.14159*(x[3]-xs)/xmax)*cos(3.14159*(x[1]-ys)/(2*ymax)); dS[eqn] = 0; } if((x[2]<=(check_left+lamda*(i+1)))&&(x[2]>=(check_left-xmax+lamda*(i+1)))) { A1 = (9.86)/(4*xmax*ymax); xs = check_left - xmax + lamda*(i+1); source = -thrust*A1*sin(3.14159*(x[3]-xs)/xmax)*cos(3.14159*(x[1]-ys)/(2*ymax)); dS[eqn] = 0; } /*else{ source = 0; dS[eqn] = 0; }*/ } } else { source = 0; dS[eqn] = 0; } return source; } |
|
Tags |
boundary condition, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF program for gaussian distribution in space, time and both | khattaksadia | Fluent UDF and Scheme Programming | 0 | April 18, 2017 02:39 |
space and time varying conditions | laurentD | OpenFOAM Running, Solving & CFD | 0 | July 28, 2015 12:34 |
Time and space varying source term | Rajarshi | OpenFOAM | 3 | June 13, 2012 18:29 |
Boundary condition varying in space and time | jasouza1974 | OpenFOAM | 0 | January 17, 2012 10:06 |
UDF for C_VOF variation with time and space | Frederik | FLUENT | 4 | December 19, 2005 01:53 |