uw-comphys / openccm

OpenCCM is a CFD-based compartment modelling software package. It is primarily intended for convection dominated reactive flows which feature a weak or one-way coupling between the reactive species and the carrier fluid, i.e. the reaction does not substantially influence the fluid flow over the course of the simulation.
https://uw-comphys.github.io/openccm/
GNU Lesser General Public License v2.1
0 stars 3 forks source link

Fix implementation of flow optimization #33

Closed Alex-Vasile closed 4 months ago

Alex-Vasile commented 4 months ago

Previously the initial flow optimization in tweak_compartment_flows required each compartment have no net outflow and that the net inflow was capped to the user specified $atol{opt}$. However, it was not enforcing $atol{opt}$ through the optimization routine, it was only checking against it after the fact. I.e. the constraint was $$\epsilon \le flow{in} - flow{out}$$

This PR changes the optimization problem to include that maximum, $atol{opt}$, as a constraint on each compartment. I.e. each compartment has the following constraints: $$\epsilon \le flow{in} - flow{out} \le atol{opt}$$

It also removes $rtol_{opt}$ since the value being compared against is $0$, thus a relative tolerance isn't needed.