Nucleation Events¶
Nucleation is a key process in phase transformations, where new phases begin to form under specific thermodynamic conditions. In MICRESS simulations, nucleation events are recorded alongside temperature profiles, enabling us to visualize the conditions under which different phases nucleate. In this example, we will demonstrate how to use MicPy to read and visualize MICRESS nucleation data based on the T01_10_AlSi_E_HypoEutecticEff_2D_Lin
example.
Step 1: Loading the Data¶
To begin, we need to read two tabular files from the MICRESS simulation output. The first file (.TabT
) contains the temperature profile, while the second file (.TabNuc
) records the nucleation events. Using MicPy's read
function from the tab
module, we can load these tables into Pandas DataFrames:
Here, df_temp
stores the temperature profile as a time series, while df_nucl
contains details of the nucleation events, such as the phase names, nucleation times, and corresponding temperatures.
Step 2: Visualizing Nucleation Events¶
Next, we can plot the temperature profile as a line and the nucleation events as scatter points on the same graph. The temperature data is extracted from df_temp
, while the nucleation times and phase information are drawn from df_nucl
.
To ensure we only plot the nucleation events that represent the formation of a new grain, we filter out the full-size-reached
positions.
The following code creates a basic plot:
This produces a plot where the temperature profile is displayed as a grey dotted line, and the nucleation events are marked by scatter points. Each phase is represented by a different color, and the legend indicates the phase corresponding to each color.
Step 3: Resolving Overlapping Data Points¶
A common issue in this type of visualization is that nucleation events may overlap if they occur under similar conditions, i.e., at nearly the same temperature and time. To resolve this, we can introduce a small vertical offset between the nucleation points for different phases. This offset helps to reduce overlap while maintaining a clear, accurate representation of the events.
Additionally, changing the scatter marker to a vertical line can further improve readability.
Here's how you can modify the plot:
In this code, each phase's nucleation temperature is slightly adjusted using the expression temperature + 3 * i
, where i
is the index of the phase. This ensures that overlapping points are spread vertically, making them easier to distinguish.