Non-Destructive Porosity Measurements of 3D Printed Polymer by Terahertz Time-Domain Spectroscopy

The porosity and inhomogeneity of 3D printed polymer samples were examined using terahertz time-domain spectroscopy, and the effects of 3D printer settings were analysed. A set of PETG samples were 3D printed by systematically varying the printer parameters, including layer thickness, nozzle diameter, filament (line) thickness, extrusion, and printing pattern. Their effective refractive indices and loss coefficients were measured and compared with those of solid PETG. Porosity was calculated from the refractive index. A diffraction feature was observed in the loss spectrum of all 3D printed samples and was used as an indication of inhomogeneity. A “sweet spot” of printer settings was found, where porosity and inhomogeneity were minimised.


Introduction
3D printing, also known as additive manufacturing (AM), is increasingly employed by a growing number of industries for a rapidly expanding variety of applications [1][2][3][4][5]. Increasingly, these applications rely on the electrical and optical as well as the mechanical properties of the printed structure. Starting at optical frequencies, 3D printed polymer and glass preforms have been drawn into optical fibres [6,7]. Millimetre-wave, microwave, and radio-frequency (RF) devices have been fabricated by 3D printing, including RFID devices [8], passive beam-steering elements such as Luneberg lenses [9], and graded index lenses (GRIN) with antireflective surfaces [10]. Capacitive force centres have been designed, fabricated, and tested [11]. Active investigations are underway for using the additive manufacturing of graded dielectrics to reduce the size of high voltage standoffs [12,13]. At all frequencies, the real permittivity of 3D printed materials decreases with porosity [9,10]. For the high voltage standoff application, the electrical breakdown strength of structures has been shown to decline with the characteristic air gaps (porosity) of 3D printed materials [14], and has also been shown to depend on the direction in which the field is applied relative to the print planes [15,16].
One of the most widely used 3D printing technologies is fused deposition modelling (FDM). The FDM process uses a continuous filament of thermoplastic material, which is fed from a spool through a heated extrusion nozzle to be deposited as printer tracks or lines.
The printer head moves in a pre-programmed pattern, creating the desired object [17][18][19]. It is well known that 3D printing in general, and FDM in particular, produces materials that are inhomogeneous, anisotropic, and contain significant porosity; these affect the mechanical, electrical, and optical properties of the printed materials. For that reason, much work has been devoted to the analysis and optimisation of 3D printing process, aimed at minimising inhomogeneity and porosity [20][21][22].
3D printing studies predominantly employ mechanical tests, such as tensile strength and elastic modulus, which are destructive and time-consuming [20][21][22], and often require specially manufactured samples. X-ray computed tomography (XCT) and X-ray diffraction (XRD) have also been employed to reveal the microscopic structure of printed materials [23,24]. Although XCT can produce detailed high-resolution images of the internal structure of the material, it is unsuited to widespread deployment at manufacturing stations and for routine quality control. Optical techniques cannot be employed, since with very few exceptions, 3D printed materials are opaque to visible wavelengths due to strong scattering. In this regard, terahertz (THz) spectroscopy (see Section 2.3 for a description of the technique) has an advantage, because the most common class of material utilised by FDM is polymers, which are transparent or semi-transparent at THz frequencies. Moreover, THz time-domain spectroscopy (TDS) can provide a simple and direct measurement of porosity [25][26][27], as well as revealing inhomogeneity and anisotropy. A crucial advantage of THz TDS is that it can serve as an in-line or near-line non-destructive tool for process monitoring and quality control.
THz TDS has long been used for examining polymers [28][29][30][31][32]. Moreover, AM is being increasingly considered as a technology for fabricating THz components [33][34][35][36]. The THz transmission properties of 3D printed polymers have been also examined [37,38]. However, neither study considered the effects of printer settings or compared the transmission of 3D printed and solid materials.
In this work, we employ transmission THz TDS to systematically investigate the effects of 3D printer settings on the porosity and inhomogeneity of FDM-fabricated PETG samples. A set of 3D printed PETG samples was prepared by systematically varying the printer parameters, including layer thickness, nozzle diameter, filament (line) thickness, extrusion, and printing pattern. Their effective refractive indices and loss coefficients were measured and compared with those of solid PETG. The porosity was calculated from the refractive index. We observed clear relationships between printer parameters and material properties, helping to identify the "sweet spot" where porosity is minimised. In doing so, we demonstrate the utility of THz TDS for the non-destructive evaluation of FDM-printed materials.

Polyethylene Terephthalate Glycol
Polyethylene terephthalate glycol, commonly known as PETG or PET-G, is a thermoplastic polyester whose chemical formula is (C 16 H 18 O 4 ) n [39] and whose structure is depicted in Figure 1. PETG is a glassy polymer, and is transparent and colourless in the visible spectrum. Its refractive index at 589 nm is 1.57 [40,41].

3D Printer Settings
The samples were fabricated with a Prusa i3 MK3S (Prusa Research, Prague, Czech Republic) model 3D printer, employing the FDM technology. The fabricated samples were PETG possesses good chemical resistance, durability, and excellent formability for 3D printing [42][43][44][45]. PETG can be easily vacuumed and pressure-formed, as well as heat-bent, thanks to its low forming temperatures. This makes it exceptionally popular for consumer and commercial applications that involve heat-forming manufacturing techniques. PETG is particularly good for 3D printing, having an extrusion temperature of between 220 • C and 260 • C [46]. It has a density of 1.27 g/cm 3 [41].

3D Printer Settings
The samples were fabricated with a Prusa i3 MK3S (Prusa Research, Prague, Czech Republic) model 3D printer, employing the FDM technology. The fabricated samples were opaque white, indicating strong scattering of visible wavelengths.
The raw PETG materials were in the form of 1.75 mm-diameter filaments. Different sample geometries were used for the three different print patterns listed in the last column of Table 1. The linear pattern, where all the layers of parallel lines are aligned along the same axis (Figure 2a), was printed as a 125 × 50 mm rectangular slab. The circular pattern ( Figure 2b) is comprised of a series of concentric rings forming a 50 mm-diameter disc. The cross-hatch pattern, which consists of alternate layers of parallel lines aligned perpendicular to the adjacent layer (Figure 2c), was printed as a square with a side length of 50 mm. All samples were around 2 mm thick.    The standard nozzle temperature for PETG is 220 • C and the print speed is 55 mm/s [46]. The surface of the print-bed was coated with polyetherimide (PEI) to improve adhesion without causing warping, and its temperature was kept at 85 • C [46]. Table 1 lists the 3D printer parameters that were varied in order to investigate their effects. Two samples were printed for each combination of printer settings; therefore, in the figures below, there are two data points at each setting. The nozzle diameter is the size of the opening that extrudes the heated material. This is typically 400 µm in most consumer FDM printers, so using a smaller diameter requires a higher nozzle temperature (240 • C) and a slower print speed (35 mm/s maximum; volumetric speed set at 3 mm 3 /s). The layer height refers to the height of a single printed layer. The "thick/thin" column refers to the nominal width of the printed lines. Thick is meant to be 250 µm and thin is meant to be 225 µm; however, due to the numerous factors involved (such as extrusion rate and material cooling rate), this should only be taken as a rough guide. The extrusion multiplier can be varied to control the extrusion rate: 1.0 indicates no change, 1.1 indicates over-extrusion by 10%, and 0.9 indicates under-extrusion by 10%. Other parameters, such as infill density and overlap, were controlled indirectly by the printer settings mentioned above.

THz Time-Domain Spectroscopy
The terahertz time-domain spectroscopy (THz TDS) measurements were carried out using a TeraFlash Pro spectrometer from Toptica Photonics (Toptica Photonics, Munich, Germany) set up in a standard optical configuration with four F/2 parabolic mirrors [47,48]. The THz beam path was purged with dry air to eliminate absorption from atmospheric water vapor. The samples were placed in the collimated section of the beam, and laser alignment was used to ensure that they were positioned normal to the THz beam. The frequency resolution was 10 GHz.
The frequency-dependent (ν) refractive index (n(ν)) and absorption coefficient (α(ν)) of each sample were calculated by the standard method of applying Fourier transform to the time-domain data to obtain the frequency-dependent field amplitude (E(ν)) and phase (φ(ν)), and using the equations [47]: where c is the speed of light, d is the sample thickness, and the subscripts s and ref refer to the sample and reference data, respectively. THz TDS has an important advantage in the measurement of the THz optical properties of materials, in that it enables unambiguous, straightforward determination of the refractive index and absorption coefficient [47,48]. The measurement uncertainty had two main components: uncertainty in sample thickness; and measurement repeatability. Since 3D printed samples deviated from being optically flat and plane-parallel by as much as 100 µm, both of these factors were significant and are responsible for the large uncertainties in the figures below. Figure 3 shows the effective refractive index and loss coefficient of two of the 3D printed samples, together with that of the solid PETG material. Note that the refractive index of solid PETG at THz frequencies is higher than in the visible (1.57 at 589.3 nm), as is the case in many materials, due to the contribution of ionic polarizability. Note also that solid PETG has moderately strong THz absorption that rises with frequency following a power law (Figure 3b inset). Strong absorption is caused by the presence of polar components in the PETG molecule, especially the OH and CO groups. The power law dependence of absorption arises from the glassy nature of PETG [49]. There are two significant differences between the solid material and 3D printed samples: in the solid, the refractive index is significantly higher, and the loss coefficient is slightly lower.   Figure 4 examines the effect of layer height on the porosity and inhomogeneity of the 3D printed PETG samples, together with the effect of thick/thin printing. Clearly, for the thick-printed samples, the porosity is lower in the sample with the taller layer and the opposite behaviour is observed in the thin-printed sample. However, the diffraction peak is stronger in both thick-and thin-printed printed samples with the taller layer, although the difference between the layer heights is larger in the thin-printed sample. This indicates that there is an optimal combination of layer and track sizes-a "sweet spot"-where the porosity and inhomogeneity are minimised.  Figure 5 considers the effect of nozzle diameter, together with layer height, on the porosity and inhomogeneity of the 3D printed PETG samples. The porosity decreases with nozzle diameter for the 150 μm layer. However, samples with 100 μm and 300 μm layers both have higher porosity for the same nozzle diameter than that with the 150 μm layer.

Effect of Nozzle Diameter
Here, again, it appears that there is a "sweet spot" where porosity is minimised for an optimal combination of layer height and nozzle diameter. The strength of the diffraction peak is greatly reduced for the larger nozzle diameter.  The effective refractive index of 3D printed samples is lower than that of solid material due to the porosity present in the printed samples. Porosity, defined as the volume fraction of air in the material (p), causes a decrease in the effective refractive index n eff , as compared with that of solid n solid , due to the presence of air voids, with n air ∼ = 1. Using a linear approximation, the effective refractive index can be obtained as [50]: The porosities of all 3D printed samples were calculated and are analysed below in relation to the printer settings.
The loss coefficient of 3D printed samples is higher than that of solid material due to the contributions of scattering and diffraction. On the one hand, porosity gives rise to scattering because the air voids act as scattering centers. Scattering loss manifests as a featureless loss edge that increases with frequency, typically according to a power law. On the other hand, porosity also reduces absorption loss, as less material is present in the beam path. The two effects counteract each other, such that the total is determined by the porosity, the material absorption, and the size of the voids. In the case of the PETG samples studied here, the effects closely counter-balance, so that the excess loss is small in all cases. This is because PETG is a polar polymer with moderately strong THz absorption. The excess loss α exc can be calculated by comparing the absorption in solid material α solid with effective loss in the sample α eff : In addition to scattering, all 3D printed samples show a diffraction loss feature, seen as a weak broad peak. This can be explained as arising from the regular variation of the refractive index in the printed structure, which forms a Bragg grating [51] with a period H equal to the height of the printing layer. The Bragg frequency is then given by ν 0 = c/(2n solid H). The Bragg feature occurs at 0.9 THz for layers of 100 µm, at 0.6 THz for layers of 150 µm, and at 0.3 THz for layers of 300 µm. Since Bragg reflection increases with refractive index variation, the intensity of the diffraction feature reflects the degree of inhomogeneity in the sample. The intensity of the Bragg feature can be taken as excess loss at the local maximum α exc,peak . Using Equation (4), the excess peak diffraction loss values of all 3D printed samples were calculated and are discussed below in relation to the printer settings. thick-printed samples, the porosity is lower in the sample with the taller layer and the opposite behaviour is observed in the thin-printed sample. However, the diffraction peak is stronger in both thick-and thin-printed printed samples with the taller layer, although the difference between the layer heights is larger in the thin-printed sample. This indicates that there is an optimal combination of layer and track sizes-a "sweet spot"-where the porosity and inhomogeneity are minimised.  Figure 4 examines the effect of layer height on the porosity and inhomogeneity of the 3D printed PETG samples, together with the effect of thick/thin printing. Clearly, for the thick-printed samples, the porosity is lower in the sample with the taller layer and the opposite behaviour is observed in the thin-printed sample. However, the diffraction peak is stronger in both thick-and thin-printed printed samples with the taller layer, although the difference between the layer heights is larger in the thin-printed sample. This indicates that there is an optimal combination of layer and track sizes-a "sweet spot"-where the porosity and inhomogeneity are minimised.  Figure 5 considers the effect of nozzle diameter, together with layer height, on the porosity and inhomogeneity of the 3D printed PETG samples. The porosity decreases with nozzle diameter for the 150 μm layer. However, samples with 100 μm and 300 μm layers both have higher porosity for the same nozzle diameter than that with the 150 μm layer. Here, again, it appears that there is a "sweet spot" where porosity is minimised for an optimal combination of layer height and nozzle diameter. The strength of the diffraction peak is greatly reduced for the larger nozzle diameter.   Figure 5 considers the effect of nozzle diameter, together with layer height, on the porosity and inhomogeneity of the 3D printed PETG samples. The porosity decreases with nozzle diameter for the 150 µm layer. However, samples with 100 µm and 300 µm layers both have higher porosity for the same nozzle diameter than that with the 150 µm layer. Here, again, it appears that there is a "sweet spot" where porosity is minimised for an optimal combination of layer height and nozzle diameter. The strength of the diffraction peak is greatly reduced for the larger nozzle diameter.  Figure 6 explores the effect of extrusion on the porosity and inhomogeneity of the 3D printed PETG samples. We note that the porosity decreases linearly with extrusion. The diffraction peaks also decrease with extrusion, although not linearly. This can be explained by the fact that both porosity and inhomogeneity decrease when more material is extruded, and provides a more complete and uniform in-fill of the spaces between the printing tracks.  Figure 6 explores the effect of extrusion on the porosity and inhomogeneity of the 3D printed PETG samples. We note that the porosity decreases linearly with extrusion. The diffraction peaks also decrease with extrusion, although not linearly. This can be explained by the fact that both porosity and inhomogeneity decrease when more material is extruded, and provides a more complete and uniform in-fill of the spaces between the printing tracks. Figure 6 explores the effect of extrusion on the porosity and inhomogeneity of the 3D printed PETG samples. We note that the porosity decreases linearly with extrusion. The diffraction peaks also decrease with extrusion, although not linearly. This can be explained by the fact that both porosity and inhomogeneity decrease when more material is extruded, and provides a more complete and uniform in-fill of the spaces between the printing tracks.  Figure 7 focuses on the effect of the printing pattern on the porosity and inhomogeneity of the 3D printed PETG samples. As expected, the linear pattern exhibits polarisation effects due to anisotropy, where the beam polarised parallel to the tracks experiences a higher refractive index (lower porosity) and weaker diffraction than the beam polarised perpendicular to the tracks. For the beam polarised normal to the tracks, the values of porosity and diffraction strength lie close to those of the circular and cross-hatch patterns. For both polarisations, the linear pattern has the lowest porosity, followed by the circular and the cross-hatch. However, there is little variation in the diffraction peak.  Figure 7 focuses on the effect of the printing pattern on the porosity and inhomogeneity of the 3D printed PETG samples. As expected, the linear pattern exhibits polarisation effects due to anisotropy, where the beam polarised parallel to the tracks experiences a higher refractive index (lower porosity) and weaker diffraction than the beam polarised perpendicular to the tracks. For the beam polarised normal to the tracks, the values of porosity and diffraction strength lie close to those of the circular and cross-hatch patterns. For both polarisations, the linear pattern has the lowest porosity, followed by the circular and the cross-hatch. However, there is little variation in the diffraction peak.

Effect of Printing Pattern
Appl. Sci. 2022, 12, x FOR PEER REVIEW 8 of 12 Figure 7. Effects of the printing pattern on the porosity (a) and diffraction loss (b) in 3D printed PETG samples. The labels "linear para" and "linear perp" refer to the linear pattern oriented parallel and perpendicular to the beam polarisation, respectively.

Relationship between Porosity and Diffraction
In examining Figures 4-7, we note an apparent positive correlation between porosity and the strength of the diffraction peak. This is confirmed by the results shown in Figure  8, where we plot the peak intensity versus porosity for all samples. The correlation may be explained by the fact that higher porosity is associated with greater structured inhomogeneity in the material, which gives rise to stronger diffraction. Printing pattern Figure 7. Effects of the printing pattern on the porosity (a) and diffraction loss (b) in 3D printed PETG samples. The labels "linear para" and "linear perp" refer to the linear pattern oriented parallel and perpendicular to the beam polarisation, respectively.

Relationship between Porosity and Diffraction
In examining Figures 4-7, we note an apparent positive correlation between porosity and the strength of the diffraction peak. This is confirmed by the results shown in Figure 8, where we plot the peak intensity versus porosity for all samples. The correlation may be explained by the fact that higher porosity is associated with greater structured inhomogeneity in the material, which gives rise to stronger diffraction.
In examining Figures 4-7, we note an apparent positive correlation between porosity and the strength of the diffraction peak. This is confirmed by the results shown in Figure  8, where we plot the peak intensity versus porosity for all samples. The correlation may be explained by the fact that higher porosity is associated with greater structured inhomogeneity in the material, which gives rise to stronger diffraction.

Model
In order to explain the findings presented here, we employ a simple geometrical model of 3D printed materials. The model, depicted in Figure 9, assumes that the deposited tracks are cylindrical, rigid, parallel, and regularly spaced. Of course, the real structure deviates from these assumptions to various degrees, especially in the fact that track cross-sections are non-circular. Nevertheless, the model provides a good first-order approximation and allows for the interpretation of the experimental results. Figure 9a shows a partial cross-section of cross-hatch printed material, where the spacing between the tracks equals their diameter, resulting in dense packing. It is easy to

Model
In order to explain the findings presented here, we employ a simple geometrical model of 3D printed materials. The model, depicted in Figure 9, assumes that the deposited tracks are cylindrical, rigid, parallel, and regularly spaced. Of course, the real structure deviates from these assumptions to various degrees, especially in the fact that track cross-sections are non-circular. Nevertheless, the model provides a good first-order approximation and allows for the interpretation of the experimental results.
Appl. Sci. 2022, 12, x FOR PEER REVIEW 9 of 12 see that the volume fraction of the voids in this case equals p = 1-π/4 = 0.22. (This is much higher than the observed porosity values due to flattening of the real printed tracks: see below.) If the track spacing is either larger or smaller than the track diameter, the packing density is reduced and porosity increases (Figure 9b,c). This explains the observation that there is a "sweet spot" of printer settings, where porosity is minimised. A linear printing pattern can produce a dense hexagonal packing (Figure 9d), where porosity equals p = 1π/(23) = 0.09, explaining why the observed porosity is lower in the linear-printed samples. The model also allows interpretation of the positive correlation between porosity and the diffraction loss peak: Bragg diffraction arises due to variations in the refractive index; these are larger in materials with higher porosity. Finally, Figure 9e depicts a more realistic picture of the 3D-printed structure, showing tracks that are deformed and flattened due to melting. Such deformation fills in the voids, significantly reducing porosity and explaining why the measured values are much lower than those estimated by the model. The simple model depicted in Figure 9 shows that a "sweet spot" for minimum porosity occurs when the track spacing and layer height are both equal to the track diameter, i.e., D = L = H. However, track deformation due to melting should also be taken into account. Minimising porosity will also lead to a reduced diffraction loss peak.

Conclusions
The effects of 3D printer settings on the porosity and homogeneity of the produced materials were examined using terahertz time-domain spectroscopy. A set of PETG samples were 3D printed by systematically varying the printer parameters, including layer thickness, nozzle diameter, thick/thin printing, extrusion, and printing pattern. The effective refractive indices and loss coefficients of the 3D printed samples were measured and compared with those of solid PETG. porosity was calculated from the difference in the refractive index of solid and 3D printed material. For the first time, a Bragg diffraction feature was observed in the loss spectrum of all 3D printed samples; material inhomogeneity was inferred from the amplitude of this feature.  Figure 9a shows a partial cross-section of cross-hatch printed material, where the spacing between the tracks equals their diameter, resulting in dense packing. It is easy to see that the volume fraction of the voids in this case equals p = 1-π/4 = 0.22. (This is much higher than the observed porosity values due to flattening of the real printed tracks: see below.) If the track spacing is either larger or smaller than the track diameter, the packing density is reduced and porosity increases (Figure 9b,c). This explains the observation that there is a "sweet spot" of printer settings, where porosity is minimised. A linear printing pattern can produce a dense hexagonal packing (Figure 9d), where porosity equals p = 1-π/(2 √ 3) = 0.09, explaining why the observed porosity is lower in the linear-printed samples. The model also allows interpretation of the positive correlation between porosity and the diffraction loss peak: Bragg diffraction arises due to variations in the refractive index; these are larger in materials with higher porosity. Finally, Figure 9e depicts a more realistic picture of the 3D-printed structure, showing tracks that are deformed and flattened due to melting. Such deformation fills in the voids, significantly reducing porosity and explaining why the measured values are much lower than those estimated by the model.
The simple model depicted in Figure 9 shows that a "sweet spot" for minimum porosity occurs when the track spacing and layer height are both equal to the track diameter, i.e., D = L = H. However, track deformation due to melting should also be taken into account. Minimising porosity will also lead to a reduced diffraction loss peak.

Conclusions
The effects of 3D printer settings on the porosity and homogeneity of the produced materials were examined using terahertz time-domain spectroscopy. A set of PETG samples were 3D printed by systematically varying the printer parameters, including layer thickness, nozzle diameter, thick/thin printing, extrusion, and printing pattern. The effective refractive indices and loss coefficients of the 3D printed samples were measured and compared with those of solid PETG. porosity was calculated from the difference in the refractive index of solid and 3D printed material. For the first time, a Bragg diffraction feature was observed in the loss spectrum of all 3D printed samples; material inhomogeneity was inferred from the amplitude of this feature.
When fabricating 3D printed materials, it is desirable to minimise their porosity and inhomogeneity in order to improve their mechanical and optical properties. It was found that porosity and inhomogeneity are strongly influenced by printer settings, and that a "sweet spot" exists where these are minimised for an optimal combination of printer settings. In particular, increasing extrusion appears to be most effective in reducing porosity and inhomogeneity. Moreover, there is a positive correlation between porosity and diffraction, such that both are minimised simultaneously. A simple geometrical model was proposed to explain the findings.
In this study, we have demonstrated the use of THz TDS for examining 3D printed materials. We have measured porosity and diffraction loss and have observed their variations with printer settings. Porosity is known to be related to the mechanical properties of 3D printed materials, such as elastic modulus. Therefore, THz TDS measurements can provide insight into the mechanical performance of such materials.
It should be noted that in the simple implementation described here, THz TDS is a bulk technique that measures the mean porosity over the volume of material (area and depth) exposed to the beam. As such, it cannot provide a 3D image of the internal structure of the object, nor depth variation of properties such as porosity. As with other optical techniques, tomographic implementations of THz TDS that can reveal internal structure are possible. However, these require complex equipment and are time-consuming, and therefore may not be suitable for routine quality control.
THz TDS is a non-contact, non-destructive technique that can be implemented in an industrial environment to provide in-line or near-line testing, and therefore offers a useful testing tool to the additive manufacturing industry.