Skip to content

Commit

Permalink
Fix old CSTR interface support
Browse files Browse the repository at this point in the history
This commit fixes the calculation of constant solid volume from the old
interface fields, which are supported for backwards compatibility.
  • Loading branch information
jbreue16 committed Dec 11, 2024
1 parent 316ef9e commit 254041d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libcadet/model/StirredTankModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,10 @@ bool CSTRModel::configure(IParameterProvider& paramProvider)
else
throw InvalidParameterException("Field CONST_SOLID_VOLUME or INIT_LIQUID_VOLUME required");

_constSolidVolume = init_liquid_volume / (1.0 - paramProvider.getDouble("POROSITY")) - init_liquid_volume; // V_s = V_l / (1 - epsilon) - V_l = (V_l + V_s) * (1 -epsilon)
const double epsilon = paramProvider.getDouble("POROSITY");

if (epsilon > 0.0) // else, constant solid volume is already set to zero
_constSolidVolume = init_liquid_volume * (1.0 - epsilon) / epsilon; // V_s = (V_l + V_s) * (1 - epsilon) -> V_s = V_l * (1 - \epsilon) / \epsilon
}
_parameters[makeParamId(hashString("CONST_SOLID_VOLUME"), _unitOpIdx, CompIndep, ParTypeIndep, BoundStateIndep, ReactionIndep, SectionIndep)] = &_constSolidVolume;

Expand Down

0 comments on commit 254041d

Please sign in to comment.