particles.mac

This macro file can be imported to an input file with

$ import particles

It is imported by VSim if VPM_INCLUDE_PARTICLES is true.

This macro file is available to all packages.

This macro file defines the finalizeParticles() macro, specific to particle simulations. It contains the macros for defining particle species. It also contains macros for <ParticleSources> whcih load the particles into the simulation, for <ParticleSinks> which remove particles from a simulation.

Public Macros

addParticleSpecies(speciesName, kind, charge, mass, nominalDensity, weighting, weightSetting, ppmorc)

Add a particle species to a simulation by adding its data to the accumulation variables. Other accumulation variables, like those for sources and sinks, are added to by the other “add” methods. finalizeParticles() writes out the species with their sources and sinks.

Parameters:
  • speciesName – The name of the particle species.
  • kind – The kind of species, e.g. relBoris, relBorisCyl, etc.
  • charge – The charge of a physical particle of the species, in Coulombs.
  • mass – The mass of a physcial particle of the species, in Kg.
  • nominalDensity – A convenient (anticipated) density for the species, in 1/meters^3. Together with nomPtclsPerCell, it can be used to set the wieght of a constantWeight macroparticles, or the normalization of variableWeight macroparticles.
  • weighting – The weighting for this species, either “constantWeights” or “variableWeights”.
  • weightSetting – How the weight is set, either explicitlySetWeights, or computedWeights from nominalDensity.
  • ppmorc – For computedWeights, the number of macro particles in a cell, when the density in that cell is equal to nominal density. For explicitlySetWeights, the number of physical particles represented by one macro particle.
addParticleSpeciesLoader(sourceName, owningSpecies, initOrRepeat, denTyp, denFunc, posGenKind, vbar, vsig, lb, ub)

Add a particle loader to a particle species given the mean and standard deviation of the velocity distribution of the loaded particles. Loading is only on initialization.

Parameters:
  • sourceName – The name of the particle loader.
  • owningSpecies – The name of the species to be loaded.
  • initOrRepeat – A string denoting whether the loading is initialize only or to repeat.
  • denTyp – Either physics load density or relative (to nominal) load density.
  • denFunc – The function to use for loading.
  • posGenKind – The kind of position generator (grid, bit-rev, …).
  • vbar – A three-vector of mean velocities.
  • vsig – A three-vector of rms velocities.
  • lb – An NDIM vector of loower coordinates.
  • ub – An NDIM vector of upper coordinates.
addParticleSpeciesLoader(sourceName, owningSpecies, initOrRepeat, tmin, tmax, denTyp, denFunc, posGenKind, vbar, vsig, lb, ub)

Add a particle loader to a particle species given the mean and standard deviation of the velocity distribution of the loaded particles. Loading is only on initialization. Delegates to addParticleSpeciesLoader(14 args).

Parameters:
  • sourceName – The name of the particle loader.
  • owningSpecies – The name of the species to be loaded.
  • initOrRepeat – A string denoting whether the loading is initialize only or to repeat.
  • tmin – Tthe time to start loading.
  • tmax – The time to stop loading (inclusive).
  • denTyp – Either physics load density or relative (to nominal) load density.
  • denFunc – The function to use for loading.
  • posGenKind – The kind of position generator (grid, bit-rev, …).
  • vbar – A three-vector of mean velocities.
  • vsig – A three-vector of rms velocities.
  • lb – An NDIM vector of loower coordinates.
  • ub – An NDIM vector of upper coordinates.
addParticleSpeciesSink(sinkName, owningSpecies, sinkKind, volType, lb, ub)

Add a particle species sink to a particle species given the lower and upper bounds.

Parameters:
  • sinkName – The name of the particle sink.
  • owningSpecies – The name of the species that contains this source block.
  • sinkKind – The kind of sink. E.g. absAndSav, absorber, specularBndry, absAndSavCutCell.
  • volType – The type of volume, either slab or location.
  • lb – The lower bounds. An integer array of length VPM_NDIM.
  • ub – The upper bounds. An integer array of length VPM_NDIM.
addParticleSpeciesSink(sinkName, owningSpecies, sinkKind, location)

Add a particle species sink to a particle species given the location.

Parameters:
  • sinkName – The name of the particle sink.
  • owningSpecies – The name of the species that contains this source block.
  • sinkKind – The kind of sink. E.g. absAndSav, absorber, specularBndry, absAndSavCutCell.
  • location – location The location of the boundary condition, one of [lower|upper][X|Y|Z].
addParticleSpeciesSink(sinkName, owningSpecies, sinkKind, volType, lb, ub, location)

Add a particle species sink to a particle species. Either location or lb and ub should be None, as they are mutually exclusive. Done by adding to the string arrays describing the sink.

Parameters:
  • sinkName – The name of the particle sink.
  • owningSpecie – The name of the species that contains this source block.
  • sinkKind – The kind of sink. E.g. absAndSav, absorber, specularBndry, absAndSavCutCell.
  • volType – The type of volume, either slab or location.
  • lb – The lower bounds. An integer array of length VPM_NDIM.
  • ub – The upper bounds. An integer array of length VPM_NDIM.
  • location – location The location of the boundary condition, one of [lower|upper][X|Y|Z].
finalizeParticles()

Writing the particle Species blocks. Inserts Sinks and Sources (loaders and emitters) into the block. Writes depositor fields if electrostatic simulation.