Meshing error during iterative definition of nodes

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

Moderators: silvia, selimgunay, Moderators

Post Reply
MUz
Posts: 8
Joined: Fri Dec 30, 2022 2:55 am

Meshing error during iterative definition of nodes

Post by MUz » Fri Dec 30, 2022 3:08 am

Hello,

I am setting up the geometry of a soil model using OpenSeesPy, defining consecutive layered rectangles for subsequent meshing and iteratively defining the vertices of the recatngles and node tags.

Running the code at the bottom of the post results in the error "Domain::addNode - node with tag 5 already exists in model" during iteration 2 (jj=1), though node coordinates for Node 5 seem to be correct and the node tag 5 does not seem to be assigned in the first iteration (jj=0) - please see screen text output below:

Iteration 1 (jj=0)
Node tags:
1 2 3 4
[1, -550, -25.0]
[2, -550, 0.0]
[3, -450.0, 0.0]
[4, -450.0, -25.0]

Iteration 2 (jj=1)
Node tags:
5 6 7 8
[5, -550, -50.0]
[6, -550, -25.0]
[7, -450.0, -25.0]
[8, -450.0, -50.0]

Could anyone help me understand what I am doing wrong?

Regards.

Code:

# ==============================================================================
# IMPORTS
# ==============================================================================

import openseespy.opensees as op

#from random import random

# ==============================================================================
# DEFINING GEOMETRIC PARAMETERS
# ==============================================================================

# Geometric parameters are expressed in [m]
H=300

# Width of left basin side
Lol=200
# Width of right basin side
Lor=500
# Internal semi-width
Li=150

# Defining height of elementary layer
Dz=25
# Defining depths of stratigraphic interfaces
n_int=int(H/Dz+1)
z_int=np.linspace(0,-H,n_int)
print(z_int)

# Defining number of layers in soil deposit
n_lay=len(z_int)-1

# # ==============================================================================
# # DEFINING GEOMETRY
# # ==============================================================================

op.wipe()
# nodes_dict = dict()

# For each layer, define the meshing rectangle
for ii in range(n_lay):
#print(ii)

# Part 1:
X11=-(Li+2*Lol)
X21=-(Li+2*Lol)
X31=-(Li+1.5*Lol)
X41=-(Li+1.5*Lol)
Y11=z_int[ii+1]
Y21=z_int[ii]
Y31=z_int[ii]
Y41=z_int[ii+1]

print(4*ii+1,4*ii+2,4*ii+3,4*ii+4)

# Defining nodes
if ii<1:
print('Layer ',ii+1)
print([4*ii+1,X11,Y11])
print([4*ii+2,X21,Y21])
print([4*ii+3,X31,Y31])
print([4*ii+4,X41,Y41])
print('')
op.node(4*ii+1,X11,Y11)
op.node(4*ii+2,X21,Y21)
op.node(4*ii+3,X31,Y31)
op.node(4*ii+4,X41,Y41)
else:
print('Layer ',ii+1)
print([4*ii+1,X11,Y11])
print([4*ii+2,X21,Y21])
print([4*ii+3,X31,Y31])
print([4*ii+4,X41,Y41])
print('')
op.node(4*ii+1,X11,Y11)
op.node(4*ii+4,X41,Y41)
# Defining mesh size
c = Dz/5
# Defining mesh
# tag Npts nodes type dof size
op.mesh('line',4*ii+1, 2, *[4*ii+1,4*ii+2], 0, 2, c)
op.mesh('line',4*ii+2, 2, *[4*ii+2,4*ii+3], 0, 2, c)
op.mesh('line',4*ii+3, 2, *[4*ii+3,4*ii+4], 0, 2, c)
op.mesh('line',4*ii+4, 2, *[4*ii+4,4*ii+1], 0, 2, c)

mhscott
Posts: 872
Joined: Tue Jul 06, 2004 3:38 pm
Location: Corvallis, Oregon USA
Contact:

Re: Meshing error during iterative definition of nodes

Post by mhscott » Fri Dec 30, 2022 6:02 am

The mesh command creates a node with tag 5

MUz
Posts: 8
Joined: Fri Dec 30, 2022 2:55 am

Re: Meshing error during iterative definition of nodes

Post by MUz » Fri Dec 30, 2022 6:44 am

mhscott wrote:
Fri Dec 30, 2022 6:02 am
The mesh command creates a node with tag 5
Hello Michael, thanks for clarifying. If I understand correctly, I guess I should define all the container shapes (rectangles, rhombuses) defining the geometry recursively in a first step and subsequently perform the meshing. The challenging part seems to be figuring out how many nodes will be generated by meshing within each shape (these are variable in size) to assign tags to the meshing-generated nodes. Apologies if these issues are trivial but I am a newby and have not been able to find examples involving recursive mesh generation.

MUz
Posts: 8
Joined: Fri Dec 30, 2022 2:55 am

Re: Meshing error during iterative definition of nodes

Post by MUz » Fri Dec 30, 2022 6:48 am

mhscott wrote:
Fri Dec 30, 2022 6:02 am
The mesh command creates a node with tag 5
Alternatively, I could implement the meshing algorithm for each of the boundary shapes and retrieve the set of nodes generated during meshing, then start with a new boundary by increasing the node tag by 1. I'll see if I am able to retrieve existing nodes (perhaps using a dictionary).

Post Reply