inmap

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2015 License: GPL-3.0, GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ratios
	NOxToN = mwN / mwNOx
	NtoNO3 = mwNO3 / mwN
	SOxToS = mwSO2 / mwS
	StoSO4 = mwS / mwSO4
	NH3ToN = mwN / mwNH3
	NtoNH4 = mwNH4 / mwN
)

Chemical mass conversions

Variables

View Source
var EmisNames = []string{"VOC", "NOx", "NH3", "SOx", "PM2_5"}

These are the names of pollutants accepted as emissions [μg/s]

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Geom                    geom.T             // Cell geometry
	WebMapGeom              geom.T             // Cell geometry in web map (mercator) coordinate system
	UPlusSpeed              float64            `desc:"Westerly wind speed" units:"m/s"`
	UMinusSpeed             float64            `desc:"Easterly wind speed" units:"m/s"`
	VPlusSpeed              float64            `desc:"Southerly wind speed" units:"m/s"`
	VMinusSpeed             float64            `desc:"Northerly wind speed" units:"m/s"`
	WPlusSpeed, WMinusSpeed float64            `desc:"Upwardly wind speed" units:"m/s"`
	AOrgPartitioning        float64            `desc:"Organic particle partitioning" units:"fraction particles"`
	BOrgPartitioning        float64            // particle fraction
	SPartitioning           float64            `desc:"Sulfur particle partitioning" units:"fraction particles"`
	NOPartitioning          float64            `desc:"Nitrate particle partitioning" units:"fraction particles"`
	NHPartitioning          float64            `desc:"Ammonium particle partitioning" units:"fraction particles"`
	ParticleWetDep          float64            `desc:"Particle wet deposition" units:"1/s"`
	SO2WetDep               float64            `desc:"SO2 wet deposition" units:"1/s"`
	OtherGasWetDep          float64            `desc:"Wet deposition: other gases" units:"1/s"`
	ParticleDryDep          float64            `desc:"Particle dry deposition" units:"m/s"`
	NH3DryDep               float64            `desc:"Ammonia dry deposition" units:"m/s"`
	SO2DryDep               float64            `desc:"SO2 dry deposition" units:"m/s"`
	VOCDryDep               float64            `desc:"VOC dry deposition" units:"m/s"`
	NOxDryDep               float64            `desc:"NOx dry deposition" units:"m/s"`
	SO2oxidation            float64            `desc:"SO2 oxidation to SO4 by HO and H2O2" units:"1/s"`
	Kzz                     float64            `desc:"Grid center vertical diffusivity after applying convective fraction" units:"m²/s"`
	KzzAbove, KzzBelow      []float64          // horizontal diffusivity [m2/s] (staggered grid)
	Kxxyy                   float64            `desc:"Grid center horizontal diffusivity" units:"m²/s"`
	KyySouth, KyyNorth      []float64          // horizontal diffusivity [m2/s] (staggered grid)
	KxxWest, KxxEast        []float64          // horizontal diffusivity at [m2/s] (staggered grid)
	M2u                     float64            `desc:"ACM2 upward mixing (Pleim 2007)" units:"1/s"`
	M2d                     float64            `desc:"ACM2 downward mixing (Pleim 2007)" units:"1/s"`
	PopData                 map[string]float64 // Population for multiple demographics [people/grid cell]
	MortalityRate           float64            `desc:"Baseline mortalities rate" units:"Deaths per 100,000 people per year"`
	Dx, Dy, Dz              float64            // grid size [meters]
	Volume                  float64            `desc:"Cell volume" units:"m³"`
	Row                     int                // master cell index
	Ci                      []float64          // concentrations at beginning of time step [μg/m³]
	Cf                      []float64          // concentrations at end of time step [μg/m³]

	West                       []*Cell   // Neighbors to the East
	East                       []*Cell   // Neighbors to the West
	South                      []*Cell   // Neighbors to the South
	North                      []*Cell   // Neighbors to the North
	Below                      []*Cell   // Neighbors below
	Above                      []*Cell   // Neighbors above
	GroundLevel                []*Cell   // Neighbors at ground level
	WestFrac, EastFrac         []float64 // Fraction of cell covered by each neighbor (adds up to 1).
	NorthFrac, SouthFrac       []float64 // Fraction of cell covered by each neighbor (adds up to 1).
	AboveFrac, BelowFrac       []float64 // Fraction of cell covered by each neighbor (adds up to 1).
	GroundLevelFrac            []float64 // Fraction of cell above to each ground level cell (adds up to 1).
	IWest                      []int     // Row indexes of neighbors to the East
	IEast                      []int     // Row indexes of neighbors to the West
	ISouth                     []int     // Row indexes of neighbors to the South
	INorth                     []int     // Row indexes of neighbors to the north
	IBelow                     []int     // Row indexes of neighbors below
	IAbove                     []int     // Row indexes of neighbors above
	IGroundLevel               []int     // Row indexes of neighbors at ground level
	DxPlusHalf                 []float64 // Distance between centers of cell and East [m]
	DxMinusHalf                []float64 // Distance between centers of cell and West [m]
	DyPlusHalf                 []float64 // Distance between centers of cell and North [m]
	DyMinusHalf                []float64 // Distance between centers of cell and South [m]
	DzPlusHalf                 []float64 // Distance between centers of cell and Above [m]
	DzMinusHalf                []float64 // Distance between centers of cell and Below [m]
	Layer                      int       // layer index of grid cell
	Temperature                float64   `desc:"Average temperature" units:"K"`
	WindSpeed                  float64   `desc:"RMS wind speed" units:"m/s"`
	WindSpeedInverse           float64   `desc:"RMS wind speed inverse" units:"(m/s)^(-1)"`
	WindSpeedMinusThird        float64   `desc:"RMS wind speed^(-1/3)" units:"(m/s)^(-1/3)"`
	WindSpeedMinusOnePointFour float64   `desc:"RMS wind speed^(-1.4)" units:"(m/s)^(-1.4)"`
	S1                         float64   `desc:"Stability parameter" units:"?"`
	SClass                     float64   `desc:"Stability class" units:"0=Unstable; 1=Stable"`
	sync.RWMutex                         // Avoid cell being written by one subroutine and read by another at the same time.
	// contains filtered or unexported fields
}

Cell holds the state of a single grid cell.

func (*Cell) Chemistry

func (c *Cell) Chemistry(d *InMAPdata)

Chemistry calculates the secondary formation of PM2.5. Explicitely calculates formation of particulate sulfate from gaseous and aqueous SO2. Partitions organic matter ("gOrg" and "pOrg"), the nitrogen in nitrate ("gNO and pNO"), and the nitrogen in ammonia ("gNH" and "pNH) between gaseous and particulate phase based on the spatially explicit partioning present in the baseline data.

func (*Cell) DryDeposition

func (c *Cell) DryDeposition(d *InMAPdata)

DryDeposition calculates particle removal by dry deposition

func (*Cell) Mixing

func (c *Cell) Mixing(Δt float64)

Mixing calculates vertical mixing based on Pleim (2007), which is combined local-nonlocal closure scheme, for boundary layer and based on Wilson (2004) for above the boundary layer. Also calculate horizontal mixing.

func (*Cell) UpwindAdvection

func (c *Cell) UpwindAdvection(Δt float64)

UpwindAdvection calculates advection in the cell based on the upwind differences scheme.

func (*Cell) WetDeposition

func (c *Cell) WetDeposition(Δt float64)

WetDeposition calculates particle removal by wet deposition

type InMAPdata

type InMAPdata struct {
	Data    []*Cell // One data holder for each grid cell
	Dt      float64 // seconds
	Nlayers int     // number of model layers

	// Number of iterations to calculate. If < 1,
	// calculate convergence automatically.
	NumIterations int

	LayerStart []int // start index of each layer (inclusive)
	LayerEnd   []int // end index of each layer (exclusive)
	// contains filtered or unexported fields
}

InMAPdata is holds the current state of the model.

func InitInMAPdata

func InitInMAPdata(filetemplate string, nLayers int, numIterations int,
	httpPort string) *InMAPdata

InitInMAPdata initializes the model, where `filename` is the path to the Gob files with meteorology and background concentration data (where `[layer]` is a stand-in for the layer number), `nLayers` is the number of vertical layers in the model, `numIterations` is the number of iterations to calculate (if `numIterations` < 1, convergence is calculated automatically), and `httpPort` is the port number for hosting the html GUI (if `httpPort` is "", then the GUI doesn't run).

func (*InMAPdata) CalcPlumeRise

func (d *InMAPdata) CalcPlumeRise(stackHeight, stackDiam, stackTemp,
	stackVel float64, row int) (plumeRow int, err error)

CalcPlumeRise calculates plume rise when given stack information (see bitbucket.org/ctessum/atmos/plumerise for required units) and the index of the (ground level) grid cell (called `row`). Returns the index of the cell the emissions should be added to. This function assumes that when one grid cell is above another grid cell, the upper cell is never smaller than the lower cell.

func (*InMAPdata) GetGeometry

func (d *InMAPdata) GetGeometry(layer int) []geom.T

GetGeometry returns the cell geometry for the given layer.

func (*InMAPdata) IntakeFraction

func (d *InMAPdata) IntakeFraction(
	breathingRate float64) map[string]map[string]float64

IntakeFraction calculates intake fraction from InMAP results. The input value is average breathing rate [m³/day]. The returned value is a map structure of intake fractions by pollutant and population type (map[pollutant][population]iF). This function will only give the correct results if run after InMAP finishes calculating.

func (*InMAPdata) Run

func (d *InMAPdata) Run(emissions map[string][]float64, outputAllLayers bool) (
	outputConc map[string][][]float64)

Run air quality model. Emissions are assumed to be in units of μg/s, and must only include the pollutants listed in "EmisNames". Output is in the form of map[pollutant][layer][row]concentration, in units of μg/m3. If `outputAllLayers` is true, write all of the vertical layers to the output, otherwise only output the ground-level layer.

func (*InMAPdata) VerticalProfile

func (d *InMAPdata) VerticalProfile(variable string, lon, lat float64) (
	height, vals []float64)

VerticalProfile retrieves the vertical profile for a given variable at a given location.

func (*InMAPdata) WebServer

func (d *InMAPdata) WebServer(httpPort string)

WebServer provides a HTML user interface for the model.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL