Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Simulating Eutectic Solidification with Phase Field and Cellular Automata in MATLAB

Tech May 10 3

This article outlines a MATLAB-based simulation for eutectic solidification, integrating concepts from the Phase Field and Cellular Automata methods. The approach is tailored for modeling solidification processes.

Program Framework Design

Model Selection

Eutectic solidification involves the competitive growth of two phases (e.g., alpha and beta) alongside solute redistribution. A recommended approach is a Phase Field-Solute Field Coupled Model, incorporating temperature field control. The core equations include:

  • Phase Field Equation (Cahn-Hilliard equation): Governs interface evolution.
  • Solute Diffusion Equation: Accounts for solute redistribution using models like Scheil or Kurz-Giovanoli.
  • Heat Conduction Equation: Manages the solidification temperature field.

Parameter Definition

% Physical parameters
region_size = 256;      % Simulation domain size (LxL)
melting_point = 1800;    % Melting point temperature (K)
initial_temp = 1750;    % Initial temperature (K)
temp_gradient = 10e3;   % Temperature gradient (K/m)
interface_velocity = 1e-4; % Interface movement speed (m/s)
solute_diffusivity = 1e-9; % Solute diffusion coefficient (m²/s)

Initialization Conditions

Phase Field Initialization

% Initial phase field: liquid in the center, alpha and beta nuclei on the sides
phase_field = zeros(region_size, region_size);
phase_field(:, 1:region_size/4) = 1;   % Alpha phase nucleus
phase_field(:, 3*region_size/4:end) = 2; % Beta phase nucleus

Solute Field Initialization

% Initial solute concentration (uniformly distributed)
solute_concentration = 0.2 * ones(region_size, region_size); % Initial solute concentration (binary alloy assumed)

Temperature Field Initialization

% Linear temperature gradient
temperature_field = initial_temp + temp_gradient * (0:region_size-1);

Main Simulation Loop

Time Stepping Loop

delta_t = 0.01;          % Time step
num_time_steps = 1000;

for t = 1:num_time_steps
    % Update temperature field (Heat Conduction Equation)
    temperature_field = update_temperature(temperature_field, temp_gradient, delta_t);
    
    % Calculate undercooling
    undercooling = melting_point - temperature_field;
    
    % Update phase field (Cahn-Hilliard Equation)
    phase_field = update_phase_field(phase_field, undercooling, delta_t);
    
    % Update solute field (Diffusion + Redistribution)
    solute_concentration = update_solute_field(solute_concentration, phase_field, solute_diffusivity, delta_t);
    
    % Visualization
    visualize_simulation(phase_field, solute_concentration, t);
end

Key Sub-functions

(1) Temperature Field Update

function T = update_temperature(T, G, dt)
    % Explicit Euler method for heat conduction equation
    thermal_diffusivity = 1e-5;  % Thermal diffusivity
    T = T + thermal_diffusivity * dt * del2(T) + G * dt;
end

(2) Phase Field Update

function phi = update_phase_field(phi, undercooling, dt)
    % Discretization of Cahn-Hilliard equation
    interface_thickness = 0.02;  % Interface thickness parameter
    mobility_coeff = 1.0;        % Interface mobility coefficient
    
    % Calculate chemical potential
    chemical_potential = interface_thickness^2 * del2(phi) - undercooling .* (1 - 2*phi);
    
    % Update phase field
    phi = phi + mobility_coeff * dt * del2(chemical_potential);
    phi(phi > 1) = 1;  % Interface truncation
    phi(phi < 0) = 0;
end

(3) Solute Field Update

function C = update_solute_field(C, phi, D, dt)
    % Solute diffusion equation (Scheil model adaptation)
    effective_diffusivity = D .* (1 + phi);  % Effective diffusion coefficient
    C = C + effective_diffusivity * dt * del2(C);
end

Visualization and Results Analysis

function visualize_simulation(phi, C, time_step)
    figure(1);
    subplot(1,2,1);
    imagesc(phi);
    colormap([0 0 1; 1 0 0]);  % Blue for alpha, Red for beta
    title(['Phase Field at t = ', num2str(time_step)]);
    
    subplot(1,2,2);
    imagesc(C);
    colormap(jet);
    title(['Solute Distribution at t = ', num2str(time_step)]);
    drawnow;
end

Model Extensions and Optimizations

  1. Polycrysstalline Simulation: Introduce random nuclei distribution during initialization for equiaxed crystal growth.
  2. Dendrite Growth: Incorporate anisotropic interfacial energy and modify chemical potential calculation.
  3. Laser Processing Coupling: Add laser energy input for simulating rapid solidification.
  4. Parallel Computing: Utilize MATLAB's parfor for accelerating large-scale simulations.

References

  • Phase Field Model Theory: Research by Yu-Ling Wang.
  • Eutectic Solidification Code: www.youwenfan.com/contentcnm/81513.html
  • Cellular Automata Implementation: Dendrite growth code from CSDN blog.
  • Solute Redistribution Models: Combination of Karma model and Scheil equation.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.