How to Create a CFD Mesh from a CT-Scanned Rock Image (JPG to OpenFOAM Workflow)

If you’re working with porous media and want to simulate real geometries in OpenFOAM, this step-by-step guide shows you how to convert a CT-scanned rock image into a CFD-ready mesh. This workflow is especially useful for researchers and engineers studying flow through natural materials like rocks, foams, or biological tissues.

đŸ§± What You’ll Need

📝 Step-by-Step Workflow

1. Start with a CT-Scanned Image

Use a 2D slice of a CT-scanned porous rock. The image should have clearly visible connected pores, ideally in black-and-white or high contrast like the image below:

2. Convert JPG to SVG

Go to online-convert.com, upload your JPG, and convert it to SVG. This step transforms your raster image into a vector outline that can be extruded in Blender.

3. Import and Extrude in Blender

  • Import the SVG file into Blender from Files>Import>Scalable Vector Graphics (.svg)
  • Convert the SVG curve to a mesh (Alt+C or right-click → Convert to Mesh).
  • Extrude along the Z-axis to give it 3D thickness.
  • Separate inlet and outlet faces.

đŸ“ș You can watch the full Blender demonstration in the video above for a clearer view of these steps.

4. Use SnappyHexMesh-GUI Addon for Blender

  • Install and Enable the SnappyHexMesh-GUI Addon for Blender add-on.
  • Set up mesh parameters: domain size, cell size, patch names.
  • Export the OpenFOAM folder structure.

5. Generate the Mesh in OpenFOAM 12

Navigate to the working directory and source the run file.

⚠Common Tips & Issues

  • Make sure your SVG is clean and well-traced.
  • Small holes or noisy boundaries can break snappyHexMesh.
  • Keep your inlet and outlet patches well-defined in Blender to avoid simulation issues later.

✅ Final Output

At the end of this process, you’ll have a mesh that closely matches your original CT-scanned geometry—ready to run flow simulations using OpenFOAM.

Turning a simple 2D CT-scan image into a fully functional CFD mesh might sound like a big leap—but as you’ve seen, it’s absolutely doable with the right tools and workflow. By combining the power of Blender, a few smart conversions, and the flexibility of OpenFOAM, you can simulate fluid flow through real-world porous structures with precision.

This workflow opens the door to more realistic simulations, whether you’re working in geosciences, biomedical engineering, or materials research.

If you found this guide helpful, make sure to check out the video, share it with your fellow CFD enthusiasts, and leave a comment below—I’d love to hear how you apply this in your own projects.

🚀 Until next time, happy meshing and keep simulating!

Leave a Comment

Your email address will not be published. Required fields are marked *