## Numerical methods

**Introduction**

The physical laws that describe the systems we study are expressed in terms of rates of change, e.g. of density, velocity, or pressure. For some very simple problems these equations can be solved exactly in terms of functions that can be evaluated to arbitrary precision. However, most real-world problems of interest do not admit such simple solutions. Instead, we represent the solutions via collections of numbers that approximate the values the true solutions would take on at various known points in space and time. When the solutions are represented in this way, the laws of physics can be written as algebraic equations that can be solved by computers using arithmetic. In general, the more numbers we use to represent the solutions (for example, by more finely subdividing space and time), the more accurate our approximate solutions become. However, there are usually many ways to do these calculations, and for a given amount of solution information some ways are much better than others. In numerical method development we try to find better ways to solve these problems using the resources we have at our disposal.

**Multilevel Poisson solvers**

The Poisson equation connects the density of matter to the gravitational force field it produces. It also comes up in many other contexts, such as electromagnetism. Unfortunately, because gravity is a long-range force, solving the Poisson equation very accurately involves computing the force on every bit of matter due to every other bit of matter -- so a naive approach turns out to be extremely expensive. A number of much more efficient techniques exploit the fact that the gravitational force becomes weaker and weaker with distance, so we can ignore some of the internal details of objects when considering their effects on objects that are very far away.

Example FLASH AMR mesh

**Particle techniques with adaptive mesh refinement**

For cosmological problems, it is usually necessary to represent dark matter or stars using "particles" that feel each other's gravitational fields but do not bounce off one another. Diffuse gas, on the other hand, can often be treated as a continuous density and pressure field that can be represented on a mesh. The mesh provides the points in space at which information (such as the gas density) is known. Adaptive mesh refinement (AMR) is a technique for using finer meshes in some regions where interesting behavior is occurring and coarser meshes in other regions. How do we combine the particle representation with the AMR representation in a self-consistent way?

A straightforward way to do this is to "deposit" onto the mesh the amount of matter represented by each particle, creating a mesh-based density field that approximates the distribution of particles. In regions where more particles congregate, the mesh density is higher -- and AMR might be used in such regions to give better fidelity than in regions where there are few or no particles. The gravitational field is determined on the mesh using a Poisson solver, and then the resulting force field is interpolated at each of the particle positions, allowing the force on each particle to be determined. The particles are accelerated in accordance with the force that acts on them and moved to a new location. The process is then repeated. This "particle-mesh" method has been used for 50 years and works very well when a uniform mesh is used.

On AMR meshes, problems can arise when particles pass from a region of high fidelity to a region of low fidelity or vice versa. Most dramatically, particles can see the artificial mesh boundary as an obstacle and bounce off of it. I have been developing techniques to smoothly transition particles from one region to the next, allowing particles to ignore these boundaries, as they should. My group uses these methods within the FLASH code to improve the accuracy of our solutions, particularly for galaxy cluster and large-scale structure problems.