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.

addVariable Macro

addVariable (varName, varValue):
Specify a variable in the initial condition

addVariable Macro Parameters

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

addPreExpression Macro

addPreExpression (expression):
Specify a preExpression in the initial condition

addPreExpression Macro Parameters

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

addExpression Macro

addExpression (expression):
Specify an Expression in the initial condition

addExpression Macro Parameters

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

addGravitationalAcceleration Macro

addGravitationalAcceleration (gravitationalAcceleration):
Add a gravitational acceleration source block to the finiteVolumeScheme

addGravitationalAcceleration Macro Parameters

gravitationalAcceleration:
Acceleration to apply in negative y-direction

addBoundaryConditionVariable (name, varName, varValue) Macro

addBoundaryConditionVariable (name, varName, varValue):
Specify a variable on a userSpecified boundary condition on the ghost entity

addBoundaryConditionVariable Macro Parameters

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

addBoundaryConditionVariable (name, entityName, varName, varValue):
Specify a variable on a userSpecified boundary condition on the ghost entity

addBoundaryConditionVariable Macro Parameters

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

addBoundaryConditionPreExpression (name, expression) Macro

addBoundaryConditionPreExpression (name, expression):
Specify a preExpression on a userSpecified boundary condition on the ghost entity.

addBoundaryConditionPreExpression Macro Parameters

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

addBoundaryConditionPreExpression (name, entityName, expression):
Specify a preExpression on a userSpecified boundary condition on the ghost entity.

addBoundaryConditionPreExpression Macro Parameters

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)

addBoundaryConditionExpression (name, expression) Macro

addBoundaryConditionExpression (name, expression):
Specify an Expression on a userSpecified boundary condition on the ghost entity.

addBoundaryConditionExpression Macro Parameters

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

addBoundaryConditionExpression (name, entityName, expression):
Specify an Expression on a userSpecified boundary condition on the ghost entity.

addBoundaryConditionExpression Macro Parameters

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

timeAdvance Macro

timeAdvance (order):
Advance simulation in time using an explicit Runge-Kutta method

timeAdvance Macro Parameters

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

diffusionTimeAdvance Macro

diffusionTimeAdvance (order):
Advance simulation in time using an explicit Super-Time Step method for diffusion problems

diffusionTimeAdvance Macro Parameters

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

implicitTimeAdvance Macro

implicitTimeAdvance (order):
Advance simulation in time using an implicit method for Poisson type problems

implicitTimeAdvance Macro Parameters

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

addOutputDiagnostic (name) Macro

addOutputDiagnostic (name):
Add a scalar output diagnostic

addOutputDiagnostic Macro Parameters

name:
The name of the output diagnostic

addOutputDiagnostic (name, numberOfComponents, isVector) Macro

addOutputDiagnostic (name, numberOfComponents, isVector):
Add a multi-component output diagnostic

addOutputDiagnostic Macro Parameters

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.

addOutputDiagnosticParameter Macro

addOutputDiagnosticParameter (name, varName, varValue):
Specify a paramter in an output diagnostic

addOutputDiagnosticParameter Macro Parameters

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

addOutputDiagnosticPreExpression Macro

addOutputDiagnosticPreExpression (name, expression):

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]

addOutputDiagnosticPreExpression Macro Parameters

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

addOutputDiagnosticExpression Macro

addOutputDiagnosticExpression (name, expression):

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 ]

addOutputDiagnosticExpression Macro Parameters

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

runFluidSimulation Macro

runFluidSimulation ():
Evaluate all macros added to the .pre file and generate the .in file