Dissociate time and algebraic problems
Description
Class MathematicalProblem
stores
- unknowns
- equations
- transient variables
- rates
The last two are unknowns in time-dependent problems. These objects were aggregated for convenience, but do not belong to the same collection.
In particular, users may want to clear a system off-design problem during a transition, and write:
class MySystem(System):
def setup(self):
self.add_event("kapow")
# whatever
def transition(self):
if self.kapow.present:
problem = self.problem
problem.clear()
problem.add_unknown(...)
problem.add_equation(...)
Currently, clearing the problem altogether deletes transients, so users have to execute:
def transition(self):
if self.kapow.present:
problem = self.problem
problem.unknowns.clear()
problem.equations.clear()
problem.add_unknown(...)
problem.add_equation(...)
Proposal
Separate time-dependent and design problems into two distinct classes MathematicalProblem
and TimeProblem
, say.
Edited by Etienne Lac