Skip to content

Commit

Permalink
Recover moments to output force/mom coefficients at ref state
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoiz committed Jun 15, 2022
1 parent de0e42c commit eceff9c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
10 changes: 9 additions & 1 deletion sharpy/linear/utils/derivatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
class Derivatives:
"""
Class containing the derivatives set for a given state-space system (i.e. aeroelastic or aerodynamic)
Args:
reference_dimensions (dict): Info on the reference dimensions ``S_ref`` (area) ``b_ref`` (span) ``c_ref`` chord
``u_inf`` velocity and ``rho`` density
static_state (tuple): Force and moment coefficient at the reference state (dim6) (inertial frame)
target_system (str): Name of target system ``aeroelastic`` or ``aerodynamic``
"""
def __init__(self, reference_dimensions, static_state, target_system=None):

self.target_system = target_system # type: str # name of target system (aerodynamic/aeroelastic)
self.transfer_function = None # type: np.array # matrix of steady-state TF for target system

self.static_state = static_state # type: tuple # [fx, fy, fz] at ref state
self.static_state = static_state # type: tuple # [fx, fy, fz, mx, my, mz] at ref state
self.reference_dimensions = reference_dimensions # type: dict # name: ref_dimension_value dictionary

self.separator = '\n' + 80 * '#' + '\n'
Expand All @@ -33,6 +39,8 @@ def __init__(self, reference_dimensions, static_state, target_system=None):
'force_angular_vel': self.dynamic_pressure * s_ref * c_ref / u_inf,
'moment_lon_angular_vel': self.dynamic_pressure * s_ref * c_ref * c_ref / u_inf} # missing rates

# only used to show the forces/moment coefficient at ref state
# for derivatives calculation the vectors at the linearisation ref are used
self.steady_coefficients = np.array(self.static_state)
self.steady_coefficients[:3] /= self.coefficients['force']
self.steady_coefficients[3] /= self.coefficients['moment_lat']
Expand Down
20 changes: 13 additions & 7 deletions sharpy/postproc/stabilityderivatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@
@solver_interface.solver
class StabilityDerivatives(solver_interface.BaseSolver):
"""
Outputs the stability derivatives of a free-flying aircraft
Outputs the stability derivatives of a free-flying aircraft.
The simulation set-up to obtain the stability derivatives is not standard, and requires specific settings
in the solvers ran prior to this post-processor. Please see the tutorial at:
https://github.com/ngoiz/hale-ders/blob/main/Delivery/01_StabilityDerivatives/01_StabilityDerivatives.ipynb
In the future, a routine will be available where these required solvers' settings are pre-populated
Note:
Requires the AeroForcesCalculator post-processor to have been run before.
"""
solver_id = 'StabilityDerivatives'
Expand Down Expand Up @@ -213,13 +222,10 @@ def get_state_space(self, target_system):
return ss

def steady_aero_forces(self):
"""Retrieve steady aerodynamic forces at the linearisation reference
"""Retrieve steady aerodynamic forces and moments at the linearisation reference at the
Returns:
tuple: (fx, fy, fz) in the inertial G frame
tuple: (fx, fy, fz, mx, my, mz) in the inertial G frame
"""
fx = np.sum(self.data.linear.tsaero0.inertial_steady_forces[:, 0], 0)
fy = np.sum(self.data.linear.tsaero0.inertial_steady_forces[:, 1], 0)
fz = np.sum(self.data.linear.tsaero0.inertial_steady_forces[:, 2], 0)

return fx, fy, fz
return self.data.linear.tsaero0.total_steady_inertial_forces

0 comments on commit eceff9c

Please sign in to comment.