A transient analysis is performed of a plane finite element model representing the Koyna Dam in India.

import matplotlib.pyplot as plt
import numpy as np

import xara
import veux

Import constants to help track units from the Units module.

from xara.units import create_units

units = create_units(length="meter", mass="kg")

GPa = units.GPa
MPa = units.MPa
m   = units.m
kg  = units.kg
kN  = units.kN

print(f"""
Units:
  {m   = }
  {kg  = }
  {kN  = }
  {GPa = }
""")
Units:
  m   = 1.0
  kg  = 1.0
  kN  = 1000.0
  GPa = 1000000000.0

Modeling#

Parameters#

L_base = 70.0 * m
H_base = 66.5 * m
H_top  = 36.5 * m
thickness = 1.0 * m
h_water = 91.75 * m


Ec = 31.027 * GPa
fc = 24.1 * MPa
ft = 2.9 * MPa
nu = 0.2
rho = 2643.0 * kg / (m ** 3)
rho_water = 1000.0 * kg / (m ** 3)
zeta = 0.03

Begin by creating the basic model components:

model = xara.Model(ndm=2, ndf=2)


material = xara.MultiaxialMaterial("ElasticIsotropic",
               E=Ec, 
               G=Ec/(2.0 * (1.0 + nu)),
               density = rho
)
# add the material to the model
model.material(material)


# Create a section to represent the "plane stress" behavior of the
# multiaxial material in a 2D element.
section = xara.PlaneSection("PlaneStress", 
                            thickness=thickness, 
                            material=material)
# Add the section to the model
model.section(section)
1

Mesh Generation#

The element mesh is generated using the Model.surface() method. The method getNodeTags of xara.Model returns the tags of all the nodes that have been defined in the model.

Element = "Q8"
plane_args = {"section": section, "b": [0.0, -rho*units.gravity]}

nx      =  8 #14 # 20
ny_base =  8 #14 # 24
ny_top  = 10 #14


model.surface(
    (nx, ny_base),
    element=Element,
    args=plane_args,
    points={
        1: (   0.0, 0.0),
        2: (L_base, 0.0),
        3: (19.25 * m, H_base),
        4: (0.0, H_base),
    },
)

model.surface(
    (nx, ny_top),
    element=Element,
    args=plane_args,
    points={
        1: (0.0, H_base),
        2: (19.25 * m, H_base),
        3: (14.8 * m, H_base + H_top),
        4: (0.0, H_base + H_top),
    },
);

Render the mesh using the veux library:

artist = veux.create_artist(model, ndf=2)
artist.draw_nodes(size=L_base/(5*nx))
artist.draw_outlines()
artist
from xara.helpers import find_nodes, find_node
# Find all nodes at y=0.0 and fix them in both x and y directions
for tag in find_nodes(model, y=0.0):
    model.fix(tag, 1, 1)

# Find the node at the crest of the dam
crest = find_node(model, y=H_base+H_top, x=0.0)

print(f'Nodes: {len(model.getNodeTags())}')
print(f'Elements: {len(model.getEleTags())}')
print(f'Crest node: {crest}')
Nodes: 485
Elements: 144
Crest node: 469

Gravity#

def hydrodynamic_loading(model, h_water, rho_water, thickness, gravity):
    face_nodes = sorted(
        [(tag, model.nodeCoord(tag)) for tag in find_nodes(model, x=0.0)],
        key=lambda item: item[1][1],
    )
    added_masses = {}
    hydro_loads = {}

    for index, (tag, (_, y)) in enumerate(face_nodes):
        if y > h_water:
            break

        if index == 0:
            tributary = (face_nodes[index + 1][1][1] - y) / 2.0
        elif index == len(face_nodes) - 1:
            tributary = (y - face_nodes[index - 1][1][1]) / 2.0
        else:
            tributary = (face_nodes[index + 1][1][1] - face_nodes[index - 1][1][1]) / 2.0

        mass_per_area = 0.875 * rho_water * np.sqrt(h_water * (h_water - y))
        node_mass = mass_per_area * tributary * thickness
        pressure = rho_water * gravity * (h_water - y)

        added_masses[tag] = (node_mass, 0.0)
        hydro_loads[tag] = (pressure * tributary * thickness, 0.0)

    return added_masses, hydro_loads
added_masses, hydro_loads = hydrodynamic_loading(model, h_water, rho_water, thickness, units.gravity)
for tag, (mx, my) in added_masses.items():
    model.mass(tag, mx, my)


gravity = xara.StaticPattern(xara.NodalLoad(model, hydro_loads))
model.pattern(gravity)


print(f'Upstream water-loaded nodes: {len(hydro_loads)}')
Upstream water-loaded nodes: 30

Create the xara.StaticAnalysis to perform the gravity analysis.

gravity_analysis = xara.StaticAnalysis(model)

gravity_analysis.analyze(1)


model.loadConst(time=0.0)
print('Gravity analysis completed.')
Gravity analysis completed.

Print the displacement in the \(x\) (1) direction using nodeDisp:

crest_disp = model.nodeDisp(crest, 1)
crest_disp
0.0032321324687975984

Plot the \(\sigma_{xx}\) stress field:

from xara.post import NodalStress

artist = veux.create_artist(model,  ndf=2)

artist.draw_outlines()
artist.draw_outlines(state=model.nodeDisp, scale=1/units.mm)
artist.draw_surfaces(state=model.nodeDisp, scale=1/units.mm, field=NodalStress(model, "sxx"))
artist

Eigenvalues and Damping#

Damping is assigned using the Rayleigh Damping method:

eigenvalues = model.eigen(5)
periods = [2.0 * np.pi / np.sqrt(value) for value in eigenvalues]

omega_1 = np.sqrt(eigenvalues[0])
beta_k = 2.0 * zeta / omega_1
model.rayleigh(0.0, 0.0, 0.0, beta_k)

print('Eigen analysis completed.')
print('First five periods (s):')
for i, period in enumerate(periods, start=1):
    print(f'  Mode {i}: {period:.6e}')
print(f'Stiffness-proportional damping beta_k = {beta_k:.6e}')
Eigen analysis completed.
First five periods (s):
  Mode 1: 3.783810e-01
  Mode 2: 1.499350e-01
  Mode 3: 9.371826e-02
  Mode 4: 7.836118e-02
  Mode 5: 5.273726e-02
Stiffness-proportional damping beta_k = 3.613272e-03

Structural modes are similarly rendered using the nodeEigenvector method.

mode = 2
artist = veux.create_artist(model, ndf=2)

artist.draw_outlines()
artist.draw_outlines(state=lambda n: model.nodeEigenvector(n, mode), scale=10000)
artist

Transient Analysis#

Locate the directory containing the earthquake excitation input files.

from pathlib import Path
cwd = Path.cwd()
KOYNA_DIR = cwd
accel_x = np.loadtxt(KOYNA_DIR / 'data' / 'koyna_x_series.txt')
accel_y = np.loadtxt(KOYNA_DIR / 'data' / 'koyna_y_series.txt')

dt_data  = 0.01
n_steps  = len(accel_x)-1
duration = n_steps * dt_data
time     = np.linspace(0,duration,len(accel_x))

print(f'Input duration: {duration:.3f} s')
print(f'Data time step: {dt_data:.3f} s')

fig, ax = plt.subplots(1,2,figsize=(12, 4))
ax[0].plot(time,accel_x)
ax[0].set_xlabel('Time, s')
ax[0].set_ylabel('Horizontal Acceleration (X), g')
ax[0].grid()
ax[1].plot(accel_y);
ax[1].set_xlabel('Time, s')
ax[1].set_ylabel('Vertical Acceleration (Y), g')
ax[1].grid()
Input duration: 10.000 s
Data time step: 0.010 s
../../_images/7e1e75fbcc2b7bb355dc011fa153ac634b570359803d650814a0a620c69310fb.png
earthquake = xara.AmbientAcceleration(model, {
      1: xara.TimeSeries(accel_x*units.gravity, dt=dt_data),
      2: xara.TimeSeries(accel_y*units.gravity, dt=dt_data)
})

model.pattern(earthquake)
2

Setup the dynamic analysis procedure with xara.TransientAnalysis

analysis = xara.TransientAnalysis(model, 
                                  integrator=("Newmark", 0.5, 0.25),
                                  system="Umfpack02",
                                  test=("EnergyIncr", 1.0e-12, 3))

The following cell uses the tqdm package to print a progress bar. If the import fails, the package can be installed by running:

python -m pip install tqdm
from tqdm import tqdm

dt = 0.005

crest_disp=[model.nodeDisp(crest,1)]

steps = int(duration/dt)
for i in tqdm(range(steps)):
    analysis.analyze(1, dt)
    crest_disp.append(model.nodeDisp(crest,1))
100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2000/2000 [00:08<00:00, 226.30it/s]
fig, ax = plt.subplots(figsize=(8, 4))
time = np.linspace(0,model.getTime(),len(crest_disp))
ax.plot(time, np.array(crest_disp)/units.mm)
ax.set_xlabel('Time, s')
ax.set_ylabel('Crest displacement, mm')
ax.grid(True)
../../_images/444fee105ef23e93defd689ad00bfe4d7370911ec5ec035a4683f6d46c19bb35.png

References#

  • Lee, J. and Fenves, G.L. (1998), A plastic-damage concrete model for earthquake analysis of dams. Earthquake Engng. Struct. Dyn., 27: 937-956. https://doi.org/10.1002/(SICI)1096-9845(199809)27:9<937::AID-EQE764>3.0.CO;2-5

  • https://ceae-server.colorado.edu/v2016/books/exa/default.htm?startat=ch02s01aex76.html