Exemple #1
0
import xc

from model import predefined_spaces
from materials import typical_materials
import math
import numpy

__author__ = "Luis C. Pérez Tato (LCPT)"
__copyright__ = "Copyright 2014, LCPT"
__license__ = "GPL"
__version__ = "3.0"
__email__ = "*****@*****.**"

masaExtremo = 1e-2  # Masa en kg.
nodeMassMatrix = xc.Matrix([[masaExtremo, 0, 0, 0, 0, 0],
                            [0, masaExtremo, 0, 0, 0, 0],
                            [0, 0, masaExtremo, 0, 0, 0], [0, 0, 0, 0, 0, 0],
                            [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]])
EMat = 1  # Elastic modulus.
nuMat = 0  # Poisson's ratio.
GMat = EMat / (2.0 * (1 + nuMat))  # Shear modulus.

Iyy = 1  # Flexural inertia on y axis.
Izz = 1  # Flexural inertia on z axis.
Ir = 4 / 3.0  # Torsional inertia.
area = 1e7  # Section area.
Lx = 1
Ly = 1
Lz = 1

# Problem type
feProblem = xc.FEProblem()
import xc_base
import geom
import xc

from model import predefined_spaces
from materials import typical_materials
import math

__author__ = "Luis C. Pérez Tato (LCPT)"
__copyright__ = "Copyright 2014, LCPT"
__license__ = "GPL"
__version__ = "3.0"
__email__ = "*****@*****.**"

storeyMass = 134.4e3
nodeMassMatrix = xc.Matrix([[storeyMass, 0, 0], [0, storeyMass, 0], [0, 0, 0]])
Ehorm = 200000 * 1e5  # Concrete elastic modulus.

Bbaja = 0.45  # Columns size.
Ibaja = 1 / 12.0 * Bbaja**4  # Cross section moment of inertia.
Hbaja = 4  # First floor height.
B1a = 0.40  # Columns size.
I1a = 1 / 12.0 * B1a**4  # Cross section moment of inertia.
H = 3  # Height of the rest of the floors.
B3a = 0.35  # Columns size.
I3a = 1 / 12.0 * B3a**4  # Cross section moment of inertia.

kPlBaja = 20 * 12 * Ehorm * Ibaja / (Hbaja**3)
kPl1a = 20 * 12 * Ehorm * I1a / (H**3)
kPl2a = kPl1a
kPl3a = 20 * 12 * Ehorm * I3a / (H**3)
Exemple #3
0
import xc_base
import geom
import xc

from model import predefined_spaces
from materials import typical_materials
import math

__author__ = "Luis C. Pérez Tato (LCPT)"
__copyright__ = "Copyright 2014, LCPT"
__license__ = "GPL"
__version__ = "3.0"
__email__ = "*****@*****.**"

storeyMass = 134.4e3
nodeMassMatrix = xc.Matrix([[storeyMass, 0, 0], [0, storeyMass, 0], [0, 0, 0]])
Ehorm = 200000 * 1e5  # Concrete elastic modulus.

Bbaja = 0.45  # Columns size.
Ibaja = 1 / 12.0 * Bbaja**4  # Cross section moment of inertia.
Hbaja = 4  # First floor height.
B1a = 0.40  # Columns size.
I1a = 1 / 12.0 * B1a**4  # Cross section moment of inertia.
H = 3  # Height of the rest of the floors.
B3a = 0.35  # Columns size.
I3a = 1 / 12.0 * B3a**4  # Cross section moment of inertia.

kPlBaja = 20 * 12 * Ehorm * Ibaja / (Hbaja**3)
kPl1a = 20 * 12 * Ehorm * I1a / (H**3)
kPl2a = kPl1a
kPl3a = 20 * 12 * Ehorm * I3a / (H**3)
Exemple #4
0
pt3 = points.newPntIDPos3d(3, geom.Pos3d(1.0, 1.0, 0.0))
pt4 = points.newPntIDPos3d(4, geom.Pos3d(0.0, 1.0, 0.0))

surfaces = preprocessor.getMultiBlockTopology.getSurfaces
surfaces.defaultTag = 1
s1 = surfaces.newQuadSurfacePts(pt1.tag, pt2.tag, pt3.tag, pt4.tag)

iVector = s1.getIVector
jVector = s1.getJVector
kVector = s1.getKVector
localAxes = s1.getLocalAxes()

ratio = (iVector - geom.Vector3d(1.0, 0.0, 0.0)).getModulus()**2
ratio += (jVector - geom.Vector3d(0.0, 1.0, 0.0)).getModulus()**2
ratio += (kVector - geom.Vector3d(0.0, 0.0, 1.0)).getModulus()**2
testMatrix = xc.Matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
ratio += (localAxes - testMatrix).OneNorm()
'''
print 'iVector= ', iVector
print 'jVector= ', jVector
print 'kVector= ', kVector
print 'localAxes= ', localAxes
print ratio
'''

feProblem.errFileName = "cerr"  # Display errors if any.
import os
from misc_utils import log_messages as lmsg
fname = os.path.basename(__file__)
if (ratio <= 1e-15):
    print "test ", fname, ": ok."
import xc

from model import fix_node_3dof
from model import predefined_spaces
from solution import predefined_solutions
from materials import typical_materials
import math

__author__ = "Luis C. Pérez Tato (LCPT)"
__copyright__ = "Copyright 2014, LCPT"
__license__ = "GPL"
__version__ = "3.0"
__email__ = "*****@*****.**"

masaPorPlanta = 134.4e3
matrizMasasNodo = xc.Matrix([[masaPorPlanta, 0, 0], [0, masaPorPlanta, 0],
                             [0, 0, 0]])
Ehorm = 200000 * 1e5  # Elastic modulus del hormigón.

Bbaja = 0.45  # Escuadría de los pilares.
Ibaja = 1 / 12.0 * Bbaja**4  # Cross section moment of inertia.
Hbaja = 4  # Altura de la planta baja.
B1a = 0.40  # Escuadría de los pilares.
I1a = 1 / 12.0 * B1a**4  # Cross section moment of inertia.
H = 3  # Altura del resto de plantas.
B3a = 0.35  # Escuadría de los pilares.
I3a = 1 / 12.0 * B3a**4  # Cross section moment of inertia.

kPlBaja = 20 * 12 * Ehorm * Ibaja / (Hbaja**3)
kPl1a = 20 * 12 * Ehorm * I1a / (H**3)
kPl2a = kPl1a
kPl3a = 20 * 12 * Ehorm * I3a / (H**3)
Exemple #6
0
           [0.0, 0.0, 0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 1.0, 0.0],
           [0.0, 0.0, 0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 1.0, 0.0]]

values6 = [[0.0, 0.0, 0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 0.0, 0.0, 1.0],
           [0.0, 0.0, 0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 0.0, 0.0, 1.0],
           [0.0, 0.0, 0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 0.0, 0.0, 1.0],
           [0.0, 0.0, 0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 0.0, 0.0, 1.0]]

values7 = [[1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
           [1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
           [1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
           [1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]

values = [values1, values2, values3, values4, values5, values6, values7]
err = 0.0

for v in values:
    elementStresses = xc.Matrix(v)
    nodeStresses = brick.getExtrapolatedValues(elementStresses)
    err += (elementStresses - nodeStresses).rowNorm()

#print('err= ',err)

import os
from misc_utils import log_messages as lmsg
fname = os.path.basename(__file__)
if (err < 1e-14):
    print("test ", fname, ": ok.")
else:
    lmsg.error(fname + ' ERROR.')
Exemple #7
0
# -*- coding: utf-8 -*-
'''Estimation of the reciprocal of the condition number using the 1-norm.'''

__author__= "Luis C. Pérez Tato (LCPT)"
__copyright__= "Copyright 2014, LCPT"
__license__= "GPL"
__version__= "3.0"
__email__= "*****@*****.**"

import xc_base
import geom
import xc

data= [[1,1],[1,0]]

testMatrix= xc.Matrix(data)

rcond= testMatrix.RCond()
oneNorm= testMatrix.OneNorm()
invMatrix= testMatrix.getInverse()
invOneNorm= invMatrix.OneNorm()
rcondTheor= 1.0/(oneNorm*invOneNorm)
ratio1= (rcond-rcondTheor)/rcondTheor

#print 'rcond= ', rcond

import os
from miscUtils import LogMessages as lmsg
fname= os.path.basename(__file__)
if (abs(ratio1)<1e-5):
  print "test ",fname,": ok."
Exemple #8
0
import geom
import xc

from model import predefined_spaces
from materials import typical_materials
import math

__author__= "Luis C. Pérez Tato (LCPT)"
__copyright__= "Copyright 2014, LCPT"
__license__= "GPL"
__version__= "3.0"
__email__= "*****@*****.**"

storeyMass= 134.4e3
nodeMassMatrix= xc.Matrix([[storeyMass,0,0],
                            [0,storeyMass,0],
                            [0,0,0]])
Ehorm= 200000*1e5 # Concrete elastic modulus.

Bbaja= 0.45 # Columns size.
Ibaja= 1/12.0*Bbaja**4 # Cross section moment of inertia.
Hbaja= 4 # First floor height.
B1a= 0.40 # Columns size.
I1a= 1/12.0*B1a**4 # Cross section moment of inertia.
H= 3 # Height of the rest of the floors.
B3a= 0.35 # Columns size.
I3a= 1/12.0*B3a**4 # Cross section moment of inertia.


kPlBaja= 20*12*Ehorm*Ibaja/(Hbaja**3)
kPl1a= 20*12*Ehorm*I1a/(H**3)
Exemple #9
0
import geom
import xc
from solution import predefined_solutions
from model import predefined_spaces
from materials import typical_materials
import math

E = 2.1e6  # Young modulus of the steel en kg/cm2.
nu = 0.3  # Poisson's ratio.
h = 0.1  # Thickness.
dens = 1.33  # Density kg/m2.

angRotacion = math.radians(10)
rotacion = xc.Matrix([[1, 0, 0],
                      [0, math.cos(angRotacion),
                       math.sin(angRotacion)],
                      [0, -math.sin(angRotacion),
                       math.cos(angRotacion)]])

# Problem type
feProblem = xc.FEProblem()
feProblem.logFileName = "/tmp/borrar.log"  # Ignore warning messages
preprocessor = feProblem.getPreprocessor
nodes = preprocessor.getNodeLoader
modelSpace = predefined_spaces.StructuralMechanics3D(nodes)
nod1 = nodes.newNodeIDXYZ(1, 0, 0, 0)
nod2 = nodes.newNodeIDXYZ(2, 2, 0, 0)
nod3 = nodes.newNodeIDXYZ(3, 2, 1, 1)
p = nod3.getInitialPos3d
vPosN3 = xc.Vector([p.x, p.y, p.z])
nod4 = nodes.newNodeIDXYZ(4, 0, 1, 1)
Exemple #10
0
modelSpace = predefined_spaces.StructuralMechanics2D(
    nodes)  #defines dimension of
#the space: nodes by three coordinates (x,y) and
#three DOF for each node (Ux,Uy,Theta)

## *** MESH ***
### *** GEOMETRY ***
n1 = nodes.newNodeXY(0.0, 0.0)
n2 = nodes.newNodeXY(0.0, 432.0)

### Single point constraints -- Boundary Conditions
constraints = prep.getBoundaryCondHandler
modelSpace.fixNode000(n1.tag)

### nodal masses:
n2.mass = xc.Matrix([[5.18, 0, 0], [0, 0, 0], [0, 0, 0]])  # node mass matrix.

### Define materials.
beamSection = typical_materials.defElasticSection2d(prep, "beamSection", 3600,
                                                    1080000, 3225)

### 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
lin = modelSpace.newLinearCrdTransf("lin")
elements = prep.getElementHandler
elements.defaultTransformation = lin.name
elements.defaultMaterial = beamSection.name
beam2d = elements.newElement("ElasticBeam2d", xc.ID([n1.tag, n2.tag]))
Exemple #11
0
import xc

from model import fix_node_3dof
from model import predefined_spaces
from solution import predefined_solutions
from materials import typical_materials
import math

__author__ = "Luis C. Pérez Tato (LCPT)"
__copyright__ = "Copyright 2014, LCPT"
__license__ = "GPL"
__version__ = "3.0"
__email__ = "*****@*****.**"

masaPorPlanta = 134.4e3
matrizMasasNodo = xc.Matrix([[masaPorPlanta, 0, 0], [0, masaPorPlanta, 0],
                             [0, 0, 0]])
Ehorm = 200000 * 1e5  # Elastic modulus del hormigón.

Bbaja = 0.45  # Escuadría de los pilares.
Ibaja = 1 / 12.0 * Bbaja**4  # Cross section moment of inertia.
Hbaja = 4  # Altura de la planta baja.
B1a = 0.40  # Escuadría de los pilares.
I1a = 1 / 12.0 * B1a**4  # Cross section moment of inertia.
H = 3  # Altura del resto de plantas.
B3a = 0.35  # Escuadría de los pilares.
I3a = 1 / 12.0 * B3a**4  # Cross section moment of inertia.

kPlBaja = 20 * 12 * Ehorm * Ibaja / (Hbaja**3)
kPl1a = 20 * 12 * Ehorm * I1a / (H**3)
kPl2a = kPl1a
kPl3a = 20 * 12 * Ehorm * I3a / (H**3)
Exemple #12
0
from model import fix_node_3dof
from model import predefined_spaces
from solution import predefined_solutions
from materials import typical_materials
import math

__author__= "Luis C. Pérez Tato (LCPT)"
__copyright__= "Copyright 2014, LCPT"
__license__= "GPL"
__version__= "3.0"
__email__= "*****@*****.**"


masaPorPlanta= 134.4e3
matrizMasasNodo= xc.Matrix([[masaPorPlanta,0,0],[0,masaPorPlanta,0],[0,0,0]])
Ehorm= 200000*1e5 # Elastic modulus del hormigón.

Bbaja= 0.45 # Escuadría de los pilares.
Ibaja= 1/12.0*Bbaja**4 # Cross section moment of inertia.
Hbaja= 4 # Altura de la planta baja.
B1a= 0.40 # Escuadría de los pilares.
I1a= 1/12.0*B1a**4 # Cross section moment of inertia.
H= 3 # Altura del resto de plantas.
B3a= 0.35 # Escuadría de los pilares.
I3a= 1/12.0*B3a**4 # Cross section moment of inertia.


kPlBaja= 20*12*Ehorm*Ibaja/(Hbaja**3)
kPl1a= 20*12*Ehorm*I1a/(H**3)
kPl2a= kPl1a