# Ideal MHD Macro¶

This macro file can be imported to an input file with \$ import idealmhd.mac.

This collection of macros can be used to define quantities required for the MHD equations.

## initializeFluidSimulation Macro¶

initializeFluidSimulation (dimensionality,tStart,tEnd,numFrames,cflNum,gammaIn,muIn,writeRestartIn,debugIn ):
Define quanties required for the Euler equations.

### initializeFluidSimulation Macro Parameters¶

dimensionality:
1,2,3. Number of dimensions for the simulation
tStart:
Start time for simulation
tEnd:
End time for simulation
numFrames:
Number of data outputs
cflNum:
Cfl limit, typically $$\Delta t = cflNum * \Delta x / V_{max}$$
gammaIn:
Adiabatic index for ideal gas eqn. of state. Pressure = (gammaIn - 1.0) * density * internal energy
muIn:
Permeability of free space
writeRestartIn:
Output data required for simulation restart
debugIn:
Run simulation in debug mode

## createFluidSimulation Macro¶

createFluidSimulation ():
Define and add the various data structures, initial conditions and primitive variable computations required for the MHD equations.

Specify a variable in the initial condition

varName:
Name to assign the quantity that is independent of grid position
varValue:
Value to assign the quantity that is independent of grid position

Specify a preExpression in the initial condition

expression:
The mathematical expression to evaluate. f=f(preExpression,variable,t,x,y,z)

Specify an Expression in the initial condition

expression:
The mathematical expression to evaluate. f=f(preExpression,variable,t,x,y,z)

## finiteVolumeScheme (diffusive) Macro¶

finteVolumeScheme (diffusive):
Add a finite volume scheme for solving the MHD equations

### finiteVolumeScheme Macro Parameters¶

diffusive:
True/False. Utilize a diffusive, but robust scheme to solve the system

## finiteVolumeScheme (diffusive,basementPressureIn,basementDensityIn) Macro¶

finteVolumeScheme (diffusive,basementPressureIn,basementDensityIn):
Add a finite volume scheme for solving the MHD equations with a density, pressure floor

### finiteVolumeScheme Macro Parameters¶

diffusive:
True/False. Utilize a diffusive, but robust scheme to solve the system
basementPressureIn:
Floor value for pressure
basementDensityIn:
Floor value for density

Add a gravitational acceleration source block to the finiteVolumeScheme

gravitationalAcceleration:
Acceleration to apply in negative y-direction

## addBoundaryConditionVariable (name, varName, varValue) Macro¶

Specify a variable on a userSpecified boundary condition on the ghost entity

name:
The type of the boundary condition to apply. Must be userSpecified.
varName:
Name to assign the quantity that is independent of grid position
varValue:
Value to assign the quantity that is independent of grid position

## addBoundaryConditionVariable (name, entityName, varName, varValue) Macro¶

Specify a variable on a userSpecified boundary condition on the ghost entity

name:
The type of the boundary condition to apply. Must be userSpecified.
entityName:
The boundary entity to apply boundary condition on
varName:
Name to assign the quantity that is independent of grid position
varValue:
Value to assign the quantity that is independent of grid position

Specify a preExpression on a userSpecified boundary condition on the ghost entity.

name:
The type of the boundary condition to apply. Must be userSpecified.
expression:
The mathematical expression to evaluate. f=f(preExpression,variable,t,x,y,z)

## addBoundaryConditionPreExpression (name, entityName, expression) Macro¶

Specify a preExpression on a userSpecified boundary condition on the ghost entity.

name:
The type of the boundary condition to apply. Must be userSpecified.
entityName:
The boundary entity to apply boundary condition on
expression:
The mathematical expression to evaluate. f=f(preExpression,variable,t,x,y,z)

Specify an Expression on a userSpecified boundary condition on the ghost entity.

name:
The type of the boundary condition to apply. Must be userSpecified.
expression:
The mathematical expression to evaluate. f=f(preExpression,variable,t,x,y,z)

## addBoundaryConditionExpression (name, entityName, expression) Macro¶

Specify an Expression on a userSpecified boundary condition on the ghost entity.

name:
The type of the boundary condition to apply. Must be userSpecified.
entityName:
The boundary entity to apply boundary condition on
expression:
The mathematical expression to evaluate. f=f(preExpression,variable,t,x,y,z)

## boundaryCondition (type) Macro¶

boundaryCondition (type):
Apply a boundary condition for the MHD equations on the ghost entity

### boundaryCondition Macro Parameters¶

type:
The type of the boundary condition to apply. Can be one of: periodic, copy, userSpecified, wall, noInflow, noSlip.

## boundaryCondition (type, entityName) Macro¶

boundaryCondition (type, entityName):
Apply a boundary condition for the Euler equations on the ghost entity

### boundaryCondition Macro Parameters¶

type:
The type of the boundary condition to apply. Can be one of: periodic, copy, userSpecified, wall, noInflow, noSlip.
entityName:
The boundary entity to apply boundary condition on

Advance simulation in time using an explicit Runge-Kutta method

order:
The order of explicit Runge-Kutta method. Can be first, second, third, fourth

Advance simulation in time using an explicit Super-Time Step method for diffusion problems

order:
The order of explicit Super-Time Step method. Can be first, second

Advance simulation in time using an implicit method for Poisson type problems

order:
The order of implicit method. Currently only None is supported

name:
The name of the output diagnostic

## addOutputDiagnostic (name, numberOfComponents, isVector) Macro¶

name:
The name of the output diagnostic
numberOfComponents:
The number of components for the output diagnostic
isVector:
True/False. Is the output diagnostic a vector quantity.

Specify a paramter in an output diagnostic

name:
The type of the output diagnostic
varName:
Name to assign the quantity that is independent of grid position
varValue:
Value to assign the quantity that is independent of grid position

Specify a preExpression in an output diagnostic. Available pre-defined quantities are

preDefined = [rho rhoVx rhoVy rhoVz En Vx Vy Vz P Pb divB Jx Jy Jz]


name:
The type of the output diagnostic
expression:
The mathematical expression to evaluate. f=f(preExpression,preDefined,variable,t,x,y,z)

Specify an Expression in an output diagnostic. Available pre-defined quantities are

preDefined = [rho rhoVx rhoVy rhoVz En Vx Vy Vz P Pb divB Jx Jy Jz ]


name:
expression: