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

Fixed bug in applying initial value of boundary conditions for PFRs #14

Closed Alex-Vasile closed 5 months ago

Alex-Vasile commented 5 months ago

A PFR may have multiple connections to the same BC. The current way that the augment assignment was written does not correctly handle this case (See the code snippet below for how it currently, incorrectly, operates). This PR changes this assignment to correctly handle multiple connections to the same BC.

c   = np.zeros(5)
idx = np.array([1,   2,   3,   4,   4,    4,    4])
bs  = np.array([1.0, 1.0, 1.0, 0.8, 0.01, 0.05, 0.14])

c[idx] += b
# Expected [0.0, 1.0, 1.0, 1.0, 1.0]
# Actual   [0.0, 1.0, 1.0, 1.0, 0.14]

This will leave c[4] with a value of 0.14 rather than the value of 1.0 as expected.