Source code for sharpy.solvers.nonlinearstatic

import numpy as np

import sharpy.structure.utils.xbeamlib as xbeamlib
import sharpy.utils.cout_utils as cout
import sharpy.utils.settings as settings
from sharpy.utils.solver_interface import solver, BaseSolver, solver_from_string
import sharpy.utils.algebra as algebra

_BaseStructural = solver_from_string('_BaseStructural')

[docs]@solver class NonLinearStatic(_BaseStructural): """ Structural solver used for the static simulation of free-flying structures. This solver provides an interface to the structural library (``xbeam``) and updates the structural parameters for every k-th step of the FSI iteration. This solver can be called as part of a standalone structural simulation or as the structural solver of a coupled static aeroelastic simulation. """ solver_id = 'NonLinearStatic' solver_classification = 'structural' # settings list settings_types = _BaseStructural.settings_types.copy() settings_default = _BaseStructural.settings_default.copy() settings_description = _BaseStructural.settings_description.copy() settings_types['initial_position'] = 'list(float)' settings_default['initial_position'] = np.array([0.0, 0.0, 0.0]) settings_table = settings.SettingsTable() __doc__ += settings_table.generate(settings_types, settings_default, settings_description) def __init__(self): = None self.settings = None def initialise(self, data, custom_settings=None): = data if custom_settings is None: self.settings = data.settings[self.solver_id] else: self.settings = custom_settings settings.to_custom_types(self.settings, self.settings_types, self.settings_default) def run(self):[].for_pos[0:3] = self.settings['initial_position'] xbeamlib.cbeam3_solv_nlnstatic(, self.settings, self.extract_resultants() return def next_step(self): def extract_resultants(self, tstep=None): if tstep is None: tstep =[] applied_forces =, tstep) applied_forces_copy = applied_forces.copy() gravity_forces_copy = tstep.gravity_forces.copy() for i_node in range( applied_forces_copy[i_node, 3:6] += algebra.cross3(tstep.pos[i_node, :], applied_forces_copy[i_node, 0:3]) gravity_forces_copy[i_node, 3:6] += algebra.cross3(tstep.pos[i_node, :], gravity_forces_copy[i_node, 0:3]) totals = np.sum(applied_forces_copy + gravity_forces_copy, axis=0) return totals[0:3], totals[3:6] def update(self, tstep=None): self.create_q_vector(tstep) def create_q_vector(self, tstep=None): import sharpy.structure.utils.xbeamlib as xb if tstep is None: tstep =[-1] xb.xbeam_solv_disp2state(, tstep)