Display current time during analysis

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
vpapanik
Posts: 36
Joined: Tue Jun 15, 2010 12:53 am
Location: Thessaloniki
Contact:

Display current time during analysis

Post by vpapanik » Fri Nov 24, 2017 3:21 pm

Is there a way to display the current time at every step of a transient analysis ; the test command only displays the current number of iterations for $pFlag=0 or 1.

selimgunay
Posts: 913
Joined: Mon Sep 09, 2013 8:50 pm
Location: University of California, Berkeley

Re: Display current time during analysis

Post by selimgunay » Sun Nov 26, 2017 4:54 pm

You can display the step number during the analyze command.

fmk
Site Admin
Posts: 5883
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Display current time during analysis

Post by fmk » Tue Nov 28, 2017 4:40 am

if you do the analysis inside a while or for loop you could spit out the time in the loop, i.e. if we look at basic example:

while {$ok == 0 && $tCurrent < $tFinal} {

set ok [analyze 1 .01]

# if the analysis fails try initial tangent iteration
if {$ok != 0} {
puts "regular newton failed .. lets try an initail stiffness for this step"
test NormDispIncr 1.0e-12 100 0
algorithm ModifiedNewton -initial
set ok [analyze 1 .01]
if {$ok == 0} {puts "that worked .. back to regular newton"}
test NormDispIncr 1.0e-12 10
algorithm Newton
}

set tCurrent [getTime]
puts "currentTime: $tCurrent]
}

vpapanik
Posts: 36
Joined: Tue Jun 15, 2010 12:53 am
Location: Thessaloniki
Contact:

Re: Display current time during analysis

Post by vpapanik » Wed Nov 29, 2017 8:27 am

Thanks a lot Frank ! I will put analyze 1 in a for-loop together with getTime. Great.

vpapanik
Posts: 36
Joined: Tue Jun 15, 2010 12:53 am
Location: Thessaloniki
Contact:

Re: Display current time during analysis

Post by vpapanik » Wed Nov 29, 2017 12:50 pm

This works great for all $pFlag options :

for .... {

set t [getTime]
puts -nonewline "Time $t "
set Ok[analyze 1]

}

Post Reply