Equation (
2) can be solved numerically using the finite difference method (Pletcher
2006). Implicitly, the differential analog of this equation for a homogeneous medium can be written as:
$$\lambda \frac{{T}_{i-1,j+1}-{2T}_{i,j+1}+{T}_{i+1,j+1}}{{\Delta z}^{2}}{=c}_{\mathrm{p}}\rho \frac{{T}_{i,j+1}-{T}_{i,j}}{\Delta t}$$
(3)
where
i,
j are indices describing points in space and time, respectively; and Δ
z and Δ
t are space and time discretization steps, respectively. An implicit scheme was used to derive the difference analog. Equation (
3) should be written independently for each discrete space–time point, but it is more convenient to use its equivalent form:
$$\begin{array}{ccc}{T}_{i-1}+U{T}_{i}+{T}_{i+1}=-W{T}_{i}^{*},& W=\frac{\Delta {z}^{2}}{D\Delta t},& U=-2-W\end{array}$$
(4)
where
\(D=\frac{\lambda }{{c}_{\mathrm{p}}\rho }\) is the thermal diffusivity of the medium,
U and
W are parameters depending on thermal diffusivity and discretization of time and space,
T is the temperature in the current time step, and
T* is the temperature in the preceding step (i.e., the initial condition). With this procedure, a system of linear equations in each time step can be formulated and written in matrix form:
$$\mathbf{A}\bullet \mathbf{h}=\mathbf{r}\mathbf{h}\mathbf{s}$$
(5)
where
A is the coefficient matrix,
h is the unknowns vector, and
rhs is the right hand vector. The following boundary and initial conditions were adopted to solve the aforementioned system:
$$\begin{array}{ccc}T(z=0,t)=f(t),& T(z=L,t)={T}_{\mathrm{p}}=\mathrm{const},& T(z,t=0) = f(z)\end{array}$$
(6)
where
L is the thickness of the seasonal fluctuation zone, and
Tp is the multiyear average annual air temperature. After the boundary and initial conditions have been formulated, the system of linear equations can be solved sequentially using any iterative algorithm. It is worth noting that the coefficient matrix is sparse, and its nonzero elements cluster only on three diagonals. Eventually, with constant Δ
t, this matrix is invariant for each time step. To determine
A−1 an existing SOLVER included with the Python NumPy package and the technique of matrix LU decomposition with partial pivoting was used (Okunev and Johnson
1997). As such, a high numerical efficiency algorithm was developed, which broadly consisted of determining the approximate matrix inverse to
A. As such, the iterative solution of Eq. (
5) in each time step was abandoned, and the unknowns vector could be found directly using the equation:
$$\mathbf{h}=\mathbf{r}\mathbf{h}\mathbf{s}\bullet {\mathbf{A}}^{-1}$$
(7)
After solving the system of equations in all time steps, the model returns a two-dimensional (2D) array representing the spatiotemporal temperature distribution in the seasonal fluctuation zone in the immediate vicinity of the spring. To determine the outflow water temperature, it is necessary to use a water mixing model that includes water flowing into the spring from both zone (a) and the neutral zone (b). Assuming that the groundwater flowlines are uniform, the temperature in zone (a) can be determined by the average value of the vector
h in each time step (Fig.
4). It should be noted that in the case of the analysed medium, this assumption does not have to be fully met. Groundwater flow takes place in this case in a fissured medium, and the filtration paths form a complex system. In addition, the width of the fissures strongly depends on the degree of rock mass relaxation and decreases with depth. Due to the limited measurement availability of the system, it is impossible to identify changes in the water permeability of the medium with depth (the study area is located in a protected zone). Therefore, and due to the fact that the calculations apply only to the near-surface zone (up to a depth of 6 m), the authors decided to treat the groundwater flow field as homogeneous. Then, the outflow water temperature can be calculated via Eq. (
1). The proportional share of these sources in the spring recharge is determined by the
α parameter, the value of which is determined by successive approximations during model calibration.
One-dimensional heat flux calculations were made using the finite difference method. The calculation space was divided into 20 blocks using (at first) a constant spatial discretization step Δz = 0.5 m, and time discretization with a constant step Δt = 1 day. The space was treated as homogeneous due to its ability to conduct and store heat. For the calculations, a constant value of thermal diffusivity of 0.043 m2 day−1 was adopted, as obtained based on the phase shift of soil temperature curves. Relations with the external environment are described using Dirichlet boundary conditions. The boundary corresponding to the land surface was assigned a time-varying value, based on soil temperatures measured at 5 cm depth. On the opposite boundary, corresponding to the upper border of the neutral zone, a constant temperature of 6 °C was set, which is a value close to the average annual air temperature in the ridges of the Pieniny Mountains. The calculation procedure consisted of two stages. First, \({\overline{T} }_{\mathrm{a}}\) (°C) was determined by averaging the temperature values obtained from the model in the entire seasonal fluctuation zone for each time step. For this purpose, the arithmetic average of temperatures obtained in individual computational blocks was calculated, which was justified due to the constant space discretization step in the model and the assumption of groundwater flowline homogeneity. The next step consisted in selecting the α parameter, which determines the proportion of flowline representing individual zones supplying the examined spring. As a result, it was possible to calculate spring temperature at the outflow, and the calculation result could be compared directly with empirical data. This provided the basis for the model calibration procedure. During calibration, the coefficient α and the neutral zone temperature were selected. The unknown depth of the neutral zone was also examined by varying the space discretization step Δz.