A display window disappears immediately. An urgent solution

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

Moderators: silvia, selimgunay, Moderators

Post Reply
jjh
Posts: 2
Joined: Sat May 21, 2016 8:13 am

A display window disappears immediately. An urgent solution

Post by jjh »

This code is elastic beam analysis in Basic Example Manual on opensees homepage. The code is very easy.

I wrote display command and "source DisplayPlane.tcl" from OpenSees "Example 6. generic 2D Frame, N-story N-bay, Reinforced-Concrete Section & Steel W-Section"

A deformed shape window was plotted but It disappeared immediately. So I could see the deformed shape for 0.1 second.

How can I keep the window in which a deformed shape plotted ?

The code that I used is following. Display code is in the last part.

The code is not important for analysis itself.

#------------------------------------------------------------------------------------------------
# Units: kips, in, sec
# Remove existing model
wipe

set ResultsN [open ResultNs.txt w]
set ResultsE [open ResultEs.txt w]

# Create ModelBuilder (with two-dimensions and 3 DOF/node)
model BasicBuilder -ndm 2 -ndf 3


set PI [expr 2.0 * asin(1.0)]
set g 386.4
set ft 12.0

set m1 [expr 1185.0/(4*$g)]; # 4 nodes per floor
set m2 [expr 1185.0/(4*$g)]
set m3 [expr 970.0/(4*$g)]

set w1 [expr 1185.0/(90*$ft)]
set w2 [expr 1185.0/(90*$ft)]
set w3 [expr 970.0/(90*$ft)]

# Create nodes & add to Domain -
# command: node nodeId xCrd yCrd <-mass $massX $massY $massRz>
# NOTE: mass is optional
node 1 0.0 0.0
node 2 360.0 0.0
node 3 720.0 0.0
node 4 1080.0 0.0

node 5 0.0 162.0 -mass $m1 $m1 0.0
node 6 360.0 162.0 -mass $m1 $m1 0.0
node 7 720.0 162.0 -mass $m1 $m1 0.0
node 8 1080.0 162.0 -mass $m1 $m1 0.0

node 9 0.0 324.0 -mass $m2 $m2 0.0
node 10 360.0 324.0 -mass $m2 $m2 0.0
node 11 720.0 324.0 -mass $m2 $m2 0.0
node 12 1080.0 324.0 -mass $m2 $m2 0.0

node 13 0.0 486.0 -mass $m3 $m3 0.0
node 14 360.0 486.0 -mass $m3 $m3 0.0
node 15 720.0 486.0 -mass $m3 $m3 0.0
node 16 1080.0 486.0 -mass $m3 $m3 0.0

# Set the boundary conditions - command: fix nodeID xResrnt? yRestrnt? rZRestrnt?
fix 1 1 1 1
fix 2 1 1 1
fix 3 1 1 1
fix 4 1 1 1

# Define geometric transformations for beam-column elements
geomTransf Linear 1; # beams
#geomTransf Linear 2; # columns
geomTransf PDelta 2; # columns

# Define elements
# Create elastic beam-column elements -
# command: element elasticBeamColumn eleID node1 node2 A E Iz geomTransfTag

# Define the Columns
element elasticBeamColumn 1 1 5 75.6 29000.0 3400.0 2; # W14X257
element elasticBeamColumn 2 5 9 75.6 29000.0 3400.0 2; # W14X257
element elasticBeamColumn 3 9 13 75.6 29000.0 3400.0 2; # W14X257

element elasticBeamColumn 4 2 6 91.4 29000.0 4330.0 2; # W14X311
element elasticBeamColumn 5 6 10 91.4 29000.0 4330.0 2; # W14X311
element elasticBeamColumn 6 10 14 91.4 29000.0 4330.0 2; # W14X311

element elasticBeamColumn 7 3 7 91.4 29000.0 4330.0 2; # W14X311
element elasticBeamColumn 8 7 11 91.4 29000.0 4330.0 2; # W14X311
element elasticBeamColumn 9 11 15 91.4 29000.0 4330.0 2; # W14X311

element elasticBeamColumn 10 4 8 75.6 29000.0 3400.0 2; # W14X257
element elasticBeamColumn 11 8 12 75.6 29000.0 3400.0 2; # W14X257
element elasticBeamColumn 12 12 16 75.6 29000.0 3400.0 2; # W14X257


# Define the Beams
element elasticBeamColumn 13 5 6 34.7 29000.0 5900.0 1; # W33X118
element elasticBeamColumn 14 6 7 34.7 29000.0 5900.0 1; # W33X118
element elasticBeamColumn 15 7 8 34.7 29000.0 5900.0 1; # W33X118

element elasticBeamColumn 16 9 10 34.2 29000.0 4930.0 1; # W30X116
element elasticBeamColumn 17 10 11 34.2 29000.0 4930.0 1; # W30X116
element elasticBeamColumn 18 11 12 34.2 29000.0 4930.0 1; # W30X116

element elasticBeamColumn 19 13 14 20.1 29000.0 1830.0 1; # W24X68
element elasticBeamColumn 20 14 15 20.1 29000.0 1830.0 1; # W24X68
element elasticBeamColumn 21 15 16 20.1 29000.0 1830.0 1; # W24X68

# Create a Plain load pattern with a linear TimeSeries:
# command pattern Plain $tag $timeSeriesTag { $loads }

# puts "ok = $ok"
puts " w1 w2 w3 = $w1 $w2 $w3"


pattern Plain 1 Linear {
eleLoad -ele 13 14 15 -type -beamUniform -$w1
eleLoad -ele 16 17 18 -type -beamUniform -$w2
eleLoad -ele 19 20 21 -type -beamUniform -$w3
}

# Create the system of equation
system BandSPD

# Create the DOF numberer, the reverse Cuthill-McKee algorithm
numberer RCM

# Create the constraint handler, a Plain handler is used as homo constraints
constraints Plain

# Create the integration scheme, the LoadControl scheme using steps of 1.0
integrator LoadControl 1.0

# Create the solution algorithm, a Linear algorithm is created
#algorithm Linear

test NormDispIncr 1.0e-6 6
algorithm Newton

# create the analysis object
analysis Static

analyze 1

print -file ResultNs.txt -node
print -file ResultEs.txt -ele

# set gravity loads constant and time in domain to 0.0
loadConst -time 0.0

timeSeries Linear 2
pattern Plain 2 2 {
load 13 220.0 0.0 0.0
load 9 180.0 0.0 0.0
load 5 90.0 0.0 0.0
}

# create the analysis object
analysis Static

analyze 1

print -file ResultNs.txt -node
print -file ResultEs.txt -ele

set eigenValues [eigen 5]

puts "\nEigenvalues:"
set eigenValue [lindex $eigenValues 0]
puts "T[expr 0+1] = [expr 2*$PI/sqrt($eigenValue)]"
set eigenValue [lindex $eigenValues 1]
puts "T[expr 1+1] = [expr 2*$PI/sqrt($eigenValue)]"
set eigenValue [lindex $eigenValues 2]
puts "T[expr 2+1] = [expr 2*$PI/sqrt($eigenValue)]"
set eigenValue [lindex $eigenValues 3]
puts "T[expr 3+1] = [expr 2*$PI/sqrt($eigenValue)]"
set eigenValue [lindex $eigenValues 4]
puts "T[expr 4+1] = [expr 2*$PI/sqrt($eigenValue)]"

# create a recorder to record eigenvalues at all free nodes
recorder Node -file eigenvector.out -nodeRange 5 16 -dof 1 2 3 eigen 0

print -node 1 2 3 4
print -ele 1 4 7 10

print -file ResultNs.txt -node
print -file ResultEs.txt -ele

set Resultimage [open Resultimage.bmp w]
# $windowTitle $xLoc $yLoc $xPixels $yPixels
recorder display "Elastic Beam" 10 10 1200 500 -file Resultimage.bmp
prp 100 100 1
vup 0 1 0
vpn 0 0 1
viewWindow -200 200 -200 200
# display 1 -1 10

source DisplayPlane.tcl
DisplayPlane DeformedShape 10 XY

puts "\n ----- Analysis has been Completed ----------------------------------------"
Last edited by jjh on Wed Apr 17, 2019 10:11 pm, edited 3 times in total.
jjh
Posts: 2
Joined: Sat May 21, 2016 8:13 am

Re: A display window disappears. An urgent solution.

Post by jjh »

I found a solution to this problem.

I wanted to find a nice solution of this problem using hardware or system software, but I could not.

So, I used Tcl code. I wrote a little code of Tcl following.

Please take look at between "# *********************************************************************************** "
and "# *********************************************************************************** " in the following code at the end of this article.

If the deformed shape is plotted many times, the deformed shape looks plotted continuously.

This is not good but urgent method for static analysis.

At this time, a file generating code are needed.


set Resultimage [open Resultimage.bmp w]
# $windowTitle $xLoc $yLoc $xPixels $yPixels
recorder display "Elastic Beam" 10 10 1200 500 -file Resultimage.bmp


According to my tests, without a file generating code, the window on which deformed shape is plotted is blinking. At least on my system, this phenomenon happened.

DisplayPlane.tcl is not written by me in the opensees code.

It is here, http://opensees.berkeley.edu/wiki/index ... yPlane.tcl

I want to upload captured image file of the deformed shape.

But this board seems not to allow binary files to be uploaded.

You will be able to capture your own deformed shape.

Thank you for reading.


opensees code is following --------------------------------------------------------------------------------------------

# Units: kips, in, sec
# Remove existing model
wipe

set ResultsN [open ResultNs.txt w]
set ResultsE [open ResultEs.txt w]

# Create ModelBuilder (with two-dimensions and 3 DOF/node)
model BasicBuilder -ndm 2 -ndf 3


set PI [expr 2.0 * asin(1.0)]
set g 386.4
set ft 12.0

set m1 [expr 1185.0/(4*$g)]; # 4 nodes per floor
set m2 [expr 1185.0/(4*$g)]
set m3 [expr 970.0/(4*$g)]

set w1 [expr 1185.0/(90*$ft)]
set w2 [expr 1185.0/(90*$ft)]
set w3 [expr 970.0/(90*$ft)]

# Create nodes & add to Domain -
# command: node nodeId xCrd yCrd <-mass $massX $massY $massRz>
# NOTE: mass is optional
node 1 0.0 0.0
node 2 360.0 0.0
node 3 720.0 0.0
node 4 1080.0 0.0

node 5 0.0 162.0 -mass $m1 $m1 0.0
node 6 360.0 162.0 -mass $m1 $m1 0.0
node 7 720.0 162.0 -mass $m1 $m1 0.0
node 8 1080.0 162.0 -mass $m1 $m1 0.0

node 9 0.0 324.0 -mass $m2 $m2 0.0
node 10 360.0 324.0 -mass $m2 $m2 0.0
node 11 720.0 324.0 -mass $m2 $m2 0.0
node 12 1080.0 324.0 -mass $m2 $m2 0.0

node 13 0.0 486.0 -mass $m3 $m3 0.0
node 14 360.0 486.0 -mass $m3 $m3 0.0
node 15 720.0 486.0 -mass $m3 $m3 0.0
node 16 1080.0 486.0 -mass $m3 $m3 0.0

# Set the boundary conditions - command: fix nodeID xResrnt? yRestrnt? rZRestrnt?
fix 1 1 1 1
fix 2 1 1 1
fix 3 1 1 1
fix 4 1 1 1

# Define geometric transformations for beam-column elements
geomTransf Linear 1; # beams
#geomTransf Linear 2; # columns
geomTransf PDelta 2; # columns

# Define elements
# Create elastic beam-column elements -
# command: element elasticBeamColumn eleID node1 node2 A E Iz geomTransfTag

# Define the Columns
element elasticBeamColumn 1 1 5 75.6 29000.0 3400.0 2; # W14X257
element elasticBeamColumn 2 5 9 75.6 29000.0 3400.0 2; # W14X257
element elasticBeamColumn 3 9 13 75.6 29000.0 3400.0 2; # W14X257

element elasticBeamColumn 4 2 6 91.4 29000.0 4330.0 2; # W14X311
element elasticBeamColumn 5 6 10 91.4 29000.0 4330.0 2; # W14X311
element elasticBeamColumn 6 10 14 91.4 29000.0 4330.0 2; # W14X311

element elasticBeamColumn 7 3 7 91.4 29000.0 4330.0 2; # W14X311
element elasticBeamColumn 8 7 11 91.4 29000.0 4330.0 2; # W14X311
element elasticBeamColumn 9 11 15 91.4 29000.0 4330.0 2; # W14X311

element elasticBeamColumn 10 4 8 75.6 29000.0 3400.0 2; # W14X257
element elasticBeamColumn 11 8 12 75.6 29000.0 3400.0 2; # W14X257
element elasticBeamColumn 12 12 16 75.6 29000.0 3400.0 2; # W14X257


# Define the Beams
element elasticBeamColumn 13 5 6 34.7 29000.0 5900.0 1; # W33X118
element elasticBeamColumn 14 6 7 34.7 29000.0 5900.0 1; # W33X118
element elasticBeamColumn 15 7 8 34.7 29000.0 5900.0 1; # W33X118

element elasticBeamColumn 16 9 10 34.2 29000.0 4930.0 1; # W30X116
element elasticBeamColumn 17 10 11 34.2 29000.0 4930.0 1; # W30X116
element elasticBeamColumn 18 11 12 34.2 29000.0 4930.0 1; # W30X116

element elasticBeamColumn 19 13 14 20.1 29000.0 1830.0 1; # W24X68
element elasticBeamColumn 20 14 15 20.1 29000.0 1830.0 1; # W24X68
element elasticBeamColumn 21 15 16 20.1 29000.0 1830.0 1; # W24X68

# Create a Plain load pattern with a linear TimeSeries:
# command pattern Plain $tag $timeSeriesTag { $loads }

# puts "ok = $ok"
puts " w1 w2 w3 = $w1 $w2 $w3"


pattern Plain 1 Linear {
eleLoad -ele 13 14 15 -type -beamUniform -$w1
eleLoad -ele 16 17 18 -type -beamUniform -$w2
eleLoad -ele 19 20 21 -type -beamUniform -$w3
}


# Create the system of equation
system BandSPD

# Create the DOF numberer, the reverse Cuthill-McKee algorithm
numberer RCM

# Create the constraint handler, a Plain handler is used as homo constraints
constraints Plain

# Create the integration scheme, the LoadControl scheme using steps of 1.0
integrator LoadControl 1.0

# Create the solution algorithm, a Linear algorithm is created
#algorithm Linear

test NormDispIncr 1.0e-6 6
algorithm Newton

# create the analysis object
analysis Static

analyze 1

print -file ResultNs.txt -node
print -file ResultEs.txt -ele


# set gravity loads constant and time in domain to 0.0
loadConst -time 0.0

timeSeries Linear 2
pattern Plain 2 2 {
load 13 220.0 0.0 0.0
load 9 180.0 0.0 0.0
load 5 90.0 0.0 0.0
}

# create the analysis object
analysis Static

analyze 1

print -file ResultNs.txt -node
print -file ResultEs.txt -ele


print -node 1 2 3 4
print -ele 1 4 7 10

print -file ResultNs.txt -node
print -file ResultEs.txt -ele

# ***********************************************************************************
set Resultimage [open Resultimage.bmp w]
# $windowTitle $xLoc $yLoc $xPixels $yPixels
recorder display "Elastic Beam" 10 10 1200 500 -file Resultimage.bmp
# prp 100 100 1
# vup 0 1 0
# vpn 0 0 1
# viewWindow -200 200 -200 200
# display 1 5 10

source DisplayPlane.tcl
for { set i 1 } {$i <=1000} {incr i} {
DisplayPlane DeformedShape 10 XY
}
# ***********************************************************************************

puts "\n ----- Analysis has been Completed ----------------------------------------"
ambaker
Posts: 10
Joined: Fri Jan 18, 2019 7:47 am
Location: Michigan Technological University

Re: A display window disappears immediately. An urgent solut

Post by ambaker »

Hi jjh,
Try adding this code at the end of your analysis:

puts "Press a key to continue"
gets stdin my_variable_name

It will prevent the screen from closing until a key is pressed.
-Alex Baker
selimgunay
Posts: 917
Joined: Mon Sep 09, 2013 8:50 pm
Location: University of California, Berkeley

Re: A display window disappears immediately. An urgent solut

Post by selimgunay »

Please make sure that the analysis is continuing. Window may be closing because of analysis termination
Post Reply