Skip to content

Commit 2f4c579

Browse files
committed
Fix drag correction
1 parent d40226f commit 2f4c579

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

BenchmarkProblems.pdf

263 Bytes
Binary file not shown.

performanceCalc.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def compute_partials(self, inputs, partials):
203203

204204

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

208208

209209
# --- Lift and drag calculations ---
@@ -525,15 +525,24 @@ def setup(self):
525525

526526
# Test the performance group derivatives
527527
if __name__ == "__main__":
528+
import os
529+
import sys
528530

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

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

0 commit comments

Comments
 (0)