1. Introduction
Energy behavior is a fundamental diagnostic in the numerical simulation of shallow water equations [
1,
2,
3]. These equations arise in a wide range of applications, including geophysical flows, coastal and river hydraulics, and environmental modeling. At the continuous level, the shallow water system admits a mechanical energy functional consisting of kinetic and gravitational potential components. In the presence of bottom friction or other dissipative mechanisms, this energy satisfies a strict decay law over time.
Preserving this mechanical energy structure at the discrete level has long been recognized as a central requirement for the stability and robustness of numerical schemes. Energy stability is closely related to nonlinear stability, suppression of spurious oscillations, and reliable long-term behavior [
4,
5,
6,
7]. Among implicit time integration methods, the Crank–Nicolson (CN) scheme is widely used due to its second-order temporal accuracy, symmetry, and favorable linear stability properties. Applied to a semi-discrete system of the form
the Crank–Nicolson method reads as
where
denotes the discrete state at time
. For linear Hamiltonian systems, the CN scheme is quite energy-conserving, and for linear dissipative systems, it is unconditionally stable [
8,
9,
10].
In the nonlinear shallow water setting, however, the discrete energy behavior of Crank–Nicolson schemes is considerably more subtle. Even when the continuous system satisfies the strict dissipation law
the fully discrete mechanical energy
need not be strictly monotone [
11,
12,
13]. Small localized increases in
may occur due to the second-order midpoint evaluation of nonlinear terms. Such behavior is intrinsic to the method and should not be interpreted as numerical instability [
14,
15].
In practical mixed finite element formulations of the shallow water equations [
16,
17,
18], the nonlinear system arising from Equation (
2) is solved at each time step by Newton-type methods. When writing the fully discrete problem in the residual form
the solution is obtained only approximately, subject to prescribed absolute and relative tolerances. Modern solver frameworks such as PETSc’s SNES combine Newton iterations with line search or trust region strategies to ensure robustness. The interaction between nonlinear solver tolerances, globalization strategies, and discrete energy diagnostics is rarely analyzed in detail. Consequently, small positive energy increments
are often misinterpreted as implementation errors or violations of physical principles, despite being consistent with midpoint quadrature structure and solver inexactness.
Energy- and entropy-stable discretizations for shallow water equations have been extensively studied from complementary perspectives. Backward Euler time discretizations are classical in the analysis of nonlinear monotone and dissipative operators, where unconditional stability and energy decay can be established under minimal regularity assumptions at the cost of only first-order temporal accuracy [
19,
20,
21]. A separate line of research concerns entropy-stable finite volume and discontinuous Galerkin (DG) methods, where carefully designed numerical fluxes and dissipation operators enforce a discrete entropy inequality, even in the presence of shocks and wetting or drying [
22,
23,
24,
25]. These approaches emphasize robustness in non-smooth regimes.
The discrete gradient and average vector field (AVF) methods provide another class of structure-preserving time integrators. By enforcing a discrete chain rule, such methods can guarantee exact discrete energy conservation or dissipation for nonlinear systems [
26,
27,
28]. However, their application to shallow water systems typically leads to more involved nonlinear formulations and increased implementation complexity, especially when combined with compatible mixed finite element spaces and positivity constraints.
The present work complements these approaches by focusing on the implicit midpoint (Crank–Nicolson) method applied to shallow water equations with nonlinear bottom friction. Rather than enforcing unconditional dissipation by construction, we derive and analyze the exact discrete mechanical energy balance satisfied by the scheme. We quantify the higher-order defect term responsible for local monotonicity violations and demonstrate—both analytically and numerically—that these increments are bounded, non-accumulating, and vanish under temporal refinement. This places the method between strictly dissipative schemes and fully conservative geometric integrators, providing a precise understanding of its discrete energy behavior.
To distinguish admissible numerical effects from genuine instability, we introduce a combined absolute–relative violation criterion
and analyze violations relative to this threshold.
Throughout this work, we distinguish carefully between energy-stable and energy-consistent discretizations. A scheme is energy-stable if it satisfies the discrete inequality
for all time steps under the prescribed boundary conditions. By contrast, a scheme is energy-consistent if it satisfies a discrete balance law of the form
where
represents a physical dissipation term and
is a higher-order residual satisfying
as
. Strict monotonicity may fail at finite time steps, but the discrete evolution faithfully reproduces the continuous energy structure up to asymptotically vanishing defects. The Crank–Nicolson discretization studied here belongs to the second category; it is energy-consistent but not unconditionally energy-stable.
The remainder of this paper is organized as follows.
Section 2 introduces the shallow water model problem and its continuous energy structure.
Section 3 presents the mixed finite element spatial discretization and the Crank–Nicolson time integration.
Section 4 describes the nonlinear solution strategy.
Section 5 defines the discrete energy diagnostics and violation criteria.
Section 6 presents the numerical results and discussion, followed by the concluding remarks in
Section 7.
2. Model Problem and Continuous Energy Structure
Let
,
be a bounded Lipschitz domain representing the horizontal spatial region, and let
be a final time. We consider the shallow water equations with a fixed bottom topography
and nonlinear bottom friction
in
.
Here, denotes the water depth, is the depth-averaged horizontal velocity, is the gravitational constant, is the bottom topography, and is a (possibly nonlinear) friction force.
The system is supplemented with initial data
with
almost everywhere in
.
2.1. Boundary Conditions
Throughout this work, we impose boundary conditions that prevent mechanical energy input through
. A prototypical choice is the impermeable slip-wall condition
where
denotes the outward unit normal. Periodic boundary conditions may also be considered.
Under either choice, boundary flux contributions vanish in the energy balance derived below.
2.2. Functional Framework and Regularity Assumptions
For the purpose of deriving the continuous mechanical energy identity, we assume a strictly positive depth
and sufficient regularity, such as
The bottom topography is assumed to satisfy
such that
. This regularity ensures that the forcing term
belongs to
and that all integration-by-parts arguments used below are mathematically justified. No higher-order smoothness of
b is required.
2.3. Continuous Mechanical Energy Functional
The total mechanical energy associated with Equation (
8) is defined by
The first term represents the kinetic energy density, while the remaining terms represent the gravitational potential energy measured relative to the fixed bathymetry. Under the positivity assumption on h, is well defined and finite.
2.4. Friction and Dissipation
We assume that the bottom friction satisfies the dissipativity condition
This condition holds, for example, for quadratic drag laws of the form
and for Manning-type friction models. Assumption (
12) expresses that bottom friction removes kinetic energy from the system.
2.5. Continuous Mechanical Energy Balance
Lemma 1 (Continuous mechanical energy identity)
. Let be a sufficiently smooth solution to Equation (8) satisfying Equation (10) (or the periodic boundary conditions). Then, for all , we haveIn particular, if Equation (12) holds, thensuch that the mechanical energy is non-increasing over time. Proof. We test the momentum equation in Equation (
8) with
and integrate over
:
Using the product rule, we have
and by inserting the mass equation
, the kinetic energy contribution combines with the advective term so that all convective transport contributions cancel out at the volume level. The boundary flux terms vanish due to Equation (
10).
Integration by parts of the pressure and bathymetry terms yields
which exactly represents the time derivative of the gravitational potential energy.
Collecting kinetic and potential contributions gives
which proves Equation (
13). □
Corollary 1 (Energy monotonicity and equilibria)
.
If the dissipativity condition in Equation (12) holds, then is non-increasing over time. Energy conservation occurs if and only if almost everywhere. In particular, for friction laws such that implies , conservation occurs precisely at lake-at-rest equilibria: The continuous dissipation identity above provides the reference mechanical stability principle against which the fully discrete Crank–Nicolson mixed finite element scheme will be assessed. Any departure from strict monotonic decay in the discrete setting must therefore be interpreted relative to this continuous energy law.
4. Nonlinear Solution Strategy
The Crank–Nicolson time discretization introduced in
Section 3 leads, at each time step, to a fully implicit and nonlinearly coupled algebraic system for the discrete water depth and velocity. In this section, we describe the nonlinear solution strategy adopted in this work, with particular emphasis on robustness, convergence control, and its interaction with the discrete energy structure developed in
Section 3.
4.1. Fully Discrete Residual Formulation
Let
denote the discrete state at time
. For a fixed time step
, the Crank–Nicolson update
is characterized as the solution to the nonlinear residual equation
where
represents the weak form of the fully discrete mass and momentum equations evaluated at the temporal midpoint
The residual operator couples the mass and momentum balances and contains nonlinear advection, pressure, bathymetric forcing, and bottom friction terms. Consequently, is nonlinear, generally non-symmetric, and locally Lipschitz-continuous with respect to .
4.2. Newton Linearization
Equation (
23) is solved using a Newton-type method. Given an initial guess
, successive iterates
are computed from the linearized system
where
denotes the Jacobian of
with respect to
. The update is
The Jacobian consistently incorporates all nonlinear midpoint evaluations, including the dependence of the friction operator on . This midpoint-consistent linearization preserves the variational structure of the Crank–Nicolson discretization and is compatible with the discrete energy analysis.
4.3. Globalization and Convergence Criteria
In practice, Newton iterations are globalized using either a line search or a trust region strategy to ensure convergence in strongly nonlinear regimes. The nonlinear solver is terminated once the residual satisfies a combined absolute–relative criterion:
Here, and denote prescribed solver tolerances.
Because of this stopping condition, the computed state
satisfies
where
is the effective nonlinear residual level determined by Equation (
25). Thus,
is an approximate root of the Crank–Nicolson system.
4.4. Impact on Discrete Energy Balance
The discrete energy identity in Lemma 2 was derived under the assumption that Equation (
23) is satisfied exactly. When the nonlinear solver is inexact, the energy increment satisfies
where
Here, is the intrinsic midpoint defect, and is a perturbation term induced by the residual error.
Under standard Lipschitz assumptions on
and its Jacobian, one obtains the bound
for some constant
C independent of
. Hence, solver-induced energy perturbations are controlled directly by the nonlinear residual tolerance.
Provided that
the solver-induced perturbation remains a smaller order than the intrinsic
midpoint defect. In particular, for sufficiently tight tolerances, the strict Lyapunov property established in Theorem 1 remains valid up to higher-order corrections.
4.5. Practical Interpretation of Energy Increments
Observed positive energy increments
may therefore arise from three distinct mechanisms:
- 1.
Intrinsic midpoint quadrature error;
- 2.
Nonlinear solver inexactness;
- 3.
Globalization effects during Newton updates.
These contributions are of a higher order and do not contradict the energy consistency of the scheme.
To distinguish admissible perturbations from genuine instability, all energy diagnostics reported in
Section 6 are evaluated using the combined absolute–relative threshold in Equation (
7). Solver tolerances are chosen such that
ensuring that the observed energy behavior reflects the Crank–Nicolson discretization rather than premature nonlinear termination. The nonlinear solution strategy described above is fully compatible with standard high-performance solver libraries, including PETSc’s SNES framework. No energy projection, correction, or post-processing steps are introduced. Energy behavior is analyzed strictly a posteriori using the diagnostic framework developed in
Section 3.
6. Numerical Results and Discussion
This section presents numerical experiments that validate the analytical results in
Section 2 and
Section 3 for the Crank–Nicolson discretization of the shallow water equations with nonlinear bottom friction. The experiments were designed to (1) confirm the expected second-order temporal convergence; (2) quantify the discrete mechanical energy behavior predicted by the discrete identity of Lemma 2 and the conditional dissipation mechanism; (3) demonstrate exact well balancedness for the lake-at-rest equilibrium; and (4) separate time discretization effects from spatial discretization and nonlinear solver effects.
6.1. Model Parameters, Friction Law, and Test Cases
We considered the shallow water system in Equation (
8) on a bounded domain
,
, equipped with either periodic boundary conditions or slip-wall conditions (Equation (
10)). Under these assumptions, the continuous energy balance of Lemma 1 holds formally without boundary flux contributions. All experiments employed a dissipative bottom friction operator
satisfying Equation (
12). Unless otherwise stated, we used the quadratic drag law
which is monotone in
and satisfies
for
.
We report the results for the following canonical scenarios chosen to probe the energy and equilibrium structure:
- (T1)
Smooth long-time evolution with friction: This has a smooth initial condition with nontrivial velocity and depth perturbations. This case is used for time step and mesh refinement studies as well as energy diagnostics.
- (T2)
Lake-at-rest equilibrium: The well-balanced test described in
Section 6.10 is used to verify exact preservation of steady states at the fully discrete level.
All initial conditions satisfied to avoid degeneracy.
6.2. Solver Tolerances and Convergence Criteria
Because the discrete energy functional is evaluated on the converged nonlinear state at each time step, it is important to specify the solver tolerances used in the simulations.
The fully discrete problem at each time step was solved using a Newton iteration. The nonlinear residual was reduced until
with tolerances
Each Newton correction was computed using a Krylov subspace linear solver (GMRES), which terminated when
These tolerances were chosen so that the nonlinear algebraic error was several orders of magnitude smaller than the observed energy increments (typically –), thereby preventing solver inaccuracy from contaminating the energy diagnostics.
6.3. Spatial Discretization and Fully Discrete Residual
Spatial discretization was performed with a compatible mixed finite element pair, namely for the velocity fluxes and for the depth. We let and denote the resulting finite element spaces. The family of meshes was assumed to be shape-regular and characterized by a mesh parameter h.
We let
denote the fully discrete state at time
. The Crank–Nicolson update is defined by the nonlinear residual equation
where
is induced by Equation (
2) after replacing the continuous spaces with
.
The discrete energy used in all experiments was
For plotting and reporting, we also used the pointwise energy density
which corresponds exactly to the diagnostic expression
(we plotted
and its components separately in
Appendix B).
6.4. Nonlinear Solver and Stopping Criteria
At each time step, we solved Equation (
41) using a Newton–Krylov method. We denoted by
the residual at Newton iterate
. The iteration was terminated once
where
is the Euclidean norm of the assembled residual vector (or an equivalent solver-provided norm). Unless otherwise stated, the same tolerances were used for all runs so that differences in energy behavior could be attributed to
rather than solver settings. To ensure that energy diagnostics were not polluted by under-solving, we also recorded the final residual norm and verified that tightening the tolerances did not change the qualitative energy conclusions.
6.5. Temporal Accuracy: Time Step Refinement at Fixed Mesh
We verified the second-order temporal accuracy of the Crank–Nicolson method, as predicted by Theorem 3, by performing a time step refinement study on a fixed, sufficiently fine mesh.
We let
denote the numerical solution at the final time
T computed with a step size
. Since an exact solution was not available, a reference solution was computed using a much smaller time step
on the same mesh. The error is defined by
The observed convergence rate was estimated as follows:
Table 1 demonstrates the second-order temporal convergence. Upon halving the time step, the error was reduced by approximately a factor of four, and the observed convergence rate satisfied
. This confirms that the Crank–Nicolson integrator was operating in its asymptotic regime on the chosen mesh and supports the theoretical consistency statement of Theorem 3.
6.6. Nonlinear Solver Behavior and Cost
We quantified nonlinear solver performance under time step refinement. For each run, we recorded (1) the average number of Newton iterations per time step; (2) the average number of Krylov iterations per Newton step; and (3) the maximum number of Newton iterations observed over all time steps.
Table 2 shows that the nonlinear iteration count remained uniformly bounded and did not increase as
decreased. A slight reduction in the average Newton iterations was observed for smaller time steps, consistent with improved local linearization for smaller increments. Similarly, the Krylov iteration count per Newton step remained stable, indicating that the linearized systems did not become progressively more ill-conditioned under temporal refinement.
Importantly, time steps flagged by the energy-monitoring procedure (see
Section 6.8) did not coincide with elevated Newton or Krylov counts. This indicates that the occasional positive energy increments were not caused by nonlinear solver difficulties but instead arose from the midpoint quadrature structure intrinsic to the Crank–Nicolson discretization.
6.7. Discrete Energy Evolution and Diagnostic Plots
We now examine the discrete mechanical energy defined in Equation (
42). For each simulation, we recorded the energy history
and the stepwise increments
We further computed the running envelopes
as well as the frictional dissipation proxy
which corresponds to the dissipative contribution in the discrete energy identity in Equation (
31).
Figure 1 shows the representative diagnostics for the smooth long-term test (T1) with
. The left panel displays the global energy
, the middle panel shows the increments
, and the right panel shows the running envelopes
and
.
Several observations follow. First, the global energy exhibited an overall decay consistent with frictional dissipation. Second, the total accumulated energy change over the simulation interval was extremely small:
This indicates the absence of long-term drift. Third, positive increments occurred only sporadically and remained small:
This magnitude decreasesd under time step refinement (see
Table 3). Finally, the running envelopes remained tightly clustered throughout the simulation, with
bounded by
.
The dissipation proxy
remains nonnegative and correlates with phases of elevated kinetic activity, confirming that the net energy decay is physically induced by the friction term rather than arising from numerical artifacts.
Appendix A provides additional benchmark examples, and
Appendix B contains spatially resolved plots of the energy density (Equation (
43)) and its kinetic and potential components. These local diagnostics confirm that energy transport and dissipation were consistent with the shallow water mechanics and that no spurious energy production was observed in the fully discrete scheme.
6.8. Energy Behavior Under Time Step Refinement
We quantified deviations from monotone energy decay using Algorithm 1 with the combined tolerance
For each time-step size
, we report the number of steps
, the total accumulated energy change
the violation count
, and the maximum positive energy increment
To assess the relative magnitude of any energy growth, we also computed the normalized maximum increment
Together, these diagnostics quantify how closely the discrete solution adheres to the monotone dissipation principle suggested by the continuous theory.
As shown in
Table 3, the total accumulated energy change remained negligible for all tested values of
, confirming the absence of long-term drift. Monotonicity violations were rare, occurring at most once per simulation. Moreover, the magnitude of the maximum positive increment decreased as
was reduced, indicating that these deviations are higher-order effects rather than structural instabilities of the method.
To make the asymptotic scaling explicit, we fit the empirical relation
using a least squares regression in log–log scale. The resulting fitted exponent and coefficient of determination are reported in
Table 4.
The fitted exponent
reported in
Table 4 confirms that the maximum positive energy increment decayed at approximately the second order with respect to
. This scaling is consistent with the midpoint defect term in the discrete energy identity and aligns with the asymptotic regime predicted by Theorem 3. In particular, the observed deviations from strict monotone decay were asymptotically negligible and diminish under temporal refinement, reinforcing the energy-consistent character of the Crank–Nicolson discretization.
6.9. Sensitivity to Nonlinear Solver Tolerances
Because the discrete energy was evaluated on the converged nonlinear iterate, it is important to verify that the energy diagnostics were not artifacts of loose nonlinear tolerances. We therefore repeated a representative simulation with increasingly strict tolerance pairs
while holding
fixed (see
Table 5).
As expected, tightening the nonlinear tolerances slightly increased the average Newton iteration count. However, the global energy change , the violation count , and the maximum positive increment remained essentially unchanged. The variation in across three orders of magnitude in tolerances was below , which is negligible relative to the increment magnitudes themselves. This demonstrates that the observed energy behavior was not caused by under-resolved nonlinear iterations.
We therefore conclude that the small positive energy increments observed in
Section 6.8 are intrinsic to the midpoint quadrature structure of the Crank–Nicolson discretization (represented by the defect term
in Lemma 2), rather than a consequence of solver inaccuracy.
6.10. Well-Balanced Lake-at-Rest Verification
We verify exact preservation of the lake-at-rest equilibrium. Let the free surface be constant
and define the initial conditions as
We measured the deviation from equilibrium as follows:
Table 6 shows that the equilibrium was preserved to machine precision and that no energy drift was observed. This verifies that the coupled Crank–Nicolson time discretization with compatible mixed finite elements was exactly well balanced at the fully discrete level, including the nonlinear friction term.
6.11. Spatial Refinement: Separating Temporal and Spatial Effects
To isolate temporal effects, we performed mesh refinement at a fixed . For each mesh size h, we report the initial and final energies, the violation count, and the maximum positive increment.
Table 7 shows that mesh refinement did not introduce additional monotonicity violations, nor did it increase the magnitude of the maximum positive increment. Both
and
stabilized as
, and the energy difference
remained consistent across the meshes. In particular,
remained at the level
and did not grow with spatial refinement.
These results confirm that the small positive energy increments observed in
Section 6.8 were not driven by spatial discretization error. Once the spatial resolution was sufficiently fine, the remaining deviations from strict monotone decay were dominated by the temporal midpoint quadrature effects identified in
Section 3. Overall, the numerical evidence supports the central conclusion that the observed energy behavior is primarily a time-discretization phenomenon rather than a spatial artifact.
7. Conclusions and Outlook
This work presented a rigorous study of the discrete energy behavior induced by the Crank–Nicolson time discretization when applied to nonlinear evolution problems that possess a continuous energy dissipation structure. By deriving a fully discrete energy identity, we showed that the Crank–Nicolson scheme satisfies a sharp discrete energy balance rather than unconditional discrete energy dissipation. This distinction is central in nonlinear settings and clarifies why Crank–Nicolson time discretization can display small, localized increases in discrete energy even when the underlying continuous model obeys a strict decay law.
Beyond the analysis, the algorithmic formulations introduced here connect energy-based theory to practical computation. In particular, the proposed energy-driven monitoring (and the associated adaptive time step philosophy) offers a principled mechanism for controlling discrete energy behavior without sacrificing second-order temporal accuracy. This perspective supports reliable long-term simulation of nonlinear energy-dissipative systems using high-order implicit integrators while providing transparent diagnostics when strict monotonicity is not observed.
The analysis established two key stability conclusions. First, the discrete energy remains uniformly bounded over finite time horizons, and any departures from monotone decay originate from higher-order temporal defects intrinsic to midpoint evaluation of nonlinear terms. Second, these energy increments are controlled, do not accumulate into secular drift, and vanish asymptotically under time step refinement. In this precise sense, the Crank–Nicolson scheme exhibits conditional energy consistency, reconciling the absence of unconditional dissipation with the strong long-term stability that is frequently observed in practice.
The numerical experiments strongly corroborate the theory. Across a range of time step sizes and mesh resolutions, the nonlinear solver converged robustly, the discrete energy exhibited no secular drift, and monotonicity deviations were small, rare, and systematically reduced under temporal refinement. Spatial mesh refinement did not exacerbate these deviations, confirming that the observed energy behavior was governed primarily by the time discretization rather than by spatial error. Moreover, the method was shown to be exactly well balanced for the lake-at-rest equilibrium at the fully discrete level, including the effects of nonlinear bottom friction.
Taken together, these results demonstrate that the Crank–Nicolson scheme provides a reliable, accurate, and physically consistent temporal discretization for energy-dissipative problems, despite not being unconditionally energy-stable. The framework developed in this work offers a rigorous interpretation of its discrete energy behavior, resolving ambiguities that often arise in numerical practice and clarifying when observed energy fluctuations are mathematically defensible rather than indicative of instability or implementation error.
The present analysis was restricted to a fixed Crank–Nicolson discretization on uniform time grids and to regimes in which the continuous energy functional was sufficiently smooth along the numerical trajectory. While the discrete energy identity provides sharp insight into observed numerical behavior, it does not yield unconditional dissipation at the fully discrete level, and it does not directly address adaptive time stepping, nonuniform temporal grids, or systems with non-smooth or degenerate energies.
Several directions for future work are therefore of interest. One natural extension is the development and analysis of modified or blended time integration schemes that recover unconditional energy stability while retaining second-order temporal accuracy. Another promising direction is adaptive time step control driven by discrete energy indicators, allowing the temporal resolution to be refined dynamically when energy deviations become significant. Further extensions include incorporating inexact nonlinear and linear solvers directly into the energy analysis and applying the framework to fully coupled multiphysics systems in which distinct energy mechanisms interact and compete.
These developments would further strengthen the connection between rigorous energy-based analysis and large-scale computational practice, enabling the design of high-order, energy-aware time integrators with provable stability properties in complex nonlinear settings.