CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Square Wave Profile (https://www.cfd-online.com/Forums/fluent/36985-square-wave-profile.html)

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) {

F_CENTROID(x,f,thread);

y = x[1];

F_PROFILE(f, thread, position) = pressure;

} end_f_loop(f, thread)

}

Islam Hassan July 4, 2019 20:02

Re: Square Wave Profile
 
Thanks David,

I have question regarding your UDF, how can I change the requecy in your code like if I need to create square wave from 0 to 90 PSI, and 90 PSI from 0 to 0.5 sec and it is 0 from 0.5 to 1., asn so on.

thanks in advance


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