Contents:
The TQ interface is an open definition and can be extended to also provide other properties such as mobilities and elastic constants that are needed for the simulation of a phase transition.
Such properties often depend on T as well as the phases and their constitutions and can be modeled in a way similar to the thermodynamic properties and stored in databases together with such data. For example, the FEM code used for a casting simulation [25] used two routines, Lever and Slopes, from a custom interface for an older open source code. These two routines can be replaced by a sequence of routines from the OC-TQ interface, as shown in Table 1.
Xiong et al.
Table 1 Conceptual list of essential routines that are available in the OC-TQ interface giving an idea of the functionality. Set a condition for T, P, composition, chemical potential, stable phase, etc. Each condition can be set and changed separately. The simulations can use multiple equilibria with different conditions to represent local equilibrium. Calculate the equilibrium for the given set of conditions. Obtain the calculated value of a chemical potential, amount, or composition of a phase, atomic mobility of a component, etc. Note that the materials database can also contain data on atomic mobilities, elastic constants, magnetic properties, etc.
A thermodynamic system consists of elements that can form many different molecules or ions, here called species. The elements are neutral monatomic species. The species are the constituents of the phases, and it is important to distinguish between the constituents of a phase and the components, the latter are usually the same as the elements.
The number of constituents can be larger than the number of components; for example, the number of species in the gas phase is frequently larger than the number of elements. For the calculation of phase equilibria, it is important that the controlling conditions of the system can be specified in a general way.
The most simple conditions for minimizing the Gibbs energy are fixed amounts of components, T, and P, but it must be possible to set chemical potentials, values of enthalpy, volume, etc. Based on single equilibrium calculations, it must also be possible to generate property diagrams and phase diagrams for varying conditions. The optimal model parameters are determined from experimental and theoretical data in an assessment procedure.
All thermodynamic parameters are stored in OC relative to the phases and depend on the model selected for the phase. These parameters can be read from a file database containing the phase descriptions. There can be many different kinds of models, from a simple stoichiometric model with no variation in composition to multisublattice models for complex crystalline phases and liquids with a short range order to a gas phase with more than species. This formalism describes the gas phase, regular solutions, inter-metallics, and ordered phases and liquids with a short range order.
The general equation for describing the Gibbs energy function per mole formula unit of a phase a is. The term srfGm represents the 'surface' of reference for the phase relative to other phases and internal ordering; cfgGm is the configurational term which assumes ideal mixing of the constituents in each sublattice. The term phy Gm is used to describe contributions to the Gibbs energy from particular physical phenomena like magnetic transitions, and eGZ is needed to describe deviations in the Gibbs energy relative to the first three terms.
The phase superscript is omitted in the following equations unless several phases are involved. The various terms in Equation 1, using customary CALPHAD notation where the elements or species are separated by':' if they are on different sublattices and',' if they are on the same sublattice, for such a model are.
The interaction parameters may depend on T, P, and the constitution. More details about the CEF and other models can be found in Lukas et al. An efficient and flexible data structure [44] has been implemented in OC to store composition dependencies in the program memory as binary trees as shown in Figure 1. Each binary tree is independent, and this allows parallel processing which can speed up calculations. As shown in the figure, several 'property records' can be linked to each parameter; this allows the description of the composition dependence of other properties other than the Gibbs energy, for example, the Curie temperature and Bohr magneton number for ferromagnetic transitions, mobilities for diffusion data, lattice parameters, etc.
This modular data structure is extremely useful for the implementation of new models as new trees can be easily added to the code. The set of elements, species, and parameters for each phase of a system is 'static' as it does not change with the external conditions. The external conditions set by the user as well as the values of the constituent fractions and the calculated results for each phase are stored in separate 'dynamic' equilibrium records as shown in Figure 2.
This approach was chosen to simplify the calculation of several equilibria in parallel, each with its own equilibrium record, for example, for calculating separate lines in a phase diagram or assessing model parameters using many experimental points. The ability for parallel execution of the calculations is especially important for the coupling with other codes, such as phase field, fluid flow, or FEM. Figure 1 Parameter structure. Example of the linked structure for storing the parameters describing the composition dependence of the Gibbs energy, or any other property, for a phase modeled as A,D B,C.
Figure 2 Data structures. The static data structure a contains all data that do not depend on the current set of conditions.
In the dynamic data structure b , each equilibrium record has a separate set of conditions and for all phases the current set of constitutions and the last calculated results. The total Gibbs energy of the system must be minimized to find the equilibrium at a fixed temperature, pressure, and composition. At the start, neither the set of stable phases nor its constitution is known. The total Gibbs energy is related to the molar Gibbs energy for the current set of stable phases as.
The algorithm for minimization implemented in OC was proposed by Hillert [45], and the first implementation was made by Jansson [46]. External conditions and internal constraints are taken into account using Lagrange multipliers. The Lagrange multipliers are also used to replace the Gibbs energy with the appropriate function considering external conditions on the volume, chemical potentials, or prescribed stable phases.
An example for the Lagrange function, L, for conditions of constant composition and fixed T and P is. The first constraint is that the mass balance is fulfilled, and the second constraint is that the sum of constituent fractions in each sublattice of a is unity. By differentiating the Lagrange function with respect to the different variables many relations can be derived.
Following Hillert [45], the first step in solving this equation is to invert the matrix of the second derivatives of the Gibbs energy with respect to the constituent fractions:. These matrix elements are used in several equations in the second step of the algorithm. Hillert [45] has shown that the Gibbs-Duhem relation can be used for the following equation to correct the constituent fractions, Aya, in the phase a at each iteration:.
All partial derivatives are calculated analytically in OC.
In complex systems, computational methods such as CALPHAD are employed to model thermodynamic properties for each phase and simulate multicomponent. In complex systems, computational methods such as CALPHAD are With a chapter dedicated to creating thermodynamic databases, the reader will be.
There is one equation for each stable phase:. For each condition on an extensive variable, we obtain an equation which in a simple case where Na is fixed is. The new values of the chemical potentials allow the updating of the phase constitutions using Equation 9. If the amount of a phase becomes negative, the phase should be removed from the set of stable phases, and if the driving force, AG, for an unstable phase p. Equation 12 requires that the constitution of the metastable phases be updated using Equation 9 at each iteration.
When the changes in chemical potentials and phase amounts are sufficiently small and all external conditions are fulfilled, the calculation has converged; otherwise, the calculation is repeated beginning with the first step. A variation of this algorithm has been proposed by Lukas [47] in which the two steps were combined and variables like Ayf are found directly by solving a larger system of linear equations than is needed in step 2 above.
This is more efficient if the set of stable phases does not change between the iterations, but each time such a change occurs, the matrix of linear equations must be reconstructed. The two-step method does not require such reconstruction. Calculations using the same models and parameters and the same external conditions with different software will give the same results if the criteria for convergence are similar. Rounding errors are the likely cause for differences in the sixth or seventh significant digit of the results.
The algorithm described above is an iterative method which depends strongly on the initial configuration of the phases. In Figure 3, the Gibbs energy curves for two phases are shown. If the start constitutions of the two phases are as marked in Figure 3b, an iterative algorithm will find the common tangent shown in Figure 3c. This is a metastable equilibrium because it lies above the most stable common tangent as shown in Figure 3d.