Simulation
Classes
- class libmurosim.Atmosphere
Object describing basic atmosphere attributes. Make sure units are consistent with everything else.
Constructor:
- Parameters
density – Atmospheric density.
dynamic_viscosity – Atmospheric dynamic viscosity.
- density
atmospheric density
- dynamic_viscosity
atmospheric dynamic viscosity
- kinematic_viscosity
atmospheric kinematic viscosity
Functions
- libmurosim.step(ac_state, aircraft, ac_input_state, inflows, wake_history, atmo, iteration, dt)
Step the simulation by one timestep
- Parameters
ac_state –
AircraftState
object holding the current state of the aircraftaircraft –
Aircraft
object describing the aircraft geometryac_input_state –
AircraftInputState
describing the aircrafts inputsinflows – a list of
Inflow
objects. One for each rotorwake_history –
WakeHistory
object containing the current and past wake statesatmo –
Atmosphere
object describing ambient atmospheric conditionsiteration – the current iteration
dt – the current timestep size
- libmurosim.basic_aircraft_rotor_dynamics(input_state, dt)
Update all rotor azimuthal positions using a basic dynamics equation with simple forward Euler integration:
\(\frac{\mathrm{d}\psi}{\mathrm{d}t} = \Omega + \dot\Omega \Delta t\)
- Parameters
input_state – The
AircraftInputState
to updatedt – The current time step size
- libmurosim.basic_single_rotor_dynamics(input_state, dt)
Updates a single rotor azimuthal positions using a basic dynamics equation with simple forward Euler integration:
\(\frac{\mathrm{d}\psi}{\mathrm{d}t} = \Omega + \dot\Omega \Delta t\)
- Parameters
input_state – The
RotorInputState
to updatedt – The current time step size
- libmurosim.chunk_size()
Returns the chunk size used by the internal data structures
Geometry
Classes
- class libmurosim.Aircraft
This class allocates and holds an array of rotors for the aircraft.
Constructor:
- Parameters
num_rotors – The number of rotors the aircraft has.
- rotors
An array of
RotorGeometry
, one for each rotor on the aircraft
- class libmurosim.RotorGeometry
This class allocates and holds all the blades and other rotor geometric data.
Constructor:
- Parameters
num_blades – Number of blades the rotor has.
origin – The global origin of the rotor. This is where the center of the hub is located.
radius – The dimensional radius of the rotor.
solidity – The solidity of the rotor.
- blades
An array of
BladeGeomtery
, one for each blade of the rotor
- origin
The global origin of the rotor. This is where the center of the hub is located.
- radius
The dimensional radius of the rotor.
- solidity
The solidity of the rotor.
- class libmurosim.BladeGeometry
This class allocates and holds the blade geomteric parameters.
Constructor:
- Parameters
num_elements – The number of spanwise blade elements.
azimuth_offset – The azimuthal offset that this blade has relative to its rotor.
average_chord – The average chord of the blade.
- average_chord
The dimensional average chord of the blade
- azimuth_offset
The azimuthal offset for this blade. This is added to the
RotorInputState
azimuth.
- chunks
Functions
- libmurosim.set_r(bg, data)
Set the spanwise radial stations (non-dimensional) of a
BladeGeometry
from a linear array.- Parameters
bg –
BladeGeometry
object to apply twist to.data – List of radial stations
- libmurosim.set_twist(bg, data)
Set the spanwise twist distribution of a
BladeGeometry
from a linear array.- Parameters
bg –
BladeGeometry
object to apply twist to.data – List of twist angles (in radians) for each radial station
- libmurosim.set_chord(bg, data)
Set the spanwise chord distribution (non-dimensional) of a
BladeGeometry
from a linear array.- Parameters
bg –
BladeGeometry
object to apply twist to.data – List of chord lengths (non-dimensional) for each radial station
- libmurosim.set_C_l_alpha(bg, data)
Set the spanwise lift curve slope (\(C_{L_{\alpha}}\))(per radian) distribution of a
BladeGeometry
from a linear array.- Parameters
bg –
BladeGeometry
object to apply twist to.data – List of lift curve slope (per radians) for each radial station
- libmurosim.set_alpha_0(bg, data)
Set the spanwise 0 lift angle (\(\alpha_0\))(in radians) distribution of a
BladeGeometry
from a linear array.- Parameters
bg –
BladeGeometry
object to apply twist to.data – List of \(\alpha_0\) (in radians) for each radial station
- libmurosim.set_sweep(bg, data)
Set the spanwise sweep angle (in radians) distribution of a
BladeGeometry
from a linear array.- Parameters
bg –
BladeGeometry
object to apply twist to.data – List of sweep angles (in radians) for each radial station
State
Classes
- class libmurosim.AircraftState
This is the top level class that holds the current aerodynamic state of an aircraft.
Constructor:
- Parameters
num_rotors – The number of rotors on this aircraft
num_blades – The number of blades on each rotor
num_elements – The requested number of spanwise elements. This will be rounded up to the nearest
chunk_size()
.ac – The
Aircraft
object associated with this state
- rotor_states
An array of
RotorState
, one for each rotor on the aircraft
- class libmurosim.RotorState
This class holds the current aerodynamic state of the rotor.
Attention
This never needs to be explicitly constructed as it will be constructed by
AircraftState
- C_T
The current thrust coefficient of this rotor
- advance_ratio
The current advance ratio of this rotor
- axial_advance_ratio
The current axial advance ratio of this rotor
- blade_states
An array of
BladeState
, one for each blade of this rotor
- class libmurosim.BladeState
This class holds the current aerodynamic state of the blade.
Attention
This never needs to be explicitly constructed as it will be constructed by
AircraftState
- C_D
The current drag coefficient contribution from this blade
- C_L
The current lift coefficient contribution from this blade
- C_Mx
The current x moment coefficient contribution from this blade
- C_My
The current y moment coefficient contribution from this blade
- C_Q
The current power/torque coefficient contribution from this blade
- C_T
The current thrust coefficient contribution from this blade
- azimuth
The current azimuthal angle of this blade
- chunks
- class libmurosim.BladeStateChunk
- aoa
A chunk of spanwise sectional angle of attack
- dC_D
A chunk of spanwise sectional drag coefficient
- dC_L
A chunk of spanwise sectional lift coefficient
- dC_Q
A chunk of spanwise sectional power/torque coefficient
- dC_T
A chunk of spanwise sectional thrust coefficient
- d_gamma
A chunk of spanwise sectional change in circulation
- gamma
A chunk of spanwise sectional circulation
Functions
- libmurosim.get_dC_T(blade_state)
Extract blade spanwise thrust coefficient to a linear array.
- Parameters
blade_state – the
BladeState
to extract the spanwise \(dC_T\) from- Returns
List of spanwise \(dC_T\) values
- libmurosim.get_dC_Q(blade_state)
Extract blade spanwise torque coefficient to a linear array.
- Parameters
blade_state – the
BladeState
to extract the spanwise \(Cd_Q\) from- Returns
List of spanwise \(dC_Q\) values
- libmurosim.get_aoa(blade_state)
Extract blade spanwise angle of attack (\({\alpha}\)) to a linear array.
- Parameters
blade_state – the
BladeState
to extract the spanwise \({\alpha}\) from- Returns
List of spanwise \({\alpha}\)
- libmurosim.get_gamma(blade_state)
Extract blade spanwise bound circulation (\({\Gamma}\)) to a linear array.
- Parameters
blade_state – the
BladeState
to extract the spanwise \({\Gamma}\) from- Returns
List of spanwise circulation values
- libmurosim.get_d_gamma(blade_state)
Extract blade spanwise change in bound circulation (\({\Delta}\)\({\Gamma}\)) to a linear array.
- Parameters
blade_state – the
BladeState
to extract the spanwise \({\Delta}\)\({\Gamma}\) from- Returns
List of spanwise \({\Delta}\)\({\Gamma}\) values
- libmurosim.get_dC_L(blade_state)
Extract blade spanwise lift coefficient (\(dC_L\)) to a linear array.
- Parameters
blade_state – the
BladeState
to extract the spanwise \(C_L\) from- Returns
List of spanwise \(dC_L\) values
- libmurosim.get_dC_D(blade_state)
Extract blade spanwise drag coefficient (\(dC_D\)) to a linear array.
- Parameters
blade_state – the
BladeState
to extract the spanwise \(C_D\) from- Returns
List of spanwise \(dC_D\) values
Input State
Classes
- class libmurosim.AircraftInputState
This class represents the input parameters for the entire aircraft.
Contructor:
- Parameters
num_rotors – Number of rotors the aircraft has.
num_blades – The number of blades each rotor has.
- rotor_inputs
An array of
RotorInputState
, one for each rotor
- class libmurosim.RotorInputState
- angle_of_attack
Angle of attack of the rotor in radians
- angular_accel
The angular acceleration of the rotor in \(mathrm{rad}/s^2\)
- angular_velocity
The angular velocity of the rotor in \(mathrm{rad}/s\)
- azimuth
The current azimuthal position of the rotor in radians
- blade_flapping
An array of blade flapping angle in radians
- blade_flapping_rate
An array of blade flapping rates in \(mathrm{rad}/s\)
- blade_pitches
An array of blade pitches taken at the 75% spanwise location in radians
- freestream_velocity
The dimensional freestream velocity
- r_0
The initial non-dimensional tip vortex core size
Functions
Inflow Models
Classes
- class libmurosim.HuangPeters
This class instantiates a dynamic inflow model for a single rotor. One of these will be needed for each rotor in the aircraft.
Constructor:
- Parameters
Mo – The number of odd modes used in the model. 4 typically works well.
Me – The number of even modes used in the model. 2 typically works well.
rotor – The geometry of the rotor this inflow model is modeling.
dt – The timestep of the simulation.
- inflow_at()
Computes the rotor induced flow at the requested location.
- Parameters
x – A chunk of x positions to compute the induced velocity at.
y – A chunk of y positions to compute the induced velocity at.
z – A chunk of z positions to compute the induced velocity at.
x_e – A chunk of x_e positions to compute the induced velocity at. Unused in this inflow model.
angle_of_attack – Current angle of attack of the rotor. Unused in this inflow model.
- Returns
A chunk of z induced velocities.
- update()
Updates the inflow model by one timestep
- Parameters
C_T – Current rotor thrust coefficient. This does nothing for this inflow model.
rotor – The current input state for the rotor.
rotor_state – The current rotor state.
advance_ratio – The current advance ratio for the rotor.
axial_advance_ratio – The current axial advance ratio for the rotor.
dt – The current timestep size.
- wake_skew()
- Returns
The current wake skew angle of the rotor in radians.
Wake
Classes
- class libmurosim.WakeHistory
Top level structure for holding the wake and its history
- class libmurosim.RotorWake
- shed_vortices
An array of
ShedVortex
- tip_vortices
An array of
VortexFilament
- class libmurosim.ShedVortex
- shed_filaments
An array of
VortexFilament
- class libmurosim.VortexFilament
- chunks
An array of
FilamentChunk
- class libmurosim.FilamentChunk
- gamma
A chunk of circulation strengths along the filament
- r_c
A chunk of vortex core size along the filament
- v_z
A chunk of induced velocities along the filament
- x
A chunk of x positions along the filament
- y
A chunk of y positions along the filament
- z
A chunk of z positions along the filament
Functions
- libmurosim.get_wake_x_component(votex_filament)
Extract filament x position component to a linear array.
- Parameters
votex_filament – the
VortexFilament
to extract the x position component from- Returns
List of filament x positions
- libmurosim.get_wake_y_component(votex_filament)
Extract filament y position component to a linear array.
- Parameters
votex_filament – the
VortexFilament
to extract the y position component from- Returns
List of filament y positions
- libmurosim.get_wake_z_component(votex_filament)
Extract filament z position component to a linear array.
- Parameters
votex_filament – the
VortexFilament
to extract the z position component from- Returns
List of filament z positions
- libmurosim.get_wake_gamma_component(votex_filament)
Extract filament cirulation strength (\(\Gamma\)) to a linear array.
- Parameters
votex_filament – the
VortexFilament
to extract \(\Gamma\) from- Returns
List of filament \(\Gamma\)
- libmurosim.get_wake_r_c_component(votex_filament)
Extract filament vortex core size (\(r_c\)) to a linear array.
- Parameters
votex_filament – the
VortexFilament
to extract \(r_c\) from- Returns
List of filament core sizes
- libmurosim.get_wake_v_z_component(votex_filament)
Extract induced velocity (\(v_z\)) acting upon the filament to a linear array.
- Parameters
votex_filament – the
VortexFilament
to extract \(v_z\) from- Returns
List of induced velocities
Vtk integration
Classes
- class libmurosim.VtkWake
This is an opaque type that holds all the relevant data for writing out a vtu file that holds the wake geometric data as well as various data in a filament.
Attention
Do not instantiate one of these yourself. Instead use
build_base_vtu_wake()
- class libmurosim.VtkRotor
This is an opaque type that holds all the relevant data for writing out a vtu file that holds the rotor geometric data as well as various spanwise data.
Attention
Do not instantiate one of these yourself. Instead use
build_base_vtu_rotor()
Functions
- libmurosim.build_base_vtu_rotor(rotor)
Construct and allocate all required data for a
VtkRotor
.- Parameters
rotor – An instance of a
RotorGeometry
object- Returns
An initialized
VtkRotor
object
- libmurosim.write_rotor_vtu(base_filename, iteration, rotor_idx, vtk_rotor, rotor_state, rotor_input_state)
Takes the
RotorState
andRotorInput
data, converts it aVtkRotor
, and saves it to a vtu file.The filaname that the data is saved to is constructed by the function such that:
filename = base_filename + "_" + rotor_idx + "_" + iteration + ".vtu"
This ensures that timeseries files can be iterpreted by paraview correctly
Caution
This function has a relatively high runtime cost, use sparingly
- Parameters
base_filename – The filename to save the data to
iteration – The iteration of the saved data
rotor_idx – The index of the rotor being saved
vtk_rotor – The
VtkRotor
object to save outrotor_state – The
RotorState
object containing the rotor state data to saverotor_input – the
RotorInput
object containing the rotor position data
- libmurosim.write_wake_vtu(base_filename, iteration, vtk_wake, wake)
Takes the
Wake
data, converts it aVtkWake
, and saves it to several vtu files. One file is saved per blade tip vortex filament, and one file is saved per blade shed wake.The filanames that the data is saved to is constructed by the function such that:
tip_vortex_filename = base_filename + "_" + rotor_idx + "_" + blade_idx + iteration + ".vtu" shed_wake_filename = base_filename + "_shed_" + rotor_idx + "_" + blade_idx + iteration + ".vtu"
This ensures that timeseries files can be iterpreted by paraview correctly
Caution
This function has a very high runtime cost, use sparingly