CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Pulsed Source Term in OpenFOAM (https://www.cfd-online.com/Forums/openfoam-programming-development/233688-pulsed-source-term-openfoam.html)

taaresh01 February 7, 2021 12:51

Pulsed Source Term in OpenFOAM
 
Hello FOAMers!

I am trying to model a dimensionedScalar source term in a particular region of the mesh, which pulsates with time, i.e. this source term is a square wave which is ON for a period of t1 seconds, and then is OFF for the next t2 seconds, and so on. Let's say I want to simulate "p" pulses of this type. Basically, there is an associated frequency for this source. It also varies in space, but I think I can take care of that part. Could someone let me know how I can go about implementing this periodic (in time) source term?

PS - I am a novice at OF development at this point. Thank you in advance!

HPE February 7, 2021 15:17

I think you can scan the available fvOptions first. If not available, please modify the fvOption closest to your application. Function1 and PatchFunction1 for the time-variant ramp and square functions (and others) are available as well.

https://develop.openfoam.com/Develop...ources/derived


https://develop.openfoam.com/Develop...ions/Function1


Hope these can give a useful start for you.

taaresh01 February 7, 2021 17:32

Thank you @HPE. I'll take a look at these. I was actually able to implement it using a basic if/else structure by defining bool flags for the pulses (ON period) and gaps between pulses (OFF period). But it would be nice to see if I can use/modify some existing fvOptions functionality to do it in a better way.

Thank you!


All times are GMT -4. The time now is 18:35.