Skip to content

Commit

Permalink
Fix drag correction
Browse files Browse the repository at this point in the history
  • Loading branch information
A-CGray committed Oct 25, 2024
1 parent d40226f commit 2f4c579
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Binary file modified BenchmarkProblems.pdf
Binary file not shown.
21 changes: 15 additions & 6 deletions performanceCalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def compute_partials(self, inputs, partials):


def computeCorrectedDrag(drag, extraDragCoeff, wingArea, dynPressure):
return drag + 1 / 2 * extraDragCoeff * wingArea * dynPressure
return drag + extraDragCoeff * wingArea * dynPressure


# --- Lift and drag calculations ---
Expand Down Expand Up @@ -525,15 +525,24 @@ def setup(self):

# Test the performance group derivatives
if __name__ == "__main__":
import os
import sys

from AircraftSpecs.STWSpecs import aircraftSpecs
from AircraftSpecs.STWFlightPoints import flightPointSets

aircraftSpecs["cruiseSpeed"] = 200.0
aircraftSpecs["dynPressure"] = 0.5 * 1.225 * aircraftSpecs["cruiseSpeed"] ** 2
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../AircraftSpecs"))
from AircraftSpecs.STWSpecs import aircraftSpecs # noqa: E402
from AircraftSpecs.STWFlightPoints import flightPointSets # noqa: E402

prob = om.Problem()
prob.model = AircraftPerformanceGroup(aircraftSpecs=aircraftSpecs, flightPoints=flightPointSets["3pt"])
prob.setup()
# Set some reasonable input values
prob.set_val("wingboxMass", 1000.0, units="kg")
prob.set_val("wingboxVolume", 6.0, units="m**3")
prob.set_val("wingArea", aircraftSpecs["refArea"], units="m**2")
for fp in flightPointSets["3pt"]:
prob.set_val(f"{fp.name}Lift", fp.loadFactor * aircraftSpecs["refMTOW"] * 9.81 / 2.0)
prob.set_val("cruiseDrag", aircraftSpecs["refMTOW"] * 9.81 / 2.0 / 20)
prob.run_model()
prob.model.list_outputs()
prob.check_partials(compact_print=True, form="central", step=1e-6)
om.n2(prob, show_browser=True)

0 comments on commit 2f4c579

Please sign in to comment.