|
[Sponsors] | |||||
|
|
|
#1 |
|
Member
Christian
Join Date: Sep 2013
Location: Germany
Posts: 88
Rep Power: 14 ![]() |
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? |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 22 ![]() |
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) |
|
|
|
|
|
|
|
|
#3 |
|
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 18,001
Rep Power: 146 ![]() ![]() ![]() ![]() |
mod(cstep,2) is simpler and not prone to round off.
|
|
|
|
|
|
|
|
|
#4 |
|
Member
Christian
Join Date: Sep 2013
Location: Germany
Posts: 88
Rep Power: 14 ![]() |
Thank you
|
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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 |