The simulation method based on ANSYS is used to solve the temperature field and stress field in squeeze casting process. Squeeze casting is a process in which heat and deformation interact. On the one hand, the change of contact pressure or gap leads to the change of interface heat transfer conditions, which makes the temperature field distribution of the casting change greatly; on the other hand, the mechanical properties of the alloy are related to temperature, and the change of temperature field directly affects the change of stress field.

The interface heat transfer coefficient and interface pressure of aluminum alloy and magnesium alloy are obtained by experiments. The interface heat transfer coefficient model of aluminum alloy and magnesium alloy is established by using the proposed modeling method of interface heat transfer coefficient model, and the model is applied to the numerical simulation in this chapter as the boundary condition. The solidification process is accompanied by the release of latent heat, so the heat source term related to the latent heat of solidification should be considered in the numerical simulation. The internal heat transfer equation of the casting is as follows,

Where l is the solidification latent heat of the casting and SF is the solid fraction in the casting.

The enthalpy of solidification process is defined by the following formula,

Enthalpy h can be calculated from pandat database.

The mechanical behavior of the alloy in the mold cavity during solidification is very complex. The deformation of solidified alloy includes elastic deformation, plastic deformation and creep. Volume shrinkage also occurs during cooling and solidification. Therefore, the total strain is composed of elastic strain, thermal strain and inelastic strain, as follows:,

The thermal strain is defined as the volume change caused by temperature change and phase transition, which can be calculated by hot wire expansion function (TLE), as follows:,

Creep is also a very important deformation at high temperature, and it is difficult to distinguish it from plastic deformation. For solid element, the creep process is described by thermoelastic viscoplastic model at high temperature,

Where a, α and N are the parameters related to the material type, R is the gas constant, and Q is the activation energy of the material. The parameters a, α, N and Q of aluminum alloy and magnesium alloy are calculated.

For the liquid element, a complete elastic-plastic model is adopted, in which the yield stress σ y is very small. This treatment not only effectively eliminates the shear stress in the liquid region, but also avoids the difficulty of calculation. The inelastic strain of the liquid element is calculated by the following formula,

The formula is used to describe the constitutive relationship of the material, as shown in the figure. The usermat subroutine provided by ANSYS can realize the user-defined constitutive relation. In each Newton Raphson iteration, usermat is called to update the stress vector, and the updated stress vector and uniform tangent operator are provided for the next calculation.