CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Expression =1 every 2 Timesteps

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By ghorrocks

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 15, 2014, 15:07
Default Expression =1 every 2 Timesteps
  #1
Member
 
Chris_321's Avatar
 
Christian
Join Date: Sep 2013
Location: Germany
Posts: 88
Rep Power: 13
Chris_321 is on a distinguished road
Hello,

im looking for an expression that is 1 every 2 timesteps.

I tried to build the expression with a sin function but somehow it does not work propably.

(abs(sin(Time*1[rad/s])) =1)

is there a easier way?
Chris_321 is offline   Reply With Quote

Old   April 15, 2014, 15:53
Default
  #2
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 21
singer1812 is on a distinguished road
Your way is close but you have the expression slightly wrong. And are you interested in every 2 "timesteps" or do you want this as a function of time?

For timesteps your variable needs to be ctstep not Time.

Also, your sin function would need to be

cos(ctstep*pi) in order to get it to "1" on every even step.

But I would be afraid of roundoff error on this and wouldnt trust it to return true using a boolean to evaluate it, so I would switch to a step function. Perhaps:

step(cos(ctstep*pi)-0.9)
singer1812 is offline   Reply With Quote

Old   April 15, 2014, 19:47
Default
  #3
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
mod(cstep,2) is simpler and not prone to round off.
ghorrocks is offline   Reply With Quote

Old   April 17, 2014, 06:33
Default
  #4
Member
 
Chris_321's Avatar
 
Christian
Join Date: Sep 2013
Location: Germany
Posts: 88
Rep Power: 13
Chris_321 is on a distinguished road
Thank you
Chris_321 is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] outputTime in Swak function immortality OpenFOAM Community Contributions 20 October 6, 2022 13:08
writing execFlowFunctionObjects immortality OpenFOAM Post-Processing 30 September 15, 2013 07:16
How to install CGNS under windows xp? lzgwhy Main CFD Forum 1 January 11, 2011 19:44
CGNS lib and Fortran compiler manaliac Main CFD Forum 2 November 29, 2010 07:25
Lift, Drag Vs time chart,calculations Jamesd69climber CFX 8 February 17, 2005 18:23


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