@dnv-plant/typescriptpws 1.0.70 → 1.0.73-alpha.1902013
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +2 -2
- package/jest.config.js +5 -0
- package/package.json +6 -6
- package/src/calculations/applicationTools.ts +2 -2
- package/src/calculations/discharge.ts +2 -2
- package/src/calculations/dispersion.ts +2 -2
- package/src/calculations/dispersionView.ts +2 -2
- package/src/calculations/fireball.ts +2 -2
- package/src/calculations/jetFire.ts +2 -2
- package/src/calculations/lateExplosion.ts +2 -2
- package/src/calculations/linkedRunners.ts +2 -2
- package/src/calculations/poolFire.ts +2 -2
- package/src/calculations/properties.ts +2 -2
- package/src/calculations/radiation.ts +2 -2
- package/src/calculations/standalones.ts +2 -2
- package/src/calculations/toxics.ts +2 -2
- package/src/calculations/utilities.ts +2 -2
- package/src/constants.ts +2 -2
- package/src/entities.ts +2 -2
- package/src/entity-schemas.ts +2 -2
- package/src/enums.ts +2 -2
- package/src/materials.ts +14 -14
- package/src/utilities.ts +2 -2
- package/tests/concentration-at-point-calculation/testCase116.test.ts +146 -0
- package/tests/concentration-at-point-calculation/testCase117.test.ts +142 -0
- package/tests/concentration-at-point-calculation/testCase118.test.ts +143 -0
- package/tests/concentration-at-point-calculation/testCase119.test.ts +149 -0
- package/tests/concentration-at-point-calculation/testCase120.test.ts +155 -0
- package/tests/constants/testConstants.test.ts +23 -0
- package/tests/convert-comp-mass-to-mole-calculation/testCase129.test.ts +74 -0
- package/tests/convert-comp-mass-to-mole-calculation/testCase130.test.ts +73 -0
- package/tests/convert-comp-mass-to-mole-calculation/testCase131.test.ts +73 -0
- package/tests/convert-comp-mass-to-mole-calculation/testCase132.test.ts +73 -0
- package/tests/convert-comp-mass-to-mole-calculation/testCase133.test.ts +73 -0
- package/tests/convert-comp-mole-to-mass-calculation/testCase134.test.ts +72 -0
- package/tests/convert-comp-mole-to-mass-calculation/testCase135.test.ts +72 -0
- package/tests/convert-comp-mole-to-mass-calculation/testCase136.test.ts +72 -0
- package/tests/convert-comp-mole-to-mass-calculation/testCase137.test.ts +72 -0
- package/tests/convert-comp-mole-to-mass-calculation/testCase138.test.ts +72 -0
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase64.test.ts +194 -0
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase65.test.ts +197 -0
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase66.test.ts +194 -0
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase67.test.ts +198 -0
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase68.test.ts +178 -0
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase31a.test.ts +158 -0
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase32a.test.ts +156 -0
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase33a.test.ts +158 -0
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase34a.test.ts +165 -0
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase35a.test.ts +188 -0
- package/tests/distances-to-conc-levels-calculation/testCase121.test.ts +149 -0
- package/tests/distances-to-conc-levels-calculation/testCase122.test.ts +145 -0
- package/tests/distances-to-conc-levels-calculation/testCase123.test.ts +150 -0
- package/tests/distances-to-conc-levels-calculation/testCase124.test.ts +154 -0
- package/tests/distances-to-conc-levels-calculation/testCase125.test.ts +157 -0
- package/tests/entities/testVessel.test.ts +49 -0
- package/tests/fireball-calculation/testCase89.test.ts +151 -0
- package/tests/fireball-calculation/testCase90.test.ts +153 -0
- package/tests/fireball-calculation/testCase91.test.ts +152 -0
- package/tests/fireball-calculation/testCse92.test.ts +150 -0
- package/tests/flash-calculation/testCase26.test.ts +71 -0
- package/tests/flash-calculation/testCase27.test.ts +69 -0
- package/tests/flash-calculation/testCase28.test.ts +69 -0
- package/tests/flash-calculation/testCase29.test.ts +67 -0
- package/tests/flash-calculation/testCase30.test.ts +70 -0
- package/tests/general/operation-id-demo.test.ts +64 -0
- package/tests/get-component-by-id/get-component-by-id-METHANE.test.ts +35 -0
- package/tests/get-mass-from-vessel-calculation/testCase139.test.ts +65 -0
- package/tests/jet-fire-calculation/testCase36.test.ts +141 -0
- package/tests/jet-fire-calculation/testCase37.test.ts +148 -0
- package/tests/jet-fire-calculation/testCase38.test.ts +147 -0
- package/tests/jet-fire-calculation/testCase39.test.ts +146 -0
- package/tests/jet-fire-calculation/testCase40.test.ts +152 -0
- package/tests/late-explosion-calculation/testCase46.test.ts +157 -0
- package/tests/late-explosion-calculation/testCase47.test.ts +149 -0
- package/tests/late-explosion-calculation/testCase48.test.ts +176 -0
- package/tests/late-explosion-calculation/testCase49.test.ts +178 -0
- package/tests/late-explosion-calculation/testCase50.test.ts +176 -0
- package/tests/late-explosion-calculation/testCase74.test.ts +166 -0
- package/tests/late-explosion-calculation/testCase75.test.ts +163 -0
- package/tests/late-explosion-calculation/testCase76.test.ts +174 -0
- package/tests/late-explosion-calculation/testCase77.test.ts +175 -0
- package/tests/late-explosion-calculation/testCase78.test.ts +175 -0
- package/tests/lethality-distance-calculation/testCase60.test.ts +142 -0
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-153.test.ts +121 -0
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-154.test.ts +167 -0
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-155.test.ts +202 -0
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-156.test.ts +201 -0
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-157.test.ts +182 -0
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-158.test.ts +200 -0
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-159.test.ts +158 -0
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-160.test.ts +165 -0
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-161.test.ts +161 -0
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-162.test.ts +167 -0
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-163.test.ts +177 -0
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-164.test.ts +165 -0
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-165.test.ts +166 -0
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-166.test.ts +154 -0
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-167.test.ts +157 -0
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-168.test.ts +168 -0
- package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase126.test.ts +72 -0
- package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase127.test.ts +73 -0
- package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase128.test.ts +72 -0
- package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase103.test.ts +74 -0
- package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase104.test.ts +75 -0
- package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase105.test.ts +74 -0
- package/tests/long-pipe-calculation/testCase55.test.ts +88 -0
- package/tests/long-pipe-calculation/testCase56.test.ts +90 -0
- package/tests/long-pipe-calculation/testCase57.test.ts +88 -0
- package/tests/long-pipe-calculation/testCase58.test.ts +88 -0
- package/tests/long-pipe-calculation/testCase59.test.ts +88 -0
- package/tests/materials/test-get-component-by-cas-id-1-2-PROPYLENE-OXIDE.test.ts +23 -0
- package/tests/materials/test-get-component-by-cas-id-CARBON-MONOXIDE.test.ts +25 -0
- package/tests/materials/test-get-component-by-cas-id-METHANE.test.ts +22 -0
- package/tests/materials/test-get-component-by-id-1-2-PROPYLENE-OXIDE.test.ts +23 -0
- package/tests/materials/test-get-component-by-id-CARBON-MONOXIDE.test.ts +22 -0
- package/tests/materials/test-get-component-by-id-METHANE.test.ts +22 -0
- package/tests/materials/test-get-component-by-name-1-2-PROPYLENE-OXIDE.test.ts +24 -0
- package/tests/materials/test-get-component-by-name-CARBON-MONOXIDE.test.ts +23 -0
- package/tests/materials/test-get-component-by-name-METHANE.test.ts +25 -0
- package/tests/materials/test-get-components.test.ts +47 -0
- package/tests/materials/test-get-dippr-components.test.ts +28 -0
- package/tests/materials/test-get-dnv-components.test.ts +28 -0
- package/tests/materials/test-get-material-by-cas-id-1-2-PROPYLENE-OXIDE.test.ts +29 -0
- package/tests/materials/test-get-material-by-cas-id-CARBON-MONOXIDE.test.ts +31 -0
- package/tests/materials/test-get-material-by-cas-id-METHANE.test.ts +30 -0
- package/tests/materials/test-get-material-by-cas-id-ZERO.test.ts +31 -0
- package/tests/materials/test-get-material-by-id-1-2-PROPYLENE-OXIDE.test.ts +30 -0
- package/tests/materials/test-get-material-by-id-CARBON-MONOXIDE.test.ts +29 -0
- package/tests/materials/test-get-material-by-id-METHANE.test.ts +29 -0
- package/tests/materials/test-get-material-by-name-1-2-PROPYLENE-OXIDE.test.ts +29 -0
- package/tests/materials/test-get-material-by-name-CARBON-MONOXIDE.test.ts +29 -0
- package/tests/materials/test-get-material-by-name-METHANE.test.ts +29 -0
- package/tests/materials/test-get-materials.test.ts +32 -0
- package/tests/max-conc-distance-calculation/testCase106.test.ts +146 -0
- package/tests/max-conc-distance-calculation/testCase107.test.ts +148 -0
- package/tests/max-conc-distance-calculation/testCase108.test.ts +172 -0
- package/tests/max-conc-distance-calculation/testCase109.test.ts +146 -0
- package/tests/max-conc-distance-calculation/testCase110.test.ts +146 -0
- package/tests/max-conc-footprint-calculation/testCase31.test.ts +169 -0
- package/tests/max-conc-footprint-calculation/testCase32.test.ts +183 -0
- package/tests/max-conc-footprint-calculation/testCase33.test.ts +161 -0
- package/tests/max-conc-footprint-calculation/testCase34.test.ts +172 -0
- package/tests/max-conc-footprint-calculation/testCase35.test.ts +188 -0
- package/tests/max-distance-to-conc-calculation/testCase111.test.ts +138 -0
- package/tests/max-distance-to-conc-calculation/testCase112.test.ts +174 -0
- package/tests/max-distance-to-conc-calculation/testCase113.test.ts +153 -0
- package/tests/max-distance-to-conc-calculation/testCase114.test.ts +162 -0
- package/tests/max-distance-to-conc-calculation/testCase115.test.ts +167 -0
- package/tests/mixture-constant-properties-calculation/testCase97.test.ts +83 -0
- package/tests/mixture-constant-properties-calculation/testCase98.test.ts +90 -0
- package/tests/mixture-constant-properties-calculation/testCase99.test.ts +87 -0
- package/tests/pool-fire-calculation/testCase41.test.ts +153 -0
- package/tests/pool-fire-calculation/testCase41a.test.ts +141 -0
- package/tests/pool-fire-calculation/testCase42.test.ts +169 -0
- package/tests/pool-fire-calculation/testCase42a.test.ts +175 -0
- package/tests/pool-fire-calculation/testCase43.test.ts +161 -0
- package/tests/pool-fire-calculation/testCase43a.test.ts +157 -0
- package/tests/pool-fire-calculation/testCase44.test.ts +147 -0
- package/tests/pool-fire-calculation/testCase44a.test.ts +152 -0
- package/tests/pool-fire-calculation/testCase45.test.ts +176 -0
- package/tests/pool-fire-calculation/testCase45a.test.ts +182 -0
- package/tests/radiation-at-ponts/testCase69.test.ts +167 -0
- package/tests/radiation-at-ponts/testCase70.test.ts +179 -0
- package/tests/radiation-at-ponts/testCase71.test.ts +150 -0
- package/tests/radiation-at-ponts/testCase72.test.ts +166 -0
- package/tests/radiation-at-ponts/testCase73.test.ts +169 -0
- package/tests/radiation-contour-calculation/testCase51.test.ts +127 -0
- package/tests/radiation-contour-calculation/testCase52.test.ts +126 -0
- package/tests/radiation-contour-calculation/testCase53.test.ts +126 -0
- package/tests/radiation-contour-calculation/testCase54.test.ts +131 -0
- package/tests/relief-valve-min-temperature-calculation/testCase140.test.ts +49 -0
- package/tests/set-mixing-layer-height/testCase100.test.ts +36 -0
- package/tests/set-mixing-layer-height/testCase101.test.ts +36 -0
- package/tests/set-mixing-layer-height/testCase102.test.ts +36 -0
- package/tests/set-phase-to-be-released-for-leak-calculation/testCase150.test.ts +67 -0
- package/tests/set-phase-to-be-released-for-line-rupture-calculation/testCase151.test.ts +67 -0
- package/tests/set-phase-to-be-released-for-relief-valve-calculation/TestCase152.test.ts +61 -0
- package/tests/sideview/testCase31b.test.ts +150 -0
- package/tests/sideview/testCase32b.test.ts +145 -0
- package/tests/sideview/testCase33b.test.ts +130 -0
- package/tests/sideview/testCase34b.test.ts +153 -0
- package/tests/sideview/testCase35b.test.ts +140 -0
- package/tests/tank-fire-calculation/testCase79.test.ts +61 -0
- package/tests/tank-fire-calculation/testCase80.test.ts +67 -0
- package/tests/tank-fire-calculation/testCase81.test.ts +68 -0
- package/tests/tank-fire-calculation/testCase82.test.ts +68 -0
- package/tests/tank-fire-calculation/testCase83.test.ts +73 -0
- package/tests/utilities/convert-camel-case-to-snake-case.test.ts +7 -0
- package/tests/utilities/convert-snake-case-to-camel-case.test.ts +7 -0
- package/tests/vessel-catastrophic-rupture-calculation/testCase1.test.ts +83 -0
- package/tests/vessel-catastrophic-rupture-calculation/testCase2.test.ts +82 -0
- package/tests/vessel-catastrophic-rupture-calculation/testCase3.test.ts +91 -0
- package/tests/vessel-catastrophic-rupture-calculation/testCase4.test.ts +85 -0
- package/tests/vessel-catastrophic-rupture-calculation/testCase5.test.ts +84 -0
- package/tests/vessel-leak-calculation/testCase10.test.ts +108 -0
- package/tests/vessel-leak-calculation/testCase6.test.ts +113 -0
- package/tests/vessel-leak-calculation/testCase7.test.ts +123 -0
- package/tests/vessel-leak-calculation/testCase8.test.ts +102 -0
- package/tests/vessel-leak-calculation/testCase9.test.ts +106 -0
- package/tests/vessel-line-rupture-calculation/vlr-ammonia.test.ts +84 -0
- package/tests/vessel-line-rupture-calculation/vlr-ethaneMethane.test.ts +82 -0
- package/tests/vessel-line-rupture-calculation/vlr-nDecane.test.ts +79 -0
- package/tests/vessel-line-rupture-calculation/vlr-oxygen.test.ts +77 -0
- package/tests/vessel-line-rupture-calculation/vlr-propane.test.ts +77 -0
- package/tests/vessel-relief-valve-calculation/vrv-chlorine.test.ts +99 -0
- package/tests/vessel-relief-valve-calculation/vrv-hydrogen.test.ts +96 -0
- package/tests/vessel-relief-valve-calculation/vrv-methane.test.ts +80 -0
- package/tests/vessel-relief-valve-calculation/vrv-methaneH2s.test.ts +86 -0
- package/tests/vessel-relief-valve-calculation/vrv-nitrogen.test.ts +80 -0
- package/tests/vessel-state-calculation/vs-ammonia.test.ts +56 -0
- package/tests/vessel-state-calculation/vs-butane.test.ts +57 -0
- package/tests/vessel-state-calculation/vs-chlorine.test.ts +56 -0
- package/tests/vessel-state-calculation/vs-methane.test.ts +57 -0
- package/tests/vessel-state-calculation/vs-naturalGas.test.ts +59 -0
- package/tests/vessel-state-calculation/vs-nitrogenPentane.test.ts +58 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { VesselLeakLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForLeakScenarioCalculation } from "../../../src/calculations/utilities";
|
|
3
|
+
import {
|
|
4
|
+
Material,
|
|
5
|
+
MaterialComponent,
|
|
6
|
+
Weather,
|
|
7
|
+
Substrate,
|
|
8
|
+
DischargeParameters,
|
|
9
|
+
FlammableParameters,
|
|
10
|
+
DispersionParameters,
|
|
11
|
+
ExplosionParameters,
|
|
12
|
+
ExplosionOutputConfig,
|
|
13
|
+
ExplosionConfinedVolume,
|
|
14
|
+
FlammableOutputConfig,
|
|
15
|
+
DispersionOutputConfig
|
|
16
|
+
} from "../../../src/entities";
|
|
17
|
+
import {
|
|
18
|
+
ResultCode,
|
|
19
|
+
AtmosphericStabilityClass,
|
|
20
|
+
SpecialConcentration,
|
|
21
|
+
WindProfileFlag,
|
|
22
|
+
MixtureModelling
|
|
23
|
+
} from "../../../src/enums";
|
|
24
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
25
|
+
|
|
26
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
27
|
+
|
|
28
|
+
if (!accessToken) {
|
|
29
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
setAccessToken(accessToken);
|
|
33
|
+
|
|
34
|
+
describe("VesselLeakLinkedRunCalculation - VLR_160", () => {
|
|
35
|
+
it("should run the calculation and validate regression outputs", async () => {
|
|
36
|
+
const material = new Material({
|
|
37
|
+
name: "CHLORINE",
|
|
38
|
+
components: [new MaterialComponent({ name: "CHLORINE", moleFraction: 1.0 })],
|
|
39
|
+
componentCount: 1
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const loadMassInventory = new LoadMassInventoryVesselForLeakScenarioCalculation(
|
|
43
|
+
material,
|
|
44
|
+
1e4,
|
|
45
|
+
6e5,
|
|
46
|
+
250,
|
|
47
|
+
0.08,
|
|
48
|
+
1.0,
|
|
49
|
+
0.0
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
console.log("Running load_mass_inventory_vessel_for_leak_scenario_calculation...");
|
|
53
|
+
const loadResultCode = await loadMassInventory.run();
|
|
54
|
+
|
|
55
|
+
if (loadMassInventory.messages.length > 0) {
|
|
56
|
+
console.log("Messages:");
|
|
57
|
+
loadMassInventory.messages.forEach((msg) => console.log(msg));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
61
|
+
|
|
62
|
+
if (loadResultCode === ResultCode.SUCCESS) {
|
|
63
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_leak_scenario_calculation (${loadMassInventory.calculationElapsedTime}ms)`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const weather = new Weather({
|
|
67
|
+
windSpeed: 5.0,
|
|
68
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_D,
|
|
69
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const substrate = new Substrate();
|
|
73
|
+
|
|
74
|
+
const dispersionParameters = [
|
|
75
|
+
new DispersionParameters({ averagingTime: 600.0 }),
|
|
76
|
+
new DispersionParameters({ averagingTime: 18.75 })
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
const dispersionOutputConfigsFlammable = [
|
|
80
|
+
new DispersionOutputConfig({
|
|
81
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
82
|
+
elevation: 0.0
|
|
83
|
+
})
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const dispersionOutputConfigsToxic = [
|
|
87
|
+
new DispersionOutputConfig({
|
|
88
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
89
|
+
concentration: 5e-5,
|
|
90
|
+
elevation: 0.0
|
|
91
|
+
})
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
const flammableParameters = new FlammableParameters();
|
|
95
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
96
|
+
|
|
97
|
+
const explosionParameters = new ExplosionParameters();
|
|
98
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
99
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
100
|
+
|
|
101
|
+
const vessel = loadMassInventory.vessel!;
|
|
102
|
+
vessel.state!.mixtureModelling = MixtureModelling.MC_MULTIPLE_AEROSOL;
|
|
103
|
+
|
|
104
|
+
const linkedCalc = new VesselLeakLinkedRunCalculation(
|
|
105
|
+
vessel,
|
|
106
|
+
loadMassInventory.leak!,
|
|
107
|
+
new DischargeParameters(),
|
|
108
|
+
substrate,
|
|
109
|
+
weather,
|
|
110
|
+
dispersionParameters,
|
|
111
|
+
dispersionParameters.length,
|
|
112
|
+
0.0,
|
|
113
|
+
flammableParameters,
|
|
114
|
+
explosionParameters,
|
|
115
|
+
dispersionOutputConfigsFlammable,
|
|
116
|
+
dispersionOutputConfigsFlammable.length,
|
|
117
|
+
dispersionOutputConfigsToxic,
|
|
118
|
+
dispersionOutputConfigsToxic.length,
|
|
119
|
+
flammableOutputConfigs,
|
|
120
|
+
flammableOutputConfigs.length,
|
|
121
|
+
explosionOutputConfigs,
|
|
122
|
+
explosionOutputConfigs.length,
|
|
123
|
+
explosionConfinedVolumes,
|
|
124
|
+
explosionConfinedVolumes.length
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
console.log("Running vessel_leak_linked_run_calculation...");
|
|
128
|
+
const resultCode = await linkedCalc.run();
|
|
129
|
+
|
|
130
|
+
if (linkedCalc.messages.length > 0) {
|
|
131
|
+
console.log("Messages:");
|
|
132
|
+
linkedCalc.messages.forEach((msg) => console.log(msg));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
136
|
+
|
|
137
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
138
|
+
expect(Math.abs(linkedCalc.dischargeRecord!.massFlow! - 121.95136629549849) / 121.95136629549849).toBeLessThan(1e-3);
|
|
139
|
+
expect(linkedCalc.jetFireFlameResult!.flameLength!).toBe(0.0);
|
|
140
|
+
expect(linkedCalc.poolFireFlameResult!.flameDiameter!).toBe(0.0);
|
|
141
|
+
expect(linkedCalc.flamConcContourPoints!.length).toBe(0);
|
|
142
|
+
expect(linkedCalc.toxicConcContourPoints!.length).toBe(665);
|
|
143
|
+
expect(linkedCalc.areaFootprintFlamConc![0]).toBe(0.0);
|
|
144
|
+
expect(Math.abs(linkedCalc.areaFootprintToxicConc![0] - 688622.679542524) / 688622.679542524).toBeLessThan(1e-3);
|
|
145
|
+
expect(linkedCalc.areaContourJet![0]).toBe(0.0);
|
|
146
|
+
expect(linkedCalc.areaContourPool![0]).toBe(0.0);
|
|
147
|
+
expect(linkedCalc.explosionOverpressureResults![0].explodedMass!).toBe(0.0);
|
|
148
|
+
expect(linkedCalc.explosionOverpressureResults![0].maximumDistance!).toBe(0.0);
|
|
149
|
+
|
|
150
|
+
console.log(`Mass flow = ${linkedCalc.dischargeRecord!.massFlow}`);
|
|
151
|
+
console.log(`Flame length = ${linkedCalc.jetFireFlameResult!.flameLength}`);
|
|
152
|
+
console.log(`Flame diameter = ${linkedCalc.poolFireFlameResult!.flameDiameter}`);
|
|
153
|
+
console.log(`Length of the dispersion flammable contour array = ${linkedCalc.flamConcContourPoints!.length}`);
|
|
154
|
+
console.log(`Length of the dispersion toxic contour array = ${linkedCalc.toxicConcContourPoints!.length}`);
|
|
155
|
+
console.log(`Area of the flammable cloud = ${linkedCalc.areaFootprintFlamConc![0]}`);
|
|
156
|
+
console.log(`Area of the toxic cloud = ${linkedCalc.areaFootprintToxicConc![0]}`);
|
|
157
|
+
console.log(`Area of the jet fire = ${linkedCalc.areaContourJet![0]}`);
|
|
158
|
+
console.log(`Area of the pool = ${linkedCalc.areaContourPool![0]}`);
|
|
159
|
+
console.log(`Flammable mass = ${linkedCalc.explosionOverpressureResults![0].explodedMass}`);
|
|
160
|
+
console.log(`Explosion maximum distance = ${linkedCalc.explosionOverpressureResults![0].maximumDistance}`);
|
|
161
|
+
|
|
162
|
+
console.log(`SUCCESS: vessel_leak_linked_run_calculation (${linkedCalc.calculationElapsedTime}ms)`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { VesselLineRuptureLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForLineRuptureScenarioCalculation } from "../../../src/calculations/utilities";
|
|
3
|
+
import {
|
|
4
|
+
Material,
|
|
5
|
+
MaterialComponent,
|
|
6
|
+
Weather,
|
|
7
|
+
Substrate,
|
|
8
|
+
DischargeParameters,
|
|
9
|
+
FlammableParameters,
|
|
10
|
+
DispersionParameters,
|
|
11
|
+
ExplosionParameters,
|
|
12
|
+
ExplosionOutputConfig,
|
|
13
|
+
ExplosionConfinedVolume,
|
|
14
|
+
FlammableOutputConfig,
|
|
15
|
+
DispersionOutputConfig,
|
|
16
|
+
} from "../../../src/entities";
|
|
17
|
+
import {
|
|
18
|
+
ResultCode,
|
|
19
|
+
AtmosphericStabilityClass,
|
|
20
|
+
SpecialConcentration,
|
|
21
|
+
WindProfileFlag,
|
|
22
|
+
} from "../../../src/enums";
|
|
23
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
24
|
+
|
|
25
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
26
|
+
|
|
27
|
+
if (!accessToken) {
|
|
28
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setAccessToken(accessToken);
|
|
32
|
+
|
|
33
|
+
describe("VesselLineRuptureLinkedRunCalculation - VLR_161", () => {
|
|
34
|
+
it("should run the calculation and validate regression outputs", async () => {
|
|
35
|
+
// Define the material
|
|
36
|
+
const material = new Material({
|
|
37
|
+
name: "AMMONIA",
|
|
38
|
+
components: [new MaterialComponent({ name: "AMMONIA", moleFraction: 1.0 })],
|
|
39
|
+
componentCount: 1,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Create the line rupture scenario calculation
|
|
43
|
+
const loadCalc = new LoadMassInventoryVesselForLineRuptureScenarioCalculation(
|
|
44
|
+
material,
|
|
45
|
+
1e3,
|
|
46
|
+
11e5,
|
|
47
|
+
250,
|
|
48
|
+
0.5,
|
|
49
|
+
10.0,
|
|
50
|
+
1.0,
|
|
51
|
+
0.35
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
console.log("Running load_mass_inventory_vessel_for_line_rupture_scenario_calculation...");
|
|
55
|
+
const loadResultCode = await loadCalc.run();
|
|
56
|
+
|
|
57
|
+
if (loadCalc.messages.length > 0) {
|
|
58
|
+
console.log("Messages:");
|
|
59
|
+
loadCalc.messages.forEach((msg) => console.log(msg));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
63
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_line_rupture_scenario_calculation (${loadCalc.calculationElapsedTime}ms)`);
|
|
64
|
+
|
|
65
|
+
// Define weather and substrate
|
|
66
|
+
const weather = new Weather({
|
|
67
|
+
windSpeed: 5.0,
|
|
68
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_B,
|
|
69
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const substrate = new Substrate();
|
|
73
|
+
|
|
74
|
+
const dispersionParams = [
|
|
75
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
76
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
const dispersionOutputConfigsFlammable = [
|
|
80
|
+
new DispersionOutputConfig({
|
|
81
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
82
|
+
elevation: 0.0,
|
|
83
|
+
}),
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const dispersionOutputConfigsToxic = [
|
|
87
|
+
new DispersionOutputConfig({
|
|
88
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
89
|
+
concentration: 5e-5,
|
|
90
|
+
elevation: 0.0,
|
|
91
|
+
}),
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
const flammableParameters = new FlammableParameters();
|
|
95
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
96
|
+
|
|
97
|
+
const explosionParameters = new ExplosionParameters();
|
|
98
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
99
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
100
|
+
|
|
101
|
+
const ruptureCalc = new VesselLineRuptureLinkedRunCalculation(
|
|
102
|
+
loadCalc.vessel!,
|
|
103
|
+
loadCalc.lineRupture!,
|
|
104
|
+
new DischargeParameters(),
|
|
105
|
+
substrate,
|
|
106
|
+
weather,
|
|
107
|
+
dispersionParams,
|
|
108
|
+
dispersionParams.length,
|
|
109
|
+
0.0,
|
|
110
|
+
flammableParameters,
|
|
111
|
+
explosionParameters,
|
|
112
|
+
dispersionOutputConfigsFlammable,
|
|
113
|
+
dispersionOutputConfigsFlammable.length,
|
|
114
|
+
dispersionOutputConfigsToxic,
|
|
115
|
+
dispersionOutputConfigsToxic.length,
|
|
116
|
+
flammableOutputConfigs,
|
|
117
|
+
flammableOutputConfigs.length,
|
|
118
|
+
explosionOutputConfigs,
|
|
119
|
+
explosionOutputConfigs.length,
|
|
120
|
+
explosionConfinedVolumes,
|
|
121
|
+
explosionConfinedVolumes.length
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
console.log("Running vessel_line_rupture_linked_run_calculation...");
|
|
125
|
+
const resultCode = await ruptureCalc.run();
|
|
126
|
+
|
|
127
|
+
if (ruptureCalc.messages.length > 0) {
|
|
128
|
+
console.log("Messages:");
|
|
129
|
+
ruptureCalc.messages.forEach((msg) => console.log(msg));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
133
|
+
|
|
134
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
135
|
+
expect(Math.abs(ruptureCalc.dischargeRecord!.massFlow! - 4854.025293797943) / 4854.025293797943).toBeLessThan(1e-3);
|
|
136
|
+
expect(Math.abs(ruptureCalc.jetFireFlameResult!.flameLength! - 662.3022367949528) / 662.3022367949528).toBeLessThan(1e-3);
|
|
137
|
+
expect(Math.abs(ruptureCalc.poolFireFlameResult!.flameDiameter! - 12.537047386169434) / 12.537047386169434).toBeLessThan(1e-3);
|
|
138
|
+
expect(ruptureCalc.flamConcContourPoints!.length).toBe(0);
|
|
139
|
+
expect(ruptureCalc.toxicConcContourPoints!.length).toBe(708);
|
|
140
|
+
expect(ruptureCalc.areaFootprintFlamConc![0]).toBe(0.0);
|
|
141
|
+
expect(Math.abs(ruptureCalc.areaFootprintToxicConc![0] - 818151.5234553284) / 818151.5234553284).toBeLessThan(1e-3);
|
|
142
|
+
expect(Math.abs(ruptureCalc.areaContourJet![0] - 873022.314841369) / 873022.314841369).toBeLessThan(1e-3);
|
|
143
|
+
expect(Math.abs(ruptureCalc.areaContourPool![0] - 604.0546926186413) / 604.0546926186413).toBeLessThan(1e-3);
|
|
144
|
+
expect(Math.abs(ruptureCalc.explosionOverpressureResults![0].explodedMass! - 468.4280045824483) / 468.4280045824483).toBeLessThan(1e-3);
|
|
145
|
+
expect(Math.abs(ruptureCalc.explosionOverpressureResults![0].maximumDistance! - 340.816800123033) / 340.816800123033).toBeLessThan(1e-3);
|
|
146
|
+
|
|
147
|
+
console.log(`Mass flow = ${ruptureCalc.dischargeRecord!.massFlow}`);
|
|
148
|
+
console.log(`Flame length = ${ruptureCalc.jetFireFlameResult!.flameLength}`);
|
|
149
|
+
console.log(`Flame diameter = ${ruptureCalc.poolFireFlameResult!.flameDiameter}`);
|
|
150
|
+
console.log(`Flam contour length = ${ruptureCalc.flamConcContourPoints!.length}`);
|
|
151
|
+
console.log(`Toxic contour length = ${ruptureCalc.toxicConcContourPoints!.length}`);
|
|
152
|
+
console.log(`Flam area = ${ruptureCalc.areaFootprintFlamConc![0]}`);
|
|
153
|
+
console.log(`Toxic area = ${ruptureCalc.areaFootprintToxicConc![0]}`);
|
|
154
|
+
console.log(`Jet area = ${ruptureCalc.areaContourJet![0]}`);
|
|
155
|
+
console.log(`Pool area = ${ruptureCalc.areaContourPool![0]}`);
|
|
156
|
+
console.log(`Exploded mass = ${ruptureCalc.explosionOverpressureResults![0].explodedMass}`);
|
|
157
|
+
console.log(`Explosion max distance = ${ruptureCalc.explosionOverpressureResults![0].maximumDistance}`);
|
|
158
|
+
console.log(`SUCCESS: vessel_line_rupture_linked_run_calculation (${ruptureCalc.calculationElapsedTime}ms)`);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
});
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { VesselLineRuptureLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForLineRuptureScenarioCalculation } from "../../../src/calculations/utilities";
|
|
3
|
+
import {
|
|
4
|
+
Material,
|
|
5
|
+
MaterialComponent,
|
|
6
|
+
Weather,
|
|
7
|
+
Substrate,
|
|
8
|
+
DischargeParameters,
|
|
9
|
+
FlammableParameters,
|
|
10
|
+
ExplosionParameters,
|
|
11
|
+
ExplosionConfinedVolume,
|
|
12
|
+
DispersionParameters,
|
|
13
|
+
DispersionOutputConfig,
|
|
14
|
+
FlammableOutputConfig,
|
|
15
|
+
ExplosionOutputConfig,
|
|
16
|
+
} from "../../../src/entities";
|
|
17
|
+
import {
|
|
18
|
+
AtmosphericStabilityClass,
|
|
19
|
+
WindProfileFlag,
|
|
20
|
+
SpecialConcentration,
|
|
21
|
+
ResultCode,
|
|
22
|
+
} from "../../../src/enums";
|
|
23
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
24
|
+
|
|
25
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
26
|
+
|
|
27
|
+
if (!accessToken) {
|
|
28
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setAccessToken(accessToken);
|
|
32
|
+
|
|
33
|
+
describe("VesselLineRuptureLinkedRunCalculation - VLR_162", () => {
|
|
34
|
+
it("should run and validate regression outputs for methane/ethane mix", async () => {
|
|
35
|
+
const material = new Material({
|
|
36
|
+
name: "METHANE+ETHANE",
|
|
37
|
+
components: [
|
|
38
|
+
new MaterialComponent({ name: "METHANE", moleFraction: 0.9 }),
|
|
39
|
+
new MaterialComponent({ name: "ETHANE", moleFraction: 0.1 }),
|
|
40
|
+
],
|
|
41
|
+
componentCount: 2,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const loadCalc = new LoadMassInventoryVesselForLineRuptureScenarioCalculation(
|
|
45
|
+
material,
|
|
46
|
+
1e5, // mass
|
|
47
|
+
11e5, // pressure
|
|
48
|
+
250, // temperature
|
|
49
|
+
0.5, // pipe diameter
|
|
50
|
+
10.0, // pipe length
|
|
51
|
+
100.0, // release elevation
|
|
52
|
+
0.0 // release angle
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
console.log("Running load_mass_inventory_vessel_for_line_rupture_scenario_calculation...");
|
|
56
|
+
const loadResultCode = await loadCalc.run();
|
|
57
|
+
|
|
58
|
+
if (loadCalc.messages.length > 0) {
|
|
59
|
+
console.log("Messages:");
|
|
60
|
+
loadCalc.messages.forEach((msg) => console.log(msg));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
64
|
+
expect(Math.abs(loadCalc.vessel!.diameter! - 27.049130317992706) / 27.049130317992706).toBeLessThan(1e-3);
|
|
65
|
+
expect(Math.abs(loadCalc.vessel!.location!.z! - 86.47543484100365) / 86.47543484100365).toBeLessThan(1e-3);
|
|
66
|
+
expect(Math.abs(loadCalc.lineRupture!.pipeDiameter! - 0.5) / 0.5).toBeLessThan(1e-3);
|
|
67
|
+
expect(Math.abs(loadCalc.lineRupture!.pipeHeightFraction! - 0.5) / 0.5).toBeLessThan(1e-3);
|
|
68
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_line_rupture_scenario_calculation (${loadCalc.calculationElapsedTime}ms)`);
|
|
69
|
+
|
|
70
|
+
const weather = new Weather({
|
|
71
|
+
windSpeed: 1.5,
|
|
72
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_F,
|
|
73
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const substrate = new Substrate();
|
|
77
|
+
|
|
78
|
+
const dispersionParams = [
|
|
79
|
+
new DispersionParameters({ averagingTime: 18.75, lflFractionToStop: 0.2 }),
|
|
80
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
const dispersionOutputConfigsFlammable = [
|
|
84
|
+
new DispersionOutputConfig({
|
|
85
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
86
|
+
elevation: 100.0,
|
|
87
|
+
lflFractionValue: 0.2,
|
|
88
|
+
}),
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
const dispersionOutputConfigsToxic = [
|
|
92
|
+
new DispersionOutputConfig({
|
|
93
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
94
|
+
concentration: 5e-5,
|
|
95
|
+
elevation: 0.0,
|
|
96
|
+
}),
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
const flammableParameters = new FlammableParameters();
|
|
100
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
101
|
+
|
|
102
|
+
const explosionParameters = new ExplosionParameters();
|
|
103
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
104
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
105
|
+
|
|
106
|
+
const ruptureCalc = new VesselLineRuptureLinkedRunCalculation(
|
|
107
|
+
loadCalc.vessel!,
|
|
108
|
+
loadCalc.lineRupture!,
|
|
109
|
+
new DischargeParameters(),
|
|
110
|
+
substrate,
|
|
111
|
+
weather,
|
|
112
|
+
dispersionParams,
|
|
113
|
+
dispersionParams.length,
|
|
114
|
+
0.0,
|
|
115
|
+
flammableParameters,
|
|
116
|
+
explosionParameters,
|
|
117
|
+
dispersionOutputConfigsFlammable,
|
|
118
|
+
dispersionOutputConfigsFlammable.length,
|
|
119
|
+
dispersionOutputConfigsToxic,
|
|
120
|
+
dispersionOutputConfigsToxic.length,
|
|
121
|
+
flammableOutputConfigs,
|
|
122
|
+
flammableOutputConfigs.length,
|
|
123
|
+
explosionOutputConfigs,
|
|
124
|
+
explosionOutputConfigs.length,
|
|
125
|
+
explosionConfinedVolumes,
|
|
126
|
+
explosionConfinedVolumes.length
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
console.log("Running vessel_line_rupture_linked_run_calculation...");
|
|
130
|
+
const resultCode = await ruptureCalc.run();
|
|
131
|
+
|
|
132
|
+
if (ruptureCalc.messages.length > 0) {
|
|
133
|
+
console.log("Messages:");
|
|
134
|
+
ruptureCalc.messages.forEach((msg) => console.log(msg));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
138
|
+
|
|
139
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
140
|
+
expect(Math.abs(ruptureCalc.dischargeRecord!.massFlow! - 369.13836776138595) / 369.13836776138595).toBeLessThan(1e-3);
|
|
141
|
+
expect(Math.abs(ruptureCalc.jetFireFlameResult!.flameLength! - 132.810385487078) / 132.810385487078).toBeLessThan(1e-3);
|
|
142
|
+
expect(ruptureCalc.poolFireFlameResult!.flameDiameter!).toBe(0.0);
|
|
143
|
+
expect(ruptureCalc.flamConcContourPoints!.length).toBe(597);
|
|
144
|
+
expect(ruptureCalc.toxicConcContourPoints!.length).toBe(873);
|
|
145
|
+
expect(Math.abs(ruptureCalc.areaFootprintFlamConc![0] - 16798.58475657922) / 16798.58475657922).toBeLessThan(1e-3);
|
|
146
|
+
expect(Math.abs(ruptureCalc.areaFootprintToxicConc![0] - 21559290.626672193) / 21559290.626672193).toBeLessThan(1e-3);
|
|
147
|
+
expect(Math.abs(ruptureCalc.areaContourJet![0] - 57212.96926113445) / 57212.96926113445).toBeLessThan(1e-3);
|
|
148
|
+
expect(ruptureCalc.areaContourPool![0]).toBe(0.0);
|
|
149
|
+
expect(Math.abs(ruptureCalc.explosionOverpressureResults![0].explodedMass! - 411.4357378379431) / 411.4357378379431).toBeLessThan(1e-3);
|
|
150
|
+
expect(Math.abs(ruptureCalc.explosionOverpressureResults![0].maximumDistance! - 593.064103906056) / 593.064103906056).toBeLessThan(1e-3);
|
|
151
|
+
|
|
152
|
+
console.log(`Mass flow = ${ruptureCalc.dischargeRecord!.massFlow}`);
|
|
153
|
+
console.log(`Flame length = ${ruptureCalc.jetFireFlameResult!.flameLength}`);
|
|
154
|
+
console.log(`Flame diameter = ${ruptureCalc.poolFireFlameResult!.flameDiameter}`);
|
|
155
|
+
console.log(`Flam contour length = ${ruptureCalc.flamConcContourPoints!.length}`);
|
|
156
|
+
console.log(`Toxic contour length = ${ruptureCalc.toxicConcContourPoints!.length}`);
|
|
157
|
+
console.log(`Flam area = ${ruptureCalc.areaFootprintFlamConc![0]}`);
|
|
158
|
+
console.log(`Toxic area = ${ruptureCalc.areaFootprintToxicConc![0]}`);
|
|
159
|
+
console.log(`Jet area = ${ruptureCalc.areaContourJet![0]}`);
|
|
160
|
+
console.log(`Pool area = ${ruptureCalc.areaContourPool![0]}`);
|
|
161
|
+
console.log(`Exploded mass = ${ruptureCalc.explosionOverpressureResults![0].explodedMass}`);
|
|
162
|
+
console.log(`Explosion max distance = ${ruptureCalc.explosionOverpressureResults![0].maximumDistance}`);
|
|
163
|
+
console.log(`SUCCESS: vessel_line_rupture_linked_run_calculation (${ruptureCalc.calculationElapsedTime}ms)`);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { VesselLineRuptureLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForLineRuptureScenarioCalculation } from "../../../src/calculations/utilities";
|
|
3
|
+
import {
|
|
4
|
+
Material,
|
|
5
|
+
MaterialComponent,
|
|
6
|
+
Substrate,
|
|
7
|
+
Bund,
|
|
8
|
+
Weather,
|
|
9
|
+
DispersionParameters,
|
|
10
|
+
DispersionOutputConfig,
|
|
11
|
+
FlammableParameters,
|
|
12
|
+
FlammableOutputConfig,
|
|
13
|
+
ExplosionParameters,
|
|
14
|
+
ExplosionOutputConfig,
|
|
15
|
+
ExplosionConfinedVolume,
|
|
16
|
+
DischargeParameters,
|
|
17
|
+
} from "../../../src/entities";
|
|
18
|
+
import {
|
|
19
|
+
ResultCode,
|
|
20
|
+
AtmosphericStabilityClass,
|
|
21
|
+
WindProfileFlag,
|
|
22
|
+
SpecialConcentration,
|
|
23
|
+
} from "../../../src/enums";
|
|
24
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
25
|
+
|
|
26
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
27
|
+
if (!accessToken) {
|
|
28
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
29
|
+
}
|
|
30
|
+
setAccessToken(accessToken);
|
|
31
|
+
|
|
32
|
+
describe("VesselLineRuptureLinkedRunCalculation - VLR_163", () => {
|
|
33
|
+
it("should match expected outputs for N-HEXANE scenario", async () => {
|
|
34
|
+
const material = new Material({
|
|
35
|
+
name: "N-HEXANE",
|
|
36
|
+
components: [new MaterialComponent({ name: "N-HEXANE", moleFraction: 1.0 })],
|
|
37
|
+
componentCount: 1,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const loadCalc = new LoadMassInventoryVesselForLineRuptureScenarioCalculation(
|
|
41
|
+
material,
|
|
42
|
+
9876,
|
|
43
|
+
7e5,
|
|
44
|
+
250,
|
|
45
|
+
0.1,
|
|
46
|
+
7.5,
|
|
47
|
+
0.0,
|
|
48
|
+
0.0
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
console.log("Running load_mass_inventory_vessel_for_line_rupture_scenario_calculation...");
|
|
52
|
+
const loadResultCode = await loadCalc.run();
|
|
53
|
+
|
|
54
|
+
if (loadCalc.messages.length > 0) {
|
|
55
|
+
console.log("Messages:");
|
|
56
|
+
loadCalc.messages.forEach((msg) => console.log(msg));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
60
|
+
|
|
61
|
+
if (loadResultCode === ResultCode.SUCCESS) {
|
|
62
|
+
expect(Math.abs(loadCalc.vessel!.diameter! - 3.0323298714998153) / 3.0323298714998153).toBeLessThan(1e-3);
|
|
63
|
+
expect(Math.abs(loadCalc.vessel!.location!.z! + 2.7170445294165657) / 2.7170445294165657).toBeLessThan(1e-3);
|
|
64
|
+
expect(Math.abs(loadCalc.lineRupture!.pipeDiameter! - 0.1) / 0.1).toBeLessThan(1e-3);
|
|
65
|
+
expect(Math.abs(loadCalc.lineRupture!.pipeHeightFraction! - 0.8960253813259087) / 0.8960253813259087).toBeLessThan(1e-3);
|
|
66
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_line_rupture_scenario_calculation (${loadCalc.calculationElapsedTime}ms)`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const weather = new Weather({
|
|
70
|
+
windSpeed: 2.0,
|
|
71
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_CD,
|
|
72
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const substrate = new Substrate({
|
|
76
|
+
bund: new Bund({
|
|
77
|
+
specifyBund: true,
|
|
78
|
+
bundHeight: 2.0,
|
|
79
|
+
bundDiameter: 20.0,
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const dispersionParams = [
|
|
84
|
+
new DispersionParameters({
|
|
85
|
+
averagingTime: 18.75,
|
|
86
|
+
lflFractionToStop: 0.15,
|
|
87
|
+
}),
|
|
88
|
+
new DispersionParameters({
|
|
89
|
+
averagingTime: 18.75,
|
|
90
|
+
}),
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
const dispersionOutputConfigsFlammable = [
|
|
94
|
+
new DispersionOutputConfig({
|
|
95
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
96
|
+
lflFractionValue: 0.15,
|
|
97
|
+
elevation: 0.0,
|
|
98
|
+
}),
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
const dispersionOutputConfigsToxic = [
|
|
102
|
+
new DispersionOutputConfig({
|
|
103
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
104
|
+
concentration: 5e-5,
|
|
105
|
+
elevation: 0.0,
|
|
106
|
+
}),
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
const flammableParameters = new FlammableParameters();
|
|
110
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
111
|
+
|
|
112
|
+
const explosionParameters = new ExplosionParameters();
|
|
113
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
114
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
115
|
+
|
|
116
|
+
const ruptureCalc = new VesselLineRuptureLinkedRunCalculation(
|
|
117
|
+
loadCalc.vessel!,
|
|
118
|
+
loadCalc.lineRupture!,
|
|
119
|
+
new DischargeParameters(),
|
|
120
|
+
substrate,
|
|
121
|
+
weather,
|
|
122
|
+
dispersionParams,
|
|
123
|
+
dispersionParams.length,
|
|
124
|
+
0.0,
|
|
125
|
+
flammableParameters,
|
|
126
|
+
explosionParameters,
|
|
127
|
+
dispersionOutputConfigsFlammable,
|
|
128
|
+
dispersionOutputConfigsFlammable.length,
|
|
129
|
+
dispersionOutputConfigsToxic,
|
|
130
|
+
dispersionOutputConfigsToxic.length,
|
|
131
|
+
flammableOutputConfigs,
|
|
132
|
+
flammableOutputConfigs.length,
|
|
133
|
+
explosionOutputConfigs,
|
|
134
|
+
explosionOutputConfigs.length,
|
|
135
|
+
explosionConfinedVolumes,
|
|
136
|
+
explosionConfinedVolumes.length
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
console.log("Running vessel_line_rupture_linked_run_calculation...");
|
|
140
|
+
const resultCode = await ruptureCalc.run();
|
|
141
|
+
|
|
142
|
+
if (ruptureCalc.messages.length > 0) {
|
|
143
|
+
console.log("Messages:");
|
|
144
|
+
ruptureCalc.messages.forEach((msg) => console.log(msg));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
148
|
+
|
|
149
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
150
|
+
expect(Math.abs(ruptureCalc.dischargeRecord!.massFlow! - 131.73664600034286) / 131.73664600034286).toBeLessThan(1e-3);
|
|
151
|
+
expect(ruptureCalc.jetFireFlameResult!.flameLength!).toBe(0.0);
|
|
152
|
+
expect(Math.abs(ruptureCalc.poolFireFlameResult!.flameDiameter! - 20.00299644470215) / 20.00299644470215).toBeLessThan(1e-3);
|
|
153
|
+
expect(ruptureCalc.flamConcContourPoints!.length).toBe(563);
|
|
154
|
+
expect(ruptureCalc.toxicConcContourPoints!.length).toBe(623);
|
|
155
|
+
expect(Math.abs(ruptureCalc.areaFootprintFlamConc![0] - 585.0061568126835) / 585.0061568126835).toBeLessThan(1e-3);
|
|
156
|
+
expect(Math.abs(ruptureCalc.areaFootprintToxicConc![0] - 12934.3464614692) / 12934.3464614692).toBeLessThan(1e-3);
|
|
157
|
+
expect(ruptureCalc.areaContourJet![0]).toBe(0.0);
|
|
158
|
+
expect(Math.abs(ruptureCalc.areaContourPool![0] - 4498.14606654948) / 4498.14606654948).toBeLessThan(1e-3);
|
|
159
|
+
expect(ruptureCalc.explosionOverpressureResults![0].explodedMass!).toBe(0.0);
|
|
160
|
+
expect(ruptureCalc.explosionOverpressureResults![0].maximumDistance!).toBe(0.0);
|
|
161
|
+
|
|
162
|
+
console.log(`Mass flow = ${ruptureCalc.dischargeRecord!.massFlow}`);
|
|
163
|
+
console.log(`Flame length = ${ruptureCalc.jetFireFlameResult!.flameLength}`);
|
|
164
|
+
console.log(`Flame diameter = ${ruptureCalc.poolFireFlameResult!.flameDiameter}`);
|
|
165
|
+
console.log(`Flam contour length = ${ruptureCalc.flamConcContourPoints!.length}`);
|
|
166
|
+
console.log(`Toxic contour length = ${ruptureCalc.toxicConcContourPoints!.length}`);
|
|
167
|
+
console.log(`Flam area = ${ruptureCalc.areaFootprintFlamConc![0]}`);
|
|
168
|
+
console.log(`Toxic area = ${ruptureCalc.areaFootprintToxicConc![0]}`);
|
|
169
|
+
console.log(`Jet area = ${ruptureCalc.areaContourJet![0]}`);
|
|
170
|
+
console.log(`Pool area = ${ruptureCalc.areaContourPool![0]}`);
|
|
171
|
+
console.log(`Exploded mass = ${ruptureCalc.explosionOverpressureResults![0].explodedMass}`);
|
|
172
|
+
console.log(`Explosion max distance = ${ruptureCalc.explosionOverpressureResults![0].maximumDistance}`);
|
|
173
|
+
console.log(`SUCCESS: vessel_line_rupture_linked_run_calculation (${ruptureCalc.calculationElapsedTime}ms)`);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|