Previously, we handled CFD problems involving algebraic equations in the form of a matrix using a simple self-coded and stupid solver :). After reading the capability of Diffeq, we would like to move into Diffeq, and we have two questions:
We have the form of the ODE that is designed to solve in Diffeq. However, it is a matrix of equations instead of just a few equations. Previously, this was solved using a loop, and the coefficient in the matrix was updated correspondingly from one timestep to another. How is this accomplished in Diffeq? I can only think of including all equations into a function (using a loop), is there a more elegant way to define the problem? According to what I’ve read, Diffeq requires a function to specify the ODE equation/system and the solver for Diffeq. However, is it possible to bypass the initial step and use the ODE solver straightaway to solve my system of equations? Another way is to redefine the ODE system at every timestep, is there any computational burden for doing that, and is there a better way of achieving this?
Suppose we can describe the ODE system and I have an artificial source term that must be calculated in a function (which has some complex logic) at each timestep. I cannot call that function in symbolic language and that requires me again to redefine my ODE problem at every timestep. What is the proper way for revising the matrix/problem definition?