Skip to content

Commit

Permalink
included review
Browse files Browse the repository at this point in the history
  • Loading branch information
schmoelder committed Aug 17, 2021
1 parent d6c7c3f commit 36938ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions src/libcadet/model/parts/ConvectionDispersionOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,20 +187,24 @@ bool ConvectionDispersionOperatorBase::configure(UnitOpIdx unitOpIdx, IParameter
bool ConvectionDispersionOperatorBase::notifyDiscontinuousSectionTransition(double t, unsigned int secIdx)
{
// If we don't have cross section area, velocity is given by parameter
double _dir_old = _dir;
double dir_old = _dir;
if (_crossSection <= 0.0)
_dir = static_cast<double>(getSectionDependentScalar(_velocity, secIdx));
{
double dir_new = static_cast<double>(getSectionDependentScalar(_velocity, secIdx));
_dir = (dir_new >= 0);
}
else if (!_velocity.empty())
{
// We have both cross section area and interstitial flow rate
// _curVelocity has already been set to the network flow rate in setFlowRates()
// the direction of the flow (i.e., sign of _curVelocity) is given by _velocity
_dir = static_cast<double>(getSectionDependentScalar(_velocity, secIdx));
if (_dir_old * static_cast<double>(_dir) < 0.0)
_curVelocity *= -1.0;
double dir_new = static_cast<double>(getSectionDependentScalar(_velocity, secIdx));
_dir = (dir_new >= 0);
}
if (dir_old * _dir < 0.0)
_curVelocity *= -1.0;

return (_dir_old * static_cast<double>(_dir) < 0.0);
return (dir_old * _dir < 0.0);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/libcadet/model/parts/ConvectionDispersionOperator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class ConvectionDispersionOperatorBase
std::vector<active> _colDispersion; //!< Column dispersion (may be section dependent) \f$ D_{\text{ax}} \f$
std::vector<active> _velocity; //!< Interstitial velocity (may be section dependent) \f$ u \f$
active _curVelocity; //!< Current interstitial velocity \f$ u \f$ in this time section
double _dir; //!< Current flow direction in this time section
int _dir; //!< Current flow direction in this time section

ArrayPool _stencilMemory; //!< Provides memory for the stencil
double* _wenoDerivatives; //!< Holds derivatives of the WENO scheme
Expand Down

0 comments on commit 36938ee

Please sign in to comment.