14.3.2.2. Dambreak with Elastic Obstacle Analysis using background mesh

  1. The source code is shown below, which can be downloaded here.
  2. Run the source code in your favorite Python program.
  3. The ParaView is needed to view the results. To view the displaced shape of fluid, use the “Warp By Vector” filter with scale factor = 1.0.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import os
import openseespy.opensees as ops


print("=======================================================")
print("Starting Dambreak with Obstacle Background Mesh example")

# ------------------------------
# Start of model generation
# -----------------------------

# wipe all previous objects
ops.wipe()

# create a model with fluid
ops.model('basic', '-ndm', 2, '-ndf', 3)

# geometric
L = 0.146
H = L * 2
H2 = 0.3
b = 0.012
h = L / 40
Hb = 20.0 * b / 3.0

# number of particles per cell in each direction
numx = 3.0
numy = 3.0

# fluid properties
rho = 1000.0
mu = 0.0001
b1 = 0.0
b2 = -9.81
thk = 0.012
kappa = -1.0

# elastis structural material
rhos = 2500.0
A = thk * thk
E = 1e6
Iz = thk * thk * thk * thk / 12.0
bmass = A * Hb * rhos

# nonlinear structural material
E0 = 1e6
Fy = 5e4
hardening = 0.02

nonlinear = False

# analysis
dtmax = 1e-3
dtmin = 1e-3
totaltime = 1.0

if nonlinear:
    filename = 'obstaclenonlinear-bg'
else:
    filename = 'obstacle-bg'

# recorder
ops.recorder('BgPVD', filename, 'disp', 'vel', 'pressure', '-dT', 1e-3)
if not os.path.exists(filename):
    os.makedirs(filename)

# fluid mesh
ndf = 3

# total number of particles in each direction
nx = round(L / h * numx)
ny = round(H / h * numy)

# create particles
eleArgs = ['PFEMElementBubble', rho, mu, b1, b2, thk, kappa]
partArgs = ['quad', 0.0, 0.0, L, 0.0, L, H, 0.0, H, nx, ny]
parttag = 1
ops.mesh('part', parttag, *partArgs, *eleArgs, '-vel', 0.0, 0.0)

# wall mesh
ops.node(1, 2 * L, 0.0)
ops.node(2, 2 * L, Hb)
ops.node(3, 0.0, H)
ops.node(4, 0.0, 0.0)
ops.node(5, 4 * L, 0.0)
ops.node(6, 4 * L, H)

sid = 1
walltag = 4
ops.mesh('line', walltag, 5, 3, 4, 1, 5, 6, sid, ndf, h)

wallNodes = ops.getNodeTags('-mesh', walltag)
for nd in wallNodes:
    ops.fix(nd, 1, 1, 1)

# structural mesh

# transformation
transfTag = 1
ops.geomTransf('Corotational', transfTag)

# section
secTag = 1
if nonlinear:
    matTag = 1
    ops.uniaxialMaterial('Steel01', matTag, Fy, E0, hardening)
    numfiber = 5
    ops.section('Fiber', secTag)
    ops.patch('rect', matTag, numfiber, numfiber, 0.0, 0.0, thk, thk)
else:
    ops.section('Elastic', secTag, E, A, Iz)

# beam integration
inteTag = 1
numpts = 2
ops.beamIntegration('Legendre', inteTag, secTag, numpts)

coltag = 3
eleArgs = ['dispBeamColumn', transfTag, inteTag]
ops.mesh('line', coltag, 2, 1, 2, sid, ndf, h, *eleArgs)

# mass
sNodes = ops.getNodeTags('-mesh', coltag)
bmass = bmass / len(sNodes)
for nd in sNodes:
    ops.mass(int(nd), bmass, bmass, 0.0)


# background mesh
lower = [-h, -h]
upper = [5 * L, 3 * L]

ops.mesh('bg', h, *lower, *upper,
     '-structure', sid, len(sNodes), *sNodes,
     '-structure', sid, len(wallNodes), *wallNodes)

print('num nodes =', len(ops.getNodeTags()))
print('num particles =', nx * ny)

# create constraint object
ops.constraints('Plain')

# create numberer object
ops.numberer('Plain')

# create convergence test object
ops.test('PFEM', 1e-5, 1e-5, 1e-5, 1e-5, 1e-5, 1e-5, 100, 3, 1, 2)

# create algorithm object
ops.algorithm('Newton')

# create integrator object
ops.integrator('PFEM', 0.5, 0.25)

# create SOE object
ops.system('PFEM')
# system('PFEM', '-mumps') Linux version can use mumps

# create analysis object
ops.analysis('PFEM', dtmax, dtmin, b2)

# analysis
while ops.getTime() < totaltime:

    # analysis
    if ops.analyze() < 0:
        break

    ops.remesh()

print("==========================================")