CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Square Wave Profile (

manish mehta June 18, 2005 23:30

Square Wave Profile
Dear All,

How do I generate a square wave profile for a pressure inlet boundary condition? I tried FFT but there are some problems with this. I need this to be a discontinous flow, because my pressure needs to have a square profile from 0 psi to 180 psi. I do not know how to write this as a UDF code. Can someone please help me?

Thanks. Manish

david June 20, 2005 10:40

Re: Square Wave Profile
Hi, I've incluced a modified version of a UDF I used to prescribe a time-dependent velocity at the inlet of a pipe. I've modified it quickly so check for errors.

To use this, either interpret or compile this UDF and go to define/boundary-conditions. Choose the face on which you want to use the pressure pulse and choose the UDF named "pressurepulse" in this case.

If you need more details, let me know.

Regards, David ---------------------------------------------------

#include "udf.h"

DEFINE_PROFILE(pressurepulse, thread, position) { real x[ND_ND]; float t, velocity,w,y,z; face_t f;

t = RP_Get_Real("flow-time"); w=floor (t); z=t-w;/* z is ranging from 0 to 1 in this case but the time variable could be modified */

if (z<0.4) pressure = 0; else pressure =180;

begin_f_loop(f, thread) {


y = x[1];

F_PROFILE(f, thread, position) = pressure;

} end_f_loop(f, thread)


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