src.spyice.models.stefan_problem#
This module provides analytical and semi-analytical solutions for the Stefan phase-change problem in one-dimensional sea ice systems.
Both:
One-phase Stefan formulation
Two-phase (solid–liquid) formulation
are implemented.
The solutions are primarily used for:
Model validation
Benchmarking numerical solvers
Comparing analytical and numerical ice growth
Mathematical Background#
The classical one-phase Stefan problem describes phase boundary motion governed by heat diffusion:
with a moving boundary determined by the Stefan condition:
The analytical solution involves the similarity variable:
where \(\lambda\) is obtained from a transcendental equation.
Class: StefanProblem#
- class StefanProblem#
A utility class providing static methods to compute one-phase and two-phase Stefan solutions.
Static Methods#
stefan_problem#
calculate_temperature_profile#
- static calculate_temperature_profile(depth_stefan, t, dz, nz, ui)#
Compute the temperature profile for the one-phase solution.
- Parameters:
depth_stefan (float) – Ice thickness.
t (float) – Time.
dz (float) – Grid spacing.
nz (int) – Number of grid cells.
ui (UserInput) – User input configuration.
- Returns:
Temperature array.
The profile is based on the error function solution:
\[T(z,t) = T_b - (T_b - T_m) \frac{\operatorname{erf}(z / 2\sqrt{\alpha t})} {\operatorname{erf}(s / 2\sqrt{\alpha t})}\]
calculate_temperature_twophase_profiles#
- static calculate_temperature_twophase_profiles(depth_stefan, t, dz, nz, ui)#
Compute temperature and salinity profiles for the two-phase Stefan problem.
- Parameters:
depth_stefan (float) – Interface position.
t (float) – Time.
dz (float) – Grid spacing.
nz (int) – Number of grid cells.
ui (UserInput) – User input configuration.
- Returns:
Tuple of:
Temperature array
Salinity array
Uses complementary error functions for the liquid region.
stefan_problem_twophase#
_plot_stefan_temp_twophase#
- static _plot_stefan_temp_twophase(z_depth=0.5)#
Utility method for plotting temperature evolution at a specified depth.
- Parameters:
z_depth (float) – Relative depth location.
- Returns:
Temperature and salinity history arrays.
Intended for validation and debugging.
Dependencies#
numpyscipy.optimizescipy.special.erfcmatplotlibspyice.parameters.user_input
Notes#
Newton iteration tolerance is set to moderate precision.
Analytical solutions assume constant thermophysical properties.
Two-phase formulation accounts for salinity depression of melting temperature.
Intended primarily for verification against the numerical solver.