cadet / CADET-Core

A modular, fast, and accurate simulation framework for (bio)chemical processes
Other
66 stars 26 forks source link

Fix for backwards compatibility of the parameter porosity and init_volume of the CSTR #311

Open AntoniaBerger opened 3 days ago

AntoniaBerger commented 3 days ago

Fixes #308

Before _constSolidVolume was always zero because the state of init_liquid_volume was declared after the parameters.

To fix this, there is now a variable init_liquid_volume to calculate _constSolidVolume even if the state is not set. Additionally the calculation of _constSolidVolume has been fixed:

Before we calculated

$$ V^{s} = V^{l}*(1-\varepsilon) $$

which is wrong because we distinguish between the total volume of the reaction $V^{total}$ and the volumes of the liquid and solid phases. Instead we now calculate

$$ V^{s} = V^{total}(1-\varepsilon) = \frac{V^{l}}{(1-\varepsilon)} - V^{l}. $$

For the last equation we used that $(1-\varepsilon) = \frac{V^{l}}{V^{l} + V^{s}} \Leftrightarrow \frac{V^{l}}{(1-\varepsilon)} - V^{l}$