# Overview Bioprinting, a form of additive manufacturing, offers a greater design freedom in tissue engineering. By enabling customised geometries using a patient's own cells, it holds potential to revolutionise healthcare. In this context, **print resolution** is critical-particularly when fabricating tissue scaffolds or constructs that replicate the mechanical properties of native tissues. This repository includes two main components: * A **dataset** and accompanying **MATLAB scripts** used to validate the leading-order asymptotic model (equations (71)-(74) of the main article) against experimental data * A **graphical user interface (GUI)** implemented in Python, enabling users to run simulations interactively, visualise filament centre-line geometries, and compute the *window of printability*—the range of air pressures expected to achieve optimal resolution in pneumatic extrusion-based bioprinting --- ## Repository Structure ### Model_Validation.zip Contains: * `NC_20G.csv`-experimental dataset * `power_law_shooting.m`-MATLAB shooting method solver * `power_law_shooting_sweep.m`-full parameter-space sweep producing CSV outputs for post-processing * `experimental_data_power_law.m`-processes dataset and generates figures * Supporting functions: `alpha_experimental.m`, `ode_system_power_law.m`, `shooting_residual.m` ### EBB_Window_of_Printability_Generator.zip Contains: * `EBB_Window_of_Printability_Generator.py`-GUI * `Underlying_Code.py`-`Simulation` function * Icons and splash screen assets * `example_input.txt`-template parameter file --- ## Dataset Description The dataset contains filament diameter and length measurements printed using Nivea Crème with: * a **20G nozzle** * a **6 mm/s nozzle moving speed**, and * air pressures ranging from **55–60 kPa** Each condition was repeated three times. Filaments were imaged with a **Dino-Lite Digital Microscope** and analysed using **ImageJ**. --- ## Underlying Model The mathematical model assumes: * a slender extruded filament * power-law rheology for shear-thinning behaviour, and * steady, axisymmetric flow Asymptotic reduction of the incompressible Navier–Stokes equations yields a system of **three first-order ODEs** governing: * radius, R^(0)^(s) * its derivative dR^(0)^/ds, and * centre-line orientation, θ^(0)^(s) It captures a viscous-dominated regime and satisfies the integral ```math ∫₀¹ cos(θ⁽⁰⁾(s)) ds = H / L, ``` which forces the centre-line to reach the build platform at Z(s)=0. Model assumptions include: * Small aspect ratio, εⁿ = R~o~/L, with n the flow behaviour index, R~o~ the nozzle outer radius, and L some typical length of the filament * Incompressible fluid * Power-law constitutive law * Negligible surface tension * Moderately shear-thinning materials (e.g. 0.39 < n < 0.68) * Leading-order parameter grouping α~PL~ = Re~PL~/Fr^2^ (gravitational and viscous forces) * Leading-order parameter grouping εⁿCa~PL~ (viscous drag and surface tension effects) * Filament is approximately axisymmetric about its centre-line * Plug flow velocity profile within the filament --- ## Extrusion Speed to Air Pressure To link theory with experimental operation, an **empirical expression** derived in previous work (see [Tansell](https://doi.org/10.1098/rsos.250504) *[et al.](https://doi.org/10.1098/rsos.250504)*[, 2025](https://doi.org/10.1098/rsos.250504)) relates **theoretical extrusion speed**-derived from the 3-ODE model-to **air pressure required by a pneumatic bioprinter**. --- # MATLAB Code for Model Validation The MATLAB scripts compute the experimental non‑dimensional parameter α~PL~, solve the ODE system using a **shooting method**, and identify the **velocity ratio** that best matches experimental filament geometries. ## Main Scripts ### power_law_shooting.m * Iterates on β = y~2~(s=1) until the boundary condition, y~1~(s=0) = 1, is satisfied, using `fzero` * After convergence, evaluates the integral to obtain the model-predicted nozzle offset to filament length ratio, H/L * Compares predicted and experimental H/L to identify a velocity ratio corresponding to a best match * Predicts the deposited radius R(s=L) = R~o~ sqrt(velocity_ratio_suggestion) * Computes percentage error and recommended extrusion speed, ū~E~ ### power_law_shooting_sweep.m For convenience and reproducibility, this MATLAB script performs a full sweep of dimensionless parameter space of the leading-order asymptotic model. * Solves the governing 3-ODE system using a **shooting method** for all combinations of: * velocity ratio, ū~E~/U~N~, and * α~PL~ * Computes the resulting H/L * Saves the complete solution for each parameter set to a **CSV file** For each combination of ū~E~/U~N~ and α~PL~, the script outputs a separate CSV file named: ``_.csv`` Each CSV contains: * The computed H/L * The solution profile over the arc-length parameter, s: * s * radius, R^(0)^(s) * its derivative dR^(0)^/ds, and * centre-line orientation, θ^(0)^(s) These files may be loaded directly by the user to recreate figures appearing in the manuscript. ### experimental_data_power_law.m * Computes mean and standard deviation of measured filament lengths and radii * Fits quadratic (`poly2`) curves for: * filament length vs pressure drop * radius vs pressure drop * Generates plots with error bars appearing in manuscript ### Supporting Functions: * `alpha_experimental.m`-computes experimental α~PL~ and H/L * `ode_system_power_law.m`-the 3-ODE system * `shooting_residual.m`-used by `fzero` --- # MATLAB Requirements * MATLAB R2020b or later (recommended) * Optimization Toolbox (for `fzero`) * Curve Fitting Toolbox (for `fit`, optional but required to reproduce the manuscript plots) --- # Python GUI: Window of Printability Generator The GUI provides a user-friendly interface for running the model without writing/amending code. It is ideal for rapid parameter exploration, to visualise filament centre-lines, and compute minimum/maximum pressure drops-the **window of printability**. ## 1. Purpose of the GUI The GUI enables user to: * Enter printing and material parameters * Import data files * Run simulations interactively * Visualise centre-line filament geometries * Compute minimum and maximum air pressures that achieve optimal resolution ## 2. Files Included * `EBB_Window_of_Printability_Generator.py`-GUI (Tkinter) * `Underlying_Code.py`-`Simulation` function * Icons and GUI assets: * `app_icon.png`, `app_icon.ico`, `app_icon.icns` * `splash_screen.png` * `error_icon.png`, `warning_icon.png` * `example_input.txt`-demonstration input file ## 3. How the GUI Works Pressing **Submit**, the GUI 1. Validates user inputs 2. Passes values to `Simulation` 3. Solves the 3‑ODE system (shooting method) 4. Computes extrusion speed to air pressure relationship 5. Returns: * A `Matplotlib` figure of centre‑line geometries * Minimum/maximum pressure drop 6. Enables export options ## 4. Installation ### Recommended (All OS) - Anaconda 1. Install [Anaconda](https://www.anaconda.com/products/distribution) 2. Create a new environment (recommended) ```bash conda create -n ebb python=3.10 conda activate ebb ``` 3. Install required packages ```bash pip install matplotlib numpy scipy pillow ``` > These packages support the GUI and the underlying simulation code. 4. Run the GUI ```bash python EBB_Window_of_Printability_Generator.py ``` > The GUI will open. > > From here, you can enter parameters, import `.txt` input files, run simulations, view centre-line geometries and windows of printability, and export results. ### Windows (without Anaconda) 1. Install Python (3.8+) from [python.org](https://www.python.org/downloads/) > **Important:** > Tick **"Add Python to PATH"** during installation. > > Python.org Windows installers include **Tkinter**, so no extra configuration is needed. 2. Install libraries ```bash pip install matplotlib numpy scipy pillow ``` 3. Run the GUI ```bash python EBB_Window_of_Printability_Generator.py ``` ### macOS (without Anaconda) 1. Install Python (3.8+) from [python.org](https://www.python.org/downloads/) > This version includes: **Tkinter** and correct Tcl/Tk version for stable GUI rendering. 2. Install libraries ```bash pip3 install matplotlib numpy scipy pillow ``` 1) Run the GUI ```bash python3 EBB_Window_of_Printability_Generator.py ``` ### Linux Use Anaconda-Linux Python distributions vary widely in Tkinter support. ## 5. Running the GUI 1. Launch the GUI 2. Enter values manually or load a `.txt` file (see `example_input.txt` for a ready-made import file) 3. Press **Submit** 4. View centre-line geometry and minimum/maximum pressure drops 5. Export results if required ## 6. Input Parameters * Flow behaviour index, n * Consistency index, K (Pa·sⁿ) * Density, ρ (kg/m³) * Nozzle base inner radius, R~i~ (μm) * Nozzle tip inner radius, R~o~ (μm) * Nozzle length, L~N~ (mm) * Nozzle travel speed, U~N~ (mm/s) * Nozzle offset, H (mm) Tooltips include definitions, units, and typical ranges. ## 7. Outputs * Centre-line geometries (mm) comprising two curves: minimum pressure drop (solid line) and maximum pressure drop (dashed line) * Minimum and maximum pressure drop values (kPa)-the **window of printability** ## 8. Features * Custom splash screen and icons handled via Pillow * Import `.txt` files with parameter names and values (**Import Data** button) * Tooltips comprising definitions, units, and typical/suitable ranges of parameters * Clear all inputs, results, and hide export button with confirmation popup (**Clear All** button) * Terminate ongoing simulation and reset GUI state with confirmation popup (**Cancel** button) * Progress bar updates in three phases: solving, matching, and plotting * Visualisation of centre-line geometries * Calculation of pressure drop range (the window of printability) * Export options (**Export Results** button): * Choose to export figure, pressure drop data, or both via checkboxes * Supported formats: `.png`, `.pdf`, `.svg` for figures; `.txt`, `.csv` for data * Input validation with custom error popups for missing/invalid inputs * Out-of-range inputs trigger a confirmation popup before proceeding ## 9. Import & Export Functionality ### Import * File must be `.txt` format * Each line should follow `Label: Value` format * Labels should match GUI labels or normalised names (punctuation, hyphens, and single letter tokens removed from `Label`) * Unmatched labels trigger a popup with guidance ### Export * Figure: `.png`, `.pdf`, `.svg` * Data: `.txt`, `.csv` * **Export Results** button appears only after simulation completes and disappears when the cancel button is pressed or a new set of parameters are submitted * Export options: * Choose to export figure, pressure drop data, or both via checkboxes ## 10. Error Handling The GUI checks for: * Invalid or missing inputs * Out-of-range parameters * Unrecognised imported labels * Failed ODE solutions * Extremely small pressure drops bounds (< 10⁻² kPa) Each triggers a context-specific popup message. ## 11. Known Limitations * Axisymmetric nozzle geometry (specifically conical and straight nozzle geometries) * Power-law fluids only * Surface tension effects neglected * Restricted to steady, catenary-like solutions * Not suitable for highly viscoplastic materials at very low shear stresses ## 12. Future Extensions Potential enhancements include: * Herschel–Bulkley (yield stress) rheology * Other axisymmetric nozzle types * Surface-tension-corrected boundary conditions --- # Citations This project makes use of the following open-source libraries: * NumPy: Harris et al., *Array programming with NumPy*, **Nature**, 2020. DOI: [https://numpy.org](https://numpy.org) * SciPy: Virtanen et al., *SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python*, **Nature Method**s, 2020. DOI: [https://scipy.org](https://scipy.org) * Matplotlib: Hunter, *Matplotlib: A 2D Graphics Environment*, **Computing in Science & Engineering**, 2007. DOI: [https://matplotlib.org](https://matplotlib.org) * Pillow: Clark et al., *Pillow (PIL Fork) Documentation*, **Python Software Foundation**, 2010-present. DOI: [https://python-pillow.org](https://python-pillow.org) Flow behaviour and consistency indices for NIVEA Crème were taken from: * N. Paxton, W. Smolan, T. Böck, F. Melchels, J. Groll, and T. Jungst. *Proposal to Assess Printability of Bioinks for Extrusion-Based Bioprinting and Evaluation of Rheological Properties Governing Bioprintability*. **Biofabrication**, 9(4):044107, 2017. DOI: [10.1088/1758-5090/aa8dd8](https://doi.org/10.1088/1758-5090/aa8dd8). Default value of 'Nozzle Base Inner Diameter', if unknown, is assumed from: * J.C. Gómez-Blanco, E. Mancha-Sanchez, A.C. Marcos, M. Matamoros, A. Díaz-Parralejo, and J.B. Pagador. *Bioink Temperature Influence on Shear Stress, Pressure and Velocity Using Computational Simulation*. **Processes**, 8(7): 865, 2020. DOI: [10.3390/pr8070865](https://doi.org/10.3390/pr8070865) Original empirical expression considering an arbitrary, axisymmetric nozzle geometry: * A.V. Tansell, N. Mahmoodi, J.P. Crolla, R.J. Dyson, G.J. Luo, L.E.J. Thomas-Seale. *Exploiting Nozzle Geometry to Predict Resolution in Extrusion-Based Bioprinting: Mathematical Modelling of a Power-Law Fluid*. **R. Soc. Open Sci.**, 12: 250504, 2025. DOI: [10.1098/rsos.250504](https://doi.org/10.1098/rsos.250504).