Modal solver now writes a table of eigenvalues, freqs etc to log
@@ -15,6 +15,7 @@ import sharpy.structure.utils.xbeamlib as xbeamlib
from sharpy.utils.solver_interface import solver, BaseSolver
import sharpy.utils.settings as settings
import sharpy.utils.algebra as algebra
+import sharpy.utils.cout_utils as cout
@@ -119,6 +120,7 @@ class Modal(BaseSolver):
self.settings = None
self.folder = None
+ self.eigenvalue_table = None
self.filename_freq = None
self.filename_damp = None
self.filename_shapes = None
@@ -159,6 +161,12 @@ class Modal(BaseSolver):
'tstep' + ("%06d" % self.data.ts) +
'_ModalShape')
+ if self.settings['print_info']:
+ cout.cout_wrap('Structural eigenvalues')
+ self.eigenvalue_table = cout.TablePrinter(7, 12, ['d', 'f', 'f', 'f', 'f', 'f', 'f'])
+ self.eigenvalue_table.print_header(['mode', 'eval_real', 'eval_imag', 'freq_n (Hz)', 'freq_d (Hz)',
+ 'damping', 'period (s)'])
+
def run(self):
r"""
@@ -442,6 +450,21 @@ class Modal(BaseSolver):
outdict['C'] = FullCglobal
outdict['K'] = FullKglobal
self.data.structure.timestep_info[self.data.ts].modal = outdict
+
+ if self.settings['print_info']:
+ for i in range(NumLambda):
+ eigenvalue = eigenvalues[i]
+ if self.settings['use_undamped_modes']:
+ eigenvalue = np.sqrt(eigenvalue)*1j
+ omega_n = np.abs(eigenvalue)
+ omega_d = np.abs(eigenvalue.imag)
+ damping_ratio = -eigenvalue.real / omega_n
+ f_n = omega_n / 2 / np.pi
+ f_d = omega_d / 2 / np.pi
+ period = 1 / f_d
+ self.eigenvalue_table.print_line([i, eigenvalue.real, eigenvalue.imag, f_n, f_d,
+ damping_ratio, period])
+
return self.data
@@ -504,7 +527,7 @@ def scale_mode(data,eigenvector,rot_max_deg=15,perc_max=0.15):
else:
fact = perc_max * RaMax / dRaMax
# correct factor to ensure max disp is perc
- return eigenvector*fact
+ return fact
@@ -699,10 +722,10 @@ def write_modes_vtk(data, eigenvectors, NumLambda, filename_root,
num_rigid_body = 0
for mode in range(num_rigid_body, NumLambda - num_rigid_body):
-
# scale eigenvector
eigvec = eigenvectors[:num_dof, mode]
- eigvec=scale_mode(data,eigvec,rot_max_deg,perc_max)
+ fact = scale_mode(data, eigvec, rot_max_deg, perc_max)
+ eigvec = eigvec * fact
zeta_mode = get_mode_zeta(data, eigvec)
write_zeta_vtk(zeta_mode, tsaero.zeta, filename_root + "_%06u" % (mode,))
