harpoon logo


case study | medical

Penn State uses Harpoon to help simulate respiration

Like many parts of the human body, the lungs have remained an untamed frontier in terms of visualizing and simulating the respiratory process. Modern medicine has identified the form and function of the lungs, but man has yet to witness the respiratory cycle of the human lung first hand, to fully understand the process and how it is affected by disease, pollution and other inhaled substances.

However, a team of researchers led by Robert Kunz, Ph.D., head of the Computational Mechanics Division at Pennsylvania State University’s Applied Research Laboratory, is breathing new life into the study of lung function using cutting-edge CFD modeling and high-performance computing to simulate human respiration. Kunz is using Harpoon extreme mesh generator by Sharc and EnSight visualization software by CEI, to produce 3D simulations of the respiratory system that may one day help physicians diagnose and treat a wide variety of breathing disorders.

Modelling the Generations

Comprised of some 50 million bronchi, the lungs are essentially a tree-like system of branches, with each generation growing progressively smaller. So far, Kunz’s research has focused on this structure at the macro scale, beginning with the upper trachea, the oral/pharyngeal cavity and the near-head environment.

“Our goal is to simulate human respiration at all scales, starting at the throat, all the way down through the 50 million bronchi, to the alveoli,” Kunz says. “We’re not at the molecular level yet, but we’re solving at the macro scale, using Harpoon to build the volume and surface meshes defined by the surfaces of the trachea, bronchi and parenchyma, or outer lobe boundary.”

Current magnetic resonance imaging (MRI) technology allows the physician to view areas of the lung in cross-section, down to about the 10th or 12th generation, but there are limitations to this technology. First, it is nearly impossible to distinguish the smallest bronchi in these images. Second, the highest resolution MRIs offer only static images, rather than dynamic sequences of a functioning lung during the respiratory cycle (although dynamic MRI technology is advancing).

Through his research, Kunz hopes to enable the physician to generate individual CFD models of the functioning lung, based on each patient’s MRI images, to better understand, diagnose and treat specific conditions.

“Ultimately we’d like to have a clinical capability where the doctor takes an MRI image, pushes a button and, through an automated process, can turn the image into a geometry, generate the mesh, solve the flow and generate useful diagnostic information in a matter of hours,” Kunz says. “The physician could then look at the efficiency of the lungs, distinguish healthy, damaged or diseased tissue, and assess the uptake of toxins and/or pharmaceuticals. With this information he or she could potentially diagnose and determine an appropriate course of treatment, including a specific dosage of a drug – we could potentially get an actual number from the model, for example, a deposition efficiency that could be used to help define a dosage of a drug based on the lung structure and function.”

 Extreme Tools Solve Complex Geometry

Sharc’s extreme mesher is making Kunz’s research possible, with outstanding efficiency and accuracy. Using Harpoon, Kunz is able to build an arbitrary polyhedral grid from MRI images and then apply his own flow solver, called NPHASE-PSU, to solve the governing equations of fluid mechanics.

“What we’re exploiting here is Harpoon’s speed and automatic (batch) functionality, as well as the ability to exploit arbitrary polyhedra through the process,” Kunz says. “Harpoon generates such elements by default, and the flow solver handles them. We then build elements on the lower generations that extrude from the Harpoon mesh, also as arbitrary polyhedra. Because the framework is arbitrary polyhedral, we are able to do this seamlessly.

” Developing a CFD mesh for the human lung can be very time consuming and complex using a conventional commercial unstructured software package. With Harpoon, applying the geometry takes just minutes, with the cross-sectional elements synthesized into a useable mesh through an automated process. It is this efficiency and automation that is critical to the clinical usage goals of Kunz’s research.

“Clearly, true to its word, Harpoon is very fast. It builds the grid fast, but, frankly, more importantly than that, you can set it up faster. You can give it these .STL files and it just builds the grid. If you don’t like it, you can change it. And, one minute later, change it again. That kind of iteration takes weeks with a conventional unstructured grid software package for these geometries.

” With Harpoon, the images go straight from MRI to surface geometry of the parenchyma of the lobes and the upper branches. Once the surface geometry is established, Harpoon takes the surface triangulated definition file (.STL) and fills it, based on the given requirements for mesh resolution, using a combination of fluid mechanics and geometry resolution, to resolve the geometry.

“This is where Harpoon’s batch capability comes into play,” Kunz says. “We don’t even have to look at this, it just happens automatically and very rapidly. We’ve written a Python script that automatically runs Harpoon and tells it what to do with the data, including boundary conditions, attribute naming, element sizing, etc.”

Some manual cleanup of the geometry may be required, and Kunz further modifies the .STL file to truncate the terminal bronchi perpendicular to the flow path for clarity. Statistically, the sub-branches beyond the 12th generation or so are homogeneous in most cases – it just doesn’t make sense to explicitly resolve all 20,000 branches in the convective regime. At this point, the cleaned-up .STL file is merged with the output of a quasi-one-dimensional model that Kunz’s colleague, Penn State professor Dan Haworth, has written to simulate these minute sub-branches.

At the end of this merging process, the result is a CFD-ready model. In the case of the upper branches and trachea, there may be between 100,000 and 1 million elements. At any given cross-section, there may be 20-50 elements wall-to-wall, like at the throat, for example. At the exit section, there may also be 20 elements.

“Then, there is this cutoff point, at which the geometry is merged with the quasi-one-dimensional elements. Because these are all arbitrary polyhedron, it doesn’t matter,” Kunz says. “The flow solver doesn’t even know that it has gone from 20 elements side-to-side to one element.”

Once the CFD-ready model is completed using Harpoon, NPHASE-PSU solves the Navier-Stokes equation, based on appropriate boundary conditions, like a steady inhale of an adult male, or a periodic pressure distribution of the entire breathing cycle.

“All of the physics are performed at the flow solver level and determines the output of the flow code,” Kunz says. “The flow solver comes back with pressures, gas fractions, velocities, turbulence intensities, mass fraction of an inhaled substance as a function of space and time, etc. We now have many megabytes of data, and, if it’s transient, maybe gigabytes. We need a way to look at it, and that’s where CEI’s EnSight comes  

The Breathing Model

Kunz’s NPHASE-PSU flow solver writes EnSight Gold files that include all the geometry and physical parameters to help researchers visualize the flow.

“We now have a viewable model that looks like it’s breathing,” Kunz says. “We can see where it’s getting starved, where there is high deposition, or where blockages are giving rise to acceleration.”

EnSight offers several features that have made Kunz’s research more effective and efficient. First, it can be pre-programmed to generate particular views, animations, plots and integrations, all of which can be automated in batch scripts as well, adding valuable efficiency and speed to the modeling process.

It also supports center-based data structures. Kunz is using a cell-centered code, solving for variables at the center of each element. Even though the grid is defined at the vertices of the elements, EnSight is able to reconcile this staggering of the grid vertices and element centroids.

“EnSight’s role is communication of what we’re doing,” Kunz says. “Ultimately, it will deliver the answer to the problem that you’re trying to solve: here it is. Look at it and use it. It would be impossible to show these complex flow fields without a heavy-hitting 3D visualizer. If you don’t have something like EnSight, you’re not doing this kind of work.”  

Better Treatment: The Ultimate Goal 

Kunz’s research is being funded by a three-year grant from the National Institutes of Health (NIH), with the ultimate goal of delivering an open source driver script, consisting of commercial and noncommercial modules, that has plug-and-play capabilities. The result will be an interface that would allow the user to employ any medical image segmenter, geometry builder, post processor, flow solver or simulator to arrive at a realistic 3D model. 

“We want to build a global model that makes it possible for the physician who has a patient with a particular disease, with a certain MRI, to be able to solve the flow and provide a diagnostic—that’s the ultimate goal,” Kunz says. “Using this system, the physician could take the respiratory tract of this real person, which may or may not be normal due to disease or injury, and arrive at a full-up visualization as a package. This is something that could be very useful in making more accurate diagnoses and determining more effective treatment patterns.

” Because of these diagnostic possibilities, NIH is keenly interested in pushing the boundaries of modeling the physics of the human being at all scales, making ample use of computer modeling techniques. In particular, National Institute of Environmental Health Sciences, the environmental health branch of NIH, is interested in the effects of pollution, toxins and other environmental inhalants on the human body and Kunz’s research is advancing the study of these factors. In addition, the Food and Drug Administration is moving toward the use of CFD as part of the pharmaceutical approval process, and the results of Kunz’s lung modeling can help better determine the delivery and efficacy of pharmaceuticals intended to treat breathing disorders.

“There is so much potential with this technology,” Kunz says. “It could help us model the effects of aging, and what happens to functionality of the lung as we age, to improve our understanding and diagnosis of emphysema or advanced lung failure. It can help us better understand the geometric characteristics of asthma, where the effective inside diameter of the affected branches changes and their resistance becomes much higher. Then, there is the effect of smoking on the lung—what’s really happening from a fluid dynamic standpoint. All of this is approachable with this technology.”  

Elements of Harpoon meshing process of upper generations of a truncated lung model


Elements of parenchyma lobe and volume filling Quasi-1D branching structure of lower generations interfaced with macro-scale model geometry.


Time dependent wall cell oxygen concentration and predicted velocity vectors at all gas flow boundaries


Surface pressure contours, particle pathlines and a clip plane colored by contours of normalized helicity, illustrating the secondary flows that develop