diff --git a/wisdem/floatingse/floating_frame.py b/wisdem/floatingse/floating_frame.py index 31fa7984a..09e153e46 100644 --- a/wisdem/floatingse/floating_frame.py +++ b/wisdem/floatingse/floating_frame.py @@ -12,9 +12,6 @@ RIGID = 1e30 EPS = 1e-6 -# TODO: -# - Added mass, hydro stiffness for tower sim - class PlatformFrame(om.ExplicitComponent): def initialize(self): @@ -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) @@ -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 diff --git a/wisdem/pyframe3dd/pyframe3dd.py b/wisdem/pyframe3dd/pyframe3dd.py index bacd8f6e3..594fd728c 100644 --- a/wisdem/pyframe3dd/pyframe3dd.py +++ b/wisdem/pyframe3dd/pyframe3dd.py @@ -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"""