# PAMHD

*Version: 20160913*

PAMHD solves equations of ideal magnetohydrodynamics in a uniform cartesian grid in one to three dimensions.

Customizable initial and boundary conditions are supported.

Divergence of magnetic field is cleaned using the method of Brackbill and Barnes 1980.

The model as offered at the CCMC for Run-on-Request does not contain any particle-in-cell component (this feature is still in development).

**Caveats:**

PAMHD solves ideal magnetohydrodynamic equations and is not suitable for problems where e.g. kinetic effects are important. Ledvina et al. 2008 has a discussion on the applicability of ideal magnetohydrodynamics.

Only equidistant grid spacing in each direction is offered at this time. Magnetosphere applications do not include an ionosphere electrodynamics solver. The numerical schemes are first order in space and time.

## Inputs

Input consists of general parameters, grid parameters, and magnetohydrodynamic variables described by initial conditions, copy boundaries and time-dependent value boundaries.

General parameters specify starting time of simulation, duration of simulation, intervals for saving results and removing divergence of magnetic field, the values of adiabatic index, vacuum permeability and proton mass, and the length of simulation time steps with respect to the CFL condition. Proton mass is used to convert number densities to mass density.

Grid parameters specify the number of simulation cells, simulation geometry and whether the grid is periodic.

Initial condition and value boundaries consist of mathematical expressions for plasma number density, velocity, thermal pressure and magnetic field.
The simulation is initialized by obtaining a value from above initial condition expressions for plasma parameters in each simulation cell. Expressions can refer to the cell's center coordinates with r[0], r[1] and r[2]. Basic mathematical functions are supported but for security reasons parentheses must be replaced with brackets (e.g. sin[2*pi*r[0]] instead of sin(2*pi*r[0])).
See the links section for pointers to additional documentation regarding supported mathematical expressions.
In value boundaries the plasma parameters are set after each time step and the mathematical expressions can also refer to current simulation time with t.

Initial condition and value boundaries allow further customization with boxes and spheres inside of which separate mathematical expressions can be used for plasma parameters. Boxes also require the start and end coordinates of their volume to be given while spheres require the center coordinates and radius. These are evaluated in a pseudorandom order so overlapping regions with different parameter values should be avoided.

Copy boundaries consist of boxes and spheres inside of which plasma parameters are set to the average value of non-boundary nearest neighbor cells. Cells inside of a copy boundary that only have boundary cells as neighbors are not updated.

## Outputs

Gridded output in 1D, 2D or 3D of the MHD variables (B_x,B_y,B_z,rho,momentum density rhoV_x,rhoV_y, rhoV_z, total energy density, resistivity), primitive MHD variables (such as velocity V_x,V)_y,V_z) and CCMC-supported derived quantities.

Model is time-dependant.

## Change Log

This model version has a flexible Python user interface that starts from one of several pre-defined problems and that allows the user to dynamically add boundaries and objects (such as a sphere representing Earth) inside the simulation domain and modify boundary conditions and physical parameters of the MHD simulation such as magnetic resistivity, grid resolution and other numerical parameters.

## Domains

- Magnetosphere / Global Magnetosphere
- Local Physics

## Space Weather Impacts

- Near-earth radiation and plasma environment (aerospace assets functionality)

## Publications

- A generic simulation cell method for developing extensible, efficient and readable parallel computational models
- Parallel grid library for rapid and flexible simulation development
- Modeling and Simulating Flowing Plasmas and Related Phenomena
- Athena: A New Code for Astrophysical MHD
- The effect of nonzero ∇ ⋅ B on the numerical solution of the magnetohydrodynamic equations

## Code

**Code Languages: **C++

**Public Repository: **https://github.com/iljah/pamhd

## Relevant Links

- ATHENA MHD solvers
- Boost C++ libraries
- muParserX libarary on Github
- Eigen linear algrebra library
- DCCRG parallelization library
- RapidJSON on Github

## Contacts

- Ilja Honkonen, Finiish Meteorological Institute (Model Developer)
- Lutz Rastaetter, NASA GSFC CCMC (CCMC Model Host)

## Publication Policy

In addition to any model-specific policy, please refer to the General Publication Policy.