# Field Function

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 1, 2012, 07:47 Field Function #1 New Member   anonymous Join Date: Dec 2012 Posts: 3 Rep Power: 5 I am looking to create a field function to turn velocity on an off with time. I want a pulsed input so that for a 1 second time step the velocity is 10m/s for the first 0.5 seconds and then zero from then on. Is there a way of having an if statement in a field function. if not I have this but wanted to know if this will give me the correct result for a field function called 'input': \$time < 0.5 1:0 then have a second field function that says: \$velocity * \$input which will then turn then velocity off after half a second. Thanks

 December 1, 2012, 15:15 #2 New Member   Eric Join Date: Dec 2012 Posts: 2 Rep Power: 0 yes, that will work Field function 1: \$Velocity = "10" Field function 2: \$Input = "(\$Time < 0.5) ? 1 : 0" Field function 3: \$Name = "\$Velocity*\$Input" However, depending on the problem you are trying to solve, you may not get the results you want. The momentum of the fluid would pull additional fluid in after shutting off a fan, making the inlet (at that time) more of a stagnation inlet. I do not know how to change the inlet from velocity to stagnation during a simulation or if you really even need to, but like I said, this all depends on the problem you are trying to solve.

 December 1, 2012, 17:13 #3 New Member   anonymous Join Date: Dec 2012 Posts: 3 Rep Power: 5 Ok thanks I will give it a go. I am trying to simulate a pulsed jet on an aerofoil so i have created an inlet on the surface and I am hoping to use this to turn the inlet velocity on and off at a given frequency. it would be good if it was a square wave input but I will see what I get out. is there any other way this can be done or is this the only option? Thanks for your help.

December 2, 2012, 05:44
#4
Senior Member

Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 1,338
Rep Power: 20
Quote:
 Originally Posted by dwilson is there any other way this can be done or is this the only option?
I think what is given here so far is great but:

A poor man's way of accomplishing it is to manually change the value at the appropriate time-step. Just edit the value of velocity in the boundary conditions after N time-steps and then keep iterating. This is easy to do if you only need to change the boundary conditions a few times. For example:

Run the simulation for 0.5 seconds with 10 m/s. Then change the velocity to 0 m/s and keep running the simulation. You will need to know how many time-steps are needed.

Last edited by LuckyTran; December 3, 2012 at 21:48.

 December 3, 2012, 17:15 #5 Member   anonymous Join Date: Dec 2012 Posts: 33 Rep Power: 5 will that enable the simulation to model the flow as the input changes or will it just be a result for the flow with it on then a seperate result for it off? thanks

December 3, 2012, 21:48
#6
Senior Member

Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 1,338
Rep Power: 20
Quote:
 Originally Posted by badger1 will that enable the simulation to model the flow as the input changes or will it just be a result for the flow with it on then a seperate result for it off? thanks
It will be input change if you are running a transient simulation. You are running a transient simulation correct?

If you are running a steady state simulation then it will be two separate simulations of flow on or flow off.

 December 4, 2012, 08:05 #7 Member   anonymous Join Date: Dec 2012 Posts: 33 Rep Power: 5 Yes I am. Is this just set from the physics continum by setting unsteady as opposed to steady and then setting the time step and other condtions?

December 4, 2012, 12:23
#8
Senior Member

Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 1,338
Rep Power: 20
Quote:
 Originally Posted by badger1 Yes I am. Is this just set from the physics continum by setting unsteady as opposed to steady and then setting the time step and other condtions?

The time-step size is found in solvers => implicit unsteady => time-step

Then set your boundary conditions in region => boundaries =>
This is the velocity you will change later

Set the appropriate number of iterations per time-step in stopping criteria (maximum inner iterations). You can probably leave this at the default 20 iterations / step.

You can setup the transient simulation to stop iterating by setting the other stopping criteria. Either maximum physical time or maximum steps (or both). This way you can setup the simulation to stop iterating at your 0.5s so that you can change the velocity.

Those are the most important ones. Remember to set/change your discretization schemes as you like.

 Tags field, frequency, function, pulsed, velocity

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post alessio.nz OpenFOAM 6 December 23, 2015 15:27 Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20 riesotto OpenFOAM 50 May 26, 2014 01:47 nzy102 OpenFOAM Bugs 14 January 10, 2012 09:53 sailor FLUENT 0 April 13, 2011 03:45

All times are GMT -4. The time now is 11:12.