CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   STAR-CCM+ (http://www.cfd-online.com/Forums/star-ccm/)
-   -   Field Function (http://www.cfd-online.com/Forums/star-ccm/109955-field-function.html)

 dwilson December 1, 2012 07:47

Field Function

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

 efmd3 December 1, 2012 15:15

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.

 dwilson December 1, 2012 17:13

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?

 LuckyTran December 2, 2012 05:44

Quote:
 Originally Posted by dwilson (Post 395209) 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.

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

 LuckyTran December 3, 2012 21:48

Quote:
 Originally Posted by badger1 (Post 395555) 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.

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?

 LuckyTran December 4, 2012 12:23

Quote:
 Originally Posted by badger1 (Post 395677) 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.

 All times are GMT -4. The time now is 05:43.