I have designed and developed an integrated software system for predicting shrinkage cavity and shrinkage porosity defects in castings, and for analyzing casting defects through expert system technology. The system is built on a general-purpose finite element analysis platform, and it combines casting theory, numerical simulation, knowledge-based reasoning, and practical foundry experience. My central objective is to help foundry engineers predict casting defect locations and severity, understand the causes of casting defects, and optimize casting processes before a physical trial is performed. In this article, I describe the theoretical foundations, system architecture, prediction algorithms, expert system components, development technologies, and an application case involving a high-chromium cast iron casting.
Shrinkage cavity and shrinkage porosity are among the most common casting defects. They are also major causes of rejected castings. The formation of these casting defects is closely related to liquid contraction, solidification contraction, solid-state contraction, feeding channel blockage, gas precipitation, and local thermal conditions. Predicting casting defects with numerical simulation is therefore a powerful way to reduce trial-and-error, shorten development cycles, lower production costs, and improve casting quality. I have focused on making such prediction practical for foundry engineers by embedding domain knowledge into a finite element environment and by providing flexible, graphical, and parameterized workflows.
Numerical Simulation in Casting Engineering
Casting process simulation and computer-aided engineering have become essential parts of modern foundry technology. A complete simulation system generally includes filling simulation, solidification temperature field simulation, stress field simulation, and microstructure simulation. Among these, filling simulation describes fluid flow during mold filling, temperature field simulation describes heat transfer and solidification, stress field simulation describes thermal stress and residual stress, and microstructure simulation describes grain growth and phase transformation. Each of these physical fields contributes to the formation of casting defects, but the temperature field is the most mature and the most directly applicable to shrinkage cavity and shrinkage porosity prediction.
| Physical field | Main governing phenomenon | Typical casting defects | Primary numerical challenge |
|---|---|---|---|
| Flow field | Liquid metal filling, turbulence, free surface | Cold shut, gas entrapment, slag inclusion, sand wash | Free surface tracking and pressure-velocity coupling |
| Temperature field | Heat conduction, convection, radiation, latent heat | Shrinkage cavity, shrinkage porosity, misrun | Nonlinear transient heat transfer with phase change |
| Stress field | Thermal stress, residual stress, deformation | Hot tear, cold crack, distortion | Thermo-elasto-plastic and creep models |
| Microstructure field | Nucleation, dendritic growth, eutectic growth | Grain size variation, segregation, mechanical property scatter | Multi-scale coupling and stochastic nucleation |
In my work, I treat the temperature field as the core physical field for casting defect prediction. The reason is that shrinkage cavity and shrinkage porosity are controlled mainly by solidification sequence, thermal gradients, cooling rates, and feeding resistance. Once the temperature field is solved, I can extract temperature, temperature gradient, solid fraction, and cooling rate data for each element at each load step. These quantities are then used in defect criteria to identify potential casting defect regions.
Heat Transfer and Solidification Theory
The solidification of a casting is a transient heat transfer process with phase change. The governing energy balance for a transient thermal analysis can be written as
$$ \rho c \frac{\partial T}{\partial t} = \frac{\partial}{\partial x}\left( k_x \frac{\partial T}{\partial x} \right) + \frac{\partial}{\partial y}\left( k_y \frac{\partial T}{\partial y} \right) + \frac{\partial}{\partial z}\left( k_z \frac{\partial T}{\partial z} \right) + \dot{q}_L $$
where \(\rho\) is density, \(c\) is specific heat, \(T\) is temperature, \(t\) is time, \(k_x\), \(k_y\), and \(k_z\) are thermal conductivities in the three coordinate directions, and \(\dot{q}_L\) is the latent heat release rate per unit volume. In finite element form, the transient thermal equilibrium can be expressed as
$$ [C]\{\dot{T}\} + [K]\{T\} = \{Q\} $$
where \([C]\) is the specific heat matrix, \([K]\) is the conduction matrix including convection and radiation effects, \(\{T\}\) is the nodal temperature vector, \(\{\dot{T}\}\) is the time derivative of the nodal temperature vector, and \(\{Q\}\) is the nodal heat flow vector. For nonlinear analysis, the material properties and boundary conditions may depend on temperature, so the matrix equation becomes nonlinear and requires iterative solution.
Heat transfer in a casting and mold system occurs by conduction, convection, and radiation. Conduction is described by Fourier’s law:
$$ \mathbf{q} = -k \nabla T $$
where \(\mathbf{q}\) is heat flux and \(k\) is thermal conductivity. Convection between a solid surface and a surrounding fluid is described by Newton’s law of cooling:
$$ q = h (T_s – T_f) $$
where \(h\) is the convective heat transfer coefficient, \(T_s\) is the solid surface temperature, and \(T_f\) is the fluid temperature. Radiation is described by the Stefan-Boltzmann law:
$$ q = \varepsilon \sigma A_1 F_{12} (T_1^4 – T_2^4) $$
where \(\varepsilon\) is emissivity, \(\sigma\) is the Stefan-Boltzmann constant, \(A_1\) is the area of surface 1, \(F_{12}\) is the view factor from surface 1 to surface 2, and \(T_1\) and \(T_2\) are absolute temperatures. In practical casting simulation, radiation is often converted into an equivalent convective boundary condition to reduce nonlinearity and computational cost.
For solidification, latent heat must be handled properly. I considered two common methods: the temperature recovery method and the equivalent specific heat method. In the temperature recovery method, the latent heat released during a time step is used to raise the temperature of the element, and the accumulated solid fraction is checked. In the equivalent specific heat method, the latent heat is incorporated into an effective specific heat:
$$ c_{\text{eff}} = c + \frac{L}{T_L – T_S} $$
where \(L\) is latent heat, \(T_L\) is liquidus temperature, and \(T_S\) is solidus temperature. I also used an enthalpy formulation in which enthalpy is defined as a function of temperature, allowing latent heat to be included naturally. For a multicomponent alloy, the solid fraction \(f_s\) is often approximated as a function of temperature. I proposed and applied a linear distribution and a parabolic distribution. The linear distribution is
$$ f_s = \frac{T_L – T}{T_L – T_S} $$
and the parabolic distribution is
$$ f_s = \left( \frac{T_L – T}{T_L – T_S} \right)^2 $$
In the developed system, I used the linear distribution for shrinkage cavity and shrinkage porosity prediction because it is simple, stable, and sufficiently accurate for the studied castings.
Contraction Behavior and Feeding Resistance
All castings undergo volume changes during cooling. The total contraction can be divided into liquid contraction, solidification contraction, and solid-state contraction. Liquid contraction is described by
$$ \beta_L = \alpha_L (T_p – T_L) $$
where \(\beta_L\) is liquid volumetric contraction, \(\alpha_L\) is the liquid contraction coefficient, \(T_p\) is pouring temperature, and \(T_L\) is liquidus temperature. Solidification contraction occurs because the atomic arrangement changes from disordered liquid to ordered solid, and it is also affected by the freezing range. Solid-state contraction is described by
$$ \beta_S = \alpha_S (T_S – T_0) $$
where \(\beta_S\) is solid volumetric contraction, \(\alpha_S\) is the solid contraction coefficient, \(T_S\) is solidus temperature, and \(T_0\) is room temperature. Shrinkage cavity formation is favored when liquid and solidification contraction cannot be compensated by feeding. A simplified expression for shrinkage cavity volume is
$$ V_{\text{sh}} = V_0 \left[ \alpha_L (T_p – T_L) + \beta_{L \to S} – \alpha_S (T_S – T_0) \right] $$
where \(V_0\) is the initial liquid volume and \(\beta_{L \to S}\) is the solidification contraction. When the feeding channel is open and the thermal gradient is large enough, the shrinkage appears as a concentrated cavity in the riser or in the last-solidifying region. When the dendritic network becomes coherent, the remaining liquid is divided into small pockets, and the contraction appears as dispersed shrinkage porosity. The critical solid fraction at which feeding becomes difficult is called the critical solid fraction, \(f_{s,c}\). When \(f_s > f_{s,c}\), liquid flow becomes very difficult, and casting defects such as shrinkage porosity are likely to form.
| Alloy | Critical solid fraction | Notes |
|---|---|---|
| Carbon steel | 0.65–0.70 | Depends on carbon content and cooling rate |
| Stainless steel | 0.60–0.70 | Often determined experimentally |
| Aluminum alloys | 0.20–0.50 | Equiaxed solidification can reduce feeding |
| Ductile iron | 0.40–0.70 | Graphite expansion complicates prediction |
| High-chromium cast iron | 0.30–0.50 | Used in the case study described later |
System Architecture and Functional Modules
I organized the system into four major subsystems: a casting process CAD subsystem, a solidification temperature field simulation subsystem, a shrinkage cavity and shrinkage porosity prediction subsystem, and a casting defect analysis subsystem. The overall workflow begins with casting design, riser design, gating system design, and mold design. Then the finite element model is created, material properties are assigned, boundary conditions are applied, and the temperature field is solved. The prediction subsystem then applies defect criteria to the temperature field results. Finally, the defect analysis subsystem uses expert system technology to help the user identify casting defect causes and propose corrective measures.
| Subsystem | Main functions | Key output |
|---|---|---|
| Casting process CAD | Parting surface, pouring position, shrinkage allowance, machining allowance, draft angle, riser design, gating design, mold design | Three-dimensional geometric model and process parameters |
| Temperature field simulation | Material database, mesh generation, initial and boundary conditions, transient thermal solution | Temperature, gradient, cooling rate, solid fraction fields |
| Shrinkage defect prediction | Temperature gradient method, New Shantou criterion, critical value determination, defect element identification | Predicted casting defect locations and severity |
| Casting defect analysis | Defect classification, cause analysis, countermeasures, knowledge base maintenance | Defect diagnosis and process improvement advice |
The casting process CAD subsystem is parameterized. It uses standard databases for alloy shrinkage, machining allowance, and riser dimensions. The riser design module divides the casting into feeding zones, calculates the modulus of each zone, determines the required riser modulus, selects the riser type, queries the riser database, checks the feeding capacity, and constructs the riser model. The gating system design module calculates the choke area, determines the cross-sectional ratios, selects the gating system type, and constructs the gating model. The mold design module defines sand material, core material, chills, coating, and flask dimensions.
The temperature field simulation subsystem includes a material property database, mesh generation, solution control, and post-processing. The material database contains temperature-dependent thermal conductivity, density, specific heat, and enthalpy for common casting alloys and molding materials. The mesh generation module supports automatic and manual mesh refinement. The solution module applies initial conditions, boundary conditions, and load steps. The post-processing module displays temperature contour plots, gradient plots, cooling curves, and animation of the solidification process.
Shrinkage Cavity and Shrinkage Porosity Prediction
The prediction subsystem is the core of my work. It uses the temperature field results to evaluate two criteria: the temperature gradient method and the New Shantou criterion, also known as the \(G/\sqrt{R}\) method. The temperature gradient method is based on the observation that a large temperature gradient along the feeding path promotes directional solidification and keeps the feeding channel open. A small temperature gradient causes the feeding channel to close before solidification ends, resulting in casting defects. The criterion can be written as
$$ G = \left| \nabla T \right| $$
where \(G\) is the magnitude of the temperature gradient. For each element, when the solid fraction reaches a critical value \(f_{s,c}\), the temperature gradient is calculated. If
$$ G < G_c $$
the element is considered a potential casting defect element. Here \(G_c\) is the critical temperature gradient. The set of all such elements represents the predicted shrinkage cavity and shrinkage porosity distribution. The critical temperature gradient depends on alloy composition, casting shape, and casting size. Therefore, I proposed two methods to determine it: the forward method and the reverse method. In the forward method, an initial critical value is assumed, the original process is simulated, defect prediction is performed, and the predicted result is compared with experimental or production data. The critical value is adjusted until the prediction matches reality. In the reverse method, an optimized process is assumed, and the critical value is adjusted until the predicted defect distribution agrees with the expected quality level. I used the forward method for a high-chromium cast iron casting and obtained a critical temperature gradient of \(10\,^{\circ}\mathrm{C}/\mathrm{mm}\).
The New Shantou criterion is expressed as
$$ \frac{G}{\sqrt{R}} < C_c $$
where \(G\) is temperature gradient, \(R\) is cooling rate, and \(C_c\) is the critical value. The cooling rate is defined as
$$ R = \left| \frac{\partial T}{\partial t} \right| $$
When the value of \(G/\sqrt{R}\) for an element is less than \(C_c\), the element is considered a potential casting defect element. The New Shantou criterion has been widely used for steel castings and has shown good performance in predicting dispersed shrinkage porosity. However, its applicability to cast irons is limited because graphite expansion and austenite contraction complicate the volume change behavior. In my case study, the New Shantou criterion did not predict the high-chromium cast iron casting defects as accurately as the temperature gradient method.
| Criterion | Expression | Advantages | Limitations |
|---|---|---|---|
| Temperature gradient method | \(G < G_c\) | Simple, intuitive, effective for directional solidification | Critical gradient depends on shape and alloy |
| New Shantou criterion | \(G/\sqrt{R} < C_c\) | Considers cooling rate, less sensitive to cooling rate variation | Not reliable for cast irons with graphite expansion |
| Solid fraction method | \(f_s > f_{s,c}\) | Directly related to feeding resistance | Requires accurate critical solid fraction |
| Time criterion | Local solidification time comparison | Easy to implement | Qualitative rather than quantitative |
I implemented the prediction algorithms so that the user can choose either the entire load step history or a specific load step or substep. This flexibility is important because casting defect formation can occur at different stages of solidification. The algorithm loops over load steps and elements, calculates the temperature and solid fraction, checks whether the critical solid fraction has been reached, calculates the temperature gradient or the \(G/\sqrt{R}\) value, compares it with the critical value, and stores the element number in a defect array. The defect array is then used to display the predicted casting defect locations and severity.
Expert System for Casting Defect Analysis
Casting defect analysis is a complex task that often relies on expert knowledge. I incorporated expert system technology into the system to provide defect query, cause analysis, countermeasure suggestions, and knowledge base maintenance. The expert system consists of a knowledge base, a working database, an inference engine, a knowledge acquisition mechanism, an explanation mechanism, and a user interface. The knowledge base stores rules in the form of production rules:
$$ \text{IF } P \text{ THEN } Q \text{ WITH } CF $$
where \(P\) is the premise, \(Q\) is the conclusion, and \(CF\) is the confidence factor. For example, a rule for identifying shrinkage cavity can be expressed as:
IF the defect is a hole type AND the shape is irregular closed or open cavity AND the wall is rough with dendrites AND it is located in a hot spot or last-solidifying region AND it is large and concentrated THEN the defect is a shrinkage cavity WITH confidence \(CF\).
I used forward reasoning and backward reasoning. Backward reasoning is used to confirm the defect type by asking the user a series of questions. Once the defect type is identified, the system uses forward reasoning to search the knowledge base for possible causes and countermeasures. The knowledge base is divided into several tables: defect coding table, Chinese and English name tables, defect category table, cause table, and countermeasure table. The defect coding follows a hierarchical structure. I also proposed a physical-field-based classification system for casting defects, which links flow field, temperature field, stress field, and coupled fields to specific casting defect types.

| Physical field | Casting defect type | Code |
|---|---|---|
| Flow field | Cold shut | F01 |
| Flow field | Gas entrapment | F02 |
| Flow field | Slag inclusion | F03 |
| Flow field | Sand wash | F04 |
| Temperature field | Shrinkage cavity | T01 |
| Temperature field | Shrinkage porosity | T02 |
| Stress field | Hot tear | S01 |
| Stress field | Cold crack | S02 |
| Stress field | Distortion | S03 |
| Coupled field | Misrun | C01 |
| Coupled field | Cold shut | C02 |
The expert system also includes an explanation mechanism. When the user asks why a conclusion was reached, the system displays the rules used and the confidence factors. The knowledge acquisition mechanism allows the user to add, modify, or delete rules and data. This is important because casting defect knowledge is constantly expanding. The system provides a knowledge base maintenance interface where the user can edit defect names, codes, causes, countermeasures, and confidence factors.
Development Principles and Technologies
I used a three-layer development architecture. The system layer is the operating system and the finite element analysis platform. The tool layer includes the internal development tools and external development tools. The application layer is the casting defect prediction and analysis system. The internal development tools include the parametric design language and the user interface design language. The external development tool is a visual programming environment for database applications. The backend database is a relational database management system.
| Layer | Tool or platform | Role |
|---|---|---|
| System layer | Operating system and finite element solver | Provide numerical solution and file management |
| Tool layer | Parametric design language | Define macros, parameters, arrays, loops, and database access |
| Tool layer | User interface design language | Create menus, dialogs, and help files |
| Tool layer | External visual development tool | Develop database application and expert system interface |
| Tool layer | Relational database | Store material properties, process parameters, and knowledge base |
| Application layer | Casting defect prediction and analysis system | Integrate all functions into a user-friendly environment |
The parametric design language is used to define geometric primitives, toolbars, parameters, and internal databases. It supports branching and looping, so I used it to implement the element loops and load step loops in the prediction algorithms. For example, the element temperature can be stored in an array and retrieved later:
$$ T_i = \frac{1}{n} \sum_{j=1}^{n} T_{ij} $$
where \(T_i\) is the average temperature of element \(i\), \(T_{ij}\) is the temperature of node \(j\) in element \(i\), and \(n\) is the number of nodes in the element. The user interface design language is used to create menus and dialogs. I created custom menus for shrinkage defect prediction, defect analysis, and knowledge base maintenance. I also created help files that explain the theory, the input parameters, and the interpretation of results.
The external development tool is used to build the expert system and the database application. It provides a graphical user interface, database connectivity, and rapid application development. I used it to create forms for defect selection, cause analysis, countermeasure display, and knowledge base editing. The relational database stores the material properties, the casting process parameters, the defect codes, and the knowledge rules. The database is open, so the user can add new materials, new alloys, new defect types, and new rules.
Application Case: High-Chromium Cast Iron Casting
I applied the developed system to a high-chromium cast iron casting used as a crusher hammer. The casting has a rectangular block shape with an internal cavity. The alloy is a hypoeutectic high-chromium cast iron with the following nominal composition: carbon 2.4–2.8%, chromium 20–24%, manganese 0.5–1.0%, silicon 0.5–1.0%, and iron balance. The casting is produced by sand casting with a three-box molding pattern. The original process used four chills in the lower mold, a top riser, and a sand core. The pouring temperature was about \(1450\,^{\circ}\mathrm{C}\), and the initial mold temperature was \(25\,^{\circ}\mathrm{C}\).
| Material | Density (kg/m³) | Specific heat (J/kg·K) | Thermal conductivity (W/m·K) | Latent heat (J/kg) |
|---|---|---|---|---|
| High-chromium cast iron | 7600 | 650 | 30 | 250000 |
| Carbon steel chill | 7850 | 480 | 45 | 270000 |
| Green sand | 1600 | 1000 | 0.6 | 0 |
| Resin sand core | 1550 | 1100 | 0.8 | 0 |
The solidification process was simulated as a transient nonlinear thermal problem. The initial temperature of the casting and gating system was set to \(1450\,^{\circ}\mathrm{C}\), and the initial temperature of the mold, chills, and sand core was set to \(25\,^{\circ}\mathrm{C}\). The interface between the casting and the mold was assumed to be perfect contact. The outer surface of the mold exchanged heat with the environment by convection and radiation, and radiation was converted into an equivalent convective coefficient. The latent heat was modeled using the enthalpy method. The solid fraction was calculated using the linear distribution.
The temperature field results showed that the hot spot was located at the inner corner of the cavity and in the thick wall region. The feeding channel from the riser to the hot spot became blocked before the end of solidification. The temperature gradient method predicted a concentrated shrinkage cavity in the riser neck and dispersed shrinkage porosity in the thick wall and the inner corner. These predicted casting defect locations agreed well with production statistics. The New Shantou criterion predicted a different pattern and did not match the observed casting defects, confirming that the criterion is not suitable for high-chromium cast iron castings without modification.
| Method | Predicted shrinkage cavity | Predicted shrinkage porosity | Agreement with production |
|---|---|---|---|
| Temperature gradient method | Riser neck and upper thick wall | Inner corner and thick wall | Good |
| New Shantou criterion | Scattered in several regions | Underpredicted in thick wall | Poor |
| Production observation | Riser neck | Inner corner and thick wall | Reference |
To improve the process, I proposed two changes. First, I added a feeding pad on the thick wall near the riser to increase the effective feeding distance. Second, I replaced the rectangular riser with a cubic riser of the same volume. Because the modulus of a cubic riser is larger than that of a rectangular riser with the same volume, the cubic riser remains liquid longer and feeds the casting more effectively. The optimized process was simulated again. The temperature field showed that the hot spot moved toward the riser, and the feeding channel remained open until the casting was almost completely solid. The temperature gradient method predicted no defect elements in the casting after optimization. The production trial confirmed that the optimized process eliminated the shrinkage cavity and reduced the shrinkage porosity significantly.
Interpretation of Results and Practical Benefits
The application case demonstrates that the developed system can predict casting defects in a practical foundry environment. The temperature gradient method is simple, fast, and effective when the critical temperature gradient is properly calibrated. The New Shantou criterion is useful for steel castings but must be used with caution for cast irons. The expert system provides a structured way to analyze casting defects and to suggest countermeasures. The database and knowledge base are open, so the system can be continuously improved as new experience is gained.
The system has several practical benefits. It reduces the need for trial-and-error in process design. It helps engineers visualize the solidification process and identify potential casting defect locations. It provides a quantitative basis for process optimization. It captures expert knowledge and makes it available to less experienced engineers. It integrates numerical simulation with expert system reasoning, so the user can move from prediction to diagnosis to corrective action in a single environment.
| Benefit | Description |
|---|---|
| Reduced trial-and-error | Predict casting defects before physical trials, saving time and cost |
| Improved quality | Optimize riser and chill design to eliminate shrinkage cavity and shrinkage porosity |
| Knowledge capture | Store expert rules and data in an open knowledge base |
| User-friendly operation | Graphical menus, parameterized input, and online help |
| Extensibility | Add new alloys, new criteria, and new defect rules |
Further Development and Outlook
I believe that casting defect prediction and analysis should continue to move toward integration, intelligence, and multi-physics coupling. Future work should include more prediction criteria, automatic critical value determination, quantitative defect grading, and coupling between filling, solidification, stress, and microstructure. The expert system should be expanded with more rules, more defect types, and more case histories. The user interface should be further improved with type trees, parameter input areas, schematic diagrams, and text explanations. The system should also support online help and remote access.
In my view, the most important lesson is that development must be targeted and application-driven. A successful casting defect prediction system must be based on real engineering cases and must be validated against production data. The system I developed is a step toward that goal. It provides a framework for predicting shrinkage cavity and shrinkage porosity, for analyzing casting defects, and for optimizing casting processes. With continued development, I expect such systems to become increasingly accurate, practical, and widely used in the foundry industry.
Conclusion
I have presented the design and development of a casting defect prediction and analysis system. The system uses a finite element analysis platform as the solver, a parametric design language and a user interface design language for internal development, a visual programming tool for external development, and a relational database for data and knowledge storage. It includes a casting process CAD subsystem, a temperature field simulation subsystem, a shrinkage cavity and shrinkage porosity prediction subsystem, and a casting defect analysis subsystem. The prediction subsystem implements the temperature gradient method and the New Shantou criterion, with flexible load step selection and critical value determination. The defect analysis subsystem uses expert system technology to provide defect query, cause analysis, countermeasures, and knowledge base maintenance. The application case on a high-chromium cast iron casting shows that the temperature gradient method can predict casting defects with good accuracy when the critical temperature gradient is properly determined, while the New Shantou criterion is less suitable for cast irons. The optimized process with a cubic riser and a feeding pad eliminated the predicted casting defects and improved the actual casting quality.
The system demonstrates that numerical simulation and expert system technology can be combined effectively to solve practical casting defect problems. It provides foundry engineers with a powerful tool for process design, defect prediction, and quality improvement. I am confident that continued research and development in this direction will lead to even more capable and intelligent systems for casting defect prediction and analysis.
