kawin 0.3.0 (12-11-2023)

Posted December 9, 2023 by  ‐ 4 min read

This is a major release that generalizes the model implementation. Additional fixes and general improvements are also introduced.

Looks like a change list for 0.2.0 was never released. The main changes in 0.2.0 was the introduction of the diffusion module, which includes implementation of a single phase model and the homogenization model.

Changes

  • Re-organization of package into submodules
    • Submodules include: solver, precipitation, diffusion and thermo
    • Commonly used imported objects are now done by “from kawin import …” instead of “from kawin.(module_name).import …”

  • Addition of an abstract model class GenericModel
    • Precipitate and diffusion models inherit this
    • Any model that inherit this will need to implement the getCurrentX, getDt and getdXdt functions to have a complete implementation
    • The solve function for all models will take in delta time and an iterator (default in 4th order Runga Kutta) - This changes the API for the PrecipitateModel where the simulation time is defined when solving rather than during initialization - Built-in iterators include explicit Euler and 4th order Runga Kutta - Custom iterators can easily be implemented and used for solving (Custom Iterators)
    • Model coupling can be done several ways (Model Coupling) - By solving multiple models for a given length of time and updating each other - Adding one model to another to be updated during solving - Using the Coupler object which takes in a list of GenericModels
    • Removed .csv support for saving and loading. Only .npz formats are supported currently as it was easier to generalize across models. The saving/loading behavior will likely be re-factored in a later version to allow users to combine multiple objects (diffusion, precipitation, strength, etc) into a single output file.

  • SinglePhaseModel changes
    • Diffusivity at the cell boundaries are now done by calculating the diffusivities at the cell centers then interpolating (this differs from the previous implementation where the composition was interpolation to the cell boundaries and the diffusivities were calculated from the interpolated compositions)

  • PrecipitateModel changes
    • Refactor to be compatible with the GenericModel
      • The initial time, final times, number of steps and linear time spacing parameters are removed during initialization. This avoids having the estimate a good number of steps to use during solving as the model will estimate the time step automatically
      • This also simplifies how each iteration is done when solving, where there’s no longer a need to track whether the population balance model changed in the number of bins and bin sizes (this was necessary before since the PBM would update in the middle of an iteration rather than at the end).
    • Phase volume parameter is combined to a single function to give the value for the volume and a parameter stating whether it’s a lattice parameter, atomic volume (unit cell volume) or molar volume)
    • Shape factors is combined to a single function where a parameter is required stating the shape to use
    • Stopping conditions are a set of classes that can be added to the mode rather than lambda functions. Information for the time that a stopping condition is satisfied can be taken direction from the stopping condition class rather than the precipitate model
      • Time-temperature-precipitation plots can be made from a precipitate model and a set of stopping conditions

  • Thermodynamic changes
    • GeneralThermodynamics, MulticomponentThermodynamics and BinaryThermodynamics are separated into their respective files
    • Tangent driving force method added, which solves for the energy difference for a precipitate to be on the same chemical potential hyperplane as the matrix phase. This allows for negative driving force to be calculated without resorting to the sampling method so the transition from positive to negative driving force is smoother
    • Growth rate for multicomponent systems can be computed for negative driving forces to properly describe dissolution behavior
    • Refactor of GeneralThermodynamics and MutlicomponentThermodynamics to remove repeated code
    • List of parameters can be added upon initialization to be freed when building the thermodynamic and mobility models

  • Mobility and Diffusivity changes
    • Mobility can handle order/disordered models
    • Free energy curvature function will correctly calculate the thermodynamic factor when the mole of formula units for a single phase at equilibrium is not 1 (this occurs for intermetallics and ordered phases with a) multiple sublattices with the sum of site ratios > 1, b) mixing of vacancies and elements on a sublattice)
    • Diffusivity calculations will handle interstitial behavior (implements u-fraction and vacancy consideration on the interstitial sublattice)

  • Additional changes
    • Diffusion models support non-isothermal simulations
    • Population balance model supports recording the time history of the PSD along with saving/loading to/from a .npz file
    • Grain growth model with zener pinning added which can be coupled to a precipitate model
    • Fix precipitation behavior when assuming no diffusion occurs within a precipitate
    • Plotting on strength model is more flexible to allow for single contributions to be plotted (rather than every contribution or total contribution)
    • Updated docstrings
    • Examples are renamed to remove spaces and have them ordered
    • Plotting for diffusion and precipitation is separated into its own file to be a bit cleaner