Source code for sharpy.solvers.nonlineardynamicprescribedstep

@modified   Alfonso del Carre

import sharpy.structure.utils.xbeamlib as xbeamlib
from sharpy.utils.solver_interface import solver, BaseSolver, solver_from_string
import sharpy.utils.settings as settings_utils

_BaseStructural = solver_from_string('_BaseStructural')

[docs]@solver class NonLinearDynamicPrescribedStep(_BaseStructural): """ Structural solver used for the dynamic simulation of clamped structures or those subject to a prescribed motion. This solver provides an interface to the structural library (``xbeam``) and updates the structural parameters for every k-th step in the FSI iteration. This solver can be called as part of a standalone structural simulation or as the structural solver of a coupled aeroelastic simulation. """ solver_id = 'NonLinearDynamicPrescribedStep' solver_classification = 'structural' settings_types = _BaseStructural.settings_types.copy() settings_default = _BaseStructural.settings_default.copy() settings_description = _BaseStructural.settings_description.copy() settings_table = settings_utils.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, restart=False): = data if custom_settings is None: self.settings = data.settings[self.solver_id] else: self.settings = custom_settings settings_utils.to_custom_types(self.settings, self.settings_types, self.settings_default) # load info from dyn dictionary, self.settings['num_steps']) def run(self, **kwargs): structural_step = settings_utils.set_value_or_default(kwargs, 'structural_step',[-1]) dt = settings_utils.set_value_or_default(kwargs, 'dt', self.settings['dt']) if > 0: try: structural_step.for_vel[:] =[ - 1]['for_vel'] structural_step.for_acc[:] =[ - 1]['for_acc'] except IndexError: pass xbeamlib.cbeam3_step_nlndyn(, self.settings,, structural_step, dt=dt) # self.extract_resultants(structural_step), dt) return def add_step(self): def next_step(self): pass # # ts = len( - 1 # if ts > 0: #[ts].for_vel[:] =[ts - 1]['for_vel'] #[ts].for_acc[:] =[ts - 1]['for_acc'] #[ts].unsteady_applied_forces[:] =[ts - 1]['dynamic_forces'] def extract_resultants(self, tstep=None): if tstep is None: tstep =[] steady, unsteady, grav = tstep.extract_resultants(, force_type=['steady', 'unsteady', 'grav']) totals = steady + unsteady + grav 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)