UNPKG

dirtybomb

Version:
1,434 lines 275 kB
[ { "__docId__": 0, "kind": "file", "static": true, "variation": null, "name": "src/Bomb.js", "memberof": null, "longname": "src/Bomb.js", "access": null, "description": null, "lineNumber": 5, "content": "/**\n * Created by austin on 6/17/16.\n */\n\nimport Source from './Dispersion/Source';\nimport Atmosphere from './Dispersion/Atmosphere';\nimport GaussianPuff from './Dispersion/GaussianPuff';\nimport DynamicGaussianPuff from './Dispersion/DynamicGaussianDecayPuff';\nimport {SourceType} from './Dispersion/Source';\n\n// For some reason importing Atmosphere makes Rollup unhappy\n\n/**\n * Explosive energy of tnt\n * MJ/kg\n * @type {number}\n * @see https://en.wikipedia.org/wiki/TNT_equivalent\n */\nconst Q_TNT = 4.184; // One Megaton of TNT == 4.184 Petajoules\n\n/**\n * A simple bomb \n */\nclass Bomb {\n /**\n *\n * @param {number} tntEqvMass - Standardized TNT equivalent kg (kg)\n * @param {Atmosphere} [atmosphere=Bomb.STANDARD_ATM]\n * @param {boolean} [isStatic=true] - Determines the type of puff that is used\n */\n constructor(tntEqvMass, atmosphere = Bomb.STANDARD_ATM, isStatic = true) {\n /**\n *\n * @type {number}\n * @private\n */\n this._mass = tntEqvMass;\n /**\n * A standardized measure for weapon strength\n * @type {number}\n * @private\n */\n this._weaponYield = tntEqvMass / 1000000;\n /**\n *\n * @type {Atmosphere}\n * @private\n */\n this._atm = atmosphere;\n\n /**\n * \n * @type {Source}\n * @private\n */\n this._source = new Source(\n SourceType.POINT,\n Math.POSITIVE_INFINITY, // Emission rate, arb for puffs. TODO!\n this.cloudHeight,\n this.cloudRadius,\n this.getGasTemp(this.cloudHeight),\n this.getGasVelocity(this.cloudHeight)\n );\n \n if (isStatic) {\n this._puff = new GaussianPuff(\n atmosphere,\n this._source,\n this.mass // Todo: how to calculate how much mass goes into the air?\n );\n } else {\n this._puff = new DynamicGaussianPuff(\n atmosphere,\n this._source,\n this.mass // Todo: how to calculate how much mass goes into the air?\n );\n }\n \n \n if (this.weaponYield > 1000) {\n console.warn(\"WARNING: this bomb library is mean for bombs weaponYields under 1000.\");\n }\n }\n\n /**\n *\n * @param atm\n * @returns {Bomb}\n */\n setAtmosphere(atm) {\n this._atm = atm;\n return this;\n }\n\n /**\n *\n * @returns {Atmosphere}\n */\n get atmosphere() {\n return this._atm;\n }\n\n /**\n *\n * @returns {number}\n */\n get weaponYield() {\n return this._weaponYield;\n }\n\n /**\n *\n * @returns {Source}\n */\n get source() {\n return this._source;\n }\n\n /**\n *\n * @param mass\n * @returns {Bomb}\n */\n setMass(mass) {\n this._mass = mass;\n return this;\n }\n\n /**\n *\n * @returns {number}\n */\n get mass() {\n return this._mass;\n }\n\n /**\n * Based on kilotons of tnt nuclear explosions\n * @returns {number} - (m)\n */\n get blastRadius() {\n return 30 * Math.pow(this.weaponYield, 1/3);\n }\n\n /**\n * From eq 7 of CISAC Fallout Model\n * Approximating this as the top of the stem cloud\n * Perhaps will change this as a combination of all three cloud alt equations\n * @see http://cisac.fsi.stanford.edu/sites/default/files/geist_2014_cv.pdf\n * @returns {number}\n */\n get cloudHeight() {\n if (this.weaponYield < 2) {\n return 1740 * Math.pow(this.weaponYield, 0.229);\n }\n if (this.weaponYield < 20) {\n return 1720 * Math.pow(this.weaponYield, 0.261);\n }\n return 2040 * Math.pow(this.weaponYield, 0.204);\n }\n\n /**\n * Should not be used in this context. Really for nuclear bombs.\n * @returns {number}\n * @private\n */\n _getMainCloudRadius() {\n return 872 * Math.pow(this.weaponYield, 0.427);\n }\n\n /**\n *\n * @returns {number} - (m)\n */\n get cloudRadius() {\n let mainRad = this._getMainCloudRadius();\n if (this.weaponYield < 20) {\n return 0.5 * mainRad;\n }\n if (this.weaponYield <= 1000) {\n return 0.5 * mainRad - 0.3 * mainRad * ((this.weaponYield - 20) / 980);\n }\n return 0.2 * mainRad - 0.1 * mainRad * ((this.weaponYield - 1000) / 9000);\n }\n\n /**\n *\n * @returns {DynamicGaussianPuff|GaussianPuff} - Depending on if the dispersion is static\n */\n get dispersion() {\n return this._puff;\n }\n\n /**\n * @see https://www.metabunk.org/attachments/blast-effect-calculation-1-pdf.2578/ equation 3\n * @param {number} r - distance from origin (m)\n * @returns {number} - pressure (atm)\n */\n getOverpressureAt(r) {\n let a = (0.84 / r) * Math.pow(this._mass, (1/3));\n let b = (2.7 / Math.pow(r, 2)) * Math.pow(this.mass, (2/3));\n let c = (7 / Math.pow(r, 3)) * this.mass;\n return a + b + c;\n }\n\n /**\n * Velocity of gas in behind shock wave front\n * @see https://www.metabunk.org/attachments/blast-effect-calculation-1-pdf.2578/ equation 5.2\n * @param {number} r - distance from origin (m)\n * @returns {number} velocity (m/s)\n */\n getGasVelocity(r) {\n let pressure = this.getOverpressureAt(r);\n // Simplified for standard atmosphere\n return 243 * pressure / Math.sqrt(1 + 0.86 * pressure);\n }\n\n /**\n * Temperature of gas in shock wave front\n * @see https://www.metabunk.org/attachments/blast-effect-calculation-1-pdf.2578/ equation 5.3\n * @param {number} r - distance from origin (m)\n * @returns {number} temperature (K)\n */\n getGasTemp(r) {\n let pressure = this.getOverpressureAt(r);\n return this.atmosphere.temperature * (1 + pressure) * (7 + pressure) / (7 + 6 * pressure);\n }\n\n /**\n * Positive Shock Phase Duration\n * @see https://www.metabunk.org/attachments/blast-effect-calculation-1-pdf.2578/ equation 4\n * @param {number} r - distance from origin (m)\n * @returns {number} duration (s)\n */\n getPosShockPhaseDuration(r) {\n return 1.3 * Math.pow(this.mass, (1 / 6)) * Math.sqrt(r) * 0.001;\n }\n\n /**\n * \n * @param {number} qExp - explosive energy (MJ/kg)\n * @returns {number}\n */\n static tntEquivalentFactor(qExp) {\n return qExp / Q_TNT;\n }\n\n /**\n * \n * @param {number} qExp - explosive energy (MJ/kg)\n * @param {number} mass - (kg)\n * @returns {number}\n */\n static tntEquivalent(qExp, mass) {\n return Bomb.tntEquivalentFactor(qExp) * mass;\n }\n}\n\n/**\n * Should probably move this to the Atmosphere class\n * 0 wind\n * 0 sky cover\n * 65 degrees sun\n * 59 degrees F / 15 degrees C\n * @type {Atmosphere}\n */\nBomb.STANDARD_ATM = new Atmosphere(0, 0, 65, 288.2);\nexport default Bomb;" }, { "__docId__": 1, "kind": "variable", "static": true, "variation": null, "name": "Q_TNT", "memberof": "src/Bomb.js", "longname": "src/Bomb.js~Q_TNT", "access": null, "export": false, "importPath": "dirtybomb/src/Bomb.js", "importStyle": null, "description": "Explosive energy of tnt\nMJ/kg", "see": [ "https://en.wikipedia.org/wiki/TNT_equivalent" ], "lineNumber": 19, "type": { "nullable": null, "types": [ "number" ], "spread": false, "description": null } }, { "__docId__": 2, "kind": "class", "static": true, "variation": null, "name": "Bomb", "memberof": "src/Bomb.js", "longname": "src/Bomb.js~Bomb", "access": null, "export": true, "importPath": "dirtybomb/src/Bomb.js", "importStyle": "Bomb", "description": "A simple bomb ", "lineNumber": 24, "interface": false }, { "__docId__": 3, "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#constructor", "access": null, "description": "", "lineNumber": 31, "params": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "tntEqvMass", "description": "Standardized TNT equivalent kg (kg)" }, { "nullable": null, "types": [ "Atmosphere" ], "spread": false, "optional": true, "defaultValue": "Bomb.STANDARD_ATM", "defaultRaw": "Bomb.STANDARD_ATM", "name": "atmosphere", "description": "" }, { "nullable": null, "types": [ "boolean" ], "spread": false, "optional": true, "defaultValue": "true", "defaultRaw": true, "name": "isStatic", "description": "Determines the type of puff that is used" } ], "generator": false }, { "__docId__": 4, "kind": "member", "static": false, "variation": null, "name": "_mass", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#_mass", "access": "private", "description": "", "lineNumber": 37, "type": { "nullable": null, "types": [ "number" ], "spread": false, "description": null } }, { "__docId__": 5, "kind": "member", "static": false, "variation": null, "name": "_weaponYield", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#_weaponYield", "access": "private", "description": "A standardized measure for weapon strength", "lineNumber": 43, "type": { "nullable": null, "types": [ "number" ], "spread": false, "description": null } }, { "__docId__": 6, "kind": "member", "static": false, "variation": null, "name": "_atm", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#_atm", "access": "private", "description": "", "lineNumber": 49, "type": { "nullable": null, "types": [ "Atmosphere" ], "spread": false, "description": null } }, { "__docId__": 7, "kind": "member", "static": false, "variation": null, "name": "_source", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#_source", "access": "private", "description": "", "lineNumber": 56, "type": { "nullable": null, "types": [ "Source" ], "spread": false, "description": null } }, { "__docId__": 8, "kind": "member", "static": false, "variation": null, "name": "_puff", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#_puff", "access": null, "description": null, "lineNumber": 66, "undocument": true, "type": { "types": [ "*" ] } }, { "__docId__": 9, "kind": "member", "static": false, "variation": null, "name": "_puff", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#_puff", "access": null, "description": null, "lineNumber": 72, "undocument": true, "type": { "types": [ "*" ] } }, { "__docId__": 10, "kind": "method", "static": false, "variation": null, "name": "setAtmosphere", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#setAtmosphere", "access": null, "description": "", "lineNumber": 90, "unknown": [ { "tagName": "@returns", "tagValue": "{Bomb}" } ], "params": [ { "nullable": null, "types": [ "*" ], "spread": false, "optional": false, "name": "atm", "description": "" } ], "return": { "nullable": null, "types": [ "Bomb" ], "spread": false, "description": "" }, "generator": false }, { "__docId__": 11, "kind": "member", "static": false, "variation": null, "name": "_atm", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#_atm", "access": null, "description": null, "lineNumber": 91, "undocument": true, "type": { "types": [ "*" ] } }, { "__docId__": 12, "kind": "get", "static": false, "variation": null, "name": "atmosphere", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#atmosphere", "access": null, "description": "", "lineNumber": 99, "unknown": [ { "tagName": "@returns", "tagValue": "{Atmosphere}" } ], "return": { "nullable": null, "types": [ "Atmosphere" ], "spread": false, "description": "" }, "type": { "types": [ "*" ] }, "generator": false }, { "__docId__": 13, "kind": "get", "static": false, "variation": null, "name": "weaponYield", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#weaponYield", "access": null, "description": "", "lineNumber": 107, "unknown": [ { "tagName": "@returns", "tagValue": "{number}" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "" }, "type": { "types": [ "*" ] }, "generator": false }, { "__docId__": 14, "kind": "get", "static": false, "variation": null, "name": "source", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#source", "access": null, "description": "", "lineNumber": 115, "unknown": [ { "tagName": "@returns", "tagValue": "{Source}" } ], "return": { "nullable": null, "types": [ "Source" ], "spread": false, "description": "" }, "type": { "types": [ "*" ] }, "generator": false }, { "__docId__": 15, "kind": "method", "static": false, "variation": null, "name": "setMass", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#setMass", "access": null, "description": "", "lineNumber": 124, "unknown": [ { "tagName": "@returns", "tagValue": "{Bomb}" } ], "params": [ { "nullable": null, "types": [ "*" ], "spread": false, "optional": false, "name": "mass", "description": "" } ], "return": { "nullable": null, "types": [ "Bomb" ], "spread": false, "description": "" }, "generator": false }, { "__docId__": 16, "kind": "member", "static": false, "variation": null, "name": "_mass", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#_mass", "access": null, "description": null, "lineNumber": 125, "undocument": true, "type": { "types": [ "*" ] } }, { "__docId__": 17, "kind": "get", "static": false, "variation": null, "name": "mass", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#mass", "access": null, "description": "", "lineNumber": 133, "unknown": [ { "tagName": "@returns", "tagValue": "{number}" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "" }, "type": { "types": [ "*" ] }, "generator": false }, { "__docId__": 18, "kind": "get", "static": false, "variation": null, "name": "blastRadius", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#blastRadius", "access": null, "description": "Based on kilotons of tnt nuclear explosions", "lineNumber": 141, "unknown": [ { "tagName": "@returns", "tagValue": "{number} - (m)" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "(m)" }, "type": { "types": [ "*" ] }, "generator": false }, { "__docId__": 19, "kind": "get", "static": false, "variation": null, "name": "cloudHeight", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#cloudHeight", "access": null, "description": "From eq 7 of CISAC Fallout Model\nApproximating this as the top of the stem cloud\nPerhaps will change this as a combination of all three cloud alt equations", "see": [ "http://cisac.fsi.stanford.edu/sites/default/files/geist_2014_cv.pdf" ], "lineNumber": 152, "unknown": [ { "tagName": "@returns", "tagValue": "{number}" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "" }, "type": { "types": [ "*" ] }, "generator": false }, { "__docId__": 20, "kind": "method", "static": false, "variation": null, "name": "_getMainCloudRadius", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#_getMainCloudRadius", "access": "private", "description": "Should not be used in this context. Really for nuclear bombs.", "lineNumber": 167, "unknown": [ { "tagName": "@returns", "tagValue": "{number}" } ], "params": [], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "" }, "generator": false }, { "__docId__": 21, "kind": "get", "static": false, "variation": null, "name": "cloudRadius", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#cloudRadius", "access": null, "description": "", "lineNumber": 175, "unknown": [ { "tagName": "@returns", "tagValue": "{number} - (m)" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "(m)" }, "type": { "types": [ "*" ] }, "generator": false }, { "__docId__": 22, "kind": "get", "static": false, "variation": null, "name": "dispersion", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#dispersion", "access": null, "description": "", "lineNumber": 190, "unknown": [ { "tagName": "@returns", "tagValue": "{DynamicGaussianPuff|GaussianPuff} - Depending on if the dispersion is static" } ], "return": { "nullable": null, "types": [ "DynamicGaussianPuff", "GaussianPuff" ], "spread": false, "description": "Depending on if the dispersion is static" }, "type": { "types": [ "*" ] }, "generator": false }, { "__docId__": 23, "kind": "method", "static": false, "variation": null, "name": "getOverpressureAt", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#getOverpressureAt", "access": null, "description": "", "see": [ "https://www.metabunk.org/attachments/blast-effect-calculation-1-pdf.2578/ equation 3" ], "lineNumber": 199, "unknown": [ { "tagName": "@returns", "tagValue": "{number} - pressure (atm)" } ], "params": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "r", "description": "distance from origin (m)" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "pressure (atm)" }, "generator": false }, { "__docId__": 24, "kind": "method", "static": false, "variation": null, "name": "getGasVelocity", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#getGasVelocity", "access": null, "description": "Velocity of gas in behind shock wave front", "see": [ "https://www.metabunk.org/attachments/blast-effect-calculation-1-pdf.2578/ equation 5.2" ], "lineNumber": 212, "unknown": [ { "tagName": "@returns", "tagValue": "{number} velocity (m/s)" } ], "params": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "r", "description": "distance from origin (m)" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "velocity (m/s)" }, "generator": false }, { "__docId__": 25, "kind": "method", "static": false, "variation": null, "name": "getGasTemp", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#getGasTemp", "access": null, "description": "Temperature of gas in shock wave front", "see": [ "https://www.metabunk.org/attachments/blast-effect-calculation-1-pdf.2578/ equation 5.3" ], "lineNumber": 224, "unknown": [ { "tagName": "@returns", "tagValue": "{number} temperature (K)" } ], "params": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "r", "description": "distance from origin (m)" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "temperature (K)" }, "generator": false }, { "__docId__": 26, "kind": "method", "static": false, "variation": null, "name": "getPosShockPhaseDuration", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb#getPosShockPhaseDuration", "access": null, "description": "Positive Shock Phase Duration", "see": [ "https://www.metabunk.org/attachments/blast-effect-calculation-1-pdf.2578/ equation 4" ], "lineNumber": 235, "unknown": [ { "tagName": "@returns", "tagValue": "{number} duration (s)" } ], "params": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "r", "description": "distance from origin (m)" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "duration (s)" }, "generator": false }, { "__docId__": 27, "kind": "method", "static": true, "variation": null, "name": "tntEquivalentFactor", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb.tntEquivalentFactor", "access": null, "description": "", "lineNumber": 244, "unknown": [ { "tagName": "@returns", "tagValue": "{number}" } ], "params": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "qExp", "description": "explosive energy (MJ/kg)" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "" }, "generator": false }, { "__docId__": 28, "kind": "method", "static": true, "variation": null, "name": "tntEquivalent", "memberof": "src/Bomb.js~Bomb", "longname": "src/Bomb.js~Bomb.tntEquivalent", "access": null, "description": "", "lineNumber": 254, "unknown": [ { "tagName": "@returns", "tagValue": "{number}" } ], "params": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "qExp", "description": "explosive energy (MJ/kg)" }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "mass", "description": "(kg)" } ], "return": { "nullable": null, "types": [ "number" ], "spread": false, "description": "" }, "generator": false }, { "__docId__": 29, "kind": "file", "static": true, "variation": null, "name": "src/Dirtybomb.js", "memberof": null, "longname": "src/Dirtybomb.js", "access": null, "description": null, "lineNumber": 7, "content": "/**\n * Created by austin on 6/2/16.\n * file: Dirtybomb.js\n * \n */\n\nimport GaussianDecayPuff from './Dispersion/GaussianDecayPuff';\nimport DynamicGaussianDecayPuff from './Dispersion/DynamicGaussianDecayPuff';\nimport Bomb from './Bomb';\nimport NuclearMaterial from './NuclearMaterial';\nimport Dispersion from './Dispersion/Dispersion';\n\n/**\n * A simple dirtybomb. Assumes all nuclear material is released into the atmosphere\n */\nclass Dirtybomb extends Bomb {\n\n /**\n * @param {NuclearMaterial} nuclearMat\n * @param {number} tntEqvMass - Standardized TNT equivalent (kg)\n * @param {Atmosphere} [atmosphere=Bomb.STANDARD_ATM]\n * @param {boolean} [isStatic=true] - Determines the type of puff that is used\n * \n */\n constructor(nuclearMat, tntEqvMass, atmosphere = Bomb.STANDARD_ATM, isStatic = true) {\n super(tntEqvMass, atmosphere, isStatic);\n \n /**\n * @type {NuclearMaterial}\n * @private\n */\n this._nucMat = nuclearMat;\n\n /**\n * Either\n * @type {GaussianPuff}\n * @private\n */\n this._puff;\n \n if (isStatic) {\n this._puff = new GaussianDecayPuff(\n atmosphere,\n this.source,\n nuclearMat.mass,\n nuclearMat.halfLife\n );\n } else {\n this._puff = new DynamicGaussianDecayPuff(\n atmosphere,\n this.source,\n nuclearMat.mass,\n nuclearMat.halfLife\n )\n }\n }\n}\n\nexport {Dispersion};\nexport {NuclearMaterial};\nexport default Dirtybomb;" }, { "__docId__": 30, "kind": "class", "static": true, "variation": null, "name": "Dirtybomb", "memberof": "src/Dirtybomb.js", "longname": "src/Dirtybomb.js~Dirtybomb", "access": null, "export": true, "importPath": "dirtybomb/src/Dirtybomb.js", "importStyle": "Dirtybomb", "description": "A simple dirtybomb. Assumes all nuclear material is released into the atmosphere", "lineNumber": 16, "interface": false, "extends": [ "src/Bomb.js~Bomb" ] }, { "__docId__": 31, "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/Dirtybomb.js~Dirtybomb", "longname": "src/Dirtybomb.js~Dirtybomb#constructor", "access": null, "description": "", "lineNumber": 25, "params": [ { "nullable": null, "types": [ "NuclearMaterial" ], "spread": false, "optional": false, "name": "nuclearMat", "description": "" }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "tntEqvMass", "description": "Standardized TNT equivalent (kg)" }, { "nullable": null, "types": [ "Atmosphere" ], "spread": false, "optional": true, "defaultValue": "Bomb.STANDARD_ATM", "defaultRaw": "Bomb.STANDARD_ATM", "name": "atmosphere", "description": "" }, { "nullable": null, "types": [ "boolean" ], "spread": false, "optional": true, "defaultValue": "true", "defaultRaw": true, "name": "isStatic", "description": "Determines the type of puff that is used" } ], "generator": false }, { "__docId__": 32, "kind": "member", "static": false, "variation": null, "name": "_nucMat", "memberof": "src/Dirtybomb.js~Dirtybomb", "longname": "src/Dirtybomb.js~Dirtybomb#_nucMat", "access": "private", "description": "", "lineNumber": 32, "type": { "nullable": null, "types": [ "NuclearMaterial" ], "spread": false, "description": null } }, { "__docId__": 33, "kind": "member", "static": false, "variation": null, "name": "_puff", "memberof": "src/Dirtybomb.js~Dirtybomb", "longname": "src/Dirtybomb.js~Dirtybomb#_puff", "access": null, "description": null, "lineNumber": 42, "undocument": true, "type": { "types": [ "*" ] } }, { "__docId__": 34, "kind": "member", "static": false, "variation": null, "name": "_puff", "memberof": "src/Dirtybomb.js~Dirtybomb", "longname": "src/Dirtybomb.js~Dirtybomb#_puff", "access": null, "description": null, "lineNumber": 49, "undocument": true, "type": { "types": [ "*" ] } }, { "__docId__": 35, "kind": "file", "static": true, "variation": null, "name": "src/Dispersion/Atmosphere.js", "memberof": null, "longname": "src/Dispersion/Atmosphere.js", "access": null, "description": null, "lineNumber": 6, "content": "/**\n * Created by austin on 6/2/16.\n * @file Atmosphere.js\n */\n\nimport Vector from './Vector';\n\n/**\n * On a scale of 0 - 6\n * Extremely unstable A ... DD, DN ... F Moderately Stable\n * @type {string[]}\n */\nconst LETTER_GRADES = ['A', 'B', 'C', 'DD', 'DN', 'E', 'F'];\n\n/**\n * Overcast should always receive a 3 (D)\n * From Table. 2 on Page 9, all mid grades are rounded up.\n * Maps _windSpeedVec and _skyCover to a grade\n * [<2, 2-3, 3-5, 5-6, >6] then\n * [strong, moderate, slight]\n * @type {number[][]}\n */\nconst DAY_GRADES = [\n [0, 0, 1],\n [0, 1, 2],\n [1, 1, 2],\n [2, 2, 3],\n [2, 3, 3]\n];\n\n/**\n * Defined as one hour before sunset to one hour after sunrise\n * NOTE: Night Grade D is DN, 4\n * [_skyCover > .5, _skyCover < .5]\n * @type {number[][]}\n */\nconst NIGHT_GRADES = [ \n [4, 4], // No given, assumed Class D / not practically possible\n [5, 6],\n [4, 5],\n [4, 4],\n [4, 4]\n];\n\n/**\n * Contains constants for wind in rural / urban settings\n * @type {Object[]}\n * @property {number} rural\n * @property {number} urban\n */\nconst WIND_PROFILES = [\n {rural: 0.07, urban: 0.15},\n {rural: 0.07, urban: 0.15},\n {rural: 0.1, urban: 0.2},\n {rural: 0.15, urban: 0.3},\n {rural: 0.15, urban: 0.3},\n {rural: 0.35, urban: 0.3},\n {rural: 0.55, urban: 0.3}\n];\n\n/**\n * Represents the physical surroundings of a Gaussian Plume\n */\nclass Atmosphere {\n\n /**\n * Only windSpeed, _skyCover, and _solarElevation are required.\n * Temperature is required when not _setting effective source height manually\n * The default is urban daytime.\n * @param {Array|number} windSpeed - at ground level (m/s)\n * @param {number} skyCover - a percentage 0-1\n * @param {number} solarElevation - (degrees)\n * @param {number} temperature - (Kelvin)\n * @param {number} pressure - (atm)\n * @param {string} [setting=\"urban\"]\n * @param {boolean} [isNight=false] - Can change this to a Date, but should be simple enough to keep track of for the user\n * 1 hour before sunset and 1 hour past sunrise\n */\n constructor(windSpeed, skyCover, solarElevation, temperature, pressure = 1, setting = \"urban\", isNight = false) {\n /**\n * \n * @type {Vector}\n * @private\n */\n this._windSpeedVec = Array.isArray(windSpeed) ? Vector.fromArray(windSpeed) : new Vector(windSpeed);\n /**\n * \n * @type {number}\n * @private\n */\n this._skyCover = skyCover;\n /**\n * \n * @type {number}\n * @private\n */\n this._solarElevation = solarElevation;\n /**\n * \n * @type {number}\n */\n this._temp = temperature;\n /**\n * \n * @type {number}\n * @private\n */\n this._pressure = pressure;\n /**\n * \n * @type {string}\n * @private\n */\n this._setting = setting;\n /**\n * \n * @type {boolean}\n * @private\n */\n this._isNight = isNight;\n //this.grade = Atmosphere.calculateGrade(_skyCover, _solarElevation, _windSpeedVec);\n }\n\n /**\n * \n * @returns {string}\n */\n toString() {\n return \"Grade: \" + this.letterGrade +\n \" Wind at \" + this.windSpeed + \" m/s,\" +\n \" Sun at \" + this._solarElevation + \" degrees\";\n }\n\n /* Static methods: these seemed more convenient at the time so one wouldn't have\n * to build a whole Atmosphere object to calculate a grade, but now seem useless */\n\n /**\n * Helper function for grade calculation\n * @private\n * @param {number} windSpeed - m/s\n * @returns {number} index of windLevel in WIND_PROFILES\n */\n static _getWindLevel(windSpeed) {\n let level;\n if (windSpeed < 2) {\n // < 2\n level = 0;\n } else if (windSpeed < 3) {\n // 2 - 3\n level = 1;\n } else if (windSpeed < 5) {\n // 3 - 5;\n level = 2;\n } else if (windSpeed < 6) {\n // 5 - 6\n level = 3;\n } else {\n // > 6\n level = 4;\n }\n return level;\n }\n\n /**\n * Helper function for grade calculation\n * @private\n * @param {number} skyCover \n * @param {number} solarElevation \n * @returns {number} \n */\n static _getInsolationLevel(skyCover, solarElevation) {\n let insolation;\n if (skyCover <= .5) {\n if (solarElevation > 60) {\n // strong\n insolation = 0;\n } else if (solarElevation > 35) {\n // moderate\n insolation = 1;\n } else {\n // slight\n insolation = 2;\n }\n } else {\n if (solarElevation > 60) {\n // moderate\n insolation = 1;\n } else if (solarElevation > 35) {\n // slight\n insolation = 2;\n } else {\n // slight\n insolation = 2;\n }\n }\n return insolation;\n }\n\n /**\n * Calculates a grade with given parameters\n * @param {number} skyCover \n * @param {number} solarElevation \n * @param {number} windSpeed\n * @param {boolean} isNight \n * @returns {number} 0 - 6\n */\n static calculateGrade(skyCover, solarElevation, windSpeed, isNight) {\n let grade;\n let windLevel = Atmosphere._getWindLevel(windSpeed);\n if (isNight) {\n let coverLevel = skyCover > .5 ? 0 : 1; // For night, just two columns\n grade = NIGHT_GRADES[windLevel][coverLevel];\n } else {\n let insolation = Atmosphere._getInsolationLevel(skyCover, solarElevation);\n grade = DAY_GRADES[windLevel][insolation];\n }\n return grade;\n }\n \n /**\n * \n * @returns {number} 0-6\n */\n get grade() {\n return Atmosphere.calculateGrade(this.skyCover, this.solarElevation, this.windSpeed, this.isNight);\n }\n \n /**\n * The Human readable\n * @returns {string} A - F\n */\n get letterGrade() {\n return LETTER_GRADES[this.grade];\n }\n\n /**\n * \n * @param speed {number[]|number} m/s\n * @returns {Atmosphere}\n */\n setWindSpeed(speed) {\n this._windSpeedVec = Array.isArray(speed) ? Vector.fromArray(speed) : new Vector(speed);\n return this;\n }\n\n /**\n * \n * @returns {Vector|*}\n */\n get windSpeedVec() {\n return this._windSpeedVec;\n }\n \n /**\n * \n * @returns {number} m/s\n */\n get windSpeed() {\n return this.windSpeedVec.abs();\n }\n\n /**\n * The percentage of the sky is covered\n * @param {number} cover - 0 - 1\n * @returns {Atmosphere}\n */\n setSkyCover(cover) {\n this._skyCover = cover;\n return this;\n }\n\n /**\n * \n * @returns {number}\n */\n get skyCover() {\n return this._skyCover;\n }\n\n /**\n * \n * @param {number} elevation - degrees \n * @returns {Atmosphere}\n */\n setSolarElevation(elevation) {\n this._solarElevation = elevation;\n return this;\n }\n\n /**\n * \n * @returns {number} degrees\n */\n get solarElevation() {\n return this._solarElevation;\n }\n\n /**\n * \n * @param {number} temp - Kelvin\n * @returns {Atmosphere}\n */\n setTemperature(temp) {\n this._temp = temp;\n return this;\n }\n\n /**\n * \n * @returns {number|*} Kelvin\n */\n get temperature() {\n return this._temp;\n }\n\n /**\n * \n * @param pressure\n * @returns {Atmosphere}\n */\n setPressure(pressure) {\n this._pressure = pressure;\n return this;\n }\n\n /**\n * \n * @returns {number}\n */\n get pressure() {\n return this._pressure;\n }\n\n /**\n * \n * @param {string} setting - Either \"rural\" or \"urban\"\n * @returns {Atmosphere}\n */\n setSetting(setting) {\n this._setting = setting;\n return this;\n }\n\n /**\n * \n * @returns {string}\n */\n get setting() {\n return this._setting;\n }\n\n /**\n * \n * @param {boolean} isNight\n * @returns {Atmosphere}\n */\n setIsNight(isNight) {\n this._isNight = isNight;\n return this;\n }\n\n /**\n *\n * @returns {boolean|*}\n */\n get isNight() {\n return this._isNight;\n }\n \n /**\n * Adjusts wind speed to a specific height. Approximation.\n * @param {number} height - m\n * @returns {number} The approx. wind speed at a specified height above the ground (m/s)\n */\n getWindSpeedAt(height) {\n // Assumes ground wind speed was measured at 10m\n let windProfile = this._setting === 'urban' ? \n WIND_PROFILES[this.grade].urban : WIND_PROFILES[this.grade].rural;\n return this.windSpeed * Math.pow((height / 10), windProfile);\n }\n}\n\nexport default Atmosphere;" }, { "__docId__": 36, "kind": "variable", "static": true, "variation": null, "name": "LETTER_GRADES", "memberof": "src/Dispersion/Atmosphere.js", "longname": "src/Dispersion/Atmosphere.js~LETTER_GRADES", "access": null, "export": false, "importPath": "dirtybomb/src/Dispersion/Atmosphere.js", "importStyle": null, "description": "On a scale of 0 - 6\nExtremely unstable A ... DD, DN ... F Moderately Stable", "lineNumber": 13, "type": { "nullable": null, "types": [ "string[]" ], "spread": false, "description": null } }, { "__docId__": 37, "kind": "variable", "static": true, "variation": null, "name": "DAY_GRADES", "memberof": "src/Dispersion/Atmosphere.js", "longname": "src/Dispersion/Atmosphere.js~DAY_GRADES", "access": null, "export": false, "importPath": "dirtybomb/src/Dispersion/Atmosphere.js", "importStyle": null, "description": "Overcast should always receive a 3 (D)\nFrom Table. 2 on Page 9, all mid grades are rounded up.\nMaps _windSpeedVec and _skyCover to a grade\n[<2, 2-3, 3-5, 5-6, >6] then\n[strong, moderate, slight]", "lineNumber": 23, "type": { "nullable": null, "types": [ "number[][]" ], "spread": false, "description": null } }, { "__docId__": 38, "kind": "variable", "static": true, "variation": null, "name": "NIGHT_GRADES", "memberof": "src/Dispersion/Atmosphere.js", "longname": "src/Dispersion/Atmosphere.js~NIGHT_GRADES", "access": null, "export": false, "importPath": "dirtybomb/src/Dispersion/Atmosphere.js", "importStyle": null, "description": "Defined as one hour before sunset to one hour after sunrise\nNOTE: Night Grade D is DN, 4\n[_skyCover > .5, _skyCover < .5]", "lineNumber": 37, "type": { "nullable": null, "types": [ "number[][]" ], "spread": false, "description": null } }, { "__docId__": 39, "kind": "variable", "static": true, "variation": null, "name": "WIND_PROFILES", "memberof": "src/Dispersion/Atmosphere.js", "longname": "src/Dispersion/Atmosphere.js~WIND_PROFILES", "access": null, "export": false, "importPath": "dirtybomb/src/Dispersion/Atmosphere.js", "importStyle": null, "description": "Contains constants for wind in rural / urban settings", "lineNumber": 51, "properties": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "rural", "description": "" }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "urban", "description": "" } ], "type": { "nullable": null, "types": [ "Object[]" ], "spread": false, "description": null } }, { "__docId__": 40, "kind": "class", "static": true, "variation": null, "name": "Atmosphere", "memberof": "src/Dispersion/Atmosphere.js", "longname": "src/Dispersion/Atmosphere.js~Atmosphere", "access": null, "export": true, "importPath": "dirtybomb/src/Dispersion/Atmosphere.js", "importStyle": "Atmosphere", "description": "Represents the physical surroundings of a Gaussian Plume", "lineNumber": 64, "interface": false }, { "__docId__": 41, "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/Dispersion/Atmosphere.js~Atmosphere", "longname": "src/Dispersion/Atmosphere.js~Atmosphere#constructor", "access": null, "description": "Only windSpeed, _skyCover, and _solarElevation are required.\nTemperature is required when not _setting effective source height manually\nThe default is urban daytime.", "lineNumber": 79, "params": [ { "nullable": null, "types": [ "Array", "number" ], "spread": false, "optional": false, "name": "windSpeed", "description": "at ground level (m/s)" }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "skyCover", "description": "a percentage 0-1" }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "solarElevation", "description": "(degrees)" }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "temperature", "description": "(Kelvin)" }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "pressure", "description": "(atm)" }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "defaultValue": "\"urban\"", "defaultRaw": "urban", "name": "setting", "description": "" }, { "nullable": null, "types": [ "boolean" ], "spread": false, "optional": true, "defaultValue": "false", "defaultRaw": false, "name": "isNight", "description": "Can change this to a Date, but should be simple enough to keep track of for the user\n 1 hour before sunset and 1 hour past sunrise" } ], "generator": false }, { "__docId__": 42, "kind": "member", "static": false, "variation": null, "name": "_windSpeedVec", "memberof": "src/Dispersion/Atmosphere.js~Atmosphere", "longname": "src/Dispersion/Atmosphere.js~Atmosphere#_windSpeedVec", "access": "private", "description": "", "lineNumber": 85, "type": { "nullable": null, "types": [ "Vector" ], "spread": false, "description": null } }, { "__docId__": 43, "kind": "member", "static": false, "variation": null, "name": "_skyCover", "memberof": "src/Dispersion/Atmosphere.js~Atmosphere", "longname": "src/Dispersion/Atmosphere.js~Atmosphere#_skyCover", "access": "private", "description": "", "lineNumber": 91, "type": { "nullable": null, "types": [ "number" ], "spread": false, "description": null } }, { "__docId__": 44, "kind": "member", "static": false, "variation": null, "name": "_solarElevation", "memberof": "src/Dispersion/Atmosphere.js~Atmosphere", "longname": "src/Dispersion/Atmosphere.js~Atmosphere#_solarElevation", "access": "private", "description": "", "lineNumber": 97, "type": { "nullable": null, "types": [ "number" ], "spread": false, "description": null } }, { "__docId__": 45, "kind": "member", "static": false, "variation": null, "name": "_temp", "memberof": "src/Dispersion/Atmosphere.js~Atmosphere", "longname": "src/Dispersion/Atmosphere.js~Atmosphere#_temp", "access": null, "description": "", "lineNumber": 102, "type": { "nullable": null, "types": [ "number" ], "spread": false, "description": null } }, { "__docId__": 46, "kind": "member", "static": false, "variation": null, "name": "_pressure", "memberof": "src/Dispersion/Atmosphere.js~Atmosphere", "longname": "src/Dispersion/Atmosphere.js~Atmosphere#_pressure", "access": "private", "description": "", "lineNumber": 108, "type": { "nullable": null, "types": [ "number" ], "spread": false, "description": null } }, { "__docId__": 47, "kind": "member", "static": false, "variation": null, "name": "_setting", "memberof": "src/Dispersion/Atmosphere.js~Atmosphere", "longname": "src/Dispersion/Atmosphere.js~Atmosphere#_setting", "access": "private", "description": "", "lineNumber": 114, "type": { "nullable": null, "types": [ "string" ], "spread": false, "description": null } }, { "__docId__": 48, "kind": "member", "static": false, "variation": null, "name": "_isNight", "memberof": "src/Dispersion/Atmosphere.js~Atmosphere", "longname": "src/Dispersion/Atmosphere.js~Atmosphere#_isNight", "access": "private", "description": "", "lineNumber": 120, "type": { "nullable": null, "types": [ "boolean" ], "spread": false, "description": null } }, { "__docId__": 49, "kind": "method", "static": false, "variation": null, "name": "toString", "memberof": "src/Dispersion/Atmosphere.js~Atmosphere", "longname": "src/Dispersion/Atmosphere.js~Atmosphere#toString", "access": null, "description": "", "lineNumber": 128, "unknown": [ { "tagName": "@returns", "tagValue": "{string}" } ], "params": [], "return": { "nullable": null, "types": [ "string" ], "spread": false, "description": "" }, "generator": false }, { "__docId__": 50, "kind": "method", "static": true, "variation": null, "name": "_getWindLevel", "memberof": "src/Dispersion/