PHAST WEB SERVICES
Introduction
Phast is the world's most comprehensive process hazard analysis software which models the progress of a potential incident from the initial release to far-field dispersion including modelling of pool spreading and evaporation and resulting flammable and toxic effects. In Phast Web Services we have taken the same state of the art consequence modelling calculations and made them available as web services so you can use them in your own applications.
Consequence analysis
Phast Web services and Python PWS have been developed to enable you to call Phast consequence calculations from within your own Python scripts.
We have services available for a wide range of consequence calculations:
- Discharge
- Toxic/flammable gas dispersion
- Fire and explosion modelling
- Various supporting, utility calculations
Reference documentation
A detailed reference document for Phast Web Services can be found here.
Getting started
In order to create a Python script that is able to call the Phast Web Services calculations you will need to obtain an access token from DNV.
Please note that the PyPWS library is tested on Python versions 3.11 onwards. It is recommended to use one of these versions.
Sample code to perform a vessel leak calculation
In the following example the VesselLeakCalculation is used to predict the release of Methane from a 50mm hole in a horizontal vessel. In order to get the correct conditions within the vessel the VesselStateCalculation is called first and the results from this are passed to the VesselLeakCalculation to correctly set it up.
from pypws.calculations import VesselLeakCalculation, VesselStateCalculation
from pypws.entities import DischargeParameters, Leak, Material, MaterialComponent, State, Vessel
from pypws.enums import ResultCode, TimeVaryingOption, VesselShape
# Define the material contained by the vessel.
material = Material(material_name, [MaterialComponent(material_name, 1.0)])
# Define the initial state of the vessel.
state = State(temperature=state_temperature, pressure=state_pressure, liquid_fraction=0.0)
# Create a vessel state calculation using the material and state.
vessel_state_calculation = VesselStateCalculation(material, state)
# Run the vessel state calculation.
vessel_state_calculation.run()
# Create a vessel entity and pass in the results from the VesselStateCalculation.
vessel = Vessel(state=vessel_state_calculation.output_state, material=vessel_state_calculation.material, vessel_conditions=vessel_state_calculation.vessel_conditions, diameter=6.0, length=10.0, shape=VesselShape.HORIZONTAL_CYLINDER, liquid_fill_fraction_by_volume=0.0)
# Create a leak to use in the vessel leak calculation.
# The leak has a hole of diameter of 50mm but we specify it as 0.05 as all calculations are performed using
# SI units which in this case is metres. The hole height fraction is set to 0.0 which corresponds to the
# bottom of the vessel. The time varying option is set topytest initial rate.
leak = Leak(hole_diameter=0.05, hole_height_fraction=0.0, time_varying_option=TimeVaryingOption.INITIAL_RATE)
# Create discharge parameters to use in the vessel leak calculation taking all the default values.
discharge_parameters = DischargeParameters()
# Create a vessel leak calculation using the vessel, leak, and discharge parameters.
vessel_leak_calculation = VesselLeakCalculation(vessel, leak, discharge_parameters)
# Run the vessel leak calculation.
result_code = vessel_leak_calculation.run()
if resultCode == ResultCode.SUCCESS:
print('SUCCESS: vessel_leak_calculation')
else:
print(f'FAILED vessel_leak_calculation with result code {resultCode}')
assert False
# Print any messages.
if len(vessel_leak_calculation.messages) > 0:
print('Messages:')
for message in vessel_leak_calculation.messages:
print(message)
Note that each calculation returns a "Result Code" which can be used to check whether the calculation was successful. In the event of a failed calculation another property (messages) of the calculation instance can be inspected to display possible reasons for the failed calculation. These two features are only shown for the vessel_leak_calculation for reasons of brevity.
Metadata
Release files for pypws 4.2.25
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pypws-4.2.25.tar.gz | 127.2 kB | Without provenance | Details for pypws-4.2.25.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pypws-4.2.25-py3-none-any.whl | Python 3 | none | any | Details for pypws-4.2.25-py3-none-any.whl |
Total release size: 230.1 kB
Release files / pypws-4.2.25.tar.gz
| Download URL | pypws-4.2.25.tar.gz |
|---|---|
| Size | 127.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d66591574457ed0485dedf062aad79fc414ae05c3ed7f192691792a638ffcda3
|
|
BLAKE2b-256 checksum How to use checksums |
f062210f886a408b3038fb72061aa244656baeaa3f084b799955f776f6e9ffd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Release files / pypws-4.2.25-py3-none-any.whl
| Download URL | pypws-4.2.25-py3-none-any.whl |
|---|---|
| Size | 102.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e5b1670dc0545b8e084b920e209dfe2003921ed4c0de5ec9054c501798de95b
|
|
BLAKE2b-256 checksum How to use checksums |
9b15fd8df54ba363ff85b58555e07a1c213d5d037267014dadb903c6daa0ea4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Security for pypws 4.2.25
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.