diff --git a/pterasoftware/movement.py b/pterasoftware/movement.py index 8ba9b6e6..2f48931e 100644 --- a/pterasoftware/movement.py +++ b/pterasoftware/movement.py @@ -16,6 +16,9 @@ OperatingPointMovement: This is a class used to contain the movement characteristics of an operating point. + IncrementalMovement: This is a class used to contain the movement characteristics of an unsteady + aerodynamics problem with incremental (non-precomputed) motion. + This module contains the following exceptions: None @@ -1483,3 +1486,75 @@ def oscillating_customspace( # Calculate and return the values. return a * custom_function(b * (times - h)) + k + + +class IncrementalMovement: + """This is a class used to contain the movement characteristics of an unsteady + aerodynamics problem with incremental (non-precomputed) motion. + + This class contains the following public methods: + None + + This class contains the following class attributes: + None + + Subclassing: + This class is not meant to be subclassed. + """ + + def __init__( + self, + initial_airplanes, + initial_operating_point, + delta_time=None, + ): + """This is the initialization method. + + :param initial_airplanes: list of Airplane objects + This is a list of objects which characterize the initial position of each airplane in the problem. + :param initial_operating_point: OperatingPoint + This parameter is the problem's initial operating point. + :param delta_time: float, optional + This float is the time, in seconds, between each time step. If + not given a value, this method will calculate one such the ring vortices + shed off the main wing will have roughly the same chord length as the + panels on the main wing. This is based on the initial airplane's reference + chord length, its main wing's number of chordwise panels, and its base + operating point's velocity (in the case of multiple airplanes, delta_time is the average of each airplane's calculated ideal value). + """ + + # Initialize the class attributes. + self.initial_airplanes = initial_airplanes + self.initial_operating_point = initial_operating_point + + # Calculate default delta_time value if the user hasn't passed one in. + if delta_time is None: + delta_times = [] + for initial_airplane in self.initial_airplanes: + + # For a given airplane object, the ideal time step length is that + # which sheds ring vortices off the main wing that have roughly the + # same chord length as the panels on the main wing. This is based on + # the airplane's reference chord length, its main wing's number + # of chordwise panels, and its base operating point's velocity. + delta_times.append( + initial_airplane.c_ref + / initial_airplane.wings[0].num_chordwise_panels + / self.initial_operating_point.velocity + ) + + # Set the delta time to be the average of the airplanes' ideal delta times. + delta_time = sum(delta_times) / len(delta_times) + + self.delta_time = delta_time + + # Generate what will become a list of lists of airplane objects that are the steps through the + # movement of each of this problem's base airplanes. The first index + # identifies the base airplane and the second index identifies the time step. For now, add each base airplane to the list for the initial time step. + self.airplanes = [] + for initial_airplane in self.initial_airplanes: + self.airplanes.append([initial_airplane]) + + # Generate what will become a list of operating point objects that are the steps through the + # movement of this problem's operating point. For now, add base operating point, which corresponds to the first time step. + self.operating_points = [initial_operating_point]