Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse partials for ExecComps #63

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions openconcept/aerodynamics/openaerostruct/aerostructural.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def setup(self):
q={"units": "Pa", "shape": (nn,)},
S={"units": "m**2"},
CD={"shape": (nn,)},
has_diag_partials=True,
),
promotes_inputs=[("q", "fltcond|q"), ("S", "ac|geom|wing|S_ref")],
promotes_outputs=["drag"],
Expand Down Expand Up @@ -1495,6 +1496,7 @@ def setup(self):
S={"units": "m**2"},
CD={"shape": (nn,)},
CD0={"shape": (1,)},
has_diag_partials=True,
),
promotes_inputs=[("q", "fltcond|q"), ("S", "ac|geom|wing|S_ref"), ("CD0", "ac|aero|CD_nonwing")],
promotes_outputs=["drag"],
Expand Down
1 change: 1 addition & 0 deletions openconcept/aerodynamics/openaerostruct/drag_polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ def setup(self):
q={"units": "Pa", "shape": (nn,)},
S={"units": "m**2"},
CD={"shape": (nn,)},
has_diag_partials=True,
),
promotes_inputs=[("q", "fltcond|q"), ("S", "ac|geom|wing|S_ref")],
promotes_outputs=["drag"],
Expand Down
1 change: 1 addition & 0 deletions openconcept/examples/B738.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def setup(self):
"tags": ["integrate", "state_name:fuel_used", "state_units:kg", "state_val:1.0", "state_promotes:True"],
},
fuel_flow_in={"val": 1.0 * np.ones((nn,)), "units": "kg/s"},
has_diag_partials=True,
)

self.add_subsystem("doubler", doubler, promotes_outputs=["*"])
Expand Down
1 change: 1 addition & 0 deletions openconcept/examples/B738_VLM_drag.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def setup(self):
"tags": ["integrate", "state_name:fuel_used", "state_units:kg", "state_val:1.0", "state_promotes:True"],
},
fuel_flow_in={"val": 1.0 * np.ones((nn,)), "units": "kg/s"},
has_diag_partials=True,
)

self.add_subsystem("doubler", doubler, promotes_outputs=["*"])
Expand Down
1 change: 1 addition & 0 deletions openconcept/examples/B738_aerostructural.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def setup(self):
"tags": ["integrate", "state_name:fuel_used", "state_units:kg", "state_val:1.0", "state_promotes:True"],
},
fuel_flow_in={"val": 1.0 * np.ones((nn,)), "units": "kg/s"},
has_diag_partials=True,
)

self.add_subsystem("doubler", doubler, promotes_outputs=["*"])
Expand Down
2 changes: 2 additions & 0 deletions openconcept/examples/minimal_integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def setup(self):
fuel_flow={"units": "kg/s", "shape": nn},
TSFC={"units": "kg/N/s", "shape": 1},
thrust={"units": "N", "shape": nn},
has_diag_partials=True,
),
promotes_inputs=[("TSFC", "ac|propulsion|TSFC"), "thrust"],
)
Expand All @@ -82,6 +83,7 @@ def setup(self):
weight={"shape": nn},
TOW={"shape": 1},
fuel_burned={"shape": nn},
has_diag_partials=True,
),
promotes_inputs=[("TOW", "ac|weights|TOW")],
promotes_outputs=["weight"],
Expand Down
7 changes: 7 additions & 0 deletions openconcept/mission/tests/test_trajectories.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def setup(self):
"tags": ["integrate", "state_name:f", "state_units:kg"],
},
x={"val": 1.0 * np.ones((nn,)), "units": "s"},
has_diag_partials=True,
),
)
self.connect("iv.x", "ec.x")
Expand Down Expand Up @@ -215,6 +216,7 @@ def setup(self):
"tags": ["integrate", "state_name:f2", "state_units:J"],
},
x={"val": 1.0 * np.ones((nn,)), "units": "s"},
has_diag_partials=True,
),
)
self.connect("iv.x", "ec2.x")
Expand Down Expand Up @@ -269,6 +271,7 @@ def setup(self):
"tags": ["integrate", "state_name:f2", "state_units:J", "state_promotes:True"],
},
x={"val": 1.0 * np.ones((nn,)), "units": "s"},
has_diag_partials=True,
),
)
self.connect("iv.x", "ec2.x")
Expand Down Expand Up @@ -330,6 +333,7 @@ def setup(self):
],
},
x={"val": 1.0 * np.ones((nn,)), "units": "s"},
has_diag_partials=True,
),
)
self.connect("iv.x", "ec2.x")
Expand Down Expand Up @@ -378,6 +382,7 @@ def setup(self):
["df = 5.1*x**3 +0.5*x-7.2"],
df={"val": 1.0 * np.ones((nn,)), "units": "W", "tags": ["integrate", "state_name:f2", "state_units:J"]},
x={"val": 1.0 * np.ones((nn,)), "units": "s"},
has_diag_partials=True,
),
)
self.connect("iv.x", "ec2.x")
Expand Down Expand Up @@ -413,6 +418,7 @@ def setup(self):
["df2 = 5.1*x**3 +0.5*x-7.2"],
df2={"val": 1.0 * np.ones((nn,)), "units": "W", "tags": ["integrate", "state_name:f", "state_units:J"]},
x={"val": 1.0 * np.ones((nn,)), "units": "s"},
has_diag_partials=True,
),
)
self.connect("iv.x", "ec2.x")
Expand Down Expand Up @@ -521,6 +527,7 @@ def setup(self):
"tags": ["integrate", "state_name:f", "state_units:kg"],
},
x={"val": 1.0 * np.ones((nn,)), "units": "s"},
has_diag_partials=True,
),
promotes_outputs=["df"],
)
Expand Down
9 changes: 8 additions & 1 deletion openconcept/thermal/heat_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ def setup(self):
# Used ExecComp here because multiplying vector and scalar inputs
self.add_subsystem(
"heat_divide",
ExecComp("q_div = q / n_pipes", q_div={"units": "W", "shape": (nn,)}, q={"units": "W", "shape": (nn,)}),
ExecComp(
"q_div = q / n_pipes",
q_div={"units": "W", "shape": (nn,)},
q={"units": "W", "shape": (nn,)},
has_diag_partials=True,
),
promotes_inputs=["q", "n_pipes"],
)

Expand Down Expand Up @@ -123,6 +128,7 @@ def setup(self):
"q_max = single_pipe_q_max * n_pipes",
q_max={"units": "W", "shape": (nn,)},
single_pipe_q_max={"units": "W", "shape": (nn,)},
has_diag_partials=True,
),
promotes_inputs=["n_pipes"],
promotes_outputs=["q_max"],
Expand Down Expand Up @@ -171,6 +177,7 @@ def setup(self):
T_evap={"units": "degC", "shape": (nn,)},
q={"units": "W", "shape": (nn,)},
R={"units": "K/W", "shape": (nn,)},
has_diag_partials=True,
),
promotes_inputs=["T_evap"],
promotes_outputs=["T_cond"],
Expand Down
Loading