CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > STAR-CCM+

Field Function

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 1, 2012, 07:47
Default Field Function
  #1
New Member
 
anonymous
Join Date: Dec 2012
Posts: 3
Rep Power: 5
dwilson is on a distinguished road
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
dwilson is offline   Reply With Quote

Old   December 1, 2012, 15:15
Default
  #2
New Member
 
Eric
Join Date: Dec 2012
Posts: 2
Rep Power: 0
efmd3 is on a distinguished road
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.
efmd3 is offline   Reply With Quote

Old   December 1, 2012, 17:13
Default
  #3
New Member
 
anonymous
Join Date: Dec 2012
Posts: 3
Rep Power: 5
dwilson is on a distinguished road
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.
dwilson is offline   Reply With Quote

Old   December 2, 2012, 05:44
Default
  #4
Senior Member
 
Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 1,291
Rep Power: 20
LuckyTran will become famous soon enough
Quote:
Originally Posted by dwilson View Post
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.
LuckyTran is offline   Reply With Quote

Old   December 3, 2012, 17:15
Default
  #5
Member
 
anonymous
Join Date: Dec 2012
Posts: 33
Rep Power: 5
badger1 is on a distinguished road
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
badger1 is offline   Reply With Quote

Old   December 3, 2012, 21:48
Default
  #6
Senior Member
 
Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 1,291
Rep Power: 20
LuckyTran will become famous soon enough
Quote:
Originally Posted by badger1 View Post
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.
LuckyTran is offline   Reply With Quote

Old   December 4, 2012, 08:05
Default
  #7
Member
 
anonymous
Join Date: Dec 2012
Posts: 33
Rep Power: 5
badger1 is on a distinguished road
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?
badger1 is offline   Reply With Quote

Old   December 4, 2012, 12:23
Default
  #8
Senior Member
 
Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 1,291
Rep Power: 20
LuckyTran will become famous soon enough
Quote:
Originally Posted by badger1 View Post
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?
Correct, use unsteady and set your time-steps. I recommend implicit unsteady, it is more stable.

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.
LuckyTran is offline   Reply With Quote

Reply

Tags
field, frequency, function, pulsed, velocity

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
problems after decomposing for running alessio.nz OpenFOAM 6 December 23, 2015 15:27
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 01:47
LiencubiclowRemodel nzy102 OpenFOAM Bugs 14 January 10, 2012 09:53
Force Report help~ or maybe Custom Field Function sailor FLUENT 0 April 13, 2011 03:45


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