Skip to main content

Simulate steady solidification of a three-phase mushy layer

Project description

mush3p

Mush3p is a Python package which simulate a steadily solidifying three-phase mushy layer growing from a liquid melt containing dissolved gas. The liquid, which contains dissolved solute and gas, is translated upwards at a constant velocity towards a cold heat exhanger at the eutectic temperature of the system. The problem set up and underlying conservation equations are detailed in an upcoming paper [To be added here]. Here is an example of a simulation of the gas fraction distribution in a steady mushy layer at different values of the concentration ratio dimensionless parameter.

Simulation of three-phase mushy layers at different concentration ratios from an upcoming paper

Installation

Mush3p is available on PyPI and can be installed with pip via

pip install mush3p

Usage

Mush3p provides the classes PhysicalParams and NonDimensionalParams to define a simulation configuration using dimensional or non-dimensional parameters respectively. The following python code illustrates how to set up and solve a simulation.

import mush3p as m3p

parameters = m3p.PhysicalParams(name="example", model_choice="full", bubble_radius=1e-3)
non_dimensional_parameters = parameters.non_dimensionalise()
solution = m3p.solve(non_dimensional_parameters)

Mush3p returns the solution as a NonDimensionalResults object which contains methods to calculate the solution profiles of quantities of interest as functions of height scaled by the mushy layer depth. These methods interpolate the solution outside of the mushy layer using known analytical solutions. The steady mushy layer exists between scaled heights of -1 and 0, with eutectic solid above and liquid below. The following python code illustrates how to plot some solution profiles.

import matplotlib.pyplot as plt
import numpy as np

# vertical coordinate to plot solution for
height = np.linspace(-1.2, 0.2, 100)

# plot four of the solution profiles side by side
fig, (ax1, ax2, ax3, ax4) = plt.subplots(nrows=1, ncols=4, sharey=True)

ax1.plot(solution.temperature(height), height)
ax1.set_ylabel("depth")
ax1.set_title("temperature")

ax2.plot(solution.solid_fraction(height), height)
ax2.set_title("solid fraction")

ax3.plot(solution.gas_fraction(height), height)
ax3.set_title("gas fraction")

ax4.plot(solution.concentration(height), height)
ax4.set_title("dissolved gas concentration")

plt.show()

Available models

Details of the available models can be found in the accompanying upcoming paper [To be added here]. In brief there are four options for the model_choice parameter:

  • "full": the full model with no approximations.
  • "incompressible": the full model but with an incompressible gas phase.
  • "reduced": the reduced approximation scheme where the volume of gas exsolved is small and incompressible and drives no liquid flow within the mushy layer. Under this approximation scheme the gas volume fraction is neglected and so solid and liquid volume fractions sum to one.
  • "instant": the reduced model with instantaneous exsolution of any dissolved gas supersaturation into the gas phase. This corresponds to the limit where the Damkohler number goes to infinity.

Tests

The tests directory contains tests of simulations for a variety of input parameters. Run the tests using pytest from the root directory of the repository.

Docs

API reference documentation built using mkdocs gh-deploy is available at documentation.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mush3p-1.0.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mush3p-1.0.1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file mush3p-1.0.1.tar.gz.

File metadata

  • Download URL: mush3p-1.0.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.13 Darwin/21.6.0

File hashes

Hashes for mush3p-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5bd6b9b77464560aff1abf41e6d57be3c940d7c99d24ef51b082142205d28bed
MD5 fbc7d74db480c181599ae33da7223264
BLAKE2b-256 7b6ad1722acf8df5e5a3f596c15536a68970643786576273fa63d75a3cf63857

See more details on using hashes here.

File details

Details for the file mush3p-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mush3p-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.13 Darwin/21.6.0

File hashes

Hashes for mush3p-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 327f575981df11a5b7d69ea0f6bb59bdb2bc18ec59805de916bd9a63ebae1df0
MD5 f56cdc636b47db7699303dabe6d43700
BLAKE2b-256 133470a65d19cd86b1a0e0e04f95d240fc094ab55a83c805f101190c61d01e6a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page