|
[Sponsors] |
if (timestep X == true) OR if (current_timestep == timestep X) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 14, 2014, 09:43 |
if (timestep X == true) OR if (current_timestep == timestep X)
|
#1 |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
hi,
I need to implement specific code for specific timesteps. Therefore I though about doing something like Code:
if (timestep X == true) {...} Code:
(current_timestep == timestep X) {...} greetings maybee |
|
March 14, 2014, 10:32 |
|
#2 |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
Hi again,
I found Code:
scalar deltaTValue () const inline //Return time step value. Code:
Foam::label timeIndex () const //Return current time index. Code:
Foam::dimensionedScalar deltaT () const //Return time step. But what about the second and the third one? Which one will just give me the number of timesteps including the actual running time step? |
|
March 14, 2014, 12:45 |
|
#3 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Since this sounds like you are doing it in a solver, runTime.value() is your friend.
|
|
March 14, 2014, 14:26 |
|
#4 | |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
Quote:
first time loop pass: 0 second time loop pass: 1 third time loop pass : 2 and so on ? |
||
March 14, 2014, 14:28 |
|
#5 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
So you want the condition to run when t = a certain value, or dt = a certain value? I may have misunderstood your initial question.
|
|
March 14, 2014, 16:07 |
|
#6 | |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
Quote:
Code:
if (time loop pass == 1) { } if (time loop pass == 2) { } . . . Last edited by maybee; March 14, 2014 at 17:51. |
||
March 17, 2014, 03:30 |
|
#7 |
Member
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 13 |
I think the confusion is about what sort of 'time' you want to measure.
Within a solver, runTime.value() will return the 'real', physical time, in seconds. If you want to count the number of iterations of your code, a counter might be a better bet? runTime.value() will return these values if your deltaT is 1 second per iteration. Although actually, the solvers that I've looked at mostly start with a runTime++; , so they'd return 1 as the first time value if dt = 1 and you took it after that line |
|
March 17, 2014, 04:52 |
|
#8 |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
hi,
thx for the reply. I ve taken an own counter now. This should work fine for me . As I already told - just wanted to check if class Time or any other class already proivdes such a counter. greetings maybee |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Modifying sonicFoam to run with variable timestep - strange results | dalaron | OpenFOAM Programming & Development | 1 | September 2, 2013 08:21 |
Restart 2-way FSI with different timestep? | Lance | CFX | 10 | April 17, 2013 01:37 |
Timestep and Pressure Correction Relationship in SIMPLE | rks171 | Main CFD Forum | 23 | May 4, 2012 02:04 |
Adequate timestep selection for multidomain problem | gerardosrez | CFX | 6 | November 28, 2010 18:50 |
Timestep study | ijk | CFX | 6 | April 9, 2010 08:38 |