1 Introduction

One of the most important parts of the engineering productive processes is the solidification of alloys and ability of controlling this process. Therefore, one of the most essential tools in the modern preparation of production are the computer programs simulating the course of solidification process. For using the simulation programs in qualified way one needs to know the mathematical models serving for constructing such procedures [1].

Solidification of the alloy proceeds in the interval from the liquidus temperature to the solidus temperature. Model of solidification in the temperature interval is based on the heat conduction equation with the included source element in which the latent heat of fusion and the volume contribution of solid phase are taken into account. Having the assumed form of function describing this contribution we can transform the equation into the heat conduction equation with the so called substitute thermal capacity. In this way, the considered differential equation defines the heat conduction in the entire homogeneous domain (in solid phase, in two-phase zone (mushy zone) and in liquid phase) [14].

Process of the alloy solidification is also affected by the process of segregation of the alloy components, for example, the change of concentration corresponds with the change of liquidus and solidus temperatures. Models, the most often used for describing the concentration, are these ones in which the immediate equalization of chemical composition of the alloy in the liquid phase and solid phase is assumed (the lever arm rule) [58] as well as the Scheil model [6, 7, 9, 10].

In this paper we consider a model in which the distribution of temperature is described by means of the heat conduction equation [24] with the substitute thermal capacity and with the liquidus and solidus temperatures varying in dependence on the concentration of the alloy component. Whereas for describing the concentration we apply the model based on the lever arm rule. And the discussed problem lies in determination of the heat transfer coefficient appearing in the third kind boundary condition defined on the boundary of solidifying alloy. Additionally, the reconstruction of temperature in the region of solidifying alloy should be also obtained. The sought elements will be calculated on the basis of temperature measurements read in selected point of the mould.

Since the considered problem consists in reconstruction of some missing part of input information on the basis of some given additional information, the problem should be classified as the inverse problem [11, 12]. Difficulty in solving such problems results from the fact that the inverse problems frequently appear to be the ill posed problems in such sense that the analytic solution does not exist or it exists but is neither unique nor stable with respect to the input data errors, it means that small input errors may cause big output errors. Therefore, each procedure successful in solving problem of that kind is interesting and desired.

Important part of the proposed approach lies in minimization of the functional representing the error of approximate solution. Tool which will be used for executing this task is the artificial bee colony algorithm (ABC algorithm)—one of the modern optimization algorithms inspired by the behavior of real bees [13, 14]. The ABC algorithm has already found a number of applications in solving a different kind of combinatorial, optimization, engineering and economic problems [1519]. Author of the current paper, with her co-workers, has also tested the ABC algorithm in solving inverse problems connected with the heat conduction [2022]. All the trials went well, therefore a new idea arose to use this optimization algorithm for solving the inverse problem in solidification of the binary alloy in the casting mould.

2 Governing equations

We discuss the region occupied by the solidifying material and the region of casting mould. With respect to the thermal symmetry, half of the region will be investigated. Geometry of the problem (together with the symbolic grid introduced for computational reasons) is presented in Fig. 1.

Fig. 1
figure 1

Domain of the discussed problem

Distribution of temperature of the solidifying material is described by the heat conduction equation [14]:

$$c\, \varrho \, \frac{\partial T(x,t)}{\partial t} = \lambda \frac{\partial ^2 T(x,t)}{\partial x^2} + L\, \varrho \, \frac{\partial f_s(x,t)}{\partial t}$$
(1)

for \((x,t)\in \varOmega\), where \(\varOmega =\{(x,t):\ x\in (0,d_1);\ t\in (0,t^*)\}, c, \varrho\) and \(\lambda\) are the specific heat, mass density and thermal conductivity coefficient, respectively, L denotes the latent heat of solidification, \(f_s\) describes the volumetric solid state fraction, T is the temperature, and finally t and x refer to the time and spatial coordinates. The volumetric solid state fraction depends on the temperature, thus we obtain

$$\frac{\partial f_s}{\partial t} = \frac{\partial f_s}{\partial T}\, \frac{\partial T}{\partial t}.$$
(2)

Substituting relation (2) to Eq. (1), after some transformations we get

$$\Big ( c - L\, \frac{\partial f_s}{\partial T}\Big )\, \varrho \, \frac{\partial T(x,t)}{\partial t} = \lambda \frac{\partial ^2 T(x,t)}{\partial x^2}$$
(3)

Introducing the so called substitute thermal capacity

$$C = c - L\, \frac{\partial f_s}{\partial T}$$
(4)

the previous equation can be written in the form

$$C\, \varrho \, \frac{\partial T(x,t)}{\partial t} = \lambda \frac{\partial ^2 T(x,t)}{\partial x^2}, \quad (x,t)\in \varOmega.$$
(5)

Distribution of temperature in the casting mould is described by equation

$$c_m\, \varrho _m\, \frac{\partial T_m(x,t)}{\partial t} = \lambda _m \frac{\partial ^2 T_m(x,t)}{\partial x^2}$$
(6)

for \((x,t)\in \varOmega _m\), where \(\varOmega _m=\{(x,t):\ x\in (d_1,d_2);\ t\in (0,t^*)\}, c_m, \varrho _m\) and \(\lambda _m\) are the specific heat, mass density and thermal conductivity coefficient, respectively, of the casting mould material, and \(T_m\) denotes the temperature of casting mould.

The above equations are completed with the following initial conditions

$$\begin{aligned} T(x,0)&= T_{0}(x),&x&\in [0,d_1], \end{aligned}$$
(7)
$$\begin{aligned} T_m(x,0)&= T_{m,0}(x),&x&\in (d_1,d_2], \end{aligned}$$
(8)

and the homogeneous boundary condition of the second kind resulting from the assumed heat symmetry of the region

$$-\lambda \frac{\partial T(0,t)}{\partial x} = 0, \qquad t\in (0,t^*).$$
(9)

At the cast–mould interface the boundary condition of the fourth kind is defined

$$\begin{aligned} T(d_1,t)&= T_m(d_1,t)&t\in (0,t^*), \end{aligned}$$
(10)
$$\begin{aligned} -\lambda \, \frac{\partial T(d_1,t)}{\partial x}&= -\lambda _m\, \frac{\partial T_m(d_1,t)}{\partial x},&t\in (0,t^*). \end{aligned}$$
(11)

Outside of the mould the third kind boundary condition is given

$$-\lambda _m\, \frac{\partial T_m(d_2,t)}{\partial t} = \alpha \, \big ( T_m(d_2,t) - T_{\infty } \big )$$
(12)

for \(t\in (0,t^*)\), where \(\alpha\) denotes the heat transfer coefficient and \(T_{\infty }\) means the ambient temperature.

In the above mathematical formulation of the problem we assume the perfect thermal contact at the cast–mould interface. We use this simplification (see [1]) as our first approach for testing the elaborated procedure. In the next step we intend to consider more real model of the process taking into account the thermal contact resistance at the cast–mould interface.

We assume the linear change of function \(f_s\) with regard to the temperature and the following equalities which must be satisfied

$$f_s(T_L) = 0 \quad \text{and} \quad f_s(T_S)=1,$$
(13)

where \(T_L\) and \(T_S\) denote the liquidus and solidus temperature, respectively. In literature a number of various hypothesis concerning the form of function \(f_s\) describing the volumetric solid state fraction can be found. For instance, assuming the linear dependence of the solid phase on the temperature in the mushy zone [13], the above conditions will be satisfied by the following function

$$f_s(T) = \frac{T_L - T}{T_L - T_S} \quad \text{ for }\quad T\in [T_S, T_L].$$
(14)

Hence we get

$$\frac{d f_s(T)}{dT} = \frac{{-}1}{T_L - T_S} \quad \text{ dla }\quad T\in [T_S, T_L],$$
(15)

thereby the substitute thermal capacity is equal to

$$\begin{aligned} C = \left\{ \begin{array}{ll} c_l &{}\quad T>T_L,\\ c_{mz} +\frac{L}{T_L - T_S}&{}\quad T\in [T_S, T_L],\\ c_s &{}\quad T < T_S,\\ \end{array} \right. \end{aligned}$$
(16)

where \(c_l, c_{mz}\) and \(c_s\) denote the specific heat of the liquid phase, mushy zone and the solid phase, respectively. In Eq. (5) the values of density and thermal conductivity coefficient vary as well in dependence on the temperature

$$\begin{aligned} \varrho &= {} \left\{ \begin{array}{lll} \varrho _l &{}\ &{} T>T_L,\\ \varrho _{mz} &{}\ &{} T\in [T_S, T_L],\\ \varrho _s &{}\ &{} T < T_S,\\ \end{array} \right. \end{aligned}$$
(17)
$$\begin{aligned} \lambda&= {} \left\{ \begin{array}{lll} \lambda _l &{}\ &{} T>T_L,\\ \lambda _{mz} &{}\ &{} T\in [T_S, T_L],\\ \lambda _s &{}\ &{} T < T_S.\\ \end{array} \right. \end{aligned}$$
(18)

One of the available models, which can be used for describing the macrosegregation phenomenon proceeding in the cast, is the model in which we assume the immediate equalization of chemical composition of the alloy in the liquid phase and in the solid phase (the lever arm rule) [5, 6, 8]. Thus we assume in this model that \(D_i\rightarrow \infty\), for \(i=1,2\), where \(D_1\) and \(D_2\) are the diffusion coefficients in the liquid and solid phase, respectively.

Introducing discretization of interval \([0,t^*]\) with nodes \(t_i, i=0,1,\ldots ,p^{*}\) and by using the mass balance of the alloy component in the cast region for the moment of time \(t_{p+1}\), we obtain the equation

$$m_0\, Z_0 = m_L(t_{p+1})\, Z_L(t_{p+1}) + m_S(t_{p+1})\, Z_S(t_{p+1}),$$
(19)

where \(m_0\) denotes mass of the alloy, \(Z_0\) is the initial concentration of the alloy component, \(Z_L(t_{p+1})\) and \(Z_S(t_{p+1})\) are the concentrations of the alloy in liquid phase and solid phase in moment \(t_{p+1}\) and finally \(m_L(t_{p+1})\) and \(m_S(t_{p+1})\) describe mass of the alloy in liquid state and solid state in moment \(t_{p+1}\). By introducing the partition coefficient \(k=\frac{Z_S(t)}{Z_L(t)}\), the above equation is transformed into the form

$$Z_L(t_{p+1}) = \frac{m_0\, Z_0}{k\, m_S(t_{p+1}) + m_L(t_{p+1}) }.$$
(20)

Considered region of the alloy is divided into the control volumes \(V_j\) of length \(\varDelta x_j,\,j=0,\ldots ,n\). If we denote by \(f_j(t)\) the contribution of solid phase in volume \(V_j\) in moment t, then the masses of metal in the solid state and in the liquid state contained in volume \(V_j\) in moment t are determined by relations

$$m_{S,j}(t) = V_j\, \varrho _s\, f_j(t)$$
(21)

and

$$m_{L,j}(t) = V_j\, \varrho _l\, (1-f_j(t)).$$
(22)

By using the above relations, Eq. (20) can be presented in form

$$\begin{aligned} Z_L(t_{p+1})&= {} d_1\, \varrho _l\, Z_0 \, \bigg [k\, \varrho _s\, \sum \limits _{j=0}^{n} \Big ( \varDelta x_j\, f_j(t_{p+1}) \Big ) \nonumber \\&\quad+ \varrho _l\, \sum \limits _{j=0}^{n} \Big ( \varDelta x_j\, \big ( 1- f_j(t_{p+1})\big ) \Big )\bigg ]^{-1}. \end{aligned}$$
(23)

The investigated inverse problem consists in determination of the temperature distribution in considered region and in identification of the heat transfer coefficient on boundary of the casting mould in case when the values of temperature in selected points of the casting mould (\((x_i,t_j)\in \varOmega _m\)) are known

$$T(x_i,t_j) = U_{ij}$$
(24)

for \(i=1,2,\ldots ,N_1\) and \(j=1,2,\ldots ,N_2\), where \(N_1\) denotes the number of sensors and \(N_2\) means the number of measurements read from each sensor.

For the fixed heat transfer coefficient \(\alpha\) the problem becomes the direct problem, solution of which gives us the possibility to find the values of temperature \(T_{ij}=T(x_i,t_j)\) corresponding to the given heat transfer coefficient \(\alpha\). By using the calculated temperatures \(T_{ij}\) and the given temperatures \(U_{ij}\) the following functional is constructed

$$J(\alpha )= \bigg (\sum \limits _{i=1}^{N_1} \sum \limits _{j=1}^{N_2} \big ( T_{ij}-U_{ij} \big )^{2} \bigg )^{1/2}$$
(25)

which determines the error of approximate solution.

3 Method of solution for the direct problem

In order to solve the direct problem we use the finite element method supplemented by the procedure of correcting the field of temperature in the vicinity of the liquidus and solidus curves. Brief description of this procedure will be presented below. More details about this method, and its generalization as well, can be found, for example, in [1, 2, 2326].

In the assumed model the substantial thermal capacity is used, the value of which varies by steps on the liquidus and solidus lines. Let us take into consideration node \(x_i\) being in the liquid phase in moment of time \(t_{p}\). That means that temperature \(T^{p}_{i}\) in this node is higher than the liquidus temperature \(T_{L}\). In the next step of calculations in this node, the values of parameters referring to the liquid phase will be used. If temperature \(T^{p+1}_{i}\) computed in the next step of calculations for moment \(t_{p+1}\) in this node is still greater than the liquidus temperature \(T_{L}\), then the node is still in the liquid phase. In this case we accept temperature \(T_{i}^{p+1}\) as properly determined and not requiring any further corrections.

In case when temperature \(T_{i}^{p+1}\) will be lower than the liquidus temperature \(T_L\), the nodes moves on to another phase (mushy zone or solid phase) which results in significant change of the thermal parameters values. Let us suppose that the node passes to the mushy zone, that is \(T_{i}^{p+1} \in (T_S, T_L]\). Time of transition of the node from the liquid phase to another phase is equal to \(\varDelta t= t_{p+1} - t_{p}\) and for part of this time the values of parameters should refer to another phase. In such situation the temperature in node \(x_{i}\) needs a correction. In order to make this correction we use the energy balance for the control element \(V_{i}\) with central node \(x_{i}\). Change of enthalpy of the control element corresponding to its cooling from temperature \(T_{i}^{p}\) to temperature \(T_{i}^{p+1}\) is equal to

$$\varDelta H_i = C_l\, \varrho _l\, \big ( T_{i}^{p} - T_{i}^{p+1} \big )\, \varDelta V_i,$$

where \(C_l\) is the substantial thermal capacity of the liquid phase and \(\varrho _l\) denotes density of the liquid phase. Two stages of releasing this heat can be distinguished in real. The first one is connected with the cooling to the liquidus temperature \(T_L\) and the second one with the cooling from the liquidus temperature \(T_L\). Hence we get

$$\begin{aligned} \varDelta H_{i1}&= C_l\, \varrho _l\, \big ( T_{i}^{p} - T_L \big )\, \varDelta V_i,\\ \varDelta H_{i2}&= C_{mz}\, \varrho _{mz}\, \big ( T_L - \overline{T}_{i}^{p+1} \big )\, \varDelta V_i, \end{aligned}$$

where \(C_{mz}\) is the substantial thermal capacity of the mushy zone and \(\varrho _l\) denotes density of the mushy zone, whereas \(\overline{T}_{i}^{p+1}\) describes the corrected value of temperature in node \(x_i\). From the balance

$$\varDelta H_i = \varDelta H_{i1} + \varDelta H_{i2},$$

the following formula expressing the corrected value of temperature in node \(x_i\) can be obtained

$$\begin{aligned} \overline{T}_{i}^{p+1} = T_L - \frac{C_l\, \varrho _l}{C_{mz}\, \varrho _{mz}}\, \big ( T_L - T_{i}^{p+1} \big ). \end{aligned}$$

Formula for the corrected value of temperature in case when node \(x_i\) passes from the mushy zone to the solid phase can be deduced similarly by receiving

$$\begin{aligned} \overline{T}_{i}^{p+1} = T_S - \frac{C_{mz}\, \varrho _{mz}}{C_s\, \varrho _s}\, \big ( T_S - T_{i}^{p+1} \big ), \end{aligned}$$

where \(C_s\) is the substantial thermal capacity of the solid phase and \(\varrho _s\) denotes density of the solid phase.

One can also derive the formula for the corrected value of temperature for the case when node \(x_i\) passes immediately from the liquid phase to the solid phase, without the mushy zone. However the length of time step \(\varDelta t\) should be selected so that this situation could be eliminated.

For computing the distribution of temperature in moment \(t_{p+1}\) we apply the finite element method which follows to obtain the matrix differential equation

$${\mathbf {C}}\, \dot{T} + {\mathbf {K}}\, T = g,$$
(26)

where \({\mathbf {C}}\) denotes the thermal capacity matrix, \({\mathbf {K}}\) is the conductivity matrix and g refers to the vector resulting from the assumed boundary conditions. For discretization of the above equation we use the implicit scheme and by receiving

$${{\mathbf {C}}}\, \frac{T^{p+1} - T^{p}}{\varDelta t} + {{\mathbf {K}}}\, T^{p+1} = g.$$
(27)

From this, after proper transformation, we get the system of linear equations

$$\begin{aligned} \Big ( \frac{1}{\varDelta t}\, {\mathbf {C}} + {\mathbf {K}}\Big )\, T^{p+1} = \frac{1}{\varDelta t}\, {\mathbf {C}}\, T^{p} + g. \end{aligned}$$
(28)

By solving the obtained system of linear equations we determine the distribution of temperature in moment of time \(t_{p+1}\), to which we apply the correction. In the next step the contribution of solid phase in volume \(V_j\) in moment \(t_{p+1}\) is computed from relation (14). Next, on the basis of formula (23) the value \(Z_{L}(t_{p+1})\) of the alloy component concentration in moment \(t_{p+1}\) is calculated, which determines the new values of the liquidus and solidus temperatures \(T_L\) and \(T_S\), respectively.

4 Artificial Bee Colony algorithm

Concept of the Artificial Bee Colony algorithm is grounded on the observation of behavior of the colony of bees searching for the flowers rich in nectar around the hive and on the communication between bees realized with the aid of a special dance, called the waggle dance. Dance of bees takes place in the particular part of hive (near the exit) and consists of two parts: moving straight and moving back to the starting point, along the semicircle, once to the right side, next to the left side. Direction of the bee dance determines the angle between the localized source of food and the sun. Duration of the straight movement determines the distance between the hive and the source of food (each 75 ms of straight movement denotes 100 m of distance). Magnitude of the bee body vibration during the dance indicates quality of the nectar. When the bees, called the scouts, find some good sources of nectar, they take the samples and fly back to the hive for informing the other bees, called the viewers, about the positions of sources of food. Next, the bees from the hive fly in pointed direction for further exploration of the most attractive from among the found sources of nectar.

In the algorithm imitating actions of the colony of bees, the role of sources of nectar is played by the points of domain—vectors \({\mathbf {y}}\) and value of optimized function J in given point—number \(J({\mathbf {y}})\)—designates the quality of respective source \({\mathbf {y}}\). In the task of minimization of the objective function, the smaller is the value \(J({\mathbf {y}})\), the better is the source \({\mathbf {y}}\) and probability of the choice of a source is the greater, the better is the quality of this source. In general, the process consists in the double search of investigated region—more generally for the first time in order to localize the best sources and then more precisely around these best selected locations. In details the ABC algorithm runs in the following way (see also [13, 14]).

Initialization of the algorithm

  1. 1.

    Initial data:

    SN – number of the explored sources of nectar (number of the bees-scouts, number of the bees-viewers);

    D – dimension of the source \({\mathbf {y}}_i,\,i=1,\ldots ,SN\);

    lim – number of “corrections” of the source position \({\mathbf {y}}_i\);

    MCN – maximal number of cycles.

  2. 2.

    Initial population – random selection of the initial sources localization represented by

    D-dimensional vectors \({\mathbf {y}}_i\), \(i=1,\ldots ,SN\).

  3. 3.

    Calculation of values \(J({\mathbf {y}}_i)\), \(i=1,\ldots ,SN\), for the initial population.

Main algorithm

  1. 1.

    Modification of sources localizations by the bees-scouts.

    1. a)

      Every bee-scout modifies position \({\mathbf {x}}_i\) according to formula

      $$v_{i}^j=y_{i}^j+\phi _{ij}(y_{i}^j-y_{k}^j), \quad j\in \{1,\ldots ,D\},$$

      where: \(\left. \begin{array}{l} k\in \{1,\ldots ,SN\},k\ne i,\\ \phi _{ij}\in [-1,1]. \end{array}\right\}\) – randomly selected numbers.

    2. b)

      If \(J({\mathbf {v}}_i)\le J({\mathbf {y}}_i)\), then position \({\mathbf {v}}_i\) replaces \({\mathbf {y}}_i\). Otherwise, position \({\mathbf {y}}_i\) stays unchanged.

      Steps a) and b) are repeated lim times. We take: \(lim=SN\cdot D\).

  2. 2.

    Calculation of probabilities \(P_i\) for the positions \({\mathbf {y}}_i\) selected in step 1. We use formula

    $$P_i=\frac{fit_i}{\sum \nolimits _{j=1}^{SN}fit_j}, \quad i=1,\ldots ,SN,$$

    where: \(fit_i= \left\{ \begin{array}{lll} \frac{1}{1+J({\mathbf {y}}_i)} &{} \quad {\rm if} &{} J({\mathbf {y}}_i)\ge 0,\\ 1+|J({\mathbf {y}}_i)| &{} \quad {\rm if} &{} J({\mathbf {y}}_i)< 0. \end{array}\right.\)

  3. 3.

    Every bee-viewer chooses one of the sources \({\mathbf {y}}_i,\) \(i=1,\ldots ,SN\), with probability \(P_i\). Of course one source can be chosen by a group of bees.

  4. 4.

    Every bee-viewer explores the chosen source and modifies its position according to the procedure described in step 1.

  5. 5.

    Selection of the \({\mathbf {y}}_{best}\) for the current cycle – the best source among the sources determined by the bees-viewers. If the current \({\mathbf {y}}_{best}\) is better that the one from the previous cycle, we accept it as the \({\mathbf {y}}_{best}\) for the entire algorithm.

  6. 6.

    If in step 1 the bee-scout did not improve position \({\mathbf {y}}_i\) (\({\mathbf {y}}_i\) did not change), it leaves the source \({\mathbf {y}}_i\) and moves to the new one by using formula

    $$y_i^j = y_{min}^j+\phi _{ij}(y_{max}^j-y_{min}^j), \quad j=1,\ldots ,D,$$

    where \(\phi _{ij}\in [0,1], y_{min}^j\) and \(y_{max}^j\) denote the minimal and maximal, respectively, value of the \(j\)-th coordinate in the current population.

Steps 1–6 are repeated MCN times.

5 Experimental verification

For verifying the elaborated procedure we solve the problem describing the solidifying cast of length 0.4 m \((d_1=0.4)\) within the mould of length 0.2 m \((d_2=0.6)\) with the following parameters [7, 27, 28]: \(t^*=500\) s, \(c_l=1275\) J/kg K, \(c_{s}=1077\) J/kg K, \(c_m=620\) J/kg K, \(\varrho _l=2498\,\hbox {kg}/\hbox {m}^3\), \(\varrho _{s}=2824\,\hbox {kg}/\hbox {m}^3\), \(\varrho _m=7500\,\hbox {kg}/\hbox {m}^3\), \(\lambda _l=183\) W/m K, \(\lambda _{s}=183\) W/m K, \(\lambda _m=40\) W/m K, L = 390,000 J/kg, ambient temperature \(T_{\infty }=300\) K, initial temperature of the solidifying cast \(T_0=960\) K, initial temperature of the casting mould \(T_{m,0}=590\) K, initial concentration of the alloy component \(Z_0=0.02\) and segregation coefficient \(k=0.125\).

Investigated problem consists in reconstruction of the heat transfer coefficient \(\alpha\) on boundary of the solidifying cast, together with the distribution of temperature inside the investigated region, on the basis of known measurements of temperature in selected point of the mould. The exact value of the sought heat transfer coefficient is known and is equal to \(250 \, [\hbox {W}/(\hbox {m}^2\hbox {K})]\), thanks to which we would be able to verify the exactness of obtained results.

In this study we took the exact value of the sought heat transfer coefficient equal to \(250\,\hbox {W}/\hbox {m}^2\hbox {K}\) (following the values taken in [7, 27, 28]). However, this is just the testing value and the procedure is prepared so that it gives the possibility to restore any value (or values) of this coefficient and for various values of input parameters.

The measurements of temperature were taken from one thermocouple (\(N_1=1\)) located in the middle of the mould (in point \(x=0.5\)). We have executed four cycles of experiment, in which the measurements were read at every 1, 2, 5 and 10 s, respectively. For constructing functional (25) we used the exact values of temperature, determined for the known exact value of \(\alpha\), and values burdened by the 1 and 2 % random error of normal distribution.That is, if we denote the exact value of temperature as \(T_{exact}\), the pseudo-measurement value is generated according to distribution \(N(T_{exact},1\,\%\cdot T_{exact})\) or \(N(T_{exact},2\,\%\cdot T_{exact})\), respectively. Thanks to this variety of input data we could investigate stability of the procedure. Thus, we executed twelve experiments altogether.

In the preformed experiment we used one sensor since it appeared to be enough to solve the one-dimensional problem of considered kind. Of course the increase of data implies better reconstruction of the boundary condition. For solving two-dimensional inverse problems we had to increase the number of sensors to 4 (see [29] where the two-dimensional inverse Stefan problem is discussed or [30] where the two-dimensional inverse problem of the binary alloy solidification is considered).

Direct problem corresponding with the considered inverse problem was solved by applying the finite element method completed with the procedure of the temperature field correction in the vicinity of the liquidus and solidus curves, as it was said in Sect. 2. Region of the cast was divided into 200 and region of the mould into 100 equal elements. Step for the time interval was taken as 0.1 s. With respect to the time variable the implicit difference scheme was applied. And for avoiding the inverse crime we generated the input data for much more dense grid.

For minimizing functional (25) we used the ABC algorithm executed for number of bees \(SN=5\) and number of cycles \(MCN=10\). The initial locations of sources were randomly selected from interval [0, 1000]. These values of parameters were selected in result of some previous testing calculations [2022]. Let us also notice that the ABC algorithm belongs to the group of heuristic algorithms which means that each execution of the procedure can give slightly different results. Therefore, for being sure that the results are not accidental we evaluated the calculations for 10 times and the best of received results were accepted as the reconstructed elements.

For better understanding, the successive steps of numerical experiment, performed in order to verify the invented procedure of solving the considered inverse problem, are included in the flowchart presented in Fig. 2.

Fig. 2
figure 2

Flowchart illustrating the method of solving the inverse problem

In Table 1 there are collected the mean values of heat transfer coefficient \(\alpha\) reconstructed in ten executions of the procedure in all twelve performed experiments. In each considered case the identified mean value is completed by the relative error of the reconstruction. Analyzing the results we may observe that the increase of input perturbation causes the increase of reconstruction error, which is understandable, but in each considered case the reconstruction errors are lower than the input data errors. Frequency of taken measurements does not influence significantly the obtained results. It can be noticed that, in general, the respective relative errors in four cycles of experiments are similar, however two errors differ from the others (second cycle, 2 % noise and third cycle, 1 % noise). It may be explained by the fact that the minimized functional is constructed on the basis of burdened data, therefore it may accidentally happen that the reconstructed values adopt better to worse values than to the exact values. Results obtained in all ten executions of procedure in each considered case were very similar, standard deviations of the results in each case were close to zero. These facts indicate stability of the discussed procedure.

Table 1 Reconstructed mean values of the heat transfer coefficient \(\alpha\) and relative errors (\(\delta _{\alpha }\)) of these reconstructions obtained for the unnoised input data and input data burdened by 1 and 2 % error, for the successive cycles of measurements

Another element which should be reconstructed to accept the problem as solved is the distribution of temperature in investigated region. Relative and maximal absolute errors of temperature reconstruction obtained for the unnoised input data and input data burdened by 1 and 2 % error for the successive cycles of measurements are compiled in Table 2. One can see that all the values of errors are marginal. Comparing the results collected in Tables 1 and 2 one can notice that the errors of heat transfer coefficient reconstruction are not linearly translated into the errors of temperature reconstruction. Errors of the coefficient reconstruction are greater, whereas the temperature reconstruction is burdened with very small error. We observe this tendency in solving the inverse problems of considered kind described by means of various mathematical models and by applying methods based on various algorithms (see also [8, 2022]). So we accept it as the specificity of the inverse problem solved by using the discussed procedure. Additionally, the distributions of relative errors of the reconstructed temperature in control point obtained for the unnoised input data and the input data burdened by 2 % error, for the cycles of measurements taken at every 5 s, are presented in Figs. 3 and 4, respectively. Similar collection of results, but received for the cycles of measurements taken at every 10 s, is shown in Figs. 5 and 6. For the perturbed input data the errors increase, but in the entire time interval they remain at the very low level. All presented results confirm very good reconstruction of temperature in considered problem.

Table 2 Relative (\(\delta _T\)) and maximal absolute (\(\varDelta _{T}\)) errors of temperature reconstruction obtained for the unnoised input data and input data burdened by 1 and 2% error, for the successive cycles of measurements
Fig. 3
figure 3

Relative error of the reconstructed temperature distribution in control point obtained for the cycle of measurements taken at every 5 s and for the unnoised input data

Fig. 4
figure 4

Relative error of the reconstructed temperature distribution in control point obtained for the cycle of measurements taken at every 5 s and for 2 % noise of input data

Fig. 5
figure 5

Relative error of the reconstructed temperature distribution in control point obtained for the cycle of measurements taken at every 10 s and for the unnoised input data

Fig. 6
figure 6

Relative error of the reconstructed temperature distribution in control point obtained for the cycle of measurements taken at every 10 s and for 2 % noise of input data

In Figs. 7, 8 and 9 there are compared the distributions of temperature in control point reconstructed on the basis of measurements taken at every 10 s and burdened with error of normal distribution and standard deviation equal to 0, 1 and 2 % of the temperature exact values, respectively, with the respective measurements. One may observe, especially in the first analyzed case, that the reconstructed values of temperature are compatible with the actual measurements which confirms the data collected in Table 2.

Fig. 7
figure 7

Comparison of the distribution of temperature in control point, reconstructed on the basis of unnoised measurements taken at every 10 s, with the measurement values

Fig. 8
figure 8

Comparison of the distribution of temperature in control point, reconstructed on the basis of measurements noised with 1 % error and taken at every 10 s, with the measurement values

Fig. 9
figure 9

Comparison of the distribution of temperature in control point, reconstructed on the basis of measurements noised with 2 % error and taken at every 10 s, with the measurement values

Next, we have chosen another point, different than the control point, in which we compared the distributions of temperature restored by using measurement values of various standard deviations (0, 1 and 2 % of the temperature exact values). Because the obtained distributions are very similar, they cover in the plot, therefore in Figs. 10 and 11 there are presented the comparisons of absolute errors of temperature reconstruction received in all three considered cases of standard deviation of the input data perturbation, for readings of temperature made at every 2 s and 10 s, respectively. The obtained absolute errors are very small in every case.

Fig. 10
figure 10

Comparison of the absolute errors of temperature in point x = 0.2 m reconstructed on the basis of measurements taken at every 2 s and noised with errors of various standard deviations (0, 1 and 2 % of temperature exact values)

Fig. 11
figure 11

Comparison of the absolute errors of temperature in point x = 0.2 m reconstructed on the basis of measurements taken at every 10 s and noised with errors of various standard deviations (0, 1 and 2 % of temperature exact values)

Finally, Figs. 12 and 13 display the distributions of temperature in two moments of time (some internal moment t = 125 s and the final moment t = 500 s) reconstructed on the basis of measurements taken at every 10 s and noised with errors of standard deviation equal to 2 % of the temperature exact values. Plots of the temperature distributions in the same moments of time, restored on the ground of measurements read with the same frequency but for the standard deviation equal to 0 and 1 % of the temperature exact values, are very similar.

Fig. 12
figure 12

Distribution of temperature in moment t = 125 s reconstructed on the basis of measurements taken at every 10 s and noised with errors of standard deviation equal to 2 % of temperature exact values

Fig. 13
figure 13

Distribution of temperature in moment t = 500 s reconstructed on the basis of measurements taken at every 10 s and noised with errors of standard deviation equal to 2 % of temperature exact values

6 Summary

Scope of the presented paper was the proposal of procedure useful for solving the inverse problem of the binary alloy solidification in the casting mould. In investigated problem we considered the region taken by the solidifying material and region of the casting mould. Outside of the mould, on the boundary of solidifying alloy, the third kind boundary condition was defined, in which the heat transfer coefficient appeared. Identification of this coefficient as well as the reconstruction of temperature were the aim of presented procedure.

Proposed approach was based on the mathematical model suitable for describing investigated solidification process, the lever arm model describing the macrosegregation process, the finite element method completed with the appropriate procedure of the temperature field correction for solving the direct problem associated with the inverse problem and the Artificial Bee Colony algorithm for minimizing the functional expressing the error of approximate solution. The sought elements were reconstructed on the basis of known measurements of temperature in selected points of the mould. The proposed procedure was studied with regard to the precision of obtained results and stability of working.

Numerical verification of the approach indicates that it works very well in reconstructing the sought elements. In each investigated case of input data and for each frequency of taken measurements the errors of heat transfer coefficient identification were smaller than the errors of input data and the errors of temperature reconstruction were insignificant. Moreover, the results obtained in multiple execution of the procedure were very similar which confirms stability of the method. Summing up, the proposed procedure constitutes the effective tool for solving the inverse problem of considered kind.