kawin.KWNEuler

class kawin.PrecipitateModel(self, t0, tf, steps, phases = [‘beta’], linearTimeSpacing = False, elements = [‘solute’])

Euler implementation of the KWN model designed for binary systems 
 
Parameters 
---------- 
t0 : float 
    Initial time in seconds 
tf : float 
    Final time in seconds 
steps : int 
    Number of time steps 
phases : list (optional) 
    Precipitate phases (array of str) 
    If only one phase is considered, the default is ['beta'] 
linearTimeSpacing : bool (optional) 
    Whether to have time increment spaced linearly or logarithimically 
    Defaults to False 
elements : list (optional) 
    Solute elements in system 
    Note: order of elements must correspond to order of elements set in Thermodynamics module 
    If binary system, then defualt is ['solute'] 

kawin.PrecipitateModel._resetArrays(self)

kawin.PrecipitateModel.reset(self)

Resets model results 

kawin.PrecipitateModel.save(self, filename, compressed = False, toCSV = False)

Save results into a numpy .npz format 
 
Parameters 
---------- 
filename : str 
compressed : bool 
    If true, will save compressed .npz format 
toCSV : bool 
    If true, wil save to .csv 

kawin.PrecipitateModel.load(filename)

Loads data 
 
Parameters 
---------- 
filename : str 
 
Returns 
------- 
PrecipitateModel object 
    Note: this will only contain model outputs which can be used for plotting 

kawin.PrecipitateModel._divideTimestep(self, i, dt)

kawin.PrecipitateModel.setPBMParameters(self, cMin = 1e-10, cMax = 1e-9, bins = 150, minBins = 100, maxBins = 200, adaptive = True, phase = None)

Sets population balance model parameters for each phase 
 
Parameters 
---------- 
cMin : float 
    Minimum bin size 
cMax : float 
    Maximum bin size 
bins : int 
    Initial number of bins 
minBins : int 
    Minimum number of bins - will not be used if adaptive = False 
maxBins : int 
    Maximum number of bins - will not be used if adaptive = False 
adaptive : bool 
    Sets adaptive bin sizes - bins may still change upon nucleation 
phase : str 
    Phase to consider (will set all phases if phase = None or 'all') 

kawin.PrecipitateModel.loadParticleSizeDistribution(self, data, phase = None)

Loads particle size distribution for specified phase 
 
Parameters 
---------- 
data : array 
    Array of data containing precipitate sizes 
phase : str (optional) 
    Phase to consider (defaults to first precipitate in list) 

kawin.PrecipitateModel.addAdditionalOutput(self, name, f)

Creates output based off PSD 
 
Parameters 
---------- 
name : str 
    Name of the function 
f : function 
    Takes in model, phase index and iteration index and returns a value 

kawin.PrecipitateModel._setupAdditionalOutputs(self)

Function to setup PSD output arrays, will be used in setup and reset functions 

kawin.PrecipitateModel._calculateAdditionalOutputs(self, i)

Calculates additional PSD functions 

kawin.PrecipitateModel.getAdditionalOutput(self, name)

Gets additional output by name 
 
Parameters 
---------- 
name : str 
    Name of function used for the additional output 
 
Returns 
------- 
(p, N) array for the output for each phase 

kawin.PrecipitateModel.particleRadius(self, phase = None)

Returns PSD bounds of given phase 
 
Parameters 
---------- 
phase : str (optional) 
    Phase to consider (defaults to first precipitate in list) 

kawin.PrecipitateModel.particleGibbs(self, radius = None, phase = None)

Returns Gibbs Thomson contribution of a particle given its radius 
 
Parameters 
---------- 
radius : array (optional) 
    Precipitate radaii (defaults to None, which will use boundaries 
        of the size classes of the precipitate PSD) 
phase : str (optional) 
    Phase to consider (defaults to first precipitate in list) 

kawin.PrecipitateModel.PSD(self, phase = None)

Returns frequency of particle size distribution of given phase 
 
Parameters 
---------- 
phase : str (optional) 
    Phase to consider (defaults to first precipitate in list) 

kawin.PrecipitateModel.createLookup(self, i = 0)

This creates a lookup table mapping the particle size classes to the interfacial composition 

kawin.PrecipitateModel.setup(self)

kawin.PrecipitateModel._interpolateAspectRatio(self, R, p)

Linear interpolation between self.eqAspectRatio and self.PBM[p].PSDbounds 
 
Parameters 
---------- 
R : float 
    Equivalent spherical radius 
p : int 
    Phase index 

kawin.PrecipitateModel._iterate(self, i)

Iteration function 

kawin.PrecipitateModel._noCheckDT(self, i)

Function if adaptive time stepping is not used 
Will calculated growth rate since it is done in the _checkDT function (not a good way of doing this, but works for now) 

kawin.PrecipitateModel._checkDT(self, i)

Checks max growth rate and updates dt correspondingly 

kawin.PrecipitateModel._noPostCheckDT(self, i)

Function if no adaptive time stepping is used, no need to do anything in this function 

kawin.PrecipitateModel._postCheckDT(self, i)

CURRENTLY UNUSED AND MAY BE REMOVED LATER 
 
If adaptive time step is used, this checks new values at iteration i 
and compares with simulation contraints 
 
If contraints are not met, then remove current values and divide time step 

kawin.PrecipitateModel._nucleate(self, i)

Calculates the nucleation rate at current timestep 
This can be done before the initial time increment checks are performed 

kawin.PrecipitateModel._calculatePSD(self, i, dt)

Updates the PSD using the population balance model from coarsening and nucleation rate 
This also updates the fraction of precipitates, matrix composition and average radius 

kawin.PrecipitateModel._massBalance(self, i)

Updates matrix composition and volume fraction of precipitates 

kawin.PrecipitateModel._singleGrowthBinary(self, i, p)

Calculates growth rate for a single phase 
This is separated from _growthRateBinary since it's used in _calculatePSD 
 
Matrix/precipitate composition are not calculated here since it's 
already calculated in createLookup 

kawin.PrecipitateModel._growthRateBinary(self, i)

Determines current growth rate of all particle size classes in a binary system 

kawin.PrecipitateModel._singleGrowthMulti(self, i, p)

Calculates growth rate for a single phase 
This is separated from _growthRateMulti since it's used in _calculatePSD 
 
This will also calculate the matrix/precipitate composition  
for the radius in the PSD as well as equilibrium (infinite radius) 

kawin.PrecipitateModel._growthRateMulti(self, i)

Determines current growth rate of all particle size classes in a multicomponent system 

kawin.PrecipitateModel.plot(self, axes, variable, bounds = None, timeUnits = ’s', radius=‘spherical’, *args, **kwargs)

Plots model outputs 
 
Parameters 
---------- 
axes : Axis 
variable : str 
    Specified variable to plot 
    Options are 'Volume Fraction', 'Total Volume Fraction', 'Critical Radius', 
        'Average Radius', 'Volume Average Radius', 'Total Average Radius',  
        'Total Volume Average Radius', 'Aspect Ratio', 'Total Aspect Ratio' 
        'Driving Force', 'Nucleation Rate', 'Total Nucleation Rate', 
        'Precipitate Density', 'Total Precipitate Density',  
        'Temperature', 'Composition', 
        'Size Distribution', 'Size Distribution Curve', 
        'Size Distribution KDE', 'Size Distribution Density 
        'Interfacial Composition Alpha', 'Interfacial Composition Beta' 
 
        Note: for multi-phase simulations, adding the word 'Total' will 
            sum the variable for all phases. Without the word 'Total', the variable 
            for each phase will be plotted separately 
 
            Interfacial composition terms are more relavent for binary systems than 
            for multicomponent systems 
             
bounds : tuple (optional) 
    Limits on the x-axis (float, float) or None (default, this will set bounds to (initial time, final time)) 
radius : str (optional) 
    For non-spherical precipitates, plot the Average Radius by the - 
        Equivalent spherical radius ('spherical') 
        Short axis ('short') 
        Long axis ('long') 
    Note: Total Average Radius and Volume Average Radius will still use the equivalent spherical radius 
*args, **kwargs - extra arguments for plotting