Skip to content

Commit

Permalink
Merge 92f4b58 into 63f9512
Browse files Browse the repository at this point in the history
  • Loading branch information
gbarter committed Jul 27, 2021
2 parents 63f9512 + 92f4b58 commit 9c4af64
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
11 changes: 4 additions & 7 deletions wisdem/floatingse/floating_frame.py
Expand Up @@ -12,9 +12,6 @@
RIGID = 1e30
EPS = 1e-6

# TODO:
# - Added mass, hydro stiffness for tower sim


class PlatformFrame(om.ExplicitComponent):
def initialize(self):
Expand Down Expand Up @@ -104,12 +101,11 @@ def setup(self):
self.add_output("platform_variable_capacity", np.zeros(n_member), units="m**3")

self.node_mem2glob = {}
# self.node_glob2mem = {}

def compute(self, inputs, outputs, discrete_inputs, discrete_outputs):
# This shouldn't change during an optimization, so save some time?
if len(self.node_mem2glob) == 0:
self.set_connectivity(inputs, outputs)
# Seems like we have to run this each time as numbering can change during optimization
self.node_mem2glob = {}
self.set_connectivity(inputs, outputs)

self.set_node_props(inputs, outputs)
self.set_element_props(inputs, outputs, discrete_inputs, discrete_outputs)
Expand Down Expand Up @@ -956,6 +952,7 @@ def compute(self, inputs, outputs):
# Add the load case and run
myframe.addLoadCase(load_obj)
# myframe.write(f"{frame}.3dd")
# myframe.draw()
displacements, forces, reactions, internalForces, mass, modal = myframe.run()

# natural frequncies
Expand Down
25 changes: 25 additions & 0 deletions wisdem/pyframe3dd/pyframe3dd.py
Expand Up @@ -1194,6 +1194,31 @@ def write(self, fname):
f.write("# End of input data file\n")
f.close()

def draw(self):
# Visualization for debugging
import matplotlib.pyplot as plt

nnode = len(self.nx)
node_array = np.zeros((nnode, 3))
mynodes = {}
for k in range(nnode):
temp = np.r_[self.nx[k], self.ny[k], self.nz[k]]
mynodes[self.nnode[k]] = temp
node_array[k, :] = temp
myelem = []
for k in range(len(self.eN1)):
myelem.append((self.eN1[k], self.eN2[k]))

fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
for e in myelem:
xs = np.array([mynodes[e[0]][0], mynodes[e[1]][0]])
ys = np.array([mynodes[e[0]][1], mynodes[e[1]][1]])
zs = np.array([mynodes[e[0]][2], mynodes[e[1]][2]])
ax.plot(xs, ys, zs, "b-")
ax.plot(node_array[:, 0], node_array[:, 1], node_array[:, 2], ".k", markersize=10)
plt.show()


class StaticLoadCase(object):
"""docstring"""
Expand Down

0 comments on commit 9c4af64

Please sign in to comment.