High-Performance Computational Framework for Skin Diffusion Modeling
Advanced numerical simulation using Generalized Finite Differences for biomedical applications
- Overview
- Features
- Installation & Setup
- Quick Start
- Usage Guide
- Visualizations
- Project Architecture
- Mathematical Model
- Dataset Structure
- Performance Benchmarks
- Contributing
- Research Team
- Industry Partners Supporting Innovation
- Citation & License
- Acknowledgments
- Contact
- FAQ
This repository presents a state-of-the-art computational framework for modeling substance diffusion in biological tissues using the Generalized Finite Differences (GFD) method. The simulator provides high-performance solutions for studying drug delivery, cosmetic penetration, and biomedical transport phenomena in skin layers.
- 🧬 Biological Modeling: 2D transient diffusion equation solver for skin tissue simulation
- ⚡ High-Performance Computing: Numba JIT compilation for maximum computational efficiency
- 🎯 Scientific Accuracy: GFD method implementation for irregular mesh handling
- 🔄 Automated Dataset Generation: Parallel processing for large-scale parameter studies
- 📊 Advanced Visualization: Comprehensive plotting and analysis tools
| Field | Application | Use Case |
|---|---|---|
| Pharmacology 💊 | Drug Delivery | Transdermal absorption studies, dosage optimization |
| Cosmetics 💄 | Skin Penetration | Formulation analysis, safety assessment |
| Dermatology 🏥 | Clinical Research | Pathological transport, treatment efficacy |
| Biomedical Engineering ⚙️ | Device Design | Patch development, delivery system optimization |
| Machine Learning 🤖 | AI Training | Dataset generation, pattern recognition |
- 2D Transient Diffusion Solver: GFD implementation with 9-point stencil
- Flexible Boundary Conditions: Mixed Dirichlet-Neumann conditions for realistic modeling
- Adaptive Time Stepping: CFL condition enforcement for numerical stability
- Irregular Mesh Support: GFD method handles complex geometries
- Numba JIT Compilation: Just-in-time optimization for critical functions
- Vectorized Operations: NumPy-based efficient array computations
- Memory Optimization: Efficient data structures for large-scale simulations
- Parallel Processing: Multi-core support for dataset generation
- Large-Scale Dataset Creation: Configurable parameter sweeps (e.g., 90,000 simulations per region mesh for a 100×900 sweep)
- Parameter Space Exploration: Systematic variation of diffusion coefficients and initial conditions
- Automated Data Management: Hierarchical organization and compression
- Scientific Visualization: Advanced plotting with Matplotlib
- Skin Layer Modeling: Realistic tissue geometry representation
- Substance Transport: Drug, cosmetic, and chemical diffusion simulation
- Clinical Validation: Framework for experimental data comparison
- Predictive Modeling: Machine learning dataset preparation
| Component | Minimum | Recommended |
|---|---|---|
| Python | 3.8+ | 3.9+ |
| RAM | 8 GB | 16 GB+ |
| CPU | 4 cores | 8+ cores |
| Storage | 5 GB | 25 GB+ (for datasets) |
| OS | Windows/Linux/macOS | Linux (optimal performance) |
# Core scientific computing
numpy >= 1.20.0 # Numerical computations
scipy >= 1.7.0 # Scientific algorithms
matplotlib >= 3.4.0 # Scientific plotting
numba >= 0.54.0 # JIT compilation
tqdm >= 4.62.0 # Progress bars# Method 1: Direct installation
git clone https://github.com/gstinoco/mGFD_Skin_Diffusion_Simulator.git
cd mGFD_Skin_Diffusion_Simulator
pip install -r requirements.txt
# Method 2: Virtual environment (recommended)
python -m venv skin_diffusion_env
source skin_diffusion_env/bin/activate # On Windows: skin_diffusion_env\Scripts\activate
pip install -r requirements.txt
# Method 3: Conda environment
conda create -n skin_gfd python=3.9
conda activate skin_gfd
pip install -r requirements.txt# Test installation
python -c "import numpy, scipy, matplotlib, numba, tqdm; print(':white_check_mark: Installation successful!')"
# Run quick demo
python GFD_skin.py# Run basic skin diffusion simulation
python GFD_skin.py# Generate complete training datasets
python create_dataset.py# Select a region mesh (.mat) from region/ (e.g., skin061, skin224, skin256)
# For single simulations, change the region file inside GFD_skin.py main()
# Parameter exploration
# Modify diffusion coefficient (nu) and initial concentration (ci) in main()
# Memory optimization for large datasets
# Adjust batch sizes in create_dataset.py# Standard resolution meshes
region/skin061.mat # 61×61 nodes, ~3.7K points
region/skin224.mat # 224×224 nodes, ~50K points
region/skin256.mat # 256×256 nodes, ~65K points
region/skin*.mat # More mesh resolutions available
# Original skin layer
region/skin_base.png # Base for the geometriesPractical workflows for running simulations and generating datasets
| Step | What to do |
|---|---|
| 1) Run |
|
| 2) Outputs |
Images: skin.png, skin2.png (saved in the project root)
|
| 3) Customize |
Edit main() in GFD_skin.py to set the region mesh, diffusion coefficient (nu) and inlet concentration (c_i).
|
| Step | What to do |
|---|---|
| 1) Run |
|
| 2) Select mesh |
Choose a region from region/ (e.g., skin061, skin224, skin256).
|
| 3) Configure sweep |
The script requests a range for nu as integer multipliers of 1e-8, plus c_i range, time steps, workers, and optional compression.
|
| 4) Outputs |
Images: Dataset/<region>/ci_###/nu_XXXXXXXX.pngOptional: Dataset/<region>/ci_###.zip
|
Concentration Initial = 100 | Different Diffusion Coefficients
Low Diffusion
|
Medium Diffusion
|
High Diffusion
|
📊 Dataset Scale: A full sweep is 100 initial conditions × 900 diffusion coefficients (= 90,000 simulations per region mesh)
:package: GFD-Skin-ML/
├── GFD_skin.py # Main simulator module
│ ├── difusion_skin_jit() # JIT-optimized solver
│ ├── difusion_skin() # Vectorized solver
│ ├── Gammas() # GFD coefficient calculator
│ └── main() # Workflow orchestrator
│
├── create_dataset.py # Automated dataset generation
│ ├── Parallel processing support # Multi-core optimization
│ ├── Parameter space exploration # Systematic variation
│ ├── Automated data management # File organization
│ └── Memory optimization # Efficient resource usage
│
├── requirements.txt # Python dependencies
├── LICENSE # MIT License
│
├── region/ # Computational mesh library
│ ├── skin224.mat # Standard resolution mesh ($224 \times 224$)
│ ├── skin256.mat # High resolution mesh ($256 \times 256$)
│ ├── skin_base.png # Geometry visualization
│ └── red files/ # Mesh generation files
│
├── Dataset/ # Generated simulation datasets
│ └── <region>/ # e.g., skin061, skin224, skin256
│ ├── ci_001/ # Initial concentration folder
│ │ ├── nu_0.00000001.png # One simulation (nu formatted with 8 decimals)
│ │ └── ... # More diffusion coefficients
│ ├── ci_002/
│ ├── ...
│ └── ci_001.zip # Optional compressed archive (one per ci_###)
│
└── docs/ # Documentation and examples
└── visualizations/ # Sample visualization gallery
├── comparison_nu_1e8_ci100.png # Low diffusion coefficient example
├── comparison_nu_450e8_ci100.png # Medium diffusion coefficient example
└── comparison_nu_900e8_ci100.png # High diffusion coefficient example
The simulator solves the 2D transient diffusion equation:
Where:
-
$u(x,y,t)$ : Concentration field [mg/L] -
$\nu$ : Diffusion coefficient [m²/s] -
$\nabla^2$ : Laplacian operator -
$t$ : Time [s]
| Component | Method | Description |
|---|---|---|
| Spatial Discretization | Generalized Finite Differences (GFD) | 9-point stencil for irregular meshes |
| Temporal Integration | Explicit Euler | First-order time stepping |
| Boundary Conditions | Mixed Dirichlet-Neumann | Inlet concentration + zero-flux boundaries |
| Stability | CFL Condition | Automatic time step adjustment |
-
Inlet (Dirichlet):
$u = c_i$ (prescribed concentration) -
Boundaries (Neumann):
$\frac{\partial u}{\partial n} = 0$ (zero flux) -
Initial Condition:
$u(x,y,0) = 0$ (clean tissue)
The generated datasets follow a hierarchical organization:
Dataset/
└── <region>/ # Selected mesh (e.g., skin061, skin224, skin256)
├── ci_001/ # Initial concentration folder
│ ├── nu_0.00000001.png # One simulation (nu formatted with 8 decimals)
│ ├── nu_0.00000002.png
│ └── ... # More diffusion coefficients
├── ci_002/
├── ...
├── ci_100/
├── ci_001.zip # Optional compressed archive
├── ci_002.zip
└── ...
-
Total Images:
$N_{c_i} \times N_{\nu}$ per region (e.g.,$100 \times 900 = 90{,}000$ images/region) - Storage: Varies by mesh size and compression (typically several GB per full sweep)
-
Parameters: Initial concentration (
$c_i$ ) and diffusion coefficient ($\nu$ ) -
Resolution: Defined by the selected region mesh (e.g.,
$61 \times 61$ ,$224 \times 224$ ,$256 \times 256$ nodes)
| Use Case | Dataset Type | Description |
|---|---|---|
| Machine Learning Training 🤖 | Complete Dataset | Large-scale image dataset per region (e.g., 90,000 images/region for a 100×900 sweep) |
| Parameter Studies 📈 | Subset Analysis | Specific parameter ranges |
| Validation ✅ | Test Sets | Independent validation data |
| Benchmarking 🏆 | Reference Solutions | Standard test cases |
| Mesh Size | Nodes | Time Steps | JIT Solver | Vectorized Solver | Memory Usage |
|---|---|---|---|---|---|
| 50,176 | 1,000 | ~4.5s | ~12.3s | ~2.1 GB | |
| 50,176 | 10,000 | ~45s | ~123s | ~2.1 GB | |
| 65,536 | 1,000 | ~6.5s | ~18.7s | ~2.8 GB | |
| 65,536 | 10,000 | ~65s | ~187s | ~2.8 GB |
Benchmarks: Intel i7-8700K @ 3.70GHz, 32GB RAM, Python 3.9
| Optimization | Speedup | Description |
|---|---|---|
| Numba JIT | 3-4x | Just-in-time compilation of critical loops |
| Vectorization | 2-3x | NumPy array operations |
| Memory Layout | 1.5x | Contiguous array storage |
| Parallel Processing | Nx | Multi-core dataset generation |
# Performance scaling with problem size
Nodes vs Time: O(N log N) # Near-linear scaling
Memory vs Nodes: O(N) # Linear memory usage
Parallel Efficiency: 85-90% # Multi-core performance
- Search existing issues: Check if the bug has already been reported
- Create a detailed report: Include steps to reproduce and expected vs actual behavior
-
Provide context: Operating system, Python version, and relevant parameters (mesh,
$\nu$ ,$c_i$ )
- Describe the feature: Clear and concise description of the proposed functionality
- Justify the need: Explain how it benefits research or reproducibility
- Provide examples: Use cases, expected inputs/outputs, and acceptance criteria
git clone https://github.com/yourusername/mGFD_Skin_Diffusion_Simulator.git
cd mGFD_Skin_Diffusion_Simulator
python -m venv dev_env
source dev_env/bin/activate # On Windows: dev_env\Scripts\activate
pip install -r requirements.txt
git checkout -b feature/your-feature-name| Photo | Student | Institution | Contact |
|---|---|---|---|
|
Gabriela Pedraza-Jiménez |
|
|
|
Eli Chagolla-Inzunza |
|
|
| Photo | Student | Institution | Contact |
|---|---|---|---|
|
Jorge L. González-Figueroa |
|
|
|
Christopher N. Magaña-Barocio |
|
|
| Photo | Student | Institution | Contact |
|---|---|---|---|
|
|
Maria Goretti Fraga-Lopez |
|
|
Collaboration between academia and industry to accelerate real-world impact
|
🎯 Focus areas:
|
- Tinoco-Guerrero, G., Domínguez-Mota, F. J., Guzmán-Torres, J. A., & Tinoco-Ruiz, J. G. (2022). "Numerical Solution of Diffusion Equation using a Method of Lines and Generalized Finite Differences." Revista Internacional de Métodos Numéricos para Cálculo y Diseño en Ingeniería, 38(2). DOI: 10.23967/j.rimni.2022.06.003
- Large-Scale Simulation Dataset: Configurable sweeps (e.g., 90,000 simulations per region mesh for a 100×900 sweep)
- High-Performance Implementation: 3-4x speedup with Numba JIT optimization
- Open Source Framework: MIT licensed for academic and commercial use
- Cross-Platform Compatibility: Windows, Linux, macOS support
If you use this software in your research, please cite:
@software{gfd_skin_simulator_2025,
title={Skin Diffusion Simulator with GFD: High-Performance Computational Framework
for Biomedical Transport Modeling},
author={Tinoco-Guerrero, Gerardo and
Domínguez-Mota, Francisco Javier and
Guzmán-Torres, José Alberto and
Arias-Rojas, Heriberto},
year={2025},
institution={Universidad Michoacana de San Nicolás de Hidalgo},
organization={SIIIA MATH: Soluciones en ingeniería},
url={https://github.com/gstinoco/mGFD_Skin_Diffusion_Simulator},
note={Advanced computational framework for skin diffusion modeling using
Generalized Finite Differences method}
}This project is licensed under the MIT License - see the full license text below:
MIT License
Copyright (c) 2025 Gerardo Tinoco-Guerrero, Francisco Javier Domínguez-Mota,
José Alberto Guzmán-Torres, Heriberto Árias Rojas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Academic Use: This software is developed for research and educational purposes. Commercial use is permitted under the MIT License terms.
We extend our gratitude to the institutions and partners supporting this research and open-source development
|
Primary Contact
Research group coordination Dr. Gerardo Tinoco Guerrero Morelia, Michoacán, México |
||||||
|
Technical Support
Bug reports, questions, and collaboration requests
|
||||||
|
Collaboration Opportunities
Research and engineering partnerships
|
||||||
|
Student Opportunities
Projects and training in scientific computing
|
||||||
|
Institutional Affiliations
|
Which meshes are available?
Check
region/ for skin*.mat files (e.g., skin061, skin224, skin256).
Where do results go?
python GFD_skin.py saves skin.png and skin2.png in the project root. Dataset generation saves outputs in Dataset/<region>/.
Can I use this in commercial projects?
Yes. The project is released under the MIT License.
How should I cite this work?
Use the BibTeX entry in the Citation section and the referenced DOI in Scientific References.










