@dnv-plant/typescriptpws 1.0.73-alpha.1902078 → 1.0.73-alpha.1902319
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/package.json +1 -1
- package/azure-pipelines-veracode.yml +0 -38
- package/jest.config.js +0 -5
- package/tests/concentration-at-point-calculation/testCase116.test.ts +0 -146
- package/tests/concentration-at-point-calculation/testCase117.test.ts +0 -142
- package/tests/concentration-at-point-calculation/testCase118.test.ts +0 -143
- package/tests/concentration-at-point-calculation/testCase119.test.ts +0 -149
- package/tests/concentration-at-point-calculation/testCase120.test.ts +0 -155
- package/tests/constants/testConstants.test.ts +0 -23
- package/tests/convert-comp-mass-to-mole-calculation/testCase129.test.ts +0 -74
- package/tests/convert-comp-mass-to-mole-calculation/testCase130.test.ts +0 -73
- package/tests/convert-comp-mass-to-mole-calculation/testCase131.test.ts +0 -73
- package/tests/convert-comp-mass-to-mole-calculation/testCase132.test.ts +0 -73
- package/tests/convert-comp-mass-to-mole-calculation/testCase133.test.ts +0 -73
- package/tests/convert-comp-mole-to-mass-calculation/testCase134.test.ts +0 -72
- package/tests/convert-comp-mole-to-mass-calculation/testCase135.test.ts +0 -72
- package/tests/convert-comp-mole-to-mass-calculation/testCase136.test.ts +0 -72
- package/tests/convert-comp-mole-to-mass-calculation/testCase137.test.ts +0 -72
- package/tests/convert-comp-mole-to-mass-calculation/testCase138.test.ts +0 -72
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase64.test.ts +0 -194
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase65.test.ts +0 -197
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase66.test.ts +0 -194
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase67.test.ts +0 -198
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase68.test.ts +0 -178
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase31a.test.ts +0 -158
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase32a.test.ts +0 -156
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase33a.test.ts +0 -158
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase34a.test.ts +0 -165
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase35a.test.ts +0 -188
- package/tests/distances-to-conc-levels-calculation/testCase121.test.ts +0 -149
- package/tests/distances-to-conc-levels-calculation/testCase122.test.ts +0 -145
- package/tests/distances-to-conc-levels-calculation/testCase123.test.ts +0 -150
- package/tests/distances-to-conc-levels-calculation/testCase124.test.ts +0 -154
- package/tests/distances-to-conc-levels-calculation/testCase125.test.ts +0 -157
- package/tests/entities/testVessel.test.ts +0 -49
- package/tests/fireball-calculation/testCase89.test.ts +0 -151
- package/tests/fireball-calculation/testCase90.test.ts +0 -153
- package/tests/fireball-calculation/testCase91.test.ts +0 -152
- package/tests/fireball-calculation/testCse92.test.ts +0 -150
- package/tests/flash-calculation/testCase26.test.ts +0 -71
- package/tests/flash-calculation/testCase27.test.ts +0 -69
- package/tests/flash-calculation/testCase28.test.ts +0 -69
- package/tests/flash-calculation/testCase29.test.ts +0 -67
- package/tests/flash-calculation/testCase30.test.ts +0 -70
- package/tests/general/operation-id-demo.test.ts +0 -64
- package/tests/get-component-by-id/get-component-by-id-METHANE.test.ts +0 -35
- package/tests/get-mass-from-vessel-calculation/testCase139.test.ts +0 -65
- package/tests/jet-fire-calculation/testCase36.test.ts +0 -141
- package/tests/jet-fire-calculation/testCase37.test.ts +0 -148
- package/tests/jet-fire-calculation/testCase38.test.ts +0 -147
- package/tests/jet-fire-calculation/testCase39.test.ts +0 -146
- package/tests/jet-fire-calculation/testCase40.test.ts +0 -152
- package/tests/late-explosion-calculation/testCase46.test.ts +0 -157
- package/tests/late-explosion-calculation/testCase47.test.ts +0 -149
- package/tests/late-explosion-calculation/testCase48.test.ts +0 -176
- package/tests/late-explosion-calculation/testCase49.test.ts +0 -178
- package/tests/late-explosion-calculation/testCase50.test.ts +0 -176
- package/tests/late-explosion-calculation/testCase74.test.ts +0 -166
- package/tests/late-explosion-calculation/testCase75.test.ts +0 -163
- package/tests/late-explosion-calculation/testCase76.test.ts +0 -174
- package/tests/late-explosion-calculation/testCase77.test.ts +0 -175
- package/tests/late-explosion-calculation/testCase78.test.ts +0 -175
- package/tests/lethality-distance-calculation/testCase60.test.ts +0 -142
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-153.test.ts +0 -121
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-154.test.ts +0 -167
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-155.test.ts +0 -202
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-156.test.ts +0 -201
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-157.test.ts +0 -182
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-158.test.ts +0 -200
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-159.test.ts +0 -158
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-160.test.ts +0 -165
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-161.test.ts +0 -161
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-162.test.ts +0 -167
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-163.test.ts +0 -177
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-164.test.ts +0 -165
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-165.test.ts +0 -166
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-166.test.ts +0 -154
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-167.test.ts +0 -157
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-168.test.ts +0 -168
- package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase126.test.ts +0 -72
- package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase127.test.ts +0 -73
- package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase128.test.ts +0 -72
- package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase103.test.ts +0 -74
- package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase104.test.ts +0 -75
- package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase105.test.ts +0 -74
- package/tests/long-pipe-calculation/testCase55.test.ts +0 -88
- package/tests/long-pipe-calculation/testCase56.test.ts +0 -90
- package/tests/long-pipe-calculation/testCase57.test.ts +0 -88
- package/tests/long-pipe-calculation/testCase58.test.ts +0 -88
- package/tests/long-pipe-calculation/testCase59.test.ts +0 -88
- package/tests/materials/test-get-component-by-cas-id-1-2-PROPYLENE-OXIDE.test.ts +0 -23
- package/tests/materials/test-get-component-by-cas-id-CARBON-MONOXIDE.test.ts +0 -25
- package/tests/materials/test-get-component-by-cas-id-METHANE.test.ts +0 -22
- package/tests/materials/test-get-component-by-id-1-2-PROPYLENE-OXIDE.test.ts +0 -23
- package/tests/materials/test-get-component-by-id-CARBON-MONOXIDE.test.ts +0 -22
- package/tests/materials/test-get-component-by-id-METHANE.test.ts +0 -22
- package/tests/materials/test-get-component-by-name-1-2-PROPYLENE-OXIDE.test.ts +0 -24
- package/tests/materials/test-get-component-by-name-CARBON-MONOXIDE.test.ts +0 -23
- package/tests/materials/test-get-component-by-name-METHANE.test.ts +0 -25
- package/tests/materials/test-get-components.test.ts +0 -47
- package/tests/materials/test-get-dippr-components.test.ts +0 -28
- package/tests/materials/test-get-dnv-components.test.ts +0 -28
- package/tests/materials/test-get-material-by-cas-id-1-2-PROPYLENE-OXIDE.test.ts +0 -29
- package/tests/materials/test-get-material-by-cas-id-CARBON-MONOXIDE.test.ts +0 -31
- package/tests/materials/test-get-material-by-cas-id-METHANE.test.ts +0 -30
- package/tests/materials/test-get-material-by-cas-id-ZERO.test.ts +0 -31
- package/tests/materials/test-get-material-by-id-1-2-PROPYLENE-OXIDE.test.ts +0 -30
- package/tests/materials/test-get-material-by-id-CARBON-MONOXIDE.test.ts +0 -29
- package/tests/materials/test-get-material-by-id-METHANE.test.ts +0 -29
- package/tests/materials/test-get-material-by-name-1-2-PROPYLENE-OXIDE.test.ts +0 -29
- package/tests/materials/test-get-material-by-name-CARBON-MONOXIDE.test.ts +0 -29
- package/tests/materials/test-get-material-by-name-METHANE.test.ts +0 -29
- package/tests/materials/test-get-materials.test.ts +0 -32
- package/tests/max-conc-distance-calculation/testCase106.test.ts +0 -146
- package/tests/max-conc-distance-calculation/testCase107.test.ts +0 -148
- package/tests/max-conc-distance-calculation/testCase108.test.ts +0 -172
- package/tests/max-conc-distance-calculation/testCase109.test.ts +0 -146
- package/tests/max-conc-distance-calculation/testCase110.test.ts +0 -146
- package/tests/max-conc-footprint-calculation/testCase31.test.ts +0 -169
- package/tests/max-conc-footprint-calculation/testCase32.test.ts +0 -183
- package/tests/max-conc-footprint-calculation/testCase33.test.ts +0 -161
- package/tests/max-conc-footprint-calculation/testCase34.test.ts +0 -172
- package/tests/max-conc-footprint-calculation/testCase35.test.ts +0 -188
- package/tests/max-distance-to-conc-calculation/testCase111.test.ts +0 -138
- package/tests/max-distance-to-conc-calculation/testCase112.test.ts +0 -174
- package/tests/max-distance-to-conc-calculation/testCase113.test.ts +0 -153
- package/tests/max-distance-to-conc-calculation/testCase114.test.ts +0 -162
- package/tests/max-distance-to-conc-calculation/testCase115.test.ts +0 -167
- package/tests/mixture-constant-properties-calculation/testCase97.test.ts +0 -83
- package/tests/mixture-constant-properties-calculation/testCase98.test.ts +0 -90
- package/tests/mixture-constant-properties-calculation/testCase99.test.ts +0 -87
- package/tests/pool-fire-calculation/testCase41.test.ts +0 -153
- package/tests/pool-fire-calculation/testCase41a.test.ts +0 -141
- package/tests/pool-fire-calculation/testCase42.test.ts +0 -169
- package/tests/pool-fire-calculation/testCase42a.test.ts +0 -175
- package/tests/pool-fire-calculation/testCase43.test.ts +0 -161
- package/tests/pool-fire-calculation/testCase43a.test.ts +0 -157
- package/tests/pool-fire-calculation/testCase44.test.ts +0 -147
- package/tests/pool-fire-calculation/testCase44a.test.ts +0 -152
- package/tests/pool-fire-calculation/testCase45.test.ts +0 -176
- package/tests/pool-fire-calculation/testCase45a.test.ts +0 -182
- package/tests/radiation-at-ponts/testCase69.test.ts +0 -167
- package/tests/radiation-at-ponts/testCase70.test.ts +0 -179
- package/tests/radiation-at-ponts/testCase71.test.ts +0 -150
- package/tests/radiation-at-ponts/testCase72.test.ts +0 -166
- package/tests/radiation-at-ponts/testCase73.test.ts +0 -169
- package/tests/radiation-contour-calculation/testCase51.test.ts +0 -127
- package/tests/radiation-contour-calculation/testCase52.test.ts +0 -126
- package/tests/radiation-contour-calculation/testCase53.test.ts +0 -126
- package/tests/radiation-contour-calculation/testCase54.test.ts +0 -131
- package/tests/relief-valve-min-temperature-calculation/testCase140.test.ts +0 -49
- package/tests/set-mixing-layer-height/testCase100.test.ts +0 -36
- package/tests/set-mixing-layer-height/testCase101.test.ts +0 -36
- package/tests/set-mixing-layer-height/testCase102.test.ts +0 -36
- package/tests/set-phase-to-be-released-for-leak-calculation/testCase150.test.ts +0 -67
- package/tests/set-phase-to-be-released-for-line-rupture-calculation/testCase151.test.ts +0 -67
- package/tests/set-phase-to-be-released-for-relief-valve-calculation/TestCase152.test.ts +0 -61
- package/tests/sideview/testCase31b.test.ts +0 -150
- package/tests/sideview/testCase32b.test.ts +0 -145
- package/tests/sideview/testCase33b.test.ts +0 -130
- package/tests/sideview/testCase34b.test.ts +0 -153
- package/tests/sideview/testCase35b.test.ts +0 -140
- package/tests/tank-fire-calculation/testCase79.test.ts +0 -61
- package/tests/tank-fire-calculation/testCase80.test.ts +0 -67
- package/tests/tank-fire-calculation/testCase81.test.ts +0 -68
- package/tests/tank-fire-calculation/testCase82.test.ts +0 -68
- package/tests/tank-fire-calculation/testCase83.test.ts +0 -73
- package/tests/utilities/convert-camel-case-to-snake-case.test.ts +0 -7
- package/tests/utilities/convert-snake-case-to-camel-case.test.ts +0 -7
- package/tests/vessel-catastrophic-rupture-calculation/testCase1.test.ts +0 -83
- package/tests/vessel-catastrophic-rupture-calculation/testCase2.test.ts +0 -82
- package/tests/vessel-catastrophic-rupture-calculation/testCase3.test.ts +0 -91
- package/tests/vessel-catastrophic-rupture-calculation/testCase4.test.ts +0 -85
- package/tests/vessel-catastrophic-rupture-calculation/testCase5.test.ts +0 -84
- package/tests/vessel-leak-calculation/testCase10.test.ts +0 -108
- package/tests/vessel-leak-calculation/testCase6.test.ts +0 -113
- package/tests/vessel-leak-calculation/testCase7.test.ts +0 -123
- package/tests/vessel-leak-calculation/testCase8.test.ts +0 -102
- package/tests/vessel-leak-calculation/testCase9.test.ts +0 -106
- package/tests/vessel-line-rupture-calculation/vlr-ammonia.test.ts +0 -84
- package/tests/vessel-line-rupture-calculation/vlr-ethaneMethane.test.ts +0 -82
- package/tests/vessel-line-rupture-calculation/vlr-nDecane.test.ts +0 -79
- package/tests/vessel-line-rupture-calculation/vlr-oxygen.test.ts +0 -77
- package/tests/vessel-line-rupture-calculation/vlr-propane.test.ts +0 -77
- package/tests/vessel-relief-valve-calculation/vrv-chlorine.test.ts +0 -99
- package/tests/vessel-relief-valve-calculation/vrv-hydrogen.test.ts +0 -96
- package/tests/vessel-relief-valve-calculation/vrv-methane.test.ts +0 -80
- package/tests/vessel-relief-valve-calculation/vrv-methaneH2s.test.ts +0 -86
- package/tests/vessel-relief-valve-calculation/vrv-nitrogen.test.ts +0 -80
- package/tests/vessel-state-calculation/vs-ammonia.test.ts +0 -56
- package/tests/vessel-state-calculation/vs-butane.test.ts +0 -57
- package/tests/vessel-state-calculation/vs-chlorine.test.ts +0 -56
- package/tests/vessel-state-calculation/vs-methane.test.ts +0 -57
- package/tests/vessel-state-calculation/vs-naturalGas.test.ts +0 -59
- package/tests/vessel-state-calculation/vs-nitrogenPentane.test.ts +0 -58
package/package.json
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
trigger:
|
|
2
|
-
batch: true
|
|
3
|
-
branches:
|
|
4
|
-
include:
|
|
5
|
-
- main
|
|
6
|
-
schedules:
|
|
7
|
-
- cron: '0 4 * * 5'
|
|
8
|
-
displayName: 'Weekly Friday 4 AM Run'
|
|
9
|
-
always: true
|
|
10
|
-
branches:
|
|
11
|
-
include:
|
|
12
|
-
- main
|
|
13
|
-
pool:
|
|
14
|
-
vmImage: ubuntu-latest
|
|
15
|
-
stages:
|
|
16
|
-
- stage: Veracode
|
|
17
|
-
jobs:
|
|
18
|
-
- job: 'Veracode_Scan'
|
|
19
|
-
steps:
|
|
20
|
-
- task: ArchiveFiles@2
|
|
21
|
-
inputs:
|
|
22
|
-
rootFolderOrFile: .
|
|
23
|
-
includeRootFolder: true
|
|
24
|
-
archiveType: 'zip'
|
|
25
|
-
archiveFile: '$(Build.ArtifactStagingDirectory)/src.zip'
|
|
26
|
-
replaceExistingArchive: true
|
|
27
|
-
- task: Veracode@3
|
|
28
|
-
inputs:
|
|
29
|
-
ConnectionDetailsSelection: 'Endpoint'
|
|
30
|
-
AnalysisService: 'Veracode'
|
|
31
|
-
veracodeAppProfile: 'PWS Clients - TypeScript PWS'
|
|
32
|
-
version: '$(Build.BuildNumber)'
|
|
33
|
-
filepath: '$(Build.ArtifactStagingDirectory)/src.zip'
|
|
34
|
-
failBuildIfUploadAndScanBuildStepFails: true
|
|
35
|
-
importResults: true
|
|
36
|
-
failBuildOnPolicyFail: false
|
|
37
|
-
maximumWaitTime: '30'
|
|
38
|
-
createProfile: true
|
package/jest.config.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import {VesselCatastrophicRuptureCalculation, VesselStateCalculation } from "../../src/calculations/discharge";
|
|
2
|
-
import { ConcentrationAtPointCalculation } from "../../src/calculations/dispersionView";
|
|
3
|
-
import { DispersionCalculation } from "../../src/calculations/dispersion";
|
|
4
|
-
import { Bund, DischargeParameters, DispersionOutputConfig, DispersionParameters, Material, MaterialComponent, State, Substrate, Vessel, Weather} from "../../src/entities";
|
|
5
|
-
import { AtmosphericStabilityClass, ResultCode, SurfaceType, VesselShape, WindProfileFlag } from "../../src/enums";
|
|
6
|
-
import { setAccessToken } from "../../src/utilities";
|
|
7
|
-
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
8
|
-
|
|
9
|
-
if (!accessToken) {
|
|
10
|
-
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
setAccessToken(accessToken);
|
|
14
|
-
|
|
15
|
-
describe('Test Case 116', () => {
|
|
16
|
-
test('Concentration at point calculation for ETHANE, BUTANE, and PROPANE', async () => {
|
|
17
|
-
|
|
18
|
-
// Define the material and its components
|
|
19
|
-
const material = new Material({
|
|
20
|
-
name: "ETHANE_BUTANE_PROPANE",
|
|
21
|
-
components: [
|
|
22
|
-
new MaterialComponent({ name: "ETHANE", moleFraction: 0.5 }),
|
|
23
|
-
new MaterialComponent({ name: "N-BUTANE", moleFraction: 0.3 }),
|
|
24
|
-
new MaterialComponent({ name: "PROPANE", moleFraction: 0.2 })
|
|
25
|
-
],
|
|
26
|
-
componentCount: 3
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// Define the state of the vessel
|
|
30
|
-
const state = new State({
|
|
31
|
-
temperature: 265.0,
|
|
32
|
-
pressure: 5.0e5,
|
|
33
|
-
liquidFraction: 0.8
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// Define the surface type and related parameters
|
|
37
|
-
const surfaceType = SurfaceType.LAND;
|
|
38
|
-
const surfaceRoughness = 0.2;
|
|
39
|
-
const windSpeed = 5.0;
|
|
40
|
-
const stabilityClass = AtmosphericStabilityClass.STABILITY_A_;
|
|
41
|
-
const endPointConcentration = 0.0;
|
|
42
|
-
const specifyBund = true;
|
|
43
|
-
const bundHeight = 1.0;
|
|
44
|
-
const bundDiameter = 8.0;
|
|
45
|
-
const windProfileFlag = WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
46
|
-
|
|
47
|
-
// Create a vessel state calculation using the material and state
|
|
48
|
-
const vesselStateCalculation = new VesselStateCalculation(material, state);
|
|
49
|
-
const vesselStateResultCode = await vesselStateCalculation.run();
|
|
50
|
-
|
|
51
|
-
// Check the result of vessel state calculation
|
|
52
|
-
expect(vesselStateResultCode).toBe(ResultCode.SUCCESS);
|
|
53
|
-
console.log(`SUCCESS: vessel_state_calculation (${vesselStateCalculation.calculationElapsedTime}ms)`);
|
|
54
|
-
console.log(`VesselConditions = ${vesselStateCalculation.vesselConditions}`);
|
|
55
|
-
|
|
56
|
-
// Create a vessel for the catastrophic rupture calculation
|
|
57
|
-
const vessel = new Vessel({
|
|
58
|
-
state: vesselStateCalculation.outputState!,
|
|
59
|
-
material: vesselStateCalculation.material,
|
|
60
|
-
liquidFillFractionByVolume: 0.8,
|
|
61
|
-
shape: VesselShape.VERTICAL_CYLINDER,
|
|
62
|
-
vesselConditions: vesselStateCalculation.vesselConditions
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const dischargeParameters = new DischargeParameters();
|
|
66
|
-
const vesselCatastrophicRuptureCalculation = new VesselCatastrophicRuptureCalculation(vessel, dischargeParameters);
|
|
67
|
-
const ruptureResultCode = await vesselCatastrophicRuptureCalculation.run();
|
|
68
|
-
|
|
69
|
-
// Check the result of vessel catastrophic rupture calculation
|
|
70
|
-
expect(ruptureResultCode).toBe(ResultCode.SUCCESS);
|
|
71
|
-
console.log(`SUCCESS: vessel_catastrophic_rupture_calculation (${vesselCatastrophicRuptureCalculation.calculationElapsedTime}ms)`);
|
|
72
|
-
console.log(`Length of discharge records = ${vesselCatastrophicRuptureCalculation.dischargeRecords!.length}`);
|
|
73
|
-
console.log(`Mass released = ${vesselCatastrophicRuptureCalculation.dischargeResult!.releaseMass}`);
|
|
74
|
-
console.log(`End of discharge = ${vesselCatastrophicRuptureCalculation.dischargeRecords![vesselCatastrophicRuptureCalculation.dischargeRecords!.length - 1].time}`);
|
|
75
|
-
|
|
76
|
-
// Set up entities for the dispersion calculation
|
|
77
|
-
const bund = new Bund({
|
|
78
|
-
specifyBund: specifyBund,
|
|
79
|
-
bundHeight: bundHeight,
|
|
80
|
-
bundDiameter: bundDiameter
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
const substrate = new Substrate({
|
|
84
|
-
bund: bund,
|
|
85
|
-
surfaceType: surfaceType,
|
|
86
|
-
surfaceRoughness: surfaceRoughness
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const weather = new Weather({
|
|
90
|
-
windSpeed: windSpeed,
|
|
91
|
-
stabilityClass: stabilityClass,
|
|
92
|
-
windProfileFlag: windProfileFlag
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const dispersionParameters = new DispersionParameters();
|
|
96
|
-
const dispersionCalculation = new DispersionCalculation(
|
|
97
|
-
vesselCatastrophicRuptureCalculation.exitMaterial!,
|
|
98
|
-
substrate,
|
|
99
|
-
vesselCatastrophicRuptureCalculation.dischargeResult!,
|
|
100
|
-
vesselCatastrophicRuptureCalculation.dischargeRecords!,
|
|
101
|
-
vesselCatastrophicRuptureCalculation.dischargeRecords!.length,
|
|
102
|
-
weather,
|
|
103
|
-
dispersionParameters,
|
|
104
|
-
endPointConcentration
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
const dispersionResultCode = await dispersionCalculation.run();
|
|
108
|
-
|
|
109
|
-
// Check the result of the dispersion calculation
|
|
110
|
-
expect(dispersionResultCode).toBe(ResultCode.SUCCESS);
|
|
111
|
-
console.log(`SUCCESS: dispersion_calculation (${dispersionCalculation.calculationElapsedTime}ms)`);
|
|
112
|
-
console.log(`Length of dispersion records = ${dispersionCalculation.dispersionRecords!.length}`);
|
|
113
|
-
console.log(`Minimum concentration = ${dispersionCalculation.scalarUdmOutputs!.minimumConcentration}`);
|
|
114
|
-
console.log(`Observer count = ${dispersionCalculation.scalarUdmOutputs!.observerCount}`);
|
|
115
|
-
console.log(`Final centreline concentration = ${dispersionCalculation.dispersionRecords![dispersionCalculation.dispersionRecords!.length - 1].centrelineConcentration}`);
|
|
116
|
-
console.log(`Final downwind distance = ${dispersionCalculation.dispersionRecords![dispersionCalculation.dispersionRecords!.length - 1].downwindDistance}`);
|
|
117
|
-
|
|
118
|
-
// Set up the entities for concentration at point calculation
|
|
119
|
-
const dispersionOutputConfig = new DispersionOutputConfig({
|
|
120
|
-
concentration: endPointConcentration,
|
|
121
|
-
downwindDistance: 10,
|
|
122
|
-
elevation: 1,
|
|
123
|
-
time: 2
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
const concentrationAtPointCalculation = new ConcentrationAtPointCalculation(
|
|
127
|
-
dispersionCalculation.scalarUdmOutputs!,
|
|
128
|
-
weather,
|
|
129
|
-
dispersionCalculation.dispersionRecords!,
|
|
130
|
-
dispersionCalculation.dispersionRecords!.length,
|
|
131
|
-
substrate,
|
|
132
|
-
dispersionOutputConfig,
|
|
133
|
-
vesselCatastrophicRuptureCalculation.exitMaterial!,
|
|
134
|
-
dispersionParameters
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
const concentrationResultCode = await concentrationAtPointCalculation.run();
|
|
138
|
-
|
|
139
|
-
// Check the result of concentration at point calculation
|
|
140
|
-
expect(concentrationResultCode).toBe(ResultCode.SUCCESS);
|
|
141
|
-
|
|
142
|
-
const expectedConcentration = 0.01953923028190563;
|
|
143
|
-
expect(Math.abs(concentrationAtPointCalculation.concentration! - expectedConcentration) / expectedConcentration).toBeLessThan(1e-3);
|
|
144
|
-
console.log(`SUCCESS: concentration_at_point_calculation (${concentrationAtPointCalculation.calculationElapsedTime}ms)`);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { VesselCatastrophicRuptureCalculation, VesselStateCalculation } from "../../src/calculations/discharge";
|
|
2
|
-
import { ConcentrationAtPointCalculation } from "../../src/calculations/dispersionView";
|
|
3
|
-
import { DispersionCalculation } from "../../src/calculations/dispersion";
|
|
4
|
-
import { Bund, DischargeParameters, DispersionOutputConfig, DispersionParameters, Material, MaterialComponent, State, Substrate, Vessel, Weather } from "../../src/entities";
|
|
5
|
-
import { AtmosphericStabilityClass, ResultCode, SurfaceType, VesselShape, WindProfileFlag } from "../../src/enums";
|
|
6
|
-
import { setAccessToken } from "../../src/utilities";
|
|
7
|
-
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
8
|
-
|
|
9
|
-
if (!accessToken) {
|
|
10
|
-
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
setAccessToken(accessToken);
|
|
14
|
-
|
|
15
|
-
describe('Test Case 117', () => {
|
|
16
|
-
test('Concentration at point calculation for HEXANE', async () => {
|
|
17
|
-
|
|
18
|
-
// Define the material and its components
|
|
19
|
-
const material = new Material({
|
|
20
|
-
name: "HEXANE",
|
|
21
|
-
components: [new MaterialComponent({ name: "N-HEXANE", moleFraction: 1.0 })],
|
|
22
|
-
componentCount: 1
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Define the state of the vessel
|
|
26
|
-
const state = new State({
|
|
27
|
-
temperature: 280.0,
|
|
28
|
-
pressure: 2.0e5,
|
|
29
|
-
liquidFraction: 0.8
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// Define the surface type and related parameters
|
|
33
|
-
const surfaceType = SurfaceType.WATER;
|
|
34
|
-
const surfaceRoughness = 0.05;
|
|
35
|
-
const windSpeed = 2.0;
|
|
36
|
-
const stabilityClass = AtmosphericStabilityClass.STABILITY_F;
|
|
37
|
-
const endPointConcentration = 0.0;
|
|
38
|
-
const specifyBund = true;
|
|
39
|
-
const bundHeight = 1.0;
|
|
40
|
-
const bundDiameter = 8.0;
|
|
41
|
-
const windProfileFlag = WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
42
|
-
|
|
43
|
-
// Create a vessel state calculation using the material and state
|
|
44
|
-
const vesselStateCalculation = new VesselStateCalculation(material, state);
|
|
45
|
-
const vesselStateResultCode = await vesselStateCalculation.run();
|
|
46
|
-
|
|
47
|
-
// Check the result of vessel state calculation
|
|
48
|
-
expect(vesselStateResultCode).toBe(ResultCode.SUCCESS);
|
|
49
|
-
console.log(`SUCCESS: vessel_state_calculation (${vesselStateCalculation.calculationElapsedTime}ms)`);
|
|
50
|
-
console.log(`VesselConditions = ${vesselStateCalculation.vesselConditions}`);
|
|
51
|
-
|
|
52
|
-
// Create a vessel for the catastrophic rupture calculation
|
|
53
|
-
const vessel = new Vessel({
|
|
54
|
-
state: vesselStateCalculation.outputState!,
|
|
55
|
-
material: vesselStateCalculation.material,
|
|
56
|
-
liquidFillFractionByVolume: 0.8,
|
|
57
|
-
shape: VesselShape.VERTICAL_CYLINDER,
|
|
58
|
-
vesselConditions: vesselStateCalculation.vesselConditions
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const dischargeParameters = new DischargeParameters();
|
|
62
|
-
const vesselCatastrophicRuptureCalculation = new VesselCatastrophicRuptureCalculation(vessel, dischargeParameters);
|
|
63
|
-
const ruptureResultCode = await vesselCatastrophicRuptureCalculation.run();
|
|
64
|
-
|
|
65
|
-
// Check the result of vessel catastrophic rupture calculation
|
|
66
|
-
expect(ruptureResultCode).toBe(ResultCode.SUCCESS);
|
|
67
|
-
console.log(`SUCCESS: vessel_catastrophic_rupture_calculation (${vesselCatastrophicRuptureCalculation.calculationElapsedTime}ms)`);
|
|
68
|
-
console.log(`Length of discharge records = ${vesselCatastrophicRuptureCalculation.dischargeRecords!.length}`);
|
|
69
|
-
console.log(`Mass released = ${vesselCatastrophicRuptureCalculation.dischargeResult!.releaseMass}`);
|
|
70
|
-
console.log(`End of discharge = ${vesselCatastrophicRuptureCalculation.dischargeRecords![vesselCatastrophicRuptureCalculation.dischargeRecords!.length - 1].time}`);
|
|
71
|
-
|
|
72
|
-
// Set up entities for the dispersion calculation
|
|
73
|
-
const bund = new Bund({
|
|
74
|
-
specifyBund: specifyBund,
|
|
75
|
-
bundHeight: bundHeight,
|
|
76
|
-
bundDiameter: bundDiameter
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const substrate = new Substrate({
|
|
80
|
-
bund: bund,
|
|
81
|
-
surfaceType: surfaceType,
|
|
82
|
-
surfaceRoughness: surfaceRoughness
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const weather = new Weather({
|
|
86
|
-
windSpeed: windSpeed,
|
|
87
|
-
stabilityClass: stabilityClass,
|
|
88
|
-
windProfileFlag: windProfileFlag
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const dispersionParameters = new DispersionParameters();
|
|
92
|
-
const dispersionCalculation = new DispersionCalculation(
|
|
93
|
-
vesselCatastrophicRuptureCalculation.exitMaterial!,
|
|
94
|
-
substrate,
|
|
95
|
-
vesselCatastrophicRuptureCalculation.dischargeResult!,
|
|
96
|
-
vesselCatastrophicRuptureCalculation.dischargeRecords!,
|
|
97
|
-
vesselCatastrophicRuptureCalculation.dischargeRecords!.length,
|
|
98
|
-
weather,
|
|
99
|
-
dispersionParameters,
|
|
100
|
-
endPointConcentration
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
const dispersionResultCode = await dispersionCalculation.run();
|
|
104
|
-
|
|
105
|
-
// Check the result of the dispersion calculation
|
|
106
|
-
expect(dispersionResultCode).toBe(ResultCode.SUCCESS);
|
|
107
|
-
console.log(`SUCCESS: dispersion_calculation (${dispersionCalculation.calculationElapsedTime}ms)`);
|
|
108
|
-
console.log(`Length of dispersion records = ${dispersionCalculation.dispersionRecords!.length}`);
|
|
109
|
-
console.log(`Minimum concentration = ${dispersionCalculation.scalarUdmOutputs!.minimumConcentration}`);
|
|
110
|
-
console.log(`Observer count = ${dispersionCalculation.scalarUdmOutputs!.observerCount}`);
|
|
111
|
-
console.log(`Final centreline concentration = ${dispersionCalculation.dispersionRecords![dispersionCalculation.dispersionRecords!.length - 1].centrelineConcentration}`);
|
|
112
|
-
console.log(`Final downwind distance = ${dispersionCalculation.dispersionRecords![dispersionCalculation.dispersionRecords!.length - 1].downwindDistance}`);
|
|
113
|
-
|
|
114
|
-
// Set up the entities for concentration at point calculation
|
|
115
|
-
const dispersionOutputConfig = new DispersionOutputConfig({
|
|
116
|
-
concentration: endPointConcentration,
|
|
117
|
-
downwindDistance: 0,
|
|
118
|
-
elevation: 1,
|
|
119
|
-
time: 0.1
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const concentrationAtPointCalculation = new ConcentrationAtPointCalculation(
|
|
123
|
-
dispersionCalculation.scalarUdmOutputs!,
|
|
124
|
-
weather,
|
|
125
|
-
dispersionCalculation.dispersionRecords!,
|
|
126
|
-
dispersionCalculation.dispersionRecords!.length,
|
|
127
|
-
substrate,
|
|
128
|
-
dispersionOutputConfig,
|
|
129
|
-
vesselCatastrophicRuptureCalculation.exitMaterial!,
|
|
130
|
-
dispersionParameters
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
const concentrationResultCode = await concentrationAtPointCalculation.run();
|
|
134
|
-
|
|
135
|
-
// Check the result of concentration at point calculation
|
|
136
|
-
expect(concentrationResultCode).toBe(ResultCode.SUCCESS);
|
|
137
|
-
|
|
138
|
-
const expectedConcentration = 0.7320545904622022;
|
|
139
|
-
expect(Math.abs(concentrationAtPointCalculation.concentration! - expectedConcentration) / expectedConcentration).toBeLessThan(1e-3);
|
|
140
|
-
console.log(`SUCCESS: concentration_at_point_calculation (${concentrationAtPointCalculation.calculationElapsedTime}ms)`);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { VesselLeakCalculation, VesselStateCalculation } from "../../src/calculations/discharge";
|
|
2
|
-
import { ConcentrationAtPointCalculation } from "../../src/calculations/dispersionView";
|
|
3
|
-
import { DispersionCalculation } from "../../src/calculations/dispersion";
|
|
4
|
-
import { Bund, DischargeParameters, DispersionOutputConfig, DispersionParameters, Material, MaterialComponent, State, Substrate, Vessel, Weather, Leak } from "../../src/entities";
|
|
5
|
-
import { AtmosphericStabilityClass, ResultCode, SurfaceType, TimeVaryingOption, VesselShape, WindProfileFlag } from "../../src/enums";
|
|
6
|
-
import { setAccessToken } from "../../src/utilities";
|
|
7
|
-
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
8
|
-
|
|
9
|
-
if (!accessToken) {
|
|
10
|
-
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
setAccessToken(accessToken);
|
|
14
|
-
|
|
15
|
-
describe('Test Case 118', () => {
|
|
16
|
-
test('Concentration at point calculation for CARBON DIOXIDE (TOXIC)', async () => {
|
|
17
|
-
|
|
18
|
-
// Set the case properties
|
|
19
|
-
const materialName = 'CARBON DIOXIDE (TOXIC)';
|
|
20
|
-
const stateTemperature = 280.0;
|
|
21
|
-
const statePressure = 8.0e6;
|
|
22
|
-
const vesselShape = VesselShape.VESSEL_SPHERE;
|
|
23
|
-
const vesselDiameter = 5.0;
|
|
24
|
-
const leakHoleDiameter = 0.008;
|
|
25
|
-
const timeVaryingOption = TimeVaryingOption.INITIAL_RATE;
|
|
26
|
-
const leakHoleHeightFraction = 0.5;
|
|
27
|
-
const surfaceType = SurfaceType.WATER;
|
|
28
|
-
const surfaceRoughness = 0.01;
|
|
29
|
-
const windSpeed = 4.0;
|
|
30
|
-
const stabilityClass = AtmosphericStabilityClass.STABILITY_C;
|
|
31
|
-
const endPointConcentration = 0.0;
|
|
32
|
-
const windProfileFlag = WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
33
|
-
|
|
34
|
-
// Define the initial state of the vessel
|
|
35
|
-
const state = new State({
|
|
36
|
-
temperature: stateTemperature,
|
|
37
|
-
pressure: statePressure,
|
|
38
|
-
liquidFraction: 0.0
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Define the material contained by the vessel
|
|
42
|
-
const material = new Material(
|
|
43
|
-
{
|
|
44
|
-
name: materialName,
|
|
45
|
-
components: [new MaterialComponent({name:materialName, moleFraction: 1.0})]
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Create a vessel state calculation using the material and state
|
|
49
|
-
const vesselStateCalculation = new VesselStateCalculation(material, state);
|
|
50
|
-
const vesselStateResultCode = await vesselStateCalculation.run();
|
|
51
|
-
|
|
52
|
-
// Check the result of vessel state calculation
|
|
53
|
-
expect(vesselStateResultCode).toBe(ResultCode.SUCCESS);
|
|
54
|
-
console.log(`SUCCESS: vessel_state_calculation (${vesselStateCalculation.calculationElapsedTime}ms)`);
|
|
55
|
-
|
|
56
|
-
// Create a vessel for the leak calculation using the previously defined entities
|
|
57
|
-
const vessel = new Vessel({
|
|
58
|
-
state: vesselStateCalculation.outputState!,
|
|
59
|
-
material: vesselStateCalculation.material,
|
|
60
|
-
vesselConditions: vesselStateCalculation.vesselConditions,
|
|
61
|
-
diameter: vesselDiameter,
|
|
62
|
-
shape: vesselShape,
|
|
63
|
-
liquidFillFractionByVolume: 0.8
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// Create a leak for the vessel leak calculation
|
|
67
|
-
const leak = new Leak({
|
|
68
|
-
holeDiameter: leakHoleDiameter,
|
|
69
|
-
holeHeightFraction: leakHoleHeightFraction,
|
|
70
|
-
timeVaryingOption: timeVaryingOption
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// Create discharge parameters for the leak calculation
|
|
74
|
-
const dischargeParameters = new DischargeParameters();
|
|
75
|
-
|
|
76
|
-
// Create a vessel leak calculation
|
|
77
|
-
const vesselLeakCalculation = new VesselLeakCalculation(vessel, leak, dischargeParameters);
|
|
78
|
-
const leakResultCode = await vesselLeakCalculation.run();
|
|
79
|
-
|
|
80
|
-
// Check the result of vessel leak calculation
|
|
81
|
-
expect(leakResultCode).toBe(ResultCode.SUCCESS);
|
|
82
|
-
console.log(`SUCCESS: vessel_leak_calculation (${vesselLeakCalculation.calculationElapsedTime}ms)`);
|
|
83
|
-
|
|
84
|
-
// Set up entities for the dispersion calculation
|
|
85
|
-
const substrate = new Substrate({
|
|
86
|
-
surfaceType: surfaceType,
|
|
87
|
-
surfaceRoughness: surfaceRoughness
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const weather = new Weather({
|
|
91
|
-
windSpeed: windSpeed,
|
|
92
|
-
stabilityClass: stabilityClass,
|
|
93
|
-
windProfileFlag: windProfileFlag
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const dispersionParameters = new DispersionParameters();
|
|
97
|
-
|
|
98
|
-
const dispersionCalculation = new DispersionCalculation(
|
|
99
|
-
vesselLeakCalculation.exitMaterial!,
|
|
100
|
-
substrate,
|
|
101
|
-
vesselLeakCalculation.dischargeResult!,
|
|
102
|
-
vesselLeakCalculation.dischargeRecords!,
|
|
103
|
-
vesselLeakCalculation.dischargeRecords!.length,
|
|
104
|
-
weather,
|
|
105
|
-
dispersionParameters,
|
|
106
|
-
endPointConcentration
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
const dispersionResultCode = await dispersionCalculation.run();
|
|
110
|
-
|
|
111
|
-
// Check the result of the dispersion calculation
|
|
112
|
-
expect(dispersionResultCode).toBe(ResultCode.SUCCESS);
|
|
113
|
-
console.log(`SUCCESS: dispersion_calculation (${dispersionCalculation.calculationElapsedTime}ms)`);
|
|
114
|
-
console.log(`Final centreline concentration = ${dispersionCalculation.dispersionRecords![dispersionCalculation.dispersionRecords!.length - 1].centrelineConcentration}`);
|
|
115
|
-
console.log(`Final downwind distance = ${dispersionCalculation.dispersionRecords![dispersionCalculation.dispersionRecords!.length - 1].downwindDistance}`);
|
|
116
|
-
|
|
117
|
-
// Set up the entities for the concentration at point calculation
|
|
118
|
-
const dispersionOutputConfig = new DispersionOutputConfig({
|
|
119
|
-
concentration: endPointConcentration,
|
|
120
|
-
downwindDistance: 10
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
const concentrationAtPointCalculation = new ConcentrationAtPointCalculation(
|
|
124
|
-
dispersionCalculation.scalarUdmOutputs!,
|
|
125
|
-
weather,
|
|
126
|
-
dispersionCalculation.dispersionRecords!,
|
|
127
|
-
dispersionCalculation.dispersionRecords!.length,
|
|
128
|
-
substrate,
|
|
129
|
-
dispersionOutputConfig,
|
|
130
|
-
vesselLeakCalculation.exitMaterial!,
|
|
131
|
-
dispersionParameters
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
const concentrationResultCode = await concentrationAtPointCalculation.run();
|
|
135
|
-
|
|
136
|
-
// Check the result of concentration at point calculation
|
|
137
|
-
expect(concentrationResultCode).toBe(ResultCode.SUCCESS);
|
|
138
|
-
|
|
139
|
-
const expectedConcentration = 0.0040424883934447944;
|
|
140
|
-
expect(Math.abs(concentrationAtPointCalculation.concentration! - expectedConcentration) / expectedConcentration).toBeLessThan(1e-3);
|
|
141
|
-
console.log(`SUCCESS: concentration_at_point_calculation (${concentrationAtPointCalculation.calculationElapsedTime}ms)`);
|
|
142
|
-
});
|
|
143
|
-
});
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { VesselLineRuptureCalculation, VesselStateCalculation } from "../../src/calculations/discharge";
|
|
2
|
-
import { ConcentrationAtPointCalculation } from "../../src/calculations/dispersionView";
|
|
3
|
-
import { DispersionCalculation } from "../../src/calculations/dispersion";
|
|
4
|
-
import { Bund, DischargeParameters, DispersionOutputConfig, DispersionParameters, Material, MaterialComponent, State, Substrate, Vessel, Weather, LineRupture } from "../../src/entities";
|
|
5
|
-
import { AtmosphericStabilityClass, ResultCode, SurfaceType, VesselShape, WindProfileFlag } from "../../src/enums";
|
|
6
|
-
import { setAccessToken } from "../../src/utilities";
|
|
7
|
-
|
|
8
|
-
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
9
|
-
|
|
10
|
-
if (!accessToken) {
|
|
11
|
-
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
setAccessToken(accessToken);
|
|
15
|
-
|
|
16
|
-
describe('Test Case 119', () => {
|
|
17
|
-
test('Concentration at point calculation for AMMONIA', async () => {
|
|
18
|
-
|
|
19
|
-
// Set the case properties
|
|
20
|
-
const materialName = 'AMMONIA';
|
|
21
|
-
const stateTemperature = 290.0;
|
|
22
|
-
const statePressure = 7.0e6;
|
|
23
|
-
const stateLiquidFraction = 1.0;
|
|
24
|
-
const surfaceType = SurfaceType.LAND;
|
|
25
|
-
const surfaceRoughness = 0.183;
|
|
26
|
-
const windSpeed = 1.5;
|
|
27
|
-
const stabilityClass = AtmosphericStabilityClass.STABILITY_D;
|
|
28
|
-
const endPointConcentration = 0.0;
|
|
29
|
-
const specifyBund = true;
|
|
30
|
-
const bundHeight = 0.5;
|
|
31
|
-
const bundDiameter = 5.0;
|
|
32
|
-
const windProfileFlag = WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
33
|
-
|
|
34
|
-
// Define the initial state of the vessel
|
|
35
|
-
const state = new State({
|
|
36
|
-
temperature: stateTemperature,
|
|
37
|
-
pressure: statePressure,
|
|
38
|
-
liquidFraction: stateLiquidFraction
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Define the material contained by the vessel
|
|
42
|
-
const material = new Material(
|
|
43
|
-
{
|
|
44
|
-
name: materialName,
|
|
45
|
-
components: [new MaterialComponent({name:materialName, moleFraction: 1.0})]
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Create a vessel state calculation using the material and state
|
|
49
|
-
const vesselStateCalculation = new VesselStateCalculation(material, state);
|
|
50
|
-
const vesselStateResultCode = await vesselStateCalculation.run();
|
|
51
|
-
|
|
52
|
-
// Check the result of vessel state calculation
|
|
53
|
-
expect(vesselStateResultCode).toBe(ResultCode.SUCCESS);
|
|
54
|
-
console.log(`SUCCESS: vessel_state_calculation (${vesselStateCalculation.calculationElapsedTime}ms)`);
|
|
55
|
-
|
|
56
|
-
// Create a vessel for the line rupture calculation using the previously defined entities
|
|
57
|
-
const vessel = new Vessel({
|
|
58
|
-
state: vesselStateCalculation.outputState!,
|
|
59
|
-
material: vesselStateCalculation.material,
|
|
60
|
-
vesselConditions: vesselStateCalculation.vesselConditions,
|
|
61
|
-
liquidFillFractionByVolume: 0.7,
|
|
62
|
-
shape: VesselShape.VESSEL_CUBOID,
|
|
63
|
-
height: 2.0,
|
|
64
|
-
width: 1.0,
|
|
65
|
-
length: 3.0
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// Create a line rupture for the vessel line rupture calculation
|
|
69
|
-
const lineRupture = new LineRupture({
|
|
70
|
-
pipeDiameter: 0.1,
|
|
71
|
-
pipeLength: 1.0,
|
|
72
|
-
pipeHeightFraction: 0.1
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// Create a vessel line rupture calculation
|
|
76
|
-
const vesselLineRuptureCalculation = new VesselLineRuptureCalculation(vessel, lineRupture, new DischargeParameters());
|
|
77
|
-
const lineRuptureResultCode = await vesselLineRuptureCalculation.run();
|
|
78
|
-
|
|
79
|
-
// Check the result of vessel line rupture calculation
|
|
80
|
-
expect(lineRuptureResultCode).toBe(ResultCode.SUCCESS);
|
|
81
|
-
console.log(`SUCCESS: vessel_line_rupture_calculation (${vesselLineRuptureCalculation.calculationElapsedTime}ms)`);
|
|
82
|
-
|
|
83
|
-
// Set up entities for the dispersion calculation
|
|
84
|
-
const bund = new Bund({
|
|
85
|
-
specifyBund: specifyBund,
|
|
86
|
-
bundHeight: bundHeight,
|
|
87
|
-
bundDiameter: bundDiameter
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const substrate = new Substrate({
|
|
91
|
-
bund: bund,
|
|
92
|
-
surfaceType: surfaceType,
|
|
93
|
-
surfaceRoughness: surfaceRoughness
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const weather = new Weather({
|
|
97
|
-
windSpeed: windSpeed,
|
|
98
|
-
stabilityClass: stabilityClass,
|
|
99
|
-
windProfileFlag: windProfileFlag
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const dispersionParameters = new DispersionParameters();
|
|
103
|
-
|
|
104
|
-
const dispersionCalculation = new DispersionCalculation(
|
|
105
|
-
vesselLineRuptureCalculation.exitMaterial!,
|
|
106
|
-
substrate,
|
|
107
|
-
vesselLineRuptureCalculation.dischargeResult!,
|
|
108
|
-
vesselLineRuptureCalculation.dischargeRecords!,
|
|
109
|
-
vesselLineRuptureCalculation.dischargeRecords!.length,
|
|
110
|
-
weather,
|
|
111
|
-
dispersionParameters,
|
|
112
|
-
endPointConcentration
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
const dispersionResultCode = await dispersionCalculation.run();
|
|
116
|
-
|
|
117
|
-
// Check the result of dispersion calculation
|
|
118
|
-
expect(dispersionResultCode).toBe(ResultCode.SUCCESS);
|
|
119
|
-
console.log(`SUCCESS: dispersion_calculation (${dispersionCalculation.calculationElapsedTime}ms)`);
|
|
120
|
-
|
|
121
|
-
// Set up the entities for the concentration at point calculation
|
|
122
|
-
const dispersionOutputConfig = new DispersionOutputConfig({
|
|
123
|
-
concentration: endPointConcentration,
|
|
124
|
-
downwindDistance: 140,
|
|
125
|
-
time: 5,
|
|
126
|
-
elevation: 1
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const concentrationAtPointCalculation = new ConcentrationAtPointCalculation(
|
|
130
|
-
dispersionCalculation.scalarUdmOutputs!,
|
|
131
|
-
weather,
|
|
132
|
-
dispersionCalculation.dispersionRecords!,
|
|
133
|
-
dispersionCalculation.dispersionRecords!.length,
|
|
134
|
-
substrate,
|
|
135
|
-
dispersionOutputConfig,
|
|
136
|
-
vesselLineRuptureCalculation.exitMaterial!,
|
|
137
|
-
dispersionParameters
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
const concentrationResultCode = await concentrationAtPointCalculation.run();
|
|
141
|
-
|
|
142
|
-
// Check the result of concentration at point calculation
|
|
143
|
-
expect(concentrationResultCode).toBe(ResultCode.SUCCESS);
|
|
144
|
-
|
|
145
|
-
const expectedConcentration = 2.593311923058257e-08;
|
|
146
|
-
expect(Math.abs(concentrationAtPointCalculation.concentration! - expectedConcentration) / expectedConcentration).toBeLessThan(1e-3);
|
|
147
|
-
console.log(`SUCCESS: concentration_at_point_calculation (${concentrationAtPointCalculation.calculationElapsedTime}ms)`);
|
|
148
|
-
});
|
|
149
|
-
});
|