Demo: Eutectic Solidification of an Al-Cu Alloy
Overview
In this example, we will use AMMBER_python to extract free energies from an Al-Cu thermodynamic database and fit phase-field compatible free energies. Next we will use the free energy parametrization to run a simulation using AMMBER-PRISMS-PF.
Instructions
1 - Install AMMBER_python
Install AMMBER_python to your environment.
2 - Install AMMBER-PRISMS-PF demo
Follow the AMMBER-PRISMS-PF installation instructions. Checkout the prisms-ws-alcu​ branch
git checkout prisms-ws-alcu
3 - Set up thermochemical system
Navigate to /grandPotential-paraboloid. Take a look at make_system.py using a code editor of your choice (nano/vim/xed/vscode).
Set up system of interest
Starting at line 8, we set up the binary system of interest and specify the conditions that we want to sample. For this example, we choose to use a thermodynamic database (TDB) file as the data source for the Al-Cu binary system using the Database interface provided by Pycalphad.
tdb_file = "AlCu.TDB"
db = Database(tdb_file)
Here, we will declare Cu to be the independent solute variable, letting the amount of Al be implicitly defined as x_Al = 1 - x_Cu.
For the temperature, we choose some undercooling below the nominal eutectic, 819 K. We also select a composition at which metastable phases (liquid) will be sampled.
Fit free energies
To fit free energies for a binary system using AMMBER, one must first construct a point-cloud representation of the free energy. The lines
AlCu_Sys = bi.BinaryIsothermalDiscreteSystem()
AlCu_Sys.fromTDB(db, component, solution_component, temperature)
populate AlCu_Sys with point-cloud free energy data extracted from the thermodynamic database.
AlCu_Sys_neareq = AlCu_Sys.resample_near_equilibrium(eutectic_comp)
creates a new BinaryIsothermalDiscreteSystem called AlCu_Sys_neareq, which only retains point data near the equilibrium phase values. Since we provided a temperature and composition below the eutectic point, this will contain data of the FCC_A1_0 and AL2CU_1 phases. Since we also need the liquid free energy, we can add it to the system using:
AlCu_Sys_neareq.phases['LIQUID'] = AlCu_Sys.phases['LIQUID'].resample_near_xpoint(eutectic_comp)
Finally, we can fit quadratic polynomials to each of the phases:
AlCu_Fit = bi.BinaryIsothermal2ndOrderSystem()
AlCu_Fit.from_discrete(AlCu_Sys_neareq)
Set up simulation parameters
To use the fitted free energy parameters in conjunction with AMMBER-PRISMS-PF, they need to be added to a formatted system.json file with
system = {}
add_to_dict(AlCu_Fit, system, add_templates=True, Vm=1.0e-5)
with open(f"system.json", "w") as f:
json.dump(system, f, indent=4)
One can choose to either fill in the kinetic parameters here in the python file, or add them manually to the templates provided in the resulting system.json. Suitable values are provided in this example script.
Run python3 make_system.py to generate system.json.
4 - Prepare simulation
Compile the grandPotential-paraboloid application.
cd grandPotential-paraboloid/
cmake .
make
Run the generate-bc-amr executable. This reads your system.json file and automatically generates suitable PRISMS-PF parameters for natural boundary conditions and adaptive meshing.
5 - Simulate and visualize
Execute the simulation:
mpirun -n <nprocs> ./main
Where <nprocs> is the number of processors you want the simulation to run on.
Next, one can visualize the simulation results. If one has VisIt installed and available to the environment the results can quickly be visulalized using a provided script with visit -cli -s plot_live.py.