Motivation

Why ?


Conservative, shock-capturing codes solve for a chosen set of primitive variables , such as density, pressure, and so on, by evolving the governing equations in their conservative form \begin{align} \frac{\partial U}{\partial t} + \nabla\cdot F & = S \end{align} where are conserved variables, are spatial fluxes and are sources. The time evolution is performed over the conserved variables , i.e. , where indicate the discrete time levels. Solving for the primitive variables from the time evolved conserved variables at the end of a discrete time step is a nonlinear root finding problem. The primitive variable recovery algorithms used in existing codes only work for perfect fluids. They cannot be used for the governing equations that include dissipative processes that arise when one deviates from local thermodynamic equilibirum1. Hence the need arose to write a physics agnostic code that can be used to explore a variety of models, independent of the sophistication of the model.

How does do it?


In , the governing equations of a particular model are written down in their conserved form and recast as a massive coupled nonlinear root finding problem. Writing down the equations of the model explicitly in terms of primitive variables to be solved for, , \begin{align} R(P^{n+1}) = \frac{\partial U}{\partial t} + \nabla\cdot F - S \end{align} where are the residuals. We wish to find those for which . We do so using the Newton-Krylov algorithm, which iteratively solves for , where is a chosen error tolerance. The algorithm numerically assembles the Jacobian during the iteration process using only the residuals as inputs. This automatic Jacobian assembly enables the inclusion of any physical model, including those in which the source terms have spatio-temporal derivatives. is built on top of the 2 framework and uses the Newton-Krylov implementation in the module. The spatio-temporal discretizations are performed over a structured grid constructed using the module. Using the module to construct the grid gives information about the width of the reconstruction stencils being used, and the connectivity between neighbouring spatial elements. With this information, can use graph coloring and efficiently assemble the Jacobian. This allows us to use both explicit , as well as implicit time stepping, and merge the code needed to do both into a single residual assembly routine. For details, see the algorithms page.