An example showing how to calculate transfer impedance of an airway tree using a simple impedance model#

In this tutorial we demonstrate the use of !SimpleImpedanceProblem to calculate transfer impedance on an
airway tree model. We further demonstrate post-processing of the output using !ImpedancePostProcessor to
calculate a number of clinically relevant measures.

Note that !SimpleImpedanceProblem uses Poiseuille formulas to calculate impedance
rather than more accurate acoustic impedance equations. For the more accurate version see !ImpedanceProblem.

The usual headers are included

!SimpleImpedanceProblem does most of the work in calculating impedance.

!ImpedancePostProcessor allows easy calculation of a number of clinically relevant measures.

Define the test

First, we load up a mesh containing the centre lines and radii of the a complete conducting airway tree.
The mesh will typically have been developed using a combination of computed tomography (CT) image segmentation
and algorithmic airway generation.

Note that the mesh defined above was developed using a CT scan taken at full inspiration. Impedance is more
commonly recorded during tidal breathing. Here we use a simple scaling to bring the airway radii down into the
tidal breathing range.

Setup a !SimpleImpedanceProblem and tell it that the given mesh is defined in millimetres

This vector lists the input frequencies at which to calculate impedance. They must be
monotonically increasing.

The simple impedance model defines a linear spring at each terminal of the airway tree.
This method allows us to set the elastance of the whole lung (in Pa/m^3). This elastance
is then evenly distributed over the terminals.

Calculates the impedance at the given frequencies

Get the calculated impedances. The impedance at each frequency is
made up of a real component (the resistance) and a complex component
(the elastance).

The impedances calculated above could at this stage be written to a file
and plotted. Instead, we make use of !ImpedancePostProcessor to calculate
a number of common clinical summary statistics from the data.