Skip to content
Draft
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
8 changes: 4 additions & 4 deletions include/common/Driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,23 +253,23 @@ class Driver

// Configure main solver parameters
pp.pushScope("solver");
_sim->configure(pp);


// Configure section times
std::vector<double> secTimes;
std::vector<bool> secCont;
extractSectionTimes(pp, secTimes, secCont);
_sim->setSectionTimes(secTimes, secCont);
_sim->configure(pp);

pp.popScope(); // solver scope

// Create and configure model
pp.pushScope("model");

// Create and configure model
cadet::IModelSystem* model = _builder->createSystem(pp);

// Hand model over to simulator
_sim->initializeModel(*model);
_sim->setSectionTimes(secTimes, secCont);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is deleted, section times will not be propagated into the models. But, this is required for the inlet profiles to work.


// Specify initial values
if (pp.exists("INIT_STATE_Y"))
Expand Down
5 changes: 5 additions & 0 deletions src/libcadet/SimulatorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,11 @@ namespace cadet
if (paramProvider.exists("USER_SOLUTION_TIMES"))
_solutionTimes = paramProvider.getDoubleArray("USER_SOLUTION_TIMES");

if (static_cast<double>(_solutionTimes.back()) > static_cast<double>(_sectionTimes.back()))
{
throw InvalidParameterException("USER_SOLUTION_TIMES exceed section times");
}

if (paramProvider.exists("CONSISTENT_INIT_MODE"))
_consistentInitMode = toConsistentInitialization(paramProvider.getInt("CONSISTENT_INIT_MODE"));

Expand Down
9 changes: 1 addition & 8 deletions src/libcadet/model/StirredTankModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,7 @@ void CSTRModel::useAnalyticJacobian(const bool analyticJac)

void CSTRModel::notifyDiscontinuousSectionTransition(double t, unsigned int secIdx, const ConstSimulationState& simState, const AdJacobianParams& adJac)
{
if (_flowRateFilter.size() > 1)
{
_curFlowRateFilter = _flowRateFilter[secIdx];
}
else if (_flowRateFilter.size() == 1)
{
_curFlowRateFilter = _flowRateFilter[0];
}
_curFlowRateFilter = getSectionDependentScalar(_flowRateFilter, secIdx);
}

void CSTRModel::reportSolution(ISolutionRecorder& recorder, double const* const solution) const
Expand Down