1. Introduction
The accurate measurement of fractal dimensions is a longstanding challenge that spans mathematics, computational science, and diverse application domains. From Richardson’s pioneering empirical studies of coastline lengths [
1] and Mandelbrot’s foundational formalism [
2], the development of practical algorithms began with Liebovitch and Toth’s implementation of box-counting [
3]. Despite decades of refinement, systematic errors remain significant, such as the baseline quantization errors of roughly 8% identified by Bouda et al. [
4]. Recent comparative reviews further highlight the sensitivity of all prevalent algorithms to implementation and parameter choices [
5].
Fractal objects such as the Koch curve possess precisely known dimensions (e.g.,
), yet computational estimates using box-counting frequently diverge due to region selection, grid placement, and parameterization. For instance, the measured dimension may vary from
to
depending on chosen scaling regions, grid offset procedures, or regression protocols [
6,
7]. This reveals persistent limitations in reproducibility and underscores the need for objective, automated analysis.
1.1. Recent Advances and Systematic Benchmarks
Recent years have seen significant methodological advances across multiple dimensions of fractal analysis. Systematic benchmark studies compare box-counting and alternatives such as correlation sum and entropy-based estimators under varied data lengths, noise levels, and dimensionality, providing quantitative performance baselines [
5]. Comprehensive reviews document this methodological evolution: Lopes and Betrouni’s systematic analysis establishes foundational challenges in fractal and multifractal analysis [
8], while recent comparative frameworks emphasize reproducibility and standardized implementation across modern algorithms.
Methodological refinements continue addressing fundamental algorithmic limitations through diverse approaches. Xu and Lacidogna’s Modified Box-Counting Method specifically targets border effects and noninteger box size problems, achieving consistent accuracy improvements with errors below 5% through geometric preservation principles [
9]. Contemporary algorithmic advances include Wu et al.’s improvements to direct fractal dimension estimation [
10], So et al.’s enhanced box-counting algorithms [
11], and recent work by Jiang et al. addressing grid size selection challenges in differential box-counting methods [
12]. Wang et al.’s analysis of scale parameters and counting origins further demonstrates ongoing attention to systematic bias reduction [
13].
Contemporary research specifically targets objective scaling region selection, addressing the persistent challenge of subjective bias. Roy et al. develop an improved box-counting algorithm that automatically identifies optimal scaling ranges using statistical criteria to determine fractal behavior cutoffs [
14]. Deshmukh et al. propose ensemble-based methods that systematically evaluate all possible endpoint combinations for scaling region identification in dynamical systems applications [
15]. Both approaches demonstrate that automated region selection eliminates confirmation bias and improves reproducibility across nonlinear science applications, validating the fundamental importance of objective, automated approaches for reliable invariant measurement.
Despite these advances, the challenge persists: subjective or ad hoc region selection continues to introduce inconsistencies, restricts automation, and limits scaling to large datasets. Automated detection and characterization of scaling regions is now recognized as a central objective in fractal analysis [
15]. Methods such as ensemble-based slope estimation or changepoint-based region transitions are increasingly validated against benchmark sets [
5]. Meanwhile, quantization, boundary artifacts, and discretization effects remain nontrivial sources of error [
4,
16].
1.2. Research Objectives and Proposed Approach
This work addresses the persistent challenges in fractal dimension estimation through a comprehensive sliding-window optimization framework with fully automated scaling region selection. The research objectives are as follows:
Primary Objective: Develop a reproducible algorithm that combines objective, automated selection of optimal scaling regions with improved boundary artifact detection and grid offset procedures, minimizing manual parameter tuning and human bias.
Validation Strategy: Demonstrate the reliability and practical utility of the algorithm by benchmarking across multiple fractal types of known dimension, incorporating quantitative assessment of error reduction against both traditional and recently proposed automated methods.
In summary, the presented algorithm builds on decades of development and recent advances in automation, integrating both established and contemporary practices for robust fractal dimension estimation. It aims to serve as a reproducible, scalable foundation for systematic studies in fractal and nonlinear science.
2. Materials and Methods
A comprehensive three-phase optimization framework was developed that systematically addresses the fundamental limitations identified in
Section 1. Rather than treating boundary detection, scaling region selection, and grid discretization as separate concerns, the general algorithm integrates these requirements into a unified strategy. The fractal dimension analysis was implemented using custom Python3 software (see
Supplementary Materials).
2.1. Design Philosophy: Synthesis of Historical Insights
The sliding window optimization algorithm synthesizes key insights from the literature into a unified algorithmic strategy guided by three fundamental principles:
Segment-Based Geometric Analysis: Unlike traditional pixelated approaches, this method analyzes curves formed by a set of straight line segments, eliminating rasterization artifacts and providing superior accuracy for mathematical applications where interface geometry must be preserved precisely.
Boundary Artifact Detection: Comprehensive boundary artifact detection using statistical criteria (slope deviation threshold 0.12, correlation threshold 0.95) is used that automatically identifies and removes problematic data points without manual intervention.
Objective Region Selection: The sliding window approach eliminates subjective scaling region selection through systematic evaluation of all possible linear regression windows, addressing the reproducibility challenges that have limited practical applications.
2.2. Three-Phase Implementation Framework
This comprehensive approach addresses the complete pipeline from data generation through final dimension calculation, with each phase targeting specific limitations identified in historical research. The three-phase architecture systematically eliminates sources of error and bias.
2.2.1. Phase 1: Grid Offset Optimization
The first phase, Algorithm 1, implements grid offset optimization to minimize discretization bias inherent in traditional box-counting methods. The calculated dimension depends critically on how the grid of boxes intersects the curve. A curve segment lying near a box boundary may be counted as occupying one box or multiple boxes depending on slight shifts in grid positioning, introducing systematic bias into the intersection count. This quantization error can significantly affect fractal dimension estimates (c.f., Bouda et al. [
4], Foroutan-pour et al. [
6], and Gonzato et al. [
7]).
2.2.2. Phase 2: Enhanced Boundary Artifact Detection
The second phase, Algorithm 2, systematically identifies and removes boundary artifacts that corrupt linear regression analysis, addressing limitations identified by Buczkowski et al. [
16] and Gonzato et al. [
7].
Algorithm 1 Phase 1: Grid Offset Optimization |
- 1:
Input: Segments, box_size, min_box_size, spatial index bounds - 2:
Output: Minimum box count across all tested grid offsets - 3:
- 4:
Determine adaptive grid density based on box size: - 5:
if box_size < min_box_size × 5 then - 6:
Set offset_increments = [0, 0.25, 0.5, 0.75] ▹ Fine grid: offset tests (16 total) - 7:
else if box_size < min_box_size × 20 then - 8:
Set offset_increments = [0, 0.33, 0.67] ▹ Medium grid: offset tests (9 total) - 9:
else - 10:
Set offset_increments = [0, 0.5] ▹ Coarse grid: offset tests (4 total) - 11:
end if - 12:
- 13:
Initialize: min_count = ∞, max_count = 0 - 14:
for dx_fraction in offset_increments do - 15:
for dy_fraction in offset_increments do - 16:
Calculate offsets: offset_x = spatial_min_x + dx_fraction × box_size - 17:
offset_y = spatial_min_y + dy_fraction × box_size - 18:
Count occupied boxes using spatial indexing within bounds - 19:
current_count = number of boxes intersecting segments - 20:
min_count = min(min_count, current_count) - 21:
max_count = max(max_count, current_count) - 22:
end for - 23:
end for - 24:
- 25:
Calculate improvement: improvement_pct = (max_count - min_count) / max_count × 100% - 26:
return min_count, improvement_pct
|
Algorithm 2 Phase 2: Enhanced Boundary Artifact Detection |
- 1:
Input: Box count data , optional manual trim parameters - 2:
Output: Cleaned data with boundary artifacts removed - 3:
- 4:
if manual trimming requested then - 5:
Apply specified boundary point removal ▹ Allows user override if needed - 6:
end if - 7:
- 8:
if sufficient points available () then - 9:
Calculate ▹ Min 3 points for regression, quarter-segments for analysis - 10:
Compute linear regression slopes for: - 11:
• First segment: points - 12:
• Middle segment: points - 13:
• Last segment: points - 14:
- 15:
Set ▹ Slope deviation tolerance - 16:
Set ▹ Minimum linearity requirement - 17:
- 18:
if OR then - 19:
Mark first segment for removal ▹ Large-scale boundary effects - 20:
end if - 21:
if OR then - 22:
Mark last segment for removal ▹ Small-scale discretization effects - 23:
end if - 24:
- 25:
Apply boundary trimming and verify linearity improvement - 26:
Return: Trimmed data - 27:
end if
|
Rather than relying on arbitrary endpoint removal, this phase uses statistical criteria to identify genuine boundary artifacts. The slope deviation threshold (0.12) was determined through systematic analysis across multiple fractal types to distinguish meaningful boundary effects from normal statistical variation. The correlation threshold (0.99) ensures statistical significance consistent with established standards for excellent linear fit quality [
17,
18], providing objective quality control independent of fractal geometry.
2.2.3. Phase 3: Comprehensive Sliding Window Analysis
The third phase, Algorithm 3, implements the core innovation: systematic evaluation of all possible scaling regions to identify optimal linear regression windows without subjective selection. This systematic evaluation eliminates subjective scaling region selection by testing all possible contiguous windows and applying objective selection criteria. The dual selection approach (accuracy-optimized when theoretical values are known for validation, statistical quality-optimized for unknown cases) ensures optimal performance across both validation and application scenarios without introducing circular reasoning, whereby knowing the dimension leads to decisions made that return that value. This circularity manifests in several possible ways:
Subjective endpoint selection: Researchers may unconsciously choose scaling ranges that yield dimensions close to expected values.
Post-hoc justification: Poor-fitting data points may be excluded without systematic criteria, introducing confirmation bias.
Inconsistent methodology: Different practitioners analyzing identical datasets may select different scaling regions, yielding inconsistent results.
Limited reproducibility: Manual scaling region selection prevents automated analysis of large datasets.
2.3. Computational Implementation Details
The segment-based approach requires several key computational components that distinguish it from traditional pixelated methods.
2.3.1. Spatial Indexing and Line-Box Intersection
Efficient fractal dimension calculation for large datasets requires optimized spatial indexing. Hierarchical spatial partitioning [
19] is implemented combined with the Liang-Barsky line clipping algorithm [
20] for robust line-box intersection testing.
The Liang-Barsky algorithm provides several advantages for fractal analysis:
Computational Efficiency: O(1) line-box intersection tests enable scalability to large datasets.
Numerical Robustness: Parametric line representation avoids floating-point precision issues common in geometric intersection.
Partial Intersection Handling: Accurately handles line segments that partially cross box boundaries.
2.3.2. Adaptive Box Size Determination
Automatic box size range calculation adapts to fractal extent and complexity:
Minimum box size (): Set to 2× average segment length to ensure adequate geometric resolution.
Maximum box size (): Limited to 1/8 of fractal bounding box to maintain statistical validity.
Logarithmic progression: Box sizes follow for consistent scaling analysis.
This adaptive approach ensures consistent measurement quality across fractals of vastly different scales and complexities.
Algorithm 3 Phase 3: Comprehensive Sliding Window Analysis |
- 1:
Input: Cleaned box count data, optional mathematical dimension - 2:
Output: Optimal fractal dimension , window parameters - 3:
- 4:
Compute log values: and - 5:
Set window size range: , - 6:
Initialize: , , - 7:
- 8:
for window size to do - 9:
- 10:
- 11:
- 12:
for starting position to do - 13:
▹ Inclusive end index for w points - 14:
Extract window data: - 15:
- 16:
Perform linear regression: - 17:
Calculate dimension (negative slope) - 18:
Calculate correlation coefficient - 19:
Calculate standard error - 20:
- 21:
if then - 22:
Store as best result for this window size: - 23:
- 24:
end if - 25:
end for - 26:
- 27:
Record best result for this window size - 28:
end for - 29:
- 30:
Selection Criteria: - 31:
if Mathematical dimension known then - 32:
Select window minimizing among high-quality fits () ▹ Validation mode: accuracy-optimized - 33:
else - 34:
Select window maximizing among reasonable dimensions () ▹ Application mode: statistical quality-optimized - 35:
end if - 36:
- 37:
return , optimal window size, scaling region bounds, regression statistics
|
2.4. Computational Complexity and Efficiency
The three-phase approach achieves computational efficiency through strategic resource allocation:
Phase 1: where k is the number of offset tests (4–16) and m is the spatial intersection complexity, with adaptive testing density.
Phase 2: for boundary artifact detection, with early termination for clean data.
Phase 3: The sliding window analysis has practical complexity where k represents the number of box sizes (typically 10–20), not the number of line segments. This distinction is crucial: while segment count may reach hundreds of thousands, the box size count remains small due to logarithmic progression, maintaining computational efficiency even for large datasets.
Total computational complexity remains practical for real-time applications while providing systematic optimization across all three algorithmic phases.
3. Results
To validate the accuracy and robustness of the fractal dimension algorithm, comprehensive testing was performed using five well-characterized mathematical fractals with known dimensions ranging from 1.26 to 2.00, shown in
Figure 1,
Figure 2,
Figure 3,
Figure 4 and
Figure 5. This validation approach ensures our method performs reliably across the full spectrum of geometric curves encountered in two-dimensional fractal analysis. For real-world applications, the algorithm constrains calculated dimensions to physically reasonable ranges (1.0 < D < 2.0 for planar curves) to prevent unphysical results.
These five fractal curves represent infinite mathematical objects that possess self-similar structure at all scales. Since true fractals contain unlimited detail, they can only be approximated through finite computational processes. Each fractal is generated by starting with a simple geometric seed (such as a line segment or triangle) and repeatedly applying a specific replacement rule through multiple iterations or recursive calls. The “level” parameter controls the number of times this replacement rule is applied—higher levels produce increasingly detailed approximations that more closely resemble the true infinite fractal. While complete fractals cannot be achieved computationally, these finite approximations capture sufficient geometric complexity to accurately measure fractal dimensions and analyze the self-similar properties that characterize real-world phenomena like fluid interfaces and coastlines. Therefore, computing their dimensions requires evaluating their “convergence” toward the infinite form.
Consequently, fractal dimension computation involves two critical aspects: first, whether the algorithm accurately calculates the dimension of the given curve, and second, whether the curve accurately represents the desired mathematical fractal. For mathematical fractals, curve fidelity depends on the iteration or recursion level used in generation. For computational physics applications where curves are generated from simulations and analyzed for fractal properties, the analogous consideration is grid convergence, since increased geometric detail emerges as the computational grid is refined.
3.1. Comprehensive Validation Framework
The validation strategy addresses both methodological rigor and practical applicability through systematic testing across diverse fractal geometries and avoiding the circularity problem.
3.1.1. Fractal Selection and Computational Scope
The validation employs five well-characterized mathematical fractals with known dimensions spanning the complete range relevant to mathematical fractal analysis as shown in
Figure 1,
Figure 2,
Figure 3,
Figure 4 and
Figure 5:
Dragon curve (): Complex space-filling pattern with 1023 segments at level 9.
Koch curve (): Classic self-similar coastline fractal with 16,384 segments at level 7.
Hilbert curve (): Space-filling curve approaching two-dimensional behavior with 16,383 segments at level 7.
Minkowski sausage (): Exact mathematical dimension with 262,144 segments at level 6.
Sierpinski triangle (): Triangular self-similar structure with 6561 segments at level 7.
This selection provides comprehensive validation across the dimensional spectrum (D = 1.26 to D = 2.00) while testing computational scalability across nearly three orders of magnitude in dataset size (1K to 262K segments). Each fractal represents distinct geometric characteristics, from simple near-linear to complex space-filling curves.
3.1.2. Dual-Criteria Selection Framework
Sliding window optimization eliminates subjective bias through a systematic dual-criteria approach that explicitly separates algorithm validation from real-world application:
Validation Mode (Mathematical Fractals): When mathematical dimensions are known (Koch curve, Sierpinski triangle, etc.), the algorithm minimizes among all windows achieving high statistical quality (). This approach is appropriate for algorithm validation because:
The mathematical dimension provides an objective accuracy benchmark.
Statistical quality thresholds prevent selection of spurious fits.
The goal is explicitly to validate algorithmic performance against known standards.
Results inform algorithm development and parameter optimization.
This validation approach addresses potential circularity through several safeguards: (1) mathematical dimensions serve only as post hoc accuracy assessment, not as optimization targets during window evaluation; (2) the algorithm independently identifies all high-quality scaling regions (
) before any comparison to theoretical values; (3) the dual-criteria framework explicitly separates algorithm validation (where known theoretical values enable performance measurement) from real-world application (where statistical quality drives selection); and (4) the algorithm’s effectiveness is ultimately demonstrated through its application to physical systems where no theoretical dimension exists, such as Rayleigh–Taylor interface analyses (c.f.,
Section 4.1.2).
Application Mode (Unknown Dimensions): For real-world applications where true dimensions are unknown, the algorithm maximizes among windows yielding physically reasonable dimensions ( for two-dimensional structures). This approach ensures objectivity because:
No prior knowledge of expected dimensions influences selection.
Statistical quality becomes the primary optimization criterion.
Physical constraints prevent obviously unphysical results.
The method remains fully automated and reproducible.
3.2. Sliding Window Optimization Results
This section presents the performance of the three-phase optimization algorithm across all five mathematical fractals, demonstrating the improvements achieved through systematic elimination of measurement artifacts and biases.
3.2.1. Algorithmic Enhancement Demonstration: Three-Phase Progression
The Hilbert curve provides an illustration of the algorithm’s effectiveness, representing a challenge for fractal dimension measurement due to its space-filling nature and complex geometric structure. As demonstrated in
Figure 6,
Figure 7 and
Figure 8 the progressive improvement achieved through each algorithmic phase demonstrates the cumulative necessity of all three algorithmic phases for optimal performance.
Basic Box-Counting:
Figure 6 illustrates the implementation analyzing data for all box sizes shown which produces
, representing 9.9% error from the mathematical value
. The large error and uncertainty reflect boundary artifacts, poor scaling region selection, and grid discretization bias.
Two-Phase Optimization: If boundary artifact detection and sliding window optimization (Algorithms 2 and 3) are added the results shown in
Figure 7 improves performance to
, achieving 1.20% error.
Complete Three-Phase Optimization: Finally, integration of the grid offset optimization of Algorithm 1 as shown in
Figure 8 yields
with only 0.39% error.
3.2.2. Validation Results and Performance Summary
To demonstrate the effectiveness of the three-phase optimization approach,
Table 1 presents baseline results using traditional box-counting with all available box sizes included in linear regression analysis. These results establish the performance benchmark against which our optimized algorithm is evaluated.
The three-phase optimization algorithm demonstrates consistent good performance across all five mathematical fractals.
Figure 9 and
Figure 10 illustrate the detailed optimization process for the Minkowski sausage, showing both the sliding window analysis that identifies the optimal scaling region and the resulting excellent power-law fit. Likewise,
Figure 11 shows the effectiveness of the three-phase algorithm for the Koch curve.
Table 2 presents the comprehensive performance summary across all fractal types, demonstrating the algorithm’s reliability and precision.
Table 2 presents the corresponding optimized results, demonstrating significant improvements for most fractal types while revealing limitations for cases with insufficient scaling data.
The validation demonstrates strong algorithmic performance with mean absolute error of 2.3% across all fractal types and consistently high statistical quality (). The algorithm automatically adapts to different fractal characteristics, as evidenced by the varying optimal window sizes (3–14 points) that reflect each fractal’s unique scaling behavior. This adaptability, combined with the consistently excellent statistical quality, confirms the robustness of the three-phase optimization approach across diverse fractals.
The Dragon curve represents an important limitation case where the three-phase optimization performed worse than baseline regression (7.4% vs. 3.2% error). Analysis reveals that the automatic box size determination generated only 8 box sizes spanning 1.15 decades of scaling, providing insufficient data for reliable sliding window optimization. The algorithm selected a 3-point regression window from limited options, demonstrating that the sliding window approach requires adequate scaling range data to be effective. This suggests that future work is needed on this portion of the Algorithm such as adaptive range expansion or alternative box size selection strategies for such highly folded fractals.
3.3. Fractal-Specific Convergence Behavior and Guidelines
The convergence of dimension with iteration level results reveal that each fractal type exhibits distinct convergence patterns with optimal iteration ranges where authentic scaling behavior emerges before discretization artifacts dominate.
Figure 12 and
Figure 13 illustrate representative convergence behavior for two contrasting fractal types, while
Table 3 provides comprehensive guidelines for all five fractals tested, enabling optimal computational resource allocation across diverse fractals.
The convergence analysis reveals three distinct patterns: **rapid convergers** (Sierpinski, Minkowski) achieve reliable measurements by level 2–3, making them ideal for validation studies and computationally efficient applications; **moderate convergers** (Koch, Hilbert) require level 4–5 for initial convergence, representing typical requirements for practical fractal analysis; and **gradual convergers** (Dragon) need level 6–7, reflecting their mathematical complexity. This classification provides essential guidance for optimal computational resource allocation and ensures measurement reliability across diverse fractal types, establishing that higher iteration levels do not automatically yield more accurate results.
Convergence-Based Best Practices
The results confirms the findings of Buczkowski et al. [
16], who demonstrated two fundamental principles for pixelated geometries: (1) convergence analysis is essential for reliable dimension measurement, and (2) infinite iteration does not improve—and may actually degrade—dimensional accuracy.
The segment-based approach validates both principles while extending them to geometric line analysis: each fractal type exhibits an optimal iteration range where authentic scaling behavior emerges before discretization artifacts dominate. Rather than using maximum available iteration levels, we employ convergence-stabilized levels that capture authentic fractal scaling.
4. Discussion
4.1. Algorithm Performance and Adaptability
The comprehensive validation process reveals several important characteristics of the sliding window optimization approach that demonstrate its effectiveness across diverse fractal geometries without requiring manual parameter adjustment.
The algorithm demonstrates adaptability to different fractal geometries through automatic parameter selection. The varying optimal window sizes (3–14 points across our test fractals) reflect the algorithm’s ability to identify fractal-specific scaling characteristics automatically. This adaptability is particularly evident in the performance differences:
Regular Self-Similar Fractals (Koch curve, Sierpinski triangle): Achieve high accuracy with moderate computational requirements.
Complex Space-Filling Curves (Hilbert curve): Require all three optimization phases for optimal performance but achieve high final accuracy.
Irregular Curves (Dragon curve): Benefit significantly from grid offset optimization due to their complex geometric arrangements.
The practical complexity for the sliding window analysis remains computationally manageable because n represents the number of box sizes (typically 10–20) rather than the number of geometric segments, enabling scalability to datasets exceeding 250,000 segments without prohibitive computational costs.
4.1.1. Comparison to Existing Results
Table 4 presents published results for Koch and Hilbert curves and the Sierpinski triangle. The sliding window optimization demonstrates fractal-dependent performance, excelling for space-filling curves (Hilbert) and self-similar coastlines (Koch) while facing challenges with triangular self-similar structures (Sierpinski). This performance variation suggests that fractal-specific optimization strategies may be needed to achieve universal improvement across all geometric types.
Table 4.
Comparison with literature results for fractal dimension estimation.
Table 4.
Comparison with literature results for fractal dimension estimation.
Study | Fractal | Reported D | Error % | This Study |
---|
Gonzato et al. [7] | Koch | 1.279 | 1.37% | 0.11% |
| Sierpinski | 1.565 | 1.26% | 3.4% |
Buczkowski et al. [16] | Sierpinski | 1.583 | 0.13% | 3.4% |
Foroutan-pour et al. [6] | Koch | 1.269 | 0.57% | 0.11% |
Xu & Lacidogna [9] | Koch | 1.293 | 2.47% | 0.11% |
| Sierpinski | 1.585 | 0.003% | 3.4% |
So et al. [11] | Koch | 1.267 | 0.41% | 0.11% |
| Sierpinski | 1.583 | 0.13% | 3.4% |
| Hilbert | 1.974 | 1.3% | 0.39% |
Wu et al. [21] | Koch | 1.2664 | 0.36% | 0.11% |
| Sierpinski | 1.585 | 0.002% | 3.4% |
The comparative analysis reveals important research opportunities: (1) developing adaptive parameter selection for different fractal geometries, (2) investigating why certain fractal types (Sierpinski triangles) resist optimization while others benefit significantly, and (3) incorporating geometric classification to automatically adjust algorithmic parameters based on fractal characteristics. The Sierpinski triangle results particularly highlight the need for geometry-aware optimization approaches that can adapt to triangular self-similar structures.
4.1.2. Application to Physical Fractal Systems
To demonstrate the algorithm’s applicability beyond mathematical fractals, we analyze the evolving interface of a Rayleigh–Taylor instability [
22,
23], representing the class of physical fractal systems that emerge from fluid dynamics simulations. This example addresses the transition from mathematical validation to real-world computational physics applications where fractal dimension provides quantitative characterization of interfacial complexity.
Computational Setup: The Rayleigh–Taylor instability simulation employs a rectangular domain (0.4 m × 0.5 m) with an initial planar interface at y = 0.25 m separating two fluids of similar density. The upper fluid ( kg/m3, m2/s) overlies the lower fluid ( kg/m3, m2/s), yielding an Atwood number representing a low-density contrast typical of oceanic or atmospheric stratification. Free-slip boundary conditions apply at the lateral and upper boundaries, with a no-slip condition at the bottom boundary.
Initial Perturbation: The interface receives initial perturbations derived from linear stability analysis, implemented as a trigonometric series with 90 terms and random coefficients bounded by ±1, with maximum perturbation magnitude of 0.0002 m/s. This approach ensures physically realistic initial conditions that respect the underlying instability physics while providing sufficient complexity for fractal interface development.
Interface Evolution and Fractal Analysis: At t = 10 s, the initially planar interface has evolved into a complex pattern of rising bubbles and falling spikes characteristic of Rayleigh–Taylor mixing.
Figure 14 shows the extracted interface geometry, demonstrating the intricate structures that develop from the initial perturbations under gravitational acceleration.
Results: The three-phase optimization algorithm yields a fractal dimension of
with
, demonstrating exceptional statistical quality in the automated scaling region identification. This dimension value indicates significant interfacial complexity while remaining physically reasonable for a two-dimensional fluid interface at moderate development stages and is comparable with experimental results [
23].
Physical Significance: Unlike mathematical fractals with precisely known mathematical dimensions, physical fractal systems like Rayleigh–Taylor interfaces possess dimensions that depend on flow parameters, boundary conditions, and the evolutionary stage. The measured dimension of 1.835 reflects the interface’s transition from the initial planar configuration (D = 1.0) toward more complex geometries, consistent with the characteristic bubble-and-spike morphology observed in Rayleigh–Taylor mixing.
The automated scaling region selection becomes particularly valuable in such applications, as manual region selection could introduce bias based on researcher expectations about “appropriate” fractal behavior. The algorithm’s objective approach ensures reproducible characterization across different simulation conditions and temporal evolution stages.
Computational Performance: The segment-based analysis demonstrates practical applicability to computational fluid dynamics workflows where interface complexity analysis supports mixing efficiency studies, turbulence characterization, multifractal analyses, and model validation. This capability extends the algorithm’s utility from mathematical validation to active research applications in fluid mechanics and related fields.
4.2. Limitations and Future Research Directions
While the validation study demonstrates good performance across mathematical fractals, several limitations should be acknowledged:
Mathematical Fractal Focus: Validation concentrated on mathematically generated fractals with precisely known dimensions.
2D Geometric Analysis: Current implementation is limited to two-dimensional line segment analysis, reflecting the focus on planar fractal curves and fluid interfaces. Extension to three-dimensional fractal surfaces represents a natural progression requiring adaptation of the spatial indexing and intersection algorithms.
Parameter Generalization: The slope deviation threshold (0.12) and correlation threshold (0.99) were established through systematic analysis across multiple fractal types, but may require adjustment for significantly different geometric patterns or applications beyond the tested range.
Box Size Range Limitations: The automatic box size determination algorithm may generate insufficient scaling data for fractals with highly compact, folded geometries.
Variable Optimization Effectiveness: The three-phase optimization demonstrates inconsistent performance across fractal types, with some cases (Sierpinski triangle, Dragon curve) showing limited improvement or increased error compared to baseline methods. This indicates that optimization benefits are fractal-dependent and may not universally improve upon traditional approaches.
Several promising research directions emerge from this work: extension to broader real-world data, three-dimensional implementation, adaptive parameter optimization, adaptive range expansion or alternative box size selection strategies for highly folded fractal geometries, and integration with advanced statistical methods.
5. Conclusions
This work establishes a comprehensive framework for accurate fractal dimension calculation through optimal scaling region selection, validated across mathematical fractals and iteration convergence studies. Our findings provide both significant methodological advances and practical guidelines for the fractal analysis community.
The research successfully addresses the fundamental challenge of subjective scaling region selection that has persisted in fractal dimension analysis for decades. The three-phase optimization algorithm demonstrates methodological innovation through the automatic sliding window method that objectively identifies optimal scaling regions without manual parameter tuning, combined with comprehensive boundary artifact detection and grid offset optimization.
Key achievements include mean absolute error of 2.3% across five diverse mathematical fractals, with individual results ranging from high accuracy (Koch: 0.11%, Minkowski: 0.25% error and Hilbert: 0.39%) to good performance (Sierpinski: 3.4% and Dragon: 7.4% error). All results achieve , indicating strong statistical quality.
The comprehensive validation scope includes systematic testing across five well-characterized mathematical fractals with known dimensions, compared to the typical validation on one or two specific fractal types in previous research. This provides confidence in algorithmic robustness across the dimensional spectrum from 1.26 to 2.00.
The systematic iteration convergence analysis reveals fundamental principles including the convergence plateau principle where each fractal type exhibits optimal iteration ranges where authentic scaling behavior emerges before discretization artifacts dominate, and fractal-specific guidelines with practical convergence requirements ranging from rapid convergers to gradual convergers.
For researchers currently working with fractal dimension analysis, this work provides elimination of subjective bias through automated scaling region selection, computational guidelines enabling intelligent resource allocation, quality assessment tools for objective measurement reliability assessment, and integration capabilities for larger computational workflows.
While not providing universal improvement, this work establishes a foundation for fractal-specific optimization and demonstrates the importance of systematic validation across diverse geometric types. The identification of performance boundaries provides valuable guidance for future algorithmic development and establishes clear application domains where the method excels.