Skip to content

Commit

Permalink
Bug fixes and updates to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-walker committed Oct 24, 2023
1 parent 7392475 commit 9f2fcbc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/zeroD/Reactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ void Reactor::buildFlowJacobian(vector<Eigen::Triplet<double>>& jacVector)
m_outlet[i]->buildReactorJacobian(this, jacVector);
}

for (size_t i = 0; i <m_outlet.size(); i++) {
for (size_t i = 0; i <m_inlet.size(); i++) {
m_inlet[i]->buildReactorJacobian(this, jacVector);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/zeroD/ReactorNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ void ReactorNet::buildJacobian(vector<Eigen::Triplet<double>>& jacVector)
}
}
// flow devices
if (m_jac_skip_flow_devices) {
if (!m_jac_skip_flow_devices) {
// outlets
for (size_t i = 0; i < r->nOutlets(); i++) {
r->outlet(i).buildNetworkJacobian(jacVector);
Expand Down
9 changes: 9 additions & 0 deletions test/python/test_reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,15 @@ def test_get_solver_type(self):
self.net2.initialize()
self.assertEqual(self.net2.linear_solver_type, "GMRES")

def test_mass_flow_jacobian(self):
self.create_reactors(add_mdot=True)

with pytest.raises(NotImplementedError, match="MassFlowController::buildReactorJacobian"):
J = self.net2.jacobian

with pytest.raises(NotImplementedError, match="MassFlowController::buildReactorJacobian"):
J = self.r2.jacobian

def test_heat_transfer_network(self):
# create first reactor
gas1 = ct.Solution("h2o2.yaml", "ohmech")
Expand Down
6 changes: 6 additions & 0 deletions test/zeroD/test_zeroD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ TEST(JacobianTests, test_wall_jacobian_build)
EXPECT_LT(it.col(), reactor2.neq());
}
}
// check that switch works
wallJac.clear();
w.jacobianCalculated();
w.buildNetworkJacobian(wallJac);
EXPECT_EQ(wallJac.size(), 0);
w.jacobianNotCalculated();
// build jac for network terms
wallJac.clear();
w.buildNetworkJacobian(wallJac);
Expand Down

0 comments on commit 9f2fcbc

Please sign in to comment.