1 Introduction

Moving boundary problems are ubiquitous in engineering and biological systems such as melting or solidification [1, 2], tumor growth and wound healing [3], free surface flows [4], and electrophotography [5]. Usually, moving boundaries split the solution domain with different governing PDEs for each subdomain. Also, interface of the split regions obeys a different governing equation [5,6,7], often expressed in its own coordinate system. Therefore, the moving boundary of the domain is solved in addition to the field variables. These features make physical systems with moving boundaries an intriguing and challenging case for learning their governing PDEs from field measurements.

Stefan type problems represent a suitable model for learning in the context of moving boundaries. Stefan problem describes heat transfer and interface evolution between a liquid and a solid domain. They have long been used as a benchmark problem for numerical solvers with a rich literature [8]. Various implicit and explicit solvers were developed to solve forward and inverse Stefan problem [1, 9, 10]. Recently, Wang and Perdikaris [11] proposed a Physics-Informed Neural Network (PINN) solver for forward and inverse solutions of a Stefan type problem. They assume that either physics or data about the system are partially available, such as certain terms in the PDEs or sparse measurements. Hence, their approach is not applicable if the terms in the governing equation are not known. When the governing equation of the system is unknown and the only available information is the measured data, reliable and physically consistent predictions can be made by discovering the underlying physics of the system from the field measurements. Purely data driven methods such as Dynamic Mode Decomposition (DMD) also offers successful short-term predictions [12]. However, model discovery reveals interpretable models with more generalization capabilities [13].

Model discovery, particularly in the presence of noise is a challenging task. Bongard and Lipson [14] used a symbolic regression approach to discover governing equations of dynamical systems from measurements. Schaeffer [15] introduced the concept of sparse learning of PDEs. The key idea is to numerically calculate the time derivatives of the field data and create a matrix that comprises the spatial derivatives of the field data and subsequently cast the problem as a sparse regression between the two steps. Sparse regression is the mechanism to inflict parsimony. Schaeffer [15] solved sparse optimization with the Douglas-Rachford algorithm. This makes the framework robust to noise in time derivatives of the field variable. Brunton et al. [16] introduced Sparse Identification of Nonlinear Dynamics (SINDy). SINDy is a versatile framework with an efficient sparse optimization algorithm. They convert the nonlinear model identification to linear system of equations similar to [15] and solve for the sparse optimization by sequentially thresholding the least squares solutions to promote sparsity. In their influential work, Zhang and Schaeffer [17] analyzed the convergence behavior of SINDy, strengthening the theoretical foundation of the method. Subsequently, SINDy has been widely adopted in the field of learning PDEs and applied to a wide range of problems [18,19,20,21]. Inspired by [22], Messenger and Bortz extended the work to leverage the weak formulation of ODEs and PDEs (Weak SINDy) [23, 24]. This method eliminates the pointwise approximation of derivatives using the weak form integral and significantly increases noise tolerance of SINDy algorithm. Fasel et al. [25] combined ensemble learning with the SINDy algorithm and introduced Ensemble SINDy. They demonstrated the capabilities of Ensemble SINDy by recovering the coefficients of several PDEs from noisy and scarce measurements. While Ensemble SINDy may not be as effective as Weak SINDy in handling noise, it can be used for experiments with moving boundaries because of the pointwise and corotational nature of the the problem. Furthermore, Ensemble SINDy can be combined with Weak SINDY to enhance its performance.

Combining Ensemble SINDy and Peridynamic Differential Operator (PDDO) introduced by Madenci et al. [26], we propose a discovery framework for learning dynamics of moving boundaries. We assume the moving boundary physics is governed in its own corotational coordinate system, with normal and tangential directions to the boundary, and its derivatives are calculated using the PDDO. The PDDO enables differentiation through integration and does not require uniform sensor placement. It simply considers the interaction between neighboring points for the evaluation of derivatives, it can be used to calculate derivatives in any coordinate system by a straightforward modification and it integrates well with the existing PDE discovery methods [27]. There appears no study in the open literature addressing the discovery of governing equations of moving boundaries.

This study is organized as follows. In Sect. 2, we explain the Ensemble SINDy. In Sect. 3, we briefly describe the multiphysics PDE model, Fisher–Stefan model and the numerical experiment to create training data synthetically. In Sect. 4, we present the results and performance of the proposed learning framework for different levels of noise in experimental data. Finally, we discuss the results and summarize the main conclusions in Sect. 5.

2 Ensemble SINDy

Introduced by Brunton et al. [16], SINDy algorithm for sparse learning of PDEs is based on

$$\mathop {\arg \min }\limits_{{{\varvec{\upalpha}}}} \left\| {{\mathbf{V}} - {\mathbf{F\alpha }}} \right\|_{2}^{2} + \lambda \left\| {{\varvec{\upalpha}}} \right\|_{1} ,$$
(1)

in which \({\mathbf{F}}\) and \({\mathbf{V}}\) are the feature matrix and velocity vector, respectively. The vector \({{\varvec{\upalpha}}}\) contains the unknown coefficients appearing in the PDE and \(\lambda\) is sparsity regularization parameter. An example of feature matrix \({\mathbf{F}}\), consisting of the field variable \(u\) and its spatial derivatives in one dimensional space, \(x\) can be constructed as

$${\mathbf{F}} = \left[ {\begin{array}{*{20}c} 1 & {u(x_{1} ,t_{1} )} & {u_{x} (x_{1} ,t_{1} )} & \cdots & {u_{xxx}^{3} (x_{1} ,t_{1} )} \\ 1 & {u(x_{2} ,t_{1} )} & {u_{x} (x_{2} ,t_{1} )} & \cdots & {u_{xxx}^{3} (x_{2} ,t_{1} )} \\ 1 & {u(x_{3} ,t_{1} )} & {u_{x} (x_{3} ,t_{1} )} & \cdots & {u_{xxx}^{3} (x_{3} ,t_{1} )} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & {u(x_{n - 1} ,t_{m} )} & {u_{x} (x_{n - 1} ,t_{m} )} & \cdots & {u_{xxx}^{3} (x_{n - 1} ,t_{m} )} \\ 1 & {u(x_{n} ,t_{m} )} & {u_{x} (x_{n} ,t_{m} )} & \cdots & {u_{xxx}^{3} (x_{n} ,t_{m} )} \\ \end{array} } \right],$$
(2)

where each column represents a different feature at \(n\) spatial points and \(m\) time instances (snapshots); the first column consists of unit values to accommodate for the bias term of the solution, i.e., a potential constant source. The velocity vector \({\mathbf{V}}\) consisting of the time derivative of the field variable \(u\) is expressed as

$${\mathbf{V}}^{T} = \left\{ {\begin{array}{*{20}c} {u_{t} (x_{1} ,t_{1} )} & {u_{t} (x_{2} ,t_{1} )} & {u_{t} (x_{3} ,t_{1} )} & \cdots & {u_{t} (x_{n - 1} ,t_{m} )} & {u_{t} (x_{n} ,t_{m} )} \\ \end{array} } \right\}.$$
(3)

The SINDy algorithm restates Eq. (1) as

$$\begin{gathered} {{\varvec{\upalpha}}}^{0} = \left( {{\mathbf{F}}^{T} {\mathbf{F}}} \right)^{ - 1} {\mathbf{F}}^{T} {\mathbf{V}} \hfill \\ S^{k} = \left\{ {j \in [n_{f} ]:\left| {{{\varvec{\upalpha}}}_{j}^{k} } \right| \ge \lambda } \right\},\,\,\,\,k \ge 0 \hfill \\ {{\varvec{\upalpha}}}^{k + 1} = \mathop {\arg \min }\limits_{{{{\varvec{\upalpha}}} \in {\mathbb{R}}^{{n_{f} }} :\sup ({{\varvec{\upalpha}}}) \subseteq S^{k} }} \left\| {{\mathbf{V}} - {\mathbf{F\alpha }}} \right\|_{2} ,\,\,\,\,k \ge 0, \hfill \\ \end{gathered}$$
(4)

where \(n_{f}\) is the number of features in the feature matrix. As shown by Zhang and Schaeffer [17], this algorithm presents attractive convergence features. However, it performs poorly in the presence of high correlation between the columns of feature library. On the other hand, STRidge algorithm is robust to the correlation between features. Therefore, Eq. (1) is modified to contain a penalty term, \(\lambda_{2}\) and it can be recast as

$$\mathop {\arg \min }\limits_{{{\varvec{\upalpha}}}} \left\| {{\mathbf{V}} - {\mathbf{F\alpha }}} \right\|_{2}^{2} + \lambda_{1} \left\| {{\varvec{\upalpha}}} \right\|_{1} + \lambda_{2} \left\| {{\varvec{\upalpha}}} \right\|_{2} ,$$
(5)

where \(\lambda_{1}\) is the penalty parameter enforcing sparsity and \(\lambda_{2}\) is the penalty parameter regularizing the magnitude of the recovered coefficients. The optimization of Eq. (5) can be achieved through the STRidge algorithm as

$$\begin{gathered} {{\varvec{\upalpha}}}^{0} = \left( {{\mathbf{F}}^{T} {\mathbf{F}} + \lambda_{2} {\mathbf{I}}} \right)^{ - 1} {\mathbf{F}}^{T} {\mathbf{V}} \hfill \\ S^{k} = \left\{ {j \in [n_{f} ]:\left| {{{\varvec{\upalpha}}}_{j}^{k} } \right| \ge \lambda_{1} } \right\},\,\,\,\,k \ge 0 \hfill \\ {{\varvec{\upalpha}}}^{k + 1} = \mathop {\arg \min }\limits_{{{{\varvec{\upalpha}}} \in {\mathbb{R}}^{{n_{f} }} :\sup ({{\varvec{\upalpha}}}) \subseteq S^{k} }} \left\| {{\mathbf{V}} - {\mathbf{F\alpha }}} \right\|_{2} + \lambda_{2} \left\| {{\varvec{\upalpha}}} \right\|_{2} ,\,\,\,\,k \ge 0. \hfill \\ \end{gathered}$$
(6)

This algorithm has been used successfully to recover governing nonlinear partial differential equations [28]. However, the success of this algorithm diminishes significantly in the presence of noise [28].

It is worth mentioning that the omission of higher-order terms in Eq. (2) is not due to any limitations of the method itself. While the method does not guarantee the discovery of the exact governing equation, it has been empirically proven effective in many cases. For instance, Shaeffer [15] notes that in the context of the KdV equation, phenomena such as traveling waves and solitons can create ambiguity, as the same dataset might be generated by different equations.

Fasel et al. [25] combined SINDy with ensemble learning to handle noisy measurements. Ensemble algorithms, which aggregate multiple hypotheses from a base learning algorithm, offer statistical, computational, and representational advantages over conventional algorithms such as the decision trees, k-nearest neighbors, support vector machines, and logistic regression [29]. Generally, the resulting ensemble algorithm is significantly more accurate than the original classifier. However, unstable learning algorithms i.e., learning algorithms which are sensitive to small changes in training dataset, should be used to leverage the full potential of ensemble methods.

Bagging (Bootstrap aggregating) [29] is one of the well known ensemble methods which is based on running the same learning method over different subsets of the same dataset. In Bagging, given a set of \(M\) data points, \(N\) distinct datasets are created by uniformly sampling \(M\) data points with replacement. The original algorithm is trained on generated datasets and finally, hypotheses are combined with aggregating the trained models by using the sample mean. Bragging (Bootstrap robust aggregating) uses the sample median for aggregation instead.

Fasel et al. [25] use bagging and bragging with Eq. (5) as the base learner. They demonstrate the capability of the proposed method by recovering the coefficients of several PDEs from noisy and scarce measurements. The instability of the learner is ensured by systematically removing features from the feature matrix and adding random noise to the dataset. The main algorithm for the Ensemble SINDy approach is shown in Fig. 1.

Fig. 1
figure 1

Ensemble SINDy algorithm

In this study, Ensemble SINDy approach is applied to learning 2D Fisher–Stefan system. This system involves a reaction–diffusion equation along with a moving boundary equation referred to as the Stefan condition. First equation evolves in a Cartesian coordinate system while the Stefan condition is defined in reference to the coordinate system of the moving boundary. Therefore, feature matrices for the discovery of Stefan condition is constructed using derivatives with respect to the moving boundary corotational coordinate system.

3 2D Fisher–Stefan problem

This study concerns the recovery of the governing equation of the 2D Fisher–Stefan model [30]. Tam et al. [31, 32] recently conducted an extensive study on the 2D Fisher–Stefan model. This model has practical applications, such as representing cell tumor growth, fibroblast cells invading a partial wound or porous media modeling for population dynamics [33] making it tangible and important. We created the dataset using the open-source Julia code shared by Tam et al. [31, 32]. Also, the details of dataset generation is explained Appendix 3. 2D Fisher–Kolmogorov–Petrovsky–Piskunov (Fisher–KPP) equation is expressed as

$$\frac{\partial u}{{\partial t}} = \nabla \cdot \left( {\nabla u} \right) + u\left( {1 - u} \right),\,\,{\text{for}}\,\,{\mathbf{x}} \in \Omega_{1} ,$$
(7)

where \(u({\mathbf{x}},t)\) denotes the population density extending the problem domain \(\Omega_{1}\) by spreading to the complement domain \(\Omega_{2}\). As the moving boundary progresses towards \(\Omega_{2}\), \(\Omega_{2}\) gradually shrinks, and \(\Omega_{1}\) expands accordingly. This expansion of \(\Omega_{1}\) represents the spreading of the population density into the complementary domain, effectively extending the problem domain.

It is assumed that the regions \(\Omega_{2}\) and \(\Omega_{2}\) are predefined and available at every timestep. In practical applications, these regions may require a priori segmentation from the observations. This segmentation can be done manually or by using a model like UNet, which is well-suited for such tasks.

This equation is a reaction–diffusion equation and has a logistic type of nonlinear source term on the right hand side \(u\left( {1 - u} \right)\) which controls the growth and competition of the species \(u\) [34]. Inspired by the classical Stefan problem [8, 35], Fisher–Stefan problem is defined by coupling Fisher–KPP equation with a moving boundary \(\Gamma \left( {{\mathbf{x}},t} \right) = \partial \Omega_{1} \cap \partial \Omega_{2}\). This boundary moves in its normal direction defined by the gradient of the population density. As a result, the problem domain \(\Omega_{1}\) evolves with the moving boundary. The Stefan and Dirichlet boundary conditions defined on the moving boundary are

$$\frac{{\partial \Gamma_{n} }}{\partial t} = - \kappa \nabla u \cdot {\mathbf{n}}\,{\text{ and}}\,\,\,u = u_{f} \,\,\,{\text{for}}\,\,\,{\mathbf{x}} \in \Gamma ,$$
(8)

where \(\kappa > 0\) is the Stefan parameter, which connects the gradient of population density and surface evolution velocity. We consider two distinct test cases (datasets) for learning the governing equations of this system: (1) a vertical moving boundary with a sinusoidal perturbance, and (2) a circular moving boundary with irregularity.

3.1 Vertical moving boundary with a sinusoidal perturbation

Spatial domain for this problem is defined as \({\mathbf{x}} \in [0,10] \times [0,10][0,10]\) and boundary conditions in \(y\) direction are defined as periodic. Initial-boundary conditions for this problem are depicted in Fig. 2.

Fig. 2
figure 2

Initial-boundary conditions for the 2D Fisher–Stefan problem with a vertical moving boundary having a sinusoidal perturbation

The remaining boundary condition on the left edge representing a fixed population density and the periodic boundary conditions in \(y\) direction are expressed as

$$\begin{gathered} u\left( {0,y,t} \right) = u_{\ell } \\ u\left( {x,y + nL_{y} ,t} \right) = u\left( {x,y,t} \right),\,\,\,{\text{for}}\,\,\,n \in {\mathbb{Z}}, \\ \end{gathered}$$
(9)

where \(L_{y} = 10\) is the length of the domain in \(y\) direction. The initial conditions are defined as

$$\begin{gathered} u\left( {{\mathbf{x}},0} \right) = u_{0} \left( {\mathbf{x}} \right),\,\,{\text{for}}\,\,{\mathbf{x}} \in \Omega_{1} \\ u\left( {{\mathbf{x}},0} \right) = u_{f} ,\,\,{\text{for}}\,\,{\mathbf{x}} \in \Omega_{2} , \\ \end{gathered}$$
(10)

where \(u_{0} \left( {\mathbf{x}} \right)\) is obtained by solving two overdetermined second order ordinary differential equations as described in [32]. The solution to the system of equations is obtained for \(\kappa = 0.5\), \(\Delta x = \Delta y = 0.025\), \(\Delta t = 0.01\), \(t \in \left[ {0,5} \right]\) using the open source code shared by [32] and the rest of the parameters of the problem can be also found in [32]. As time progresses, this solution for the population density along with the moving boundary is depicted in Fig. 3.

Fig. 3
figure 3

Time evolution of the field data \(\Theta = \left[ {u,\Gamma } \right]\) for the 2D Fisher–Stefan problem with a vertical moving boundary having a sinusoidal perturbation

3.2 Circular moving boundary with irregularity

Figure 4 shows the spatial domain with \({\mathbf{x}} \in [ - 10,10] \times [ - 10,10]\) and the initial-boundary conditions.

Fig. 4
figure 4

Initial-boundary conditions for the 2D Fisher–Stefan problem with a circular moving boundary having irregularity

The initial position of the moving boundary \(\Gamma \left( {{\mathbf{x}},0} \right)\) is defined as

$$\Gamma \left( {{\mathbf{x}},0} \right) = 3.5 + 0.2\left( {\sin 3\theta + \sin 12\theta + \sin 16\theta } \right),$$
(11)

where

$$\theta = \tan^{ - 1} \frac{y}{x}.$$
(12)

The remaining boundary conditions on the outer edges representing fixed population density are expressed as

$$u\left( {{\mathbf{x}},0} \right) = 0\,\,{\text{for}}\,\,{\mathbf{x}} \in \partial \Omega_{2} .$$
(13)

The initial conditions are defined as

$$\begin{gathered} u\left( {{\mathbf{x}},0} \right) = u_{f} ,\,\,{\text{for}}\,\,{\mathbf{x}} \in \Omega_{1} \\ u\left( {{\mathbf{x}},0} \right) = 0,\,\,{\text{for}}\,\,{\mathbf{x}} \in \Omega_{2} . \\ \end{gathered}$$
(14)

The solution to the system of equations is obtained using the open source code shared by Tam and Simpson [31] for \(\kappa = 0.1\), \(\Delta x = \Delta y = 0.1\), \(\Delta t = 0.04\), \(t \in \left[ {0,40} \right]\). As time progresses, this solution for the population density along with the moving boundary is depicted in Fig. 5.

Fig. 5
figure 5

Time evolution of the field data \(\Theta = \left[ {u,\Gamma } \right]\) for the 2D Fisher–Stefan problem with a circular moving boundary having irregularity

3.3 Corotational coordinate system of the moving boundary and the surface evolution velocity

This section describes the learning of the underlying governing equations for the 2D Fisher–Stefan problem. The learning includes the 2D Fisher–KPP equation which evolves in a 2D Cartesian coordinate system and the governing equation for the moving boundary (Stefan condition) which evolves in its own corotational coordinate system.

The derivatives of the field are constructed by employing the PDDO [26, 41] as explained in Appendix 1. For the derivatives in Cartesian coordinate system, the approach described by Bekar and Madenci [27] is adopted without any special treatment. The derivatives in corotational coordinates are calculated by rotating the coordinate system to the normal and tangent directions to the interface at the “sensor” locations. The “sensor” locations refer to imaginary nodes situated on the moving boundary as well as on the nodes of discretization within the domain to draw analogy to measurement locations in a real experimental setup. The families of the material points (representing the unique set of points interacting with the point of interest inside a finite radius) are also demarcated using the tangents. This approach is described in Fig. 6.

Fig. 6
figure 6

Peridynamic (PD) families and interface coordinate system on the moving boundary

Coordinate transformation can be accomplished by using two different methods. The first method is based on the use of arctangents of the line sections between sensor locations on the moving boundary. The second method is based on the use of level sets. Using the snapshots of the moving boundary, the level set equation is solved and the gradients of level sets are calculated. These gradients after normalization define the normal directions to the moving boundary (interface).

Figure 7 illustrates the coordinate system rotation and advancing interface velocity calculations using panels between the coordinate locations on the interface. First, we consider a coordinate point, \(\tilde{p}_{i}^{t}\) between two neighboring points on the moving interface. Subsequently, we rotate the coordinate system based on the arctangent of the angle \(\theta\). At last, we calculate the distance vector \({\mathbf{s}}_{i}^{t}\) between the panel midpoint \(\tilde{p}_{i}^{t}\) and the nearest coordinate point on the moving interface in the next time step.

Fig. 7
figure 7

Discrete points on the moving boundary (interface), rotation of the coordinate system using panel angles and calculation of the distance vector

The norm of this distance vector can be divided to timestep size \(\Delta t\) to calculate the velocity of the interface in the normal direction as

$$\left[ {\frac{{\partial \Gamma_{n} }}{\partial t}} \right]^{i} \approx \frac{{\left| {{\mathbf{s}}_{i}^{t} } \right|}}{\Delta t}.$$
(15)

An alternative approach is to rotate the vector \({\mathbf{s}}_{i}^{t}\) using the calculated panel normal and use the norm of the resulting vector as

$$\left[ {\frac{{\partial \Gamma_{n} }}{\partial t}} \right]^{i} \approx \frac{{\left| {{\mathbf{s}}_{i}^{t} \cdot {\mathbf{n}}_{i}^{t} } \right|}}{\Delta t},$$
(16)

where \({\mathbf{n}}_{i}^{t}\) is the calculated panel normal at time \(t\) and location \(i\). As discussed in [36], the peridynamic analysis could provide an alternative method for computing normal directions to the boundary.

Our advancement scheme of material points on the moving boundary does not prevent the material point accumulation or crossing. However, the material points can be updated if accumulation occurs since the sensor locations on the moving boundary are based on visual data.

4 Numerical results

This section presents the numerical results of the recovery experiments conducted to test the proposed learning framework. It presents the recovered models for the Stefan condition and Fisher–KPP equation, obtained for different noise levels. The relative error of the model coefficients is calculated as

$$\varepsilon_{c} = \frac{{\left\| {{{\varvec{\upalpha}}} - {\hat{\mathbf{\alpha }}}} \right\|_{2} }}{{\left\| {{\varvec{\upalpha}}} \right\|_{2} }}.$$
(17)

where \({{\varvec{\upalpha}}}\) is the vector of ground truth coefficients and \({\hat{\mathbf{\alpha }}}\) is the vector of the recovered coefficients. Our framework is implemented in Python, the codes and data are available at: https://github.com/alicanbekar/MB_PDDO-SINDy.

4.1 Discovery of the Stefan condition

We employ Ensemble SINDy to discover the Stefan condition from the field measurements. The candidate features consisting of the field derivatives and their products are assembled as

$$\left[ {\begin{array}{*{20}c} 1 & u & {u_{{x_{n} }} } & {u_{{x_{t} }} } & {u_{{x_{n} }} \times u_{{x_{n} }} } & {u_{{x_{n} }} \times u_{{x_{t} }} } & {u_{{x_{t} }} \times u_{{x_{t} }} } & {u_{{x_{n} x_{n} }} } & {u_{{x_{t} x_{t} }} } & {u_{{x_{n} x_{t} }} } & {u_{{x_{n} x_{n} }} + } \\ \end{array} u_{{x_{t} x_{t} }} } \right].$$
(18)

The derivatives of the field variable \(u\) are constructed in the corotational coordinate system using the PDDO as described in detail in Appendix 1. This candidate space can also include derivatives of the field variable in the Cartesian coordinate system or higher-order derivatives and their products. In real life applications, the derivatives of the moving boundary curve with respect to the coordinate system of the field equation can also be added to the feature library, e.g. curvature of the moving boundary \(\nabla^{2} \Gamma\). It is worth noting that there is no guaranteed method for selecting the candidate space. However, we keep the candidate space simple and assume that it includes only the terms to explain the underlying dynamics of the moving boundary. Furthermore, we normalize each feature by its maximum absolute value to prevent the optimizer to be biased.

We test Ensemble SINDy with library bagging on 3 different noise levels. We aggregate the models by choosing the median of the recovered coefficients from different bootstrapped datasets. Additionally, we construct the probability distributions using Gaussian kernel estimation [37]. For the dataset with no measurement noise, we bootstrap the data for 60 times and bootstrap the features by leaving 3 out at every regression. This results in 9900 different tests. We calculate the inclusion probabilities of the features by dividing the number of appearances to the total number of tests. We set the threshold for the inclusion probability \(P_{inc}\) as 0.7. This means that we disregard the features appearing less than 70% of the time. We calculate the standard deviation of the coefficients of the features that appear more than \(P_{inc}\), and construct the confidence intervals using the margins of \(3\sigma\) from the mean \(\mu\).

We chose the parameters for the STRidge regression as \(\lambda_{1} = 0.3\) and \(\lambda_{2} = 1.0\). The selection of \(\lambda_{2} = 1\) is heuristic, and it is primarily used to regularize the ridge regression solutions between threshold operations. The value of \(\lambda_{1}\) can be chosen using information criteria like BIC [38] or AIC [39]. The Python library we share contains a function to evaluate the AIC scores of the models and returns the suitable value for \(\lambda_{1}\).

4.1.1 Discovery of the vertical moving boundary with a sinusoidal perturbation

Figure 8 depicts the recovered coefficients, uncertainties, inclusion probabilities and the probability density estimations for the case with clean data. It shows that out of 11 terms, only 8 terms appear at least once. Also, majority of the recovered coefficients appear less than 3% of the time. Only 2 terms have significant inclusion probabilities, \(u_{{x_{n} }}\) and \(u_{{x_{n} }} \times u_{{x_{n} }}\). Considering the correlation among them makes this appearance rational. The only term appearing more than the threshold probability is \(u_{{x_{n} }}\) with \(P_{inc} = 0.788\) and median value of 0.514, which is the term responsible for the underlying dynamics of the moving boundary. We calculate \(\varepsilon_{c}\) using Eq. (17) as 0.028 which corresponds to less than 3% relative error in the recovered coefficient.

Fig. 8
figure 8

Median values, 99% \(\left( {\mu \pm 3\sigma } \right)\) confidence intervals and inclusion probabilities for the Stefan condition with a vertical moving boundary having a sinusoidal perturbation for the clean dataset

Figure 8 also shows the 99% or \(3\sigma\) confidence interval of the recovered coefficient of the feature \(u_{{x_{n} }}\). We use the limits of the confidence interval and solve for the moving boundary locations to show the uncertainty of the position of the interface. Figure 9 depicts the region of uncertainty, ground truth solution and solution obtained with the median value from the recovery. We also provide the Fréchet distance between the ground truth and predictions in Appendix 4. Since the dataset is clean, the recovered coefficients and the position of the moving boundary has a narrow region of uncertainty. Furthermore, the solution obtained with the median value of the recovery coincides with the ground truth solution.

Fig. 9
figure 9

Interface positions with the confidence intervals at \(t = 1,2,3,4\;{\text{s}}\) for the clean data case with a vertical moving boundary having a sinusoidal perturbation

Subsequently, we add noise to the training data as \(\overline{u} = u + n\) where \(n \sim {\mathcal{N}}\left( {0,\sigma^{2} } \right)\) and \({\mathcal{N}}\left( {\mu ,\sigma^{2} } \right)\) is Gaussian random variable defined as \(f(x) = {{e^{{{{ - \left( {x - \mu } \right)^{2} } \mathord{\left/ {\vphantom {{ - \left( {x - \mu } \right)^{2} } 2}} \right. \kern-0pt} 2}\sigma^{2} }} } \mathord{\left/ {\vphantom {{e^{{{{ - \left( {x - \mu } \right)^{2} } \mathord{\left/ {\vphantom {{ - \left( {x - \mu } \right)^{2} } 2}} \right. \kern-0pt} 2}\sigma^{2} }} } {\sigma \sqrt {2\pi } }}} \right. \kern-0pt} {\sigma \sqrt {2\pi } }}\) with \(\sigma\) and \(\mu\) representing the standard deviation and mean of the distribution, respectively, where \(\sigma\) is chosen to be the standard deviation of \(u\). The noise magnitude \(\eta\) multiplied with \(\sigma\) to introduce the desired level of noise to the dataset. The data is corrupted by considering 1% Gaussian random noise for the first trial. The learning and bragging parameters are the same as those of the clean data case.

Figure 10 depicts that adding noise increases the probability of irrelevant features appearing in the recovered model. Also, the confidence interval of the coefficient of the feature \(u_{{x_{n} }}\) increases and \(3\sigma\) confidence interval corresponds to \(\left[ {0.316,0.617} \right]\). Interestingly, inclusion probability of the correct model also increases with \(P_{inc} = 0.975\) and median value of 0.504 is closer to the ground truth value compared to the case with clean data (\(\varepsilon_{c} = 0.008\)). This is caused by the probabilistic nature of the bagging process. However, noise in the field data increases the uncertainty of the recovered model, making the recovered median value less reliable. Figure 11 depicts that the noise in the dataset widens the 99% confidence interval and increases the uncertainty of the predicted position of the moving boundary. However, the recovered position using the recovered coefficient still overlaps with the ground truth position at\(t=4s\).

Fig. 10
figure 10

Median values, 99% \(\left( {\mu \pm 3\sigma } \right)\) confidence intervals and inclusion probabilities for the Stefan condition with a vertical moving boundary having a sinusoidal perturbation using dataset with \(1\%\) noise level

Fig. 11
figure 11

Interface positions with the confidence intervals at \(t = 1,2,3,4\;{\text{s}}\) for the case of 1% Gaussian noise case with a vertical moving boundary having a sinusoidal perturbation

Finally, we corrupt the data by considering 5% Gaussian random noise. The learning and bragging parameters are the same as those of the clean data case. Figure 12 shows the results for the recovery. The \(3\sigma\) confidence interval of the coefficient of the feature \(u_{{x_{n} }}\) corresponds to \(\left[ { - 0.054,0.732} \right]\) with the median value of 0.387 (\(\varepsilon_{c} = 0.226\)) which indicates a larger error. Nonetheless, Ensemble SINDy can properly identify the responsible terms for underlying dynamics even in the presence of relatively high measurement noise.

Fig. 12
figure 12

Median values, 99% \(\left( {\mu \pm 3\sigma } \right)\) confidence intervals and inclusion probabilities for the Stefan condition with a vertical moving boundary having a sinusoidal perturbation using dataset with \(5\%\) noise level

Figure 13 illustrates an increasing discrepancy between the ground truth position and the recovered position as noise levels escalate. However, compared to the confidence region, recovered position is relatively close to the ground truth position. Table 1 in Appendix 2 shows the comparison of the recovered coefficients with the ground truth model.

Fig. 13
figure 13

Interface positions with the confidence intervals at \(t = 1,2,3,4 \, s\) for the 5% Gaussian noise case with a vertical moving boundary having a sinusoidal perturbation

4.1.2 Discovery for circular moving boundary with irregularity

For this case, we modify the sparsity penalty and change it from \(\lambda_{1} = 0.3\) to \(\lambda_{1} = 0.1\). The reason for this modification is that none of the inclusion probabilities exceed the threshold inclusion probability for \(\lambda_{1} = 0.3\). Figure 14 depicts the results of the ensemble process for the clean dataset.

Fig. 14
figure 14

Median values, 99% \(\left( {\mu \pm 3\sigma } \right)\) confidence intervals and inclusion probabilities for the Stefan condition with a circular moving boundary having irregularity using the clean dataset

Figure 14 shows that \(u_{{x_{n} }}\) is the only relevant term explaining the underlying dynamics of the moving boundary, with \(P_{inc} = 0.714\) and median value of 0.086 (\(\varepsilon_{c} = 0.14\)). It can be seen that compared to Fig. 9, Fig. 15 shows a broader region of uncertainty. This is primarily caused by the longer duration of the analysis \(t = 40\).

Fig. 15
figure 15

Interface positions with the confidence intervals at \(t = 4,16,24,40\;{\text{s}}\) for the clean data case with a circular moving boundary having irregularity

Subsequently, we corrupt the data using 1% Gaussian random noise. Figure 16 shows that added noise widens the confidence interval to \(\left[ {0.037,0.166} \right]\). However, the median value of 0.105 is closer to the ground truth value compared to the case with the clean data (\(\varepsilon_{c} = 0.05\)).

Fig. 16
figure 16

Median values, 99% \(\left( {\mu \pm 3\sigma } \right)\) confidence intervals and inclusion probabilities for the Stefan condition with a circular moving boundary having irregularity using dataset with \(1\%\) noise level

Figure 17 shows that recovered position using the median value of the recovered coefficient still overlaps with the ground truth position at \(t = 40\) despite the added noise.

Fig. 17
figure 17

Interface positions with the confidence intervals at \(t = 4,16,24,40\;{\text{s}}\) for the 1% Gaussian noise case with a circular moving boundary having irregularity

Finally, we corrupt the data using 5% Gaussian random noise. Figure 18 shows that similar to the clean data case of the vertical moving boundary having a sinusoidal perturbation, the term \(u_{{x_{n} }} \times u_{{x_{n} }}\) appears in addition to the term \(u_{{x_{n} }}\). The \(3\sigma\) confidence interval of the coefficient of the feature \(u_{{x_{n} }}\) corresponds to \(\left[ {0.048,0.204} \right]\) with the median value of 0.106 (\(\varepsilon_{c} = 0.06\)). Figure 19 shows the recovered position using the median value of recovered coefficients.

Fig. 18
figure 18

Median values, 99% \(\left( {\mu \pm 3\sigma } \right)\) confidence intervals and inclusion probabilities for the Stefan condition with a circular moving boundary having irregularity using dataset with \(5\%\) noise level

Fig. 19
figure 19

Interface positions with the confidence intervals at \(t = 4,16,24,40\;{\text{s}}\) for the 5% Gaussian noise case with a circular moving boundary having irregularity

Table 2 in Appendix 2 shows the comparison of the recovered coefficients with the ground truth model.

4.2 Discovery of the Fisher–KPP Equation

For this case, we also employ Ensemble SINDy to discover the Fisher–KPP equation from the field measurements. Our candidate space terms for the discovery are based on the assumption that the population density evolves in a Cartesian coordinate system. Therefore, the derivatives of the field variable \(u\) are constructed in \(x\) and \(y\) directions. This is the inductive bias of our model for the Fisher–KPP equation. The candidate space consisting the field derivatives and their products is assembled as

$$\left[ {\begin{array}{*{20}c} 1 & u & {u^{2} } & {\nabla^{2} u} & {u_{x} } & {u_{y} } & {u_{xx} } & {u_{xy} } & {u_{yy} } & {u_{y} u_{xx} } \\ \end{array} } \right].$$
(19)

Again, we keep the candidate space simple because of the computational burden of the ensembling process and assume that it includes only the terms to explain the underlying dynamics of the Fisher–KPP equation. We scale each feature by its maximum absolute value.

Fisher–KPP equation with the chosen initial conditions is a challenging case for discovery. The main reason for this is that the saturation of the concentration values far from the moving boundary. When the field variable saturates, its derivatives vanish, giving no information about the field equation; nevertheless, we use Ensemble SINDy with library bagging on Fisher–KPP equation to discover the underlying dynamics. For the dataset with no measurement noise, we bootstrap the data for 60 times and bootstrap the features by leaving 1 out at every regression. This results in 600 different tests. We set the threshold for the inclusion probability \(P_{inc}\) as 0.7. We calculate the standard deviation of the coefficients of the features appearing more than \(P_{inc}\) and construct the confidence interval using \(3\sigma\). The learning and parameters are specified as the same as those of the Stefan condition experiments. Figure 20 shows the results for the recovery for Fisher–KPP equation.

Fig. 20
figure 20

Median values, 99% \(\left( {\mu \pm 3\sigma } \right)\) confidence intervals and inclusion probabilities for the Fisher–KPP equation using the clean dataset

Figure 20 shows that the terms \(u\) and \(u^{2}\) appear with \(P_{inc} = 0.889\) and median values have the same magnitude ± 0.980 with opposite signs. This means that these terms appear as a pair and can be combined to a form \(u(1 - u)\). Laplacian term \(\nabla^{2} u\) appears with \(P_{inc} = 0.778\) which is also greater than the threshold probability with the median value 0.972. Other appearing terms \(u_{xx}\) and \(u_{yy}\) also show up in pairs when Laplacian term is singled out, which is combined to form the Laplacian term. Hence, all recovered coefficients are relevant but the algorithm chooses the parsimonious solution. We calculate \(\varepsilon_{c}\) as 0.022 which corresponds to less than 3% relative error in the recovered coefficients. Figure 21 shows the absolute error between the ground truth solution and the recovered solution with the largest error being \(\approx 4 \times 10^{ - 3}\).

Fig. 21
figure 21

The absolute error between the ground truth and the recovered solutions

Additional Gaussian noise in Fisher–KPP equation results in recovering incorrect models, vanishing derivatives might be the real cause of this failure. A potential solution to this issue can be the initialization of the same model multiple times with varying initial conditions; thereby generating a more diverse training dataset. Additionally Weak SINDy can be employed for this problem to increase recovery success. However, Weak SINDy is beyond the scope of this study.

5 Discussion and conclusions

This study proposes a novel framework for learning underlying physics of processes with moving boundaries. By combining the recently introduced Ensemble SINDy and PDDO, we have successfully recovered the moving boundary equation and Fisher–KPP equation of Fisher–Stefan model. We impose the inductive bias assuming that the corotational coordinate system admits the parsimonious dynamical model. While this inductive bias does not limit the additional features evolving in a Cartesian coordinate system, it is a critical part of the algorithm. We have demonstrated the robustness of the present approach by considering various levels of noise in the measured data. We present the confidence intervals of recovered coefficients and demonstrate the uncertainties of the moving boundary positions by obtaining the solutions using the recovered coefficients.

Although the main focus is Fisher–Stefan model, this proposed framework is applicable to any kind of moving boundary problem with a smooth interface without a transitional region between the interacting domains. There are many other potential applications of the proposed framework, but one interesting application can be the discovery of mathematical models for regrowing limbs and tissue [40, 41]. Regrowing limbs by nature is a moving boundary problem, and mathematical understanding of this complex mechanism can help researchers govern or predict the process better. Exploring the physics of crystal growth presents another valuable application. Understanding these dynamics is crucial for enhancing the efficiency and quality of semiconductor production.

In spite of the success of the proposed framework for learning physics with moving boundaries, there is still room for improvement. One limitation is locating the moving boundary. We assume that the location of the moving boundary is known beforehand. This process can be automated using a segmentation algorithm. Another improvement is to use the suitable measurement techniques for moving boundary problems because field measurements can disturb the moving boundary. One suitable way can be digital partical image thermometry/velocimetry [42] for measuring the temperature change while following the moving boundary using the visual input. An additional feature to the proposed algorithm can be discovery of parametric PDEs. Ultimately, proposed algorithm might also be integrated with the Weak SINDy approach, this can allow the recovery of Fisher–KPP equation in presence of noise. A possible extension of the Weak SINDy can be by using the weak form of peridynamics for discovering the nonlocal forms of the local PDEs [42]. The assumption of the parsimonious dynamics evolve in moving boundary curve corotational coordinate system can also be relaxed using an approach similar to [18].