######################################################################
#
# File: simpleEm.pre
#
# Purpose: Simple electromagnetic simulation.
# Shows vacuum propagation of a wave launched from
# x-lower end of simulation.
#
######################################################################
##########
#
# Define variables in lines starting with ¿$¿ for later use
#
##########
# Variable for the dimension simulation parameter
$ NDIM = 3 # Number of dimensions in simulation (1, 2, or 3)
# Variables for the grid input block
# Number of cells along x, y, and z axes
$ NX = 40
$ NY = 20
$ NZ = 20
# Length of grid along x, y, and z axes
$ LX = 1.6e-5
$ LY = 5.e-5
$ LZ = 5.e-5
# Location of start point along x, y, and z axes in SI units
$ XSTART = 0.
$ YSTART = -0.5*LY
$ ZSTART = -0.5*LZ
# Variables for setting up the time step simulation parameter
# Courant condition
$ DXI = NX/LX
$ DYI = NY/LY
$ DZI = NZ/LZ
$ DLI = math.sqrt(DXI*DXI + DYI*DYI + DZI*DZI)
$ DL = 1./DLI
$ LIGHTSPEED = 2.9979e8
# Define 90% of Courant limit
$ DT = 0.9*DL/LIGHTSPEED
# Variable for the moving window simulation parameter
# Shift position - when pulse gets close to x-upper wall
$ DSHFTPOS = 0.95*LX
# Variables for setting up boundary condition input blocks
# Number of cells along x, y, and z axes plus one guard cell
$ NX1 = NX + 1
$ NY1 = NY + 1
$ NZ1 = NZ + 1
# Variables for setting up pulse in boundary condition input block
$ WAVELENGTH = 4.e-6
$ FREQUENCY = LIGHTSPEED/WAVELENGTH
$ PI = 3.1415926535897931
$ OMEGA = 2.*PI*FREQUENCY
$ KAY = 2.*PI/WAVELENGTH
$ AMPLITUDE = 8.0e10 # peak amplitude of pulse in volts/meter
##########
#
# Define the simulation parameters
#
##########
# Parameters that can be overridden on the command line are
# commented with (OR)
# The dimension and precision of the simulation
dimension = NDIM # (OR)
floattype = float # (OR)
# Time step and number of steps
dt = DT
nsteps = 250 # (OR)
# Dump output into an HDF5 file every 250 time steps
dumpPeriodicity = 250 # (OR)
# Moving window
downShiftDir = 0 # Shift along direction 0
downShiftPos = DSHFTPOS # Start shifting at t = DSHFTPOS/(speed of light)
##########
#
# Define the grid: the physical problem and the number of cells
#
##########
numPhysCells = [NX NY NZ]
lengths = [LX LY LZ]
startPositions = [XSTART YSTART ZSTART]
##########
#
# Define the decomposition
#
##########
periodicDirs = [1 2] # The periodic directions
decompType = regular
##########
#
# Define the electromagnetic field; describe the EM field¿s boundary
# conditions
#
##########
# The electromagnetic field is a Yee field, with z-polarized wave
# launched from x-lower end of simulation, conductors x-lower and x-upper
#
kind = yeeEmField # An FDTD EM field on a Yee mesh
# This boundary condition puts values of E_z on x-lower boundary
# The indices parameter determines which components of E_z are set.
# The length of indices must match that of amplitudes and phases,
# resulting in those being used for other components of E.
kind = variable # Value given by a function
lowerBounds = [0 -1 -1] # Lower cell limits for BC application
upperBounds = [1 NY1 NZ1] # Upper cell limits for BC application
indices = [2] # z polarized
function = planeWavePulse # Function used for E_z
# Below here are the parameters for the function.
# There should be one amplitude and one phase for each index.
amplitudes = [AMPLITUDE] # Amplitudes for each of the indices
phases = [1.57] # Phases for each of the indices
# The following parameters are used for all indices
k = [KAY 0 0 ] # k-vector parameter for wave
omega = OMEGA # Angular frequency parameter for wave
vg = LIGHTSPEED # Group velocity parameter for wave
widths = [5.e-6 1.e-5 1.e-5] # Widths of pulses, along k, transverse
origin = [-5.e-6 0.e-5 0.e-5] # Origin parameter for wave
# Set E_y to zero on x-lower boundary
kind = constant # Value same at all cells
lowerBounds = [0 -1 -1] # Lower cell limits for BC application
upperBounds = [1 NY1 NZ1] # Upper cell limits for BC application
# There should be one amplitude for each index
indices = [1] # E_y set by this
amplitudes = [0.] # E_y set to zero
# Set E_y and E_z to zero on x-upper boundary
kind = constant # Value same at all cells
lowerBounds = [NX -1 -1] # Lower cell limits for BC application
upperBounds = [NX1 NY1 NZ1] # Upper cell limits for BC application
# There should be one amplitude for each index
indices = [1 2] # E_y and E_z set by this
amplitudes = [0. 0.] # Values for E_y and E_z