Skip to content

Commit

Permalink
Merge branch 'hotfix-0.3.2'
Browse files Browse the repository at this point in the history
Former-commit-id: 03f46fa [formerly e501f33b6425f86a76a3db4b6dae00b1b5f51d2d] [formerly b48de2fd8d7e3a297bf4e996635d8d8a284ab1ab [formerly 2c69ba342b078a69e9bce6a6650e2fa92f1427fb]] [formerly 86a1355b297d17be3122bb6296e4003d303bf980 [formerly e3ada611bb8a836fb712216deb09a4c0761a455e] [formerly 575a799c51a53f9f79a0bc8a6cd736761914c58a [formerly 5160c15]]]
Former-commit-id: 08ad62092a1a1d992a78ef44e43026013ff8a9cb [formerly 6c8cf47f65dccf0b66579b2efe38ef65b524fd43] [formerly 07c7adfe02129c725f1e6cc62bc142e99750a6c3 [formerly 7d16234]]
Former-commit-id: 9abf8a34ca300b5555e6a235ca0028abb257d368 [formerly 0ee108ad290325a4c385fd629b9e29c39b68b5c5]
Former-commit-id: 0839020ca25bdeea6d6f4dc24f0475d87d4d88e7
  • Loading branch information
camUrban committed Dec 9, 2020
2 parents 773d4ad + 13025c7 commit dbc3302
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
14 changes: 10 additions & 4 deletions pterasoftware/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def populate_coordinates(self):

# Make uncambered coordinates.
# Generate cosine-spaced points.
x_t = cosspace(n_points=n_points_per_side)
x_t = cosspace(n_points=n_points_per_side, endpoint=True)
y_t = (
5
* thickness
Expand Down Expand Up @@ -772,7 +772,7 @@ def repanel_current_airfoil(self, n_points_per_side=100):
lower_original_coordinates = self.lower_coordinates()

# Generate a cosine-spaced list of points from 0 to 1.
cosine_spaced_x_values = cosspace(n_points=n_points_per_side)
cosine_spaced_x_values = cosspace(n_points=n_points_per_side, endpoint=True,)

# Create interpolated functions for the x and y values of the upper and lower surfaces as a function of the
# chord fractions
Expand Down Expand Up @@ -1076,7 +1076,9 @@ def update_pressure(self):
)


def cosspace(minimum=0.0, maximum=1.0, n_points=50):
def cosspace(
minimum=0.0, maximum=1.0, n_points=50, endpoint=True,
):
""" This function is used to create a ndarray containing a specified number of values between a specified minimum
and maximum value that are spaced via a cosine function.
Expand All @@ -1091,6 +1093,8 @@ def cosspace(minimum=0.0, maximum=1.0, n_points=50):
This is the maximum value of the range of numbers you would like spaced. The default is 1.0.
:param n_points: int, optional
This is the number of points to space. The default is 50.
:param endpoint: bool, optional
This sets whether or not the maximum value will be included in the output. The default is True.
:return cosine_spaced_points: 1D ndarray
This is a 1D ndarray of the points, ranging from the minimum to the maximum value (inclusive), spaced via a
cosine function.
Expand All @@ -1101,7 +1105,9 @@ def cosspace(minimum=0.0, maximum=1.0, n_points=50):
amp = (maximum - minimum) / 2

# Space the points by applying cosine to the linspace function. Then return the points.
cosine_spaced_points = mean + amp * np.cos(np.linspace(np.pi, 0, n_points))
cosine_spaced_points = mean + amp * np.cos(
np.linspace(np.pi, 0, n_points, endpoint=endpoint)
)
return cosine_spaced_points


Expand Down
12 changes: 8 additions & 4 deletions pterasoftware/meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ def mesh_wing(wing):

# Get the chordwise coordinates.
if wing.chordwise_spacing == "uniform":
nondim_chordwise_coordinates = np.linspace(0, 1, num_chordwise_coordinates)
nondim_chordwise_coordinates = np.linspace(
0, 1, num_chordwise_coordinates, endpoint=True,
)
elif wing.chordwise_spacing == "cosine":
nondim_chordwise_coordinates = ps.geometry.cosspace(
0, 1, num_chordwise_coordinates
0, 1, num_chordwise_coordinates, endpoint=True,
)
else:
raise Exception("Bad value of wing.chordwise_spacing!")
Expand Down Expand Up @@ -301,10 +303,12 @@ def mesh_wing(wing):

# Get the spanwise coordinates.
if wing_cross_section.spanwise_spacing == "uniform":
nondim_spanwise_coordinates = np.linspace(0, 1, num_spanwise_coordinates)
nondim_spanwise_coordinates = np.linspace(
0, 1, num_spanwise_coordinates, endpoint=True,
)
elif wing_cross_section.spanwise_spacing == "cosine":
nondim_spanwise_coordinates = ps.geometry.cosspace(
n_points=num_spanwise_coordinates
n_points=num_spanwise_coordinates, endpoint=True,
)
else:
raise Exception("Bad value of section.spanwise_spacing!")
Expand Down
6 changes: 3 additions & 3 deletions pterasoftware/movement.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ def oscillating_sinspace(amplitude, period, base_value, num_steps, delta_time):
total_time = num_steps * delta_time

# Get the time at each time step.
times = np.linspace(0, total_time, num_steps)
times = np.linspace(0, total_time, num_steps, endpoint=False,)

# Convert the function characteristics into classic wave function constants.
a = amplitude
Expand Down Expand Up @@ -1145,7 +1145,7 @@ def oscillating_linspace(amplitude, period, base_value, num_steps, delta_time):
total_time = num_steps * delta_time

# Get the time at each time step.
times = np.linspace(0, total_time, num_steps)
times = np.linspace(0, total_time, num_steps, endpoint=False,)

# Convert the function characteristics into classic wave function constants.
a = amplitude
Expand Down Expand Up @@ -1193,7 +1193,7 @@ def oscillating_customspace(
total_time = num_steps * delta_time

# Get the time at each time step.
times = np.linspace(0, total_time, num_steps)
times = np.linspace(0, total_time, num_steps, endpoint=False,)

# Convert the function characteristics into classic wave function constants.
a = amplitude
Expand Down
2 changes: 1 addition & 1 deletion pterasoftware/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def plot_results_versus_time(unsteady_solver, testing=False):
delta_time = unsteady_solver.delta_time

# Create a 1D ndarray with the time at each time step.
times = np.linspace(0, num_steps * delta_time, num_steps)
times = np.linspace(0, num_steps * delta_time, num_steps, endpoint=False,)

# Initialize matrices to hold the forces, moments, and coefficients at each time step.
total_near_field_force_wind_axes = np.zeros((3, num_steps))
Expand Down

0 comments on commit dbc3302

Please sign in to comment.