Skip to content

Commit a72cfce

Browse files
committed
updated readme
1 parent d7f711b commit a72cfce

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

README.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,11 @@ example.
139139
140140
# load the full file
141141
fobj = pyansys.FullReader('file.full')
142-
dofref, k, m = fobj.LoadKM(utri=False)
143-
142+
dofref, k, m = fobj.LoadKM() # upper triangle only
143+
144+
# make k, m full
145+
k += sparse.triu(k, 1).T
146+
m += sparse.triu(m, 1).T
144147
145148
If you have ``scipy`` installed, you can solve the eigensystem for its natural
146149
frequencies and mode shapes.
@@ -149,6 +152,10 @@ frequencies and mode shapes.
149152
150153
from scipy.sparse import linalg
151154
155+
# condition the k matrix
156+
# to avoid getting the "Factor is exactly singular" error
157+
k += sparse.diags(np.random.random(k.shape[0])/1E20, shape=k.shape)
158+
152159
# Solve
153160
w, v = linalg.eigsh(k, k=20, M=m, sigma=10000)
154161
# System natural frequencies

0 commit comments

Comments
 (0)