results
Organize simulation results.
- class results.SimulationResults(simu_parameters)[source]
Bases:
object
Organize composition variables from a simulation.
- Variables:
saved_steps (list) – Steps for which simulation results are stored in resdict.
saved_times (1D array) – Times in h (rounded) that correspond to the saved steps.
comps (list of str) – System constituents, with ‘Va’ first and dependent constituent last.
inds (list of str) – Independent constituents, with ‘Va’ first.
V_partial (dict) – Partial molar volumes.
title (str) – Default plot title.
results (dict) – Simulation results stored as
UnitResult
instances.
- __init__(simu_parameters)[source]
Class constructor.
- Parameters:
resdict (dict) – Simulation results (dict).
simu_parameters (dict) – Simulation parameters, see class attributes.
- add_results(resdict)[source]
Populate results dictionary.
Generate
UnitResult
instances and set up theirplots.StaticProfile
attribute.
- result(step_index=-1, th=None)[source]
Access results at required step index or nearest to asked time.
- Parameters:
step_index (int) – Index of required time step in saved_steps/saved_times.
th (float) – Required time in hour.
- Returns:
Simulation results.
- Return type:
- Raises:
Exception – If the user specifies both step_index and th. If step_index is not an integer or is out of range.
- plot(varname='x', step_index=-1, th=None, **kwargs)[source]
Plot profile of variable varname at required time.
Select results at time step with
result()
(see doc ofresult()
for handling of step_index and th). Then callUnitResult.plot()
.- Parameters:
varname (str) – Name of variable to be plotted.
step_index (int) – Index of required time step in saved_steps/saved_times.
th (float) – Required time in hour.
- Returns:
fig, ax
- Return type:
matplotlib figure and axis
- plot_quartet(step_index=-1, th=None, **kwargs)[source]
Plot 2x2 subplots with profiles of simulation results.
Select results at time step with
result()
(see doc ofresult()
for handling of step_index and th). Then callUnitResult.plot_quartet()
.- Parameters:
step_index (int) – Index of required time step in saved_steps/saved_times.
th (float) – Required time in hour.
- Returns:
fig, axes, lines
- Return type:
matplotlib figure, axes and lines
- interactive_plot(variable='x')[source]
Interactive plot (call
plots.InteractivePlot
).
- add_mass_balance()[source]
Add mass balance.
For each time step in steps, integrate concentrations and volume along profile, and compute difference with initial values.
Variables:
N : amount of vacancies and atom species
Np : amount of pores
NW : amount of vacancies annihilated due to volume variation since initial step.
Nv : amount of vacancies in simulation box, in solution and in pores, plus amount annihilated due to volume variations.
Type of operation:
INx : integral amount in mol/m2
dINx : difference with initial value, mol/m2
rdINx : relative difference with initial value
- class results.UnitResult(result, V_partial)[source]
Bases:
object
Gather composition variables from one time step of a simulation.
Most attributes below are available in three versions: * x_mid: variable x evaluated on mid points * x_nod: variable x evaluated on nodes * x: shorthand for x_nod
- Variables:
z_nod (1D array) – Node positions.
z_mid (1D array) – Midpoint positions.
c (dict of 1D arrays) – System concentrations.
V (1D array) – Average molar volume of system.
y (dict of 1D arrays) – Metal site fractions.
yVa_eq (1D array) – Equilibrium vacancy site fraction.
dyVa (1D array) – Difference between actual and equilibrium vacancy fraction.
ryVa (1D array) – Relative difference between actual and eq. vacancy fraction.
x (dict of 1D arrays) – Metal atom fractions.
Vm (1D array) – Average molar volume of metal.
mu (dict of 1D arrays) – Chemical potentials.
Jlat (dict of 1D arrays) – Fluxes in lattice-fixed frame.
v (1D array) – Velocity field of lattice relative to laboratory frame.
Jref (dict of 1D arrays) – Fluxes in laboratory frame.
alpha_dislo (1D array) – Lattice sink rate due to dislocations.
alpha_pores (1D array) – Lattice sink rate due to pore growth.
alpha (1D array) – Total lattice sink rate.
L (2D array) – Onsager coefficients.
fm (1D array) – Metal volume fraction.
fp (1D array) – Pore volume fraction.
gamma_V (1D array) – Relative volume variation rate due to molar volume variations.
gamma_N (1D array) – Relative volume variation rate due to variations in the number of lattice sites.
gamma_p (1D array) – Relative volume variation rate due to pore growth.
gamma (1D array) – Total relative volume variation.
deformation (1D array) – Relative length variation.
static_prof (
plots.StaticProfile
) – Configure and plot static profiles.
- __init__(result, V_partial)[source]
Class constructor.
- Parameters:
comps (list of str) – System constituents, list with ‘Va’ first and dependent constituent last.
result (dict) – Simulation results at one time step.
V_partial (dict) – Partial molar volumes.
- make_nod_attributes()[source]
Make attributes on nodes.
For every variable x in the list, create attribute x_nod by interpolating x_mid on nodes.
- make_shorthands()[source]
Make attribute shorthands.
For every variable x in the list, create attribute with shorthand x and assign existing x_nod value.
- plot(varname='x', title=None, **kwargs)[source]
Plot profile of variable varname.
Call
plots.StaticProfile.single()
. See list of variable names in class documentation.
- plot_quartet(**kwargs)[source]
Plot 2x2 grid plot with profiles of simulation results.
Call
plots.StaticProfile.quartet()
. Plot x, yVa, Jlat, fp.