Skip to content
Go back

Applying A-Star Algorithm to Calculate Geometric Tortuosity in Porous Media: My Journey in Interdisciplinary Research

Three years ago, during my undergraduate studies in Computer Science at ESPOL, I had the opportunity to participate in research that completely changed my perspective on the applications of computational science. What started as an academic project became a scientific publication that demonstrated the power of applying computer science algorithms to real-world problems in materials science.

This experience was both exciting and challenging - it marked my first deep dive into applying computational science to interdisciplinary fields, showing me how algorithms I learned in class could have profound impacts beyond traditional software development.

Beyond Chain-of-Thought

Table of contents

Open Table of contents

The Challenge: When Computer Science Meets Materials Science

Throughout my studies, I was always fascinated by the idea that the algorithms we learned in class could have applications beyond traditional software development. This passion led me to collaborate with Dr. Mayken Espinoza-Andaluz and his team at the Center for Renewable and Alternative Energy at ESPOL.

The problem we faced was complex: How to efficiently calculate geometric tortuosity in two-dimensional porous media? For someone without training in materials science, this sounded like science fiction, but I soon discovered it was a real problem with important applications in fuel cells, filters, and biomedical materials.

What is Geometric Tortuosity?

Geometric tortuosity is an intrinsic property that characterizes the morphology of porous materials. Imagine you need to find the most efficient path through a maze full of obstacles: that path complexity is similar to what tortuosity measures.

Mathematically, it’s defined as:

τgeometric = Lg / L0

Where:

This metric is crucial for understanding how gases, liquids flow or how chemical species diffuse through porous materials like diffusion layers in fuel cells.

The Eureka Moment: A-Star as a Solution

During the first weeks of the project, I found myself studying different approaches to calculate these effective routes. Traditional methods included algorithms like Dijkstra, direct shortest-path search, and skeleton-based methods. That’s when it occurred to me: why not use A-Star?

A-Star is a pathfinding algorithm widely known in video games and robotics. Its beauty lies in combining the guarantee of finding the optimal path (like Dijkstra) with the efficiency of a directed heuristic search.

Why A-Star?

  1. Computational efficiency: Significantly reduces search time compared to exhaustive methods
  2. Flexibility: Can move in 8 directions (cardinal and diagonal)
  3. Optimization: Finds the shortest path while avoiding solid obstacles

Implementation: Challenges and Breakthroughs

Digital Porous Media Generation

We used Python’s PoreSpy library to generate synthetic porous media with different porosity levels (0.5 to 0.9). Each medium was represented as a 100×100 pixel binary matrix:

The Adapted A-Star Algorithm

The traditional A-Star formula we implemented was:

f(n) = g(x,y) + h(x,y)

Where:

Conceptual Code

def calculate_geometric_tortuosity(porous_matrix):
    start_nodes = find_inlet_nodes(porous_matrix)
    end_nodes = find_outlet_nodes(porous_matrix)
    
    total_paths = []
    
    for start in start_nodes:
        for end in end_nodes:
            path = a_star_pathfinding(porous_matrix, start, end)
            if path:
                path_length = calculate_euclidean_length(path)
                total_paths.append(path_length)
    
    avg_path_length = np.mean([min(paths) for paths in group_by_start(total_paths)])
    straight_length = matrix_width  # L0
    
    return avg_path_length / straight_length

Results That Exceeded Expectations

Empirical Correlations

After analyzing 540 samples (60 for each porosity level), we developed three empirical correlations to predict tortuosity:

  1. Power (the best): τ = 9.112×10⁻² × φ⁻²·¹⁵⁵ + 0.9093
  2. Exponential: τ = 3.524 × e⁻⁴·⁶⁶⁴×φ + 0.9703
  3. Polynomial: τ = 1.142φ² - 2.328φ + 2.187

The power correlation achieved a coefficient of determination of 99.7%, meaning our model predicts tortuosity with extraordinary precision.

Comparison with Other Methods

AlgorithmTortuosity τRelative Deviation (%)
A-Star (Ours)1.2747-
Pore Centroid1.38318.503
Skeleton (PoreSpy)1.410910.685
Dijkstra1.32133.655

Validation: Hydraulic vs Geometric Tortuosity

To validate our results, we compared geometric tortuosity (calculated with A-Star) with hydraulic tortuosity (calculated using the Lattice Boltzmann method). The results showed:

This small difference confirms the validity of our approach and aligns with theory establishing that geometric tortuosity is always lower than hydraulic tortuosity.

Reflections: The Impact of Interdisciplinary Research

What I Learned

This experience taught me several valuable lessons:

  1. Algorithms have life beyond code: An algorithm designed for video games can solve problems in materials science
  2. The importance of validation: It’s not enough that it works; it must be compared and validated with established methods
  3. Statistics is your friend: Analyzing 540 samples gave us the statistical confidence necessary for our conclusions

The Emotional Side of Research

I vividly remember the moment when the first results arrived and the correlations began to take shape. Seeing how an algorithm I had implemented was generating data that could contribute to designing better fuel cells or biomedical materials was absolutely exciting.

There were also challenging moments. Debugging why certain porous media didn’t generate valid paths, optimizing performance to process hundreds of samples, and understanding materials science literature as a computer science student were challenges that made me grow as a researcher.

The transition from pure theoretical computer science to applied interdisciplinary research was both thrilling and daunting. It required me to learn an entirely new vocabulary, understand physical phenomena, and bridge the gap between algorithmic thinking and materials engineering.

Real-World Applications

The results of this research have direct applications in:

1. Fuel Cells

2. Biomedical Materials

3. Filtration and Separation

Open Source and Reproducibility

All the code developed for this research is available and uses open-source tools:

# Main libraries used
import numpy as np
import porespy as ps
import matplotlib.pyplot as plt
from scipy import ndimage
import heapq  # For efficient A-Star implementation

# Example of porous medium generation
def generate_porous_medium(porosity, size=100, blobiness=0.5):
    return ps.generators.blobs(
        shape=[size, size], 
        porosity=porosity, 
        blobiness=blobiness
    )

Impact and Publication

This research culminated in a publication in Computation journal (MDPI), with impact factor and peer review. Seeing our work cited by other researchers and contributing to global scientific knowledge was an incredibly gratifying experience.

Paper Metrics:

Lessons for Future Researchers

For Computer Science Students

  1. Don’t limit yourselves to traditional applications: Algorithms can solve problems in physics, biology, chemistry, and more
  2. Collaborate interdisciplinarily: Some of the best innovations arise at the intersection of disciplines
  3. Document everything: Reproducibility is key in scientific research

For the Scientific Community

  1. A-Star is underestimated: While more modern algorithms exist, A-Star remains a powerful and versatile tool
  2. Cross-validation is essential: Comparing multiple methods strengthens confidence in results
  3. Synthetic data can be valuable: You don’t always need experimental data to do meaningful research

Looking to the Future

Possible Extensions

  1. 3D Porous Media: Expand the algorithm to handle three-dimensional structures
  2. More Advanced Algorithms: Explore contraction hierarchies or transit routes for greater efficiency
  3. Machine Learning: Use neural networks to predict tortuosity directly from images

Emerging Applications

The Personal Journey: From Code to Science

Looking back, this research experience was transformative. It taught me that computer science isn’t just about creating applications or systems; it’s about solving real human problems using computational tools. The excitement of seeing how a pathfinding algorithm could contribute to clean energy technology development was the moment that defined my career.

The challenges were real too. Understanding fluid dynamics concepts, learning about material characterization techniques, and translating between computational and physical domains required patience and persistence. But every breakthrough moment - when the correlations converged, when our validation matched theory, when we saw our algorithm outperforming traditional methods - made every challenge worthwhile.

The Interdisciplinary Mindset

This project taught me to think beyond the boundaries of my field. It showed me that the most impactful research often happens at the intersection of disciplines. Computer science provides powerful tools, but the problems worth solving often come from other fields - materials science, biology, environmental engineering, medicine.

Conclusion: When Passion Meets Purpose

This research showed me that computer science is not just about creating applications or systems; it’s about solving real human problems using computational tools. The excitement of seeing how a pathfinding algorithm could contribute to the development of clean energy technologies was the moment that defined my career.

For any student reading this: don’t be afraid to explore outside your comfort zone. The most interesting problems and most elegant solutions are often found at the intersection of seemingly unrelated disciplines.

The A-Star algorithm will continue finding paths, whether in video games, robotics, or porous materials. And that versatility is precisely what makes computational science beautiful.

The experience of applying computer science to materials engineering was both exhilarating and humbling. It reminded me that the algorithms we study in textbooks can have real impact on technologies that could help solve global challenges like clean energy and sustainable materials.


Interested in interdisciplinary research? Have you applied CS algorithms to other fields? I’d love to hear about your experiences in the comments.

References:


Share this post on:

Next Post
Building an AI-Powered Resume Matching System for Modern Recruitment