Documentation
¶
Index ¶
- Constants
- Variables
- type Cell
- type InMAPdata
- func (d *InMAPdata) CalcPlumeRise(stackHeight, stackDiam, stackTemp, stackVel float64, row int) (plumeRow int, plumeHeight float64, err error)
- func (d *InMAPdata) GetGeometry(layer int) []geom.T
- func (d *InMAPdata) IntakeFraction(breathingRate float64) map[string]map[string]float64
- func (d *InMAPdata) Run(emissions map[string][]float64, outputAllLayers bool) (outputConc map[string][][]float64)
- func (d *InMAPdata) VerticalProfile(variable string, lon, lat float64) (height, vals []float64)
- func (d *InMAPdata) WebServer(httpPort string)
- type InitOption
Constants ¶
const ( NOxToN = mwN / mwNOx NtoNO3 = mwNO3 / mwN SOxToS = mwSO2 / mwS StoSO4 = mwS / mwSO4 NH3ToN = mwN / mwNH3 NtoNH4 = mwNH4 / mwN )
Chemical mass conversions [ratios]
Variables ¶
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.T // Cell geometry WebMapGeom geom.T // Cell geometry in web map (mercator) coordinate system UAvg float64 `desc:"Average East-West wind speed" units:"m/s"` VAvg float64 `desc:"Average North-South wind speed" units:"m/s"` WAvg float64 `desc:"Average up-down wind speed" units:"m/s"` UDeviation float64 `desc:"Average deviation from East-West velocity" units:"m/s"` VDeviation float64 `desc:"Average deviation from North-South velocity" 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"` SO2oxidation float64 `desc:"SO2 oxidation to SO4 by HO and H2O2" units:"1/s"` 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"` 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 Boundary bool // Does this cell represent a boundary condition? 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 ¶
Chemistry calculates the secondary formation of PM2.5. It explicitely calculates formation of particulate sulfate from gaseous and aqueous SO2. It 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 ¶
DryDeposition calculates particle removal by dry deposition
func (*Cell) MeanderMixing ¶
MeanderMixing calculates changes in concentrations caused by meanders: adevection that is resolved by the underlying comprehensive chemical transport model but is not resolved by InMAP.
func (*Cell) Mixing ¶
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 ¶
UpwindAdvection calculates advection in the cell based on the upwind differences scheme.
func (*Cell) WetDeposition ¶
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(option InitOption, numIterations int, httpPort string) (*InMAPdata, error)
InitInMAPdata initializes the model where `option` is the selected option for retrieving the input data, `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, plumeHeight float64, err error)
CalcPlumeRise calculates plume rise when given stack information (see github.com/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 ¶
GetGeometry returns the cell geometry for the given layer.
func (*InMAPdata) IntakeFraction ¶
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 ¶
VerticalProfile retrieves the vertical profile for a given variable at a given location.
type InitOption ¶
InitOption allows options of different ways to initialize the model.
func UseCloudStorage ¶
func UseCloudStorage(ctx context.Context, bucket string, fileNameTemplate string, nLayers int) InitOption
UseCloudStorage initializes the model with data from Google Cloud Storage, where ctx is the Context, `bucket` is the name of the bucket, `fileNameTemplate` is the template for the names of the Gob files with meteorology and background concentration data (where `[layer]` is a stand-in for the layer number), and `nLayers` is the number of vertical layers in the model. To minimize individual download sizes, the input files must be enclosed in zip files, with one input file per zip file. ctx must include any authentication needed for acessing the files.
func UseFileTemplate ¶
func UseFileTemplate(filetemplate string, nLayers int) InitOption
UseFileTemplate initializes the model with data from a local disk, where `filetemplate` is the path to the Gob files with meteorology and background concentration data (where `[layer]` is a stand-in for the layer number), and `nLayers` is the number of vertical layers in the model.
func UseReaders ¶
func UseReaders(readers []io.ReadCloser) InitOption
UseReaders initializes the model with data from `readers`, with one reader for the data for each model layer. The readers must be input in order with the ground-level data first.
func UseWebArchive ¶
func UseWebArchive(url, fileNameTemplate string, nLayers int) InitOption
UseWebArchive initializes the model with data from a network, where `url` is the network address, `fileNameTemplate` is the template for the names of the Gob files with meteorology and background concentration data (where `[layer]` is a stand-in for the layer number), and `nLayers` is the number of vertical layers in the model. It is assumed that the input files are contained in a single zip archive.