dirtybomb
Version:
A dirty bomb model
321 lines (277 loc) • 11.5 kB
HTML
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/Dispersion/DynamicGaussianPuff.js | API Document</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
</head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./">Home</a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<a href="test.html" data-ice="testLink">Test</a>
<a data-ice="repoURL" href="https://github.com/austincawley/dirtybomb" class="repo-url-github">Repository</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
</header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Bomb.js~Bomb.html">Bomb</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Dirtybomb.js~Dirtybomb.html">Dirtybomb</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/NuclearMaterial.js~NuclearMaterial.html">NuclearMaterial</a></span></span></li>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">Dispersion</div><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Dispersion/Atmosphere.js~Atmosphere.html">Atmosphere</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Dispersion/DynamicGaussianDecayPuff.js~DynamicGaussianDecayPuff.html">DynamicGaussianDecayPuff</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Dispersion/DynamicGaussianPuff.js~DynamicGaussianPuff.html">DynamicGaussianPuff</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Dispersion/GaussianDecayPlume.js~GaussianDecayPlume.html">GaussianDecayPlume</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Dispersion/GaussianDecayPuff.js~GaussianDecayPuff.html">GaussianDecayPuff</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Dispersion/GaussianPlume.js~GaussianPlume.html">GaussianPlume</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Dispersion/GaussianPuff.js~GaussianPuff.html">GaussianPuff</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Dispersion/Source.js~Source.html">Source</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-Vector">Vector</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-integrate">integrate</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-Dispersion">Dispersion</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-SourceType">SourceType</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-Coord">Coord</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-STD_Y_COEFF">STD_Y_COEFF</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-STD_Z_COEFF">STD_Z_COEFF</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-Stat">Stat</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/Dispersion/DynamicGaussianPuff.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">/**
* Created by austin on 6/16/16.
* @file DynamicGaussianPuff.js
*
*/
import Vector from './Vector';
import GaussianPuff from './GaussianPuff';
/**
* Allows for atmospheric changes between puff movements
*/
class DynamicGaussianPuff extends GaussianPuff {
/**
*
* @param {Atmosphere} atmosphere
* @param {Source} source
* @param {number} massReleased
* @param {array} [center] - Manually set the center, defaults to (0,0,0)
*/
constructor(atmosphere, source, massReleased, center) {
super(atmosphere, source, massReleased);
/**
*
* @type {number}
* @private
*/
this._currentTime = 0;
/**
* Really doesn't need to be a vector. Easy enough to use a vector as a cartesian coord though.
* @type {Vector}
* @private
*/
this._currentCenter = center ? Vector.fromArray(center) : new Vector(0, 0, this.getEffectiveSourceHeight());
/**
* @type {Vector}
* @private
*/
this._startCenter = this._currentCenter.clone();
/**
*
* @type {Array}
* @private
*/
this._path = [];
/**
* dY
* @type {number}
* @private
*/
this._virtHoriz = 0;
/**
* dZ
* @type {number}
* @private
*/
this._vertDist = 0;
/**
*
* @type {number}
* @private
*/
this._stdY = 0;
/**
*
* @type {number}
* @private
*/
this._stdZ = 0;
}
/**
*
* @returns {number}
*/
get time() {
return this._currentTime;
}
/**
*
* @param center
* @returns {DynamicGaussianPuff}
* @private
*/
_setCenter(center) {
this._currentCenter = center;
return this;
}
/**
*
* @returns {Vector}
*/
get center() {
return this._currentCenter;
}
get path() {
return this._path;
}
/**
*
* @returns {Vector}
*/
get start() {
return this._startCenter;
}
/**
*
* @returns {number}
*/
get distanceFromStart() {
return this.center.subtract(this.start).abs();
}
/**
*
* @returns {number}
*/
get distanceTraveled() {
let dist = 0;
let start = this.start;
for (var point of this._path) {
dist += point.subtract(start).abs();
start = point;
}
return dist;
}
/**
* A helper function for the StdZ calculation
* @override
* @protected
* @returns {STD_Y_COEFF}
*/
_getStdYCoeffs() {
let x = this.distanceTraveled;
return super._getStdYCoeffs(x);
}
/**
* Brookhaven sigma
* The crosswind distance standard deviation for a distance x downwind.
* To be used in a Gaussian distribution
* @override
* @returns {number} crosswind standard deviation at x meters downwind (m)
*/
get stdY() {
return this._stdY;
}
/**
* Brookhaven sigma
* The vertical distance standard deviation for a distance x downwind.
* To be used in a Gaussian distribution
* @override
* @returns {number}
*/
get stdZ() {
return this._stdZ;
}
/**
*
* @returns {number|*}
*/
get virtHoriz() {
return this._virtHoriz;
}
/**
*
* @returns {number|*}
*/
get vertDist() {
return this._vertDist;
}
/**
* Moves the puff along by t seconds
* @see http://www.sciencedirect.com/science/article/pii/S0093641303000247 Section 3.2, equation 14
* @param {number} deltaT - seconds to increment by
* @returns {DynamicGaussianPuff}
*/
step(deltaT) {
// update vertHoriz and vertDist
let x = this.distanceTraveled;
let stdYCoeffs = super._getStdYCoeffs(x);
let stdZCoeffs = super._getStdZCoeffs(x);
// Update the Virtual horizontal and the vertical distance @see equation 15
this._virtHoriz = Math.pow((this.stdY / stdYCoeffs.c), (1 / stdYCoeffs.d));
this._vertDist = Math.pow((this.stdZ / stdZCoeffs.a), (1 / stdZCoeffs.b));
// Find the change in x and y directions
// Todo: use Navier-Stokes equation solver to account for momentum @see equation 16
let deltaDVec = this.atmosphere.windSpeedVec.multiply(deltaT); // The change in distance from wind
let deltaD = deltaDVec.abs();
// Update the standard deviations @see equation 17
this._stdY = stdYCoeffs.c * Math.pow(this.virtHoriz + deltaD, stdYCoeffs.d);
this._stdZ = stdZCoeffs.a * Math.pow(this.vertDist + deltaD, stdZCoeffs.b);
// Update position/time/path
this._currentTime += deltaT;
this._setCenter(this.center.add(deltaDVec));
this._path.push(this.center.clone());
return this;
}
/**
* @see http://www.sciencedirect.com/science/article/pii/S0093641303000247 Section 3.2, equation 14
* @override
* @param {number} x - downwind (m)
* @param {number} y - crosswind (m)
* @param {number} z - height (m)
* @returns {number}
*/
getConcentration(x, y, z) {
let stdY = this.stdY;
let stdZ = this.stdZ;
let H = this.getEffectiveSourceHeight();
let a = this.massReleased / (Math.pow(2 * Math.PI, 1.5) * Math.pow(stdY, 2) * stdZ);
let b = Math.exp(-0.5 * Math.pow(x / stdY, 2));
let c = Math.exp(-0.5 * Math.pow(y / stdY, 2));
let d = Math.exp(-0.5 * Math.pow((z - H) / stdZ, 2));
return a * b * c * d;
}
}
export default DynamicGaussianPuff;</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(0.4.7)</span></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>