Visous Damper example in python version

Forum for asking and answering questions related to use of the OpenSeesPy module

Moderators: silvia, selimgunay, Moderators

Post Reply
Prafullamalla
Posts: 160
Joined: Mon Feb 02, 2015 6:32 pm

Visous Damper example in python version

Post by Prafullamalla »

There is some error while computing Time period using viscous damper in python and Tcl. I think there is error in tcl version as time period does not changes with addition of viscous damper. Change the viscous damper with # uniaxialmaterial

Code: Select all

# -*- coding: utf-8 -*-
"""
Created on Wed Jan 17 11:07:53 2024

@author: praf_
"""

# -*- coding: utf-8 -*-
"""
Created on Wed Jan 17 11:02:09 2024

@author: praf_malla@hotmail.com
"""


import os
import sys

import openseespy.opensees as ops
import opsvis as opsv
import numpy as np
import matplotlib.pyplot as plt

PathData ='D:/Openseespy/Viscous_Damper_Example'
sys.path.append(PathData)
# Clear memory of past model definitions

ops.wipe()

# Define the model builder
ops.model('basic', '-ndm', 2, '-ndf', 3)

# Create data directory
output_directory = 'Output'
# Check if the directory already exists
if not os.path.exists(output_directory):
    # Create the directory if it doesn't exist
    os.makedirs(output_directory)
else:
    print(f"The directory '{output_directory}' already exists.")


#

# SET UP ----------------------------------------------------------------------------
ops.wipe()						       # clear opensees model
ops.model('basic', '-ndm', 2, '-ndf', 3)	       # 2 dimensions, 3 dof per node
# file mkdir data 				   # create data directory

# define GEOMETRY -------------------------------------------------------------
# nodal coordinates:
# Define geometry
L = 5000.0  # Bay width
h = 3000.0  # Story height

# Define nodal coordinates
ops.node(1, 0.0, 0.0)
ops.node(2, L, 0.0)
ops.node(3, 0.0, h)
ops.node(4, L, h)
ops.node(5, L, h)
# Single point constraints -- Boundary Conditions
ops.fix(1, 1, 1, 1)
ops.fix(2, 1, 1, 1)

# MP constraints
ops.equalDOF(3, 4, 2, 3)  # Shear Beam
# Mass
W = 1000.0  # KN
g = 9810.0  # mm/sec^2
m = W / g
print(m)
# Assign mass
ops.mass(3, 0.5 * m, 0.0, 0.0)
ops.mass(4, 0.5 * m, 0.0, 0.0)

# Define dynamic properties
Tnn = 0.7  # sec (Natural Period)
pi = 3.141592653589793238462643383279502884197

# Columns and Beam Properties
K = (2 * pi / Tnn) ** 2 * m  # KN/mm
print(f"stiffness = {K} ")
E = 200.0  # KN/mm^2
Ic = K * h ** 3 / (24 * E)  # mm^4 (K=24EIc/h^3) Take half of stiffness because of 2 column
Ib = 1e12 * Ic  # mm^4
A = 1e12  # mm^2
print(Ic)

# Damper Properties
Kd = 25.0
Cd = 20.7452
ad = 0.35

# Define ViscousDamper Material
#ops.uniaxialMaterial('ViscousDamper', 1, Kd, Cd, ad)
ops.uniaxialMaterial('Elastic', 1, K)
ops.uniaxialMaterial('Elastic', 2, K*999999)
# Define ELEMENTS -------------------------------------------------------------
# define geometric transformation: performs a linear geometric transformation of beam stiffness and resisting force from the basic system to the global-coordinate system
TransfTag = 1
ops.geomTransf('Linear', TransfTag)

# connectivity:
# Define Elements------------------------------------------------------------
# Columns
ops.element('elasticBeamColumn', 1, 1, 3, A, E, Ic, TransfTag)
ops.element('elasticBeamColumn', 2, 2, 4, A, E, Ic, TransfTag)
# Beam
ops.element('elasticBeamColumn', 3, 3, 4, A, E, Ib, TransfTag)
# Damper
#ops.element('twoNodeLink', 4, 1, 4, '-mat', 1, '-dir', 1)
ops.element('elasticBeamColumn', 4, 1, 5, A, E, Ib, TransfTag)
ops.element('zeroLength', 5, 5, 4, '-mat',1,2,2,'-dir',1,2,3)
print('Model Built')	
print("Eigen analysis before")
lamda1 = ops.eigen('-fullGenLapack', 1)[0]
freq = lamda1**0.5
print("freq = ", freq)
t1 = 2*pi/freq
print(f"T1 = {t1} sec")
Prafulla Malla, Nepal
Praf_malla@hotmail.com
Prafullamalla
Posts: 160
Joined: Mon Feb 02, 2015 6:32 pm

Re: Visous Damper example in python version

Post by Prafullamalla »

problem solved by updating to newer version of
Prafulla Malla, Nepal
Praf_malla@hotmail.com
Post Reply