Prevent negative values in reactor state
This commit is contained in:
2
dependencies/reactor_class.js
vendored
2
dependencies/reactor_class.js
vendored
@@ -65,7 +65,7 @@ class Reactor_CSTR {
|
||||
|
||||
const dC_total = math.multiply(math.add(dC_in, dC_out, r, t_O), time_step);
|
||||
|
||||
this.state = math.add(this.state, dC_total);
|
||||
this.state = math.abs(math.add(this.state, dC_total)); // make sure that concentrations do not go negative
|
||||
return this.state;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user