Skip to content

Commit

Permalink
Fix duct (#59)
Browse files Browse the repository at this point in the history
* Fix connections in ImplicitCompressibleDuct

* Fix ducts and their tests

* Bump patch version
  • Loading branch information
eytanadler committed Feb 5, 2024
1 parent 4fc037d commit 4767dc7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/openconcept.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ jobs:
run: |
conda config --set always_yes yes
python -m pip install pip==${{ matrix.PIP_VERSION_OLDEST }} setuptools==${{ matrix.SETUPTOOLS_VERSION_OLDEST }} --upgrade wheel
pip install numpy==${{ matrix.NUMPY_VERSION_OLDEST }} scipy==${{ matrix.SCIPY_VERSION_OLDEST }} openmdao==${{ matrix.OPENMDAO_VERSION_OLDEST }}
pip install numpy==${{ matrix.NUMPY_VERSION_OLDEST }} scipy==${{ matrix.SCIPY_VERSION_OLDEST }} openmdao==${{ matrix.OPENMDAO_VERSION_OLDEST }} om-pycycle
- name: Install dependencies (latest versions)
if: ${{ matrix.dep-versions == 'latest' }}
run: |
conda config --set always_yes yes
pip install numpy scipy openmdao
pip install numpy scipy openmdao om-pycycle
- name: Install OpenConcept
run: |
Expand Down
2 changes: 1 addition & 1 deletion openconcept/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.0"
__version__ = "1.1.1"
15 changes: 11 additions & 4 deletions openconcept/thermal/ducts.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,7 @@ class ImplicitCompressibleDuct(Group):

def initialize(self):
self.options.declare("num_nodes", default=1, desc="Number of analysis points")
self.options.declare("cfg", default=0.98, desc="Gross thrust coefficient")

def setup(self):
nn = self.options["num_nodes"]
Expand All @@ -981,6 +982,7 @@ def setup(self):
iv.add_output("delta_p_1", val=np.zeros((nn,)), units="Pa")
iv.add_output("heat_in_1", val=np.zeros((nn,)), units="W")
iv.add_output("pressure_recovery_1", val=np.ones((nn,)))
iv.add_output("loss_factor_1", val=0.0)

iv.add_output("delta_p_2", val=np.ones((nn,)) * 0.0, units="Pa")
iv.add_output("heat_in_2", val=np.ones((nn,)) * 0.0, units="W")
Expand All @@ -991,6 +993,8 @@ def setup(self):
iv.add_output("area_nozzle", val=58 * np.ones((nn,)), units="inch**2")
iv.add_output("convergence_hack", val=-20, units="Pa")

self.add_subsystem("mdotguess", FlowMatcher(num_nodes=nn), promotes=["*"])

self.add_subsystem("inlet", Inlet(num_nodes=nn), promotes_inputs=[("p", "p_inf"), ("T", "T_inf"), "Utrue"])

self.add_subsystem(
Expand All @@ -1007,6 +1011,7 @@ def setup(self):
)
self.connect("inlet.pt", "sta1.pt_in")
self.connect("inlet.Tt", "sta1.Tt_in")
self.connect("loss_factor_1", "sta1.dynamic_pressure_loss_factor")

self.add_subsystem(
"sta2",
Expand Down Expand Up @@ -1059,14 +1064,16 @@ def setup(self):
self.add_subsystem(
"nozzle",
OutletNozzle(num_nodes=nn),
promotes_inputs=["p_exit", ("area", "area_nozzle")],
promotes_outputs=["mdot"],
promotes_inputs=["mdot", "p_exit", ("area", "area_nozzle")],
promotes_outputs=["mdot_actual"],
)
self.connect("sta3.pt_out", "nozzle.pt")
self.connect("sta3.pt_out", "nozzle.pt_in")
self.connect("sta3.Tt_out", "nozzle.Tt")

self.add_subsystem(
"force", NetForce(num_nodes=nn), promotes_inputs=["mdot", "p_inf", ("Utrue_inf", "Utrue"), "area_nozzle"]
"force",
NetForce(num_nodes=nn, cfg=self.options["cfg"]),
promotes_inputs=["mdot", "p_inf", ("Utrue_inf", "Utrue"), "area_nozzle"],
)
self.connect("nozzle.p", "force.p_nozzle")
self.connect("nozzle.rho", "force.rho_nozzle")
Expand Down
7 changes: 2 additions & 5 deletions openconcept/thermal/tests/test_ducts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
try:
import pycycle

pyc_version = float(pycycle.__version__)
if pyc_version >= 3.0:
pyc_major_version = int(pycycle.__version__.split(".")[0])
if pyc_major_version >= 4:
HAS_PYCYCLE = True
import pycycle.api as pyc

Expand Down Expand Up @@ -114,9 +114,6 @@ def viewer(prob, pt):

class MPDuct(pyc.MPCycle):
def setup(self):
self.options["thermo_method"] = "CEA"
self.options["thermo_data"] = pyc.species_data.janaf

self.pyc_add_pnt("design", PyCycleDuct(design=True, thermo_method="CEA"))

# define the off-design conditions we want to run
Expand Down

0 comments on commit 4767dc7

Please sign in to comment.