# Open-Source Script for Design and 3D Printing of Porous Structures for Soil Science

Romain Bedell, Alaa Hassan, Anne-Julie Tinet, Javier Arrieta-Escobar, Delphine Derrien, Marie-France Dignac, Vincent Boly, Stéphanie Ouvrard, Joshua Pearce

► To cite this version:

Romain Bedell, Alaa Hassan, Anne-Julie Tinet, Javier Arrieta-Escobar, Delphine Derrien, et al. Open-Source Script for Design and 3D Printing of Porous Structures for Soil Science. Technologies, 2021, 9 (3), pp. 67. 10.3390/technologies9030067. [hal-03344448](https://hal-univ-lorraine.fr/hal-03344448)

HAL Id: hal-03344448

https://hal.univ-lorraine.fr/hal-03344448

Submitted on 5 Nov 2021

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
<figure><img src="image_2.png" /></figure>

Article

# Open-Source Script for Design and 3D Printing of Porous Structures for Soil Science

Romain Bedell<fnref n="1" />, Alaa Hassan <fnref n="1" />,* , Anne-Julie Tinet <fnref n="2" /> , Javier Arrieta-Escobar <fnref n="3" /> , Delphine Derrien <fnref n="4" /> , Marie-France Dignac <fnref n="5" /> , Vincent Boly <fnref n="1" />, Stéphanie Ouvrard <fnref n="6" /> and Joshua M. Pearce <fnref n="7" />

<figure><img src="image_3.png" /></figure>

check for
updates

**Citation:** Bedell, R.; Hassan, A.; Tinet, A.-J.; Arrieta-Escobar, J.; Derrien, D.; Dignac, M.-F.; Boly, V.; Ouvrard, S.; Pearce, J.M. Open-Source Script for Design and 3D Printing of Porous Structures for Soil Science.
*Technologies* **2021**, *9*, 67. https://doi.org/10.3390/technologies9030067

Academic Editor: Pietro Zanuttigh

Received: 14 July 2021

Accepted: 9 September 2021

Published: 15 September 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

<figure><img src="image_4.png" /></figure>

**Copyright:** © 2021 by the authors.
Licensee MDPI, Basel, Switzerland.
This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

**Abstract:** Three-dimensional (3D) printing in soil science is relatively rare but offers promising directions for research. Having 3D-printed soil samples will help academics and researchers conduct experiments in a reproducible and participatory research network and gain a better understanding of the studied soil parameters. One of the most important challenges in utilizing 3D printing techniques for soil modeling is the manufacturing of a soil structure. Until now, the most widespread method for printing porous soil structures is based on scanning a real sample via X-ray tomography. The aim of this paper is to design a porous soil structure based on mathematical models rather than on samples themselves. This can allow soil scientists to design and parameterize their samples according to their desired experiments. An open-source toolchain is developed using a Lua script, in the IceSL slicer, with graphical user interface to enable researchers to create and configure their digital soil models, called monoliths, without using meshing algorithms or STL files which reduce the resolution of the model. Examples of monoliths are 3D-printed in polylactic acid using fused filament fabrication technology with a layer thickness of 0.20, 0.12, and 0.08 mm. The images generated from the digital model slicing are analyzed using open-source ImageJ software to obtain information about internal geometrical shape, porosity, tortuosity, grain size distribution, and hydraulic conductivities. The results show that the developed script enables designing reproducible numerical models that imitate soil structures with defined pore and grain sizes in a range between coarse sand (from 1 mm diameter) to fine gravel (up to 12 mm diameter).

**Keywords:** 3D printing; additive manufacturing; soil structure; open-source; modeling; slicing; open-source image processing software

## 1. Introduction

Additive manufacturing (AM), also known as 3D printing, is driving major innovation in many research and industrial areas. It is now commonly used to manufacture scientific research tools to increase reproducibility, lower costs, and improve accessibility [1-4]. In general, the use of 3D printing to fabricate open hardware for scientific use reduces the cost by 92% compared to proprietary commercial tools [5] and has thus been used in a wide variety of sciences. For example, in geoscience, a number of studies have employed 3D printing techniques to investigate its capabilities in rock mechanics to reproduce strength in common rock mechanics tests [6,7] in replicating natural rock joint specimens to study

<footnote n="1">¹ Université de Lorraine, ERPI, F-54000 Nancy, France; romain.bedell@viacesi.fr (R.B.); vincent.boly@univ-lorraine.fr (V.B.)</footnote>

<footnote n="2">2 Université de Lorraine-CNRS, GeoRessources, F-54000 Nancy, France; anne-julie.tinet@univ-lorraine.fr</footnote>

<footnote n="3">³ Université de Lorraine-CNRS, LRGP, F-54000 Nancy, France; javier-andres.arrieta-escobar@univ-lorraine.fr</footnote>

<footnote n="4">⁴ INRAE, BEF, F-54000 Nancy, France; delphine.derrien@inrae.fr</footnote>

<footnote n="5">5 INRAE, Institute of Ecology and Environmental Sciences of Paris iEES-Paris, CNRS, Sorbonne Université, F-75005 Paris, France; marie-france.dignac@inrae.fr</footnote>

<footnote n="6">6 Université de Lorraine-INRAE, Laboratoire Sols et Environnement, F-54500 Vandoeuvre-lès-Nancy, France; stephanie.ouvrard@univ-lorraine.fr</footnote>

<footnote n="7">⁷ Department of Electrical & Computer Engineering, Western University, London, ON N6A 5B9, Canada; joshua.pearce@uwo.ca</footnote>

<footnote>* Correspondence: alaa.hassan@univ-lorraine.fr; Tel.: +33-3-72-74-35-33</footnote>
rock surface properties [8], or to study internal structures [9]. These works have aimed to develop methods to produce 3D-printed rock samples. Additional studies have focused on the process of reproducing rock specimens by the translation of X-ray scanning images (X-ray tomography images) to computer-aided design (CAD)-based models that could then be 3D printed. Others have focused on the different material options to create artificial specimens such as powder and adhesive and binding agents. In a recent study [10], a plant root system was modeled and 3D-printed using acrylonitrile butadiene styrene (ABS) plastic. The root was planted in a soil model and then mechanical tests were conducted to investigate the response of a vegetated slope to earthquake ground motion.

Unlike in geosciences, the use of AM in soil science is a relatively new research area. Only a few articles have dealt with the use of 3D printing techniques at the service of soil science. X-ray-computed tomography and 3D printing technology have been combined to produce physical structures with replicable, complex pore geometries reflecting those of soils [11]. Another study combined X-ray micro CT with 3D multijet printing technology to evaluate the reproducibility of 3D-printed soil structures at the original scale with a resolution of 80 µm. Results showed that soil-like prototypes were similar to the original samples in terms of total porosity and pore shape [12]. Moreover, a spatially explicit model was developed for nutrient uptake by root hairs based on X-ray-computed tomography images of the rhizosphere soil structure [13]. The undisturbed soil column of Ultuna clay soil was 3D-printed in ABS material based on X-ray images and the potential and limitations of reproducing this were evaluated [14]. These studies using ABS show that further research needs to be conducted to circumvent the problem of residual material blocking pores. Moreover, regardless of the 3D printing material, the fine pore matrix cannot be printed. Therefore, there is a need to develop a printing method to produce soil with connected macropores.

Most research studies are based on X-ray tomography images to generate a digital model of the soil and then fabricating it with 3D printing. Other articles, however, adopt an- other approach that proposes mathematical modeling of the soil structure. Ngom et al. [15] propose the modeling of soil microstructures using generalized cylinders, with a specific application to pore space. As the pore space defines a complex volume shape that cannot be approximated using simple analytical functions, Ngom et al. propose representing this shape using an approximation by means of generalized cylinders. This modeling is, however, not oriented towards the fabrication of soil structures by 3D printing but aims at simulating biological dynamics. Buj-Corral et al. [16] provide a methodology to design porous structures to be 3D printed. Their model is defined with some theoretical parallel planes, with each plane having randomly distributed points on it. Then, the points are joined with lines using the marching cubes algorithm. This approach is interesting, but since the generation of points is random, this modeling is not reproducible.

Soil science experiments have been greatly impacted by the technological advances that have been developed over the past decades. However, support for these experiments has evolved very slowly. Soil samples are still taken in the “traditional” way from specific fields. For this purpose, agricultural researchers determine in advance which areas would contain the most suitable soil for an experiment. This method leads to many approximations and uncontrolled parameters, which greatly complicates the analysis of the obtained results. Thus, for some studies, there is a need for identical replicates, and 3D printing offers a good opportunity to meet this need.

The modeling of a porous structure for soil science must consider a combination of specifications (nature of the material, porosity, location of a specific substance or living organisms) [17]. Besides, the modeling process should be based on an engineering design approach, so that the soil model should be customizable and reproducible. The main characteristics of the model will be identified and studied according to the complexity of the phenomena in the soil and then a design approach will be achieved to define the 3D printing process.
To support this design approach, one main challenge is the development of software that allows soil scientists to create their soil models according to their needs in terms of the soil structure. This software should be dedicated to scientific research and should promote data sharing and exchange across an international community.

One principle of the research is to opt for an open-source system. Indeed, open-source makes the evolution of the modeling software easier [18–20]. For years, open-source software and hardware have contributed to the modernization and improvement of agriculture. For example, open-source software such as the statistical software R [21] is used for data analysis and GeoFIS as a decision-support tool for precision agriculture data [22]. Open-source hardware examples are found on the notion of precision agriculture and SmartFarm by integrating open-source technologies such as smart sensors, recording devices, and drones [23–26].

In this context, the objective of this paper is to present a developed open-source toolchain that allows soil scientists to generate customizable and reproducible digital soil models, called monoliths. This open-source script is developed under the IceSL environment [27], which is an open-source slicer. The Section 2 introduces the need for 3D-printed monoliths for soil scientists and the script development approach. It also presents the main interface of the script and shows examples of monolith settings. Four different monoliths with various settings are generated and some examples are 3D-printed to show the ability of this script to fulfill the scientist's needs. The Section 3 presents the analysis of the monolith digital models.

## 2. Materials and Methods

### 2.1. *The Need for 3D-Printed Samples in Soil Science*

Soils have very diverse and heterogeneous properties from one area to another—samples taken at the same time, a few centimeters apart, can have completely different characteristics. This is because all parameters are related to the fauna, human activity, the physical structure of the soil, its chemistry, etc. As a result, the soil sample parameters supporting research experiments on soil function are partly uncontrolled, which greatly complicates the analysis of the obtained results. Additionally, the researcher is unable to obtain a batch of identical samples to repeat their experiments several times and thus confirm or disprove their results. This leads to the following scientific problem: is it not possible today for soil researchers to obtain two identical and controlled soil samples for their experiments? This observation becomes problematic when we know that each experiment needs a large number of iterations for the results to be significant.

In this context, the main need is to obtain 3D-printed soil samples that are identical, customizable, and reproducible. These “artificial” 3D-printed monoliths, which are porous structures, will be able to meet the needs of soil science researchers by providing them with a reference sample to conduct and repeat their experiments.

There are many experiments that can be carried out on monoliths, in relation to the flow of water and solutes in the soil matrix, and to the movement or growth of living organisms (germination and root development). However, the first challenge is to design and fabricate a monolith with a porous structure and controlled geometry. The material used must also be biocompatible. The objective is not to reproduce a real soil sample (as achieved with X-ray tomography images), but to be able to design a given sample according to the desired experiment that will be conducted on this sample. Therefore, the main specifications of the monoliths and their design software are summarized as follows:

* For the present study, the monolith has a cylindrical shape with a maximum radius of 20 mm and a maximum height of 70 mm (these values can be modified depending on the 3D printer used);

* The porosity of the monolith must be controllable;

* The monolith structure must be an open-cell, i.e., it permits the flow of water;

* The monolith design software (or script) must be open-source in order to make it available to the scientific community and to allow for its evolution;
* The design software (or script) should provide a user-friendly interface for the configuration of the monolith;

* The 3D printer used to produce the monoliths should preferably be open-source;

* The design and fabrication of monoliths must be replicable;

* The materials used for the 3D-printing of monoliths must be non-toxic to plants, fauna, and fungi;

* It is preferable that the script gives the possibility to add a root system to the monolith model (i.e., to create a void root system).

## 2.2. Script Development Methodology

Figure 1 shows the main steps of the methodology for developing the script allowing for the generation of a porous structure. The following paragraphs describe each step.

<figure><img src="image_5.png" /><figcaption>**Figure 1.** Methodology for developing the porous structure generator script.</figcaption></figure>

### 2.2.1. Study of Mathematical Models

The first step in our approach is to study the different models and algorithms for creating a complex porous structure. The model must allow the pseudo-stochastic generation of interconnected solid cells. This notion of pseudo-stochastic is essential, on the one hand, to mimic the internal random geometry of the soil, and, on the other, to be able to replicate the monolith model. In addition, the mathematical model makes it possible to generate an open-cell porous structure that allows for the circulation of water or living organisms (plants, fauna, fungi, etc.) within the monolith. As the monolith models are designed for 3D printing, the notion of lattices and foams, which are commonly used for this manufacturing technique, is emphasized. A lattice structure is an architecture formed by an array of spatial periodic unit cells with edges and faces, and they are often linked to cellular solids [28]. A foam is an architecture formed by a stochastic array of cells. Figure 2 shows the different categories of cellular solids.
<figure><img src="image_6.png" /><figcaption>**Figure 2.** Categories of cellular solids [28].</figcaption></figure>

In the following, some major algorithm approaches for designing a complex porous structure are described:

* Marching cubes is a computer graphics algorithm for extracting a polygonal mesh of an iso-surface from a three-dimensional scalar field. It is widely used to reconstruct a surface from medical X-ray tomography scans and to create an STL file [29]. This algorithm is less adapted to our context because using the STL format will degrade the resolution of the generated structure.

* The generation of lattices—periodic arrays of trusses (geometric patterns)—when combined, yield unique properties [30]. Morphological characteristics of the lattices, such as their orientation, size, and spatial arrangement (random, regular, irregular) can be optimized to improve the mechanical properties and manufacturability. Lattices, however, are more suitable for predefined internal structures and not for random internal structures as in the case of monoliths.

* Generation of a trabecular structure, also called foam structure, is a derivative of the lattice structure. The trabecular network is an open-cell random structure with interconnected voids. The trabecular structure is largely used in the 3D printing of human bones.

* The L-System, or Lindenmayer system, is a common tool in plant architecture modeling that is used for creating root architecture [31]. It will help in creating the required root system in the monolith model as described later

As a result of this study, a trabecular structure is selected and an algorithm supporting its generation is employed in the developed script for the generation of the monolith open-cell structure. In addition, the L-System is used to generate the root system of the monolith.

### 2.2.2. Study of Basic Soil Structures

Besides reviewing the mathematical principles, it is important to study the structure of the soil, especially its geometry, in order to derive design criteria for the monoliths. Soil is a heterogeneous porous system containing solid particles of different sizes as well as other organic matter, fauna, roots, etc. Focusing on the geometric structure of the soil, two main factors are considered in this study: the size of the grains and their arrangements.

The form and size of the grains have an effect on the internal structure and the final porosity of the monolith, so it will be interesting to design models where the grains could take different forms. The effects of grain packing arrangement and shape on the porosity are studied in [32]. It has been shown that for well-sorted sand, the particle size does not
affect porosity. In this case, the porosity range of sphere sand grain shape is 39 to 41% and for the disk shape is 44 to 49%, while the average porosity for triclinic arrangement is 26% and for cubic arrangement is 47.4%.

Moreover, the distribution of the grain form, and thus their size, varies according to the depth. For some types of soil, soil sand content increased, and silt and clay content decreased with soil depths [33].

The second factor refers to the grouping of soil grains into aggregates. The arrangement of these aggregates determines the soil structure. Soil structures are dependent on the studied environment, but the basic types are presented in [34] as shown in Figure 3.

<figure><img src="image_7.png" /><figcaption>**Figure 3.** Basic types of aggregate arrangements. (A) granular; (B) blocky; (C) prismatic; (D) massive [34].</figcaption></figure>

Therefore, two key soil parameters are identified as inputs for the developed script: the grain number and the infill (material filling ratio in the geometrical volume).

### 2.2.3. Selection of the Development Software

To allow the design of the monoliths using mathematical models, it will first be necessary to choose a modeling software for developing the design script. Indeed, since the monolith model is based on complex mathematical functions, only a development tool that allows the implementation of such functions is interesting.

The development software must be open-source and meet the different required functionalities and specifications. Many CAD and Slicing software programs exist, and some of them combine both functionalities. A list of selection criteria has been established in order to objectively select the most adequate software. Table 1 shows these selection criteria and a comparison between different software and slicers according to the criteria. The symbol “×” means that the software has this functionality (i.e., it meets this criterion).

<table><caption>**Table 1.** Comparison between different scriptable open-source software programs according to the selection criteria.</caption><thead><tr><td>Software</td><td>Export STL</td><td>Export G-Code</td><td>Scripting</td><td>Export Images</td><td>G-Code Preview</td></tr></thead><tbody><tr><td>Blender</td><td>×</td><td></td><td>×</td><td>×</td><td></td></tr><tr><td>OpenSCAD</td><td>×</td><td></td><td>×</td><td>×</td><td></td></tr><tr><td>IceSL</td><td>×</td><td>×</td><td>×</td><td>×</td><td>×</td></tr></tbody></table>

Three software packages are available offering the possibility to develop scripts. Blender is a powerful tool with interesting features; however, it is more adapted to work on meshes than on solids based on volume. OpenSCAD is more complete at the mathematical level, with libraries that avoid the implementation of complex mathematical structures
such as the Lindenmeyer system [31]. IceSL [27], which is a derivative of OpenSCAD, is a research tool that offers interesting features such as the direct generation of G-code from the model without the conversion to the STL format. This feature is key in the D printing of monoliths since it prevents degradation in the resolution of the geometry because of the conversion to the STL format. Besides, IceSL is used in other projects to generate foam models respecting the constraints of 3D printing [35]. Thus, IceSL was chosen to develop the monolith modeling script.

### 2.2.4. Monolith Script Development

In order to allow the creation of a customizable porous structure, i.e., a monolith, a script has been developed in the Lua language [36] which should be loaded in the IceSL software. This script is open-source and available on https://github.com/RomainBedell/Porous_medium_generator (accessed on 29 June 2021). The generated monolith model is a pseudo-random trabecular structure (open-cell) in which different cylindrical forms can be generated and customized. To facilitate the use of this script, a GUI has been developed that gives the user the control to configure the desired monolith. Figure 4 shows this interface while Table 2 explains the functionality of each parameter.

<figure><img src="image_8.png" /><figcaption>Figure 4. The main interface of the monolith design script.</figcaption></figure>

<table><caption>Table 2. The GUI commands and their functionalities.</caption><thead><tr><td>Command</td><td>Description</td></tr></thead><tbody><tr><td>Additional Form</td><td>Allows additional forms in the monolith to mix the grain sizes or to change the parameters of grain on different layers, Form_1 is set by default</td></tr><tr><td>ShapeForm_1 -> Form_1</td><td>Render monolith porous structure based on a Trabecular model</td></tr><tr><td>ShapeForm_1 -> Hollow_1</td><td>Render the negative of monolith structure, corresponds to its porous network</td></tr><tr><td>ShapeForm_1 -> Hollow & Form Merge_1</td><td>Render monolith solid form and its porosity in order to print, for example, the porosity in soluble materials</td></tr><tr><td>Diameter_1, Height_1, and Color_1</td><td>For each Form in the monolith, set the diameter of the cylinder (mm), the height (mm), and the color</td></tr><tr><td>Grain Number_1</td><td>Set the number of grains according to their size, the higher the value, the more numerous and smaller are the grains</td></tr></tbody></table>
<table><caption>**Table 2.** *Cont.*</caption><thead><tr><td>Command</td><td>Description</td></tr></thead><tbody><tr><td>Infill_1</td><td>Set material/void ratio, the bigger the factor the more material filling in the geometry will be, this influences the size of the grains, but not their number and distribution</td></tr><tr><td>Form Translate X_1, Y_1, Z_1</td><td>To move the Form on the X, Y, or Z-axis, useful for multi-form modeling</td></tr><tr><td>Root_ -> Yes</td><td>To add a root model, as an STL file, to the monolith. The position of the root can be modified and its size can be rescaled</td></tr></tbody></table>

To illustrate the use of the developed script, four examples of the generated monoliths are shown with their respective parameters; Monolith 1 in Figure 5, Monolith 2 in Figure 6, Monolith 3 in Figure 7 and Monolith 4 in Figure 8.

<figure><img src="image_9.png" /><figcaption>**Figure 5.** Settings and model of the Monolith 1.</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>**Figure 6.** Settings and model of the Monolith 2, a bigger monolith with fewer and bigger grains.</figcaption></figure>
<figure><img src="image_11.png" /><figcaption>Figure 7. Settings and model of the Monolith 3, mix of different grain sizes.</figcaption></figure>

<figure><img src="image_12.png" /><figcaption>Figure 8. Settings and model of the Monolith 4 with an offset root system for illustration.</figcaption></figure>
### 2.2.5. Analysis of Digital and 3D-Printed Monoliths

IceSL allows slicing of the model by images in SVG (Scalable Vector Graphics) format. In order to evaluate the monoliths generated using the developed script, SVG images were used to compute monolith properties commonly used in soil science and geotechnical engineering. Figure 9 shows an example of an SVG image of a layer from Monolith 3.

<figure><img src="image_13.png" /><figcaption>**Figure 9.** SVG image generated of the 135th layer of Monolith 3.</figcaption></figure>

As a first step, the obtained data from the developed script were transformed into voxelized images. The size of a voxel is fixed at the layer thickness (see Table 3) in all directions. This voxelization leads to staircase shapes of the interfaces between the solid and voids. Although this has little impact on the volumetric parameters, it can influence the surface calculations. All image analyses were performed using the open-source software ImageJ and its plugins XLib [37] and MorphoLibJ [38]. The calculated properties are as follows:

* Intergranular porosity is the ratio of volume of voids to total volume.

* Specific surface is the ratio of the total interface between solid and voids to solid volume. The interface between solid and voids is computed using the Cauchy-Crofton algorithm with C6 connectivity (voxels are considered connected if they have at least a face in common) in the MorphoLibJ package [38].

* The tortuosity is calculated as the ratio of the geodesic distance to the Euclidian distance between the inlet face and the outlet face. The geodesic distance is computed following the methodology described in [38], and the Euclidian distance corresponds to the size of the sample.

* Pore size distribution is computed using the MIP (Mercury Intrusion Porosimetry) simulation algorithm in the XLib package [37]. The MIP simulation algorithm simulates intrusion from one face in a manner similar to how the experimental measurement in MIP is performed.

* Granulometry (or grain size distribution) is computed in two steps. First, the grains are separated using the 'Disconnect Particles' algorithm in XLib [39]. Then, their properties are computed using the MorphoLibJ plugin. The particle diameter is obtained from the particle volume using an equivalent sphere approach.

* Hydraulic conductivities are obtained by numerical upscaling. The Stokes equation of flow is solved using the Lattice Boltzmann Method (LBM) [40,41] on the 3D image. Using the average value of the flow rate, permeability (in m²) in the direction orthogonal to the printing slices, can then be obtained. By analogy to the properties commonly used in soil science, permeabilities are then converted to hydraulic conductivities (in m/s).
<table><caption>**Table 3.** Three-dimensional (3D) printing parameters used to print Monolith 1.</caption><thead><tr><th></th><th>Layer thickness (mm)</th><th>Nozzle D (mm)</th><th>Extrusion Temperature (°C)</th><th>Bed Temperature (°C)</th><th>Infill (%)</th><th>Weight (g)</th><th>Printing Time</th></tr></thead><tbody><tr><td>Monolith 1</td><td>0.12</td><td>0.4</td><td>200</td><td>45</td><td>20</td><td>9.1</td><td>4 h 38 min</td></tr></tbody></table>

### 3. Results

#### 3.1. *Analysis of the Digital Monoliths*

The numerical models of the monoliths are analyzed using ImageJ software. Inter-granular porosity, specific surface, and tortuosity are computed by image analysis, while hydraulic conductivity is computed by numerical simulation. Table 4 summarizes the results of the image analysis and numerical simulations.

<table><caption>**Table 4.** Monolith properties obtained by image analysis and computed physical properties.</caption><thead><tr><th>Property</th><th>Monolith 1</th><th>Monolith 2</th><th>Monolith 3</th><th>Monolith 4</th></tr></thead><tbody><tr><td>Intergranular porosity</td><td>0.304</td><td>0.294</td><td>0.693</td><td>0.0595</td></tr><tr><td>Specific surface [1/mm]</td><td>1.369</td><td>0.884</td><td>1.578</td><td>0.432</td></tr><tr><td>Tortuosity</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.291</td></tr><tr><td>Hydraulic conductivity [m/s]</td><td>0.186</td><td>0.347</td><td>1.801</td><td>0.0343</td></tr></tbody></table>

Porosities around 0.3 are classical values in soils. Monolith 4 exhibits a much smaller porosity.

The tortuosity is quite low for monoliths 1 to 3, this is partly due to the small size of the samples. Monolith 4 exhibits a larger tortuosity, and this is likely related to the smaller intergranular porosity. The presence of the roots—void structure in Monolith 4—does not apparently affect the tortuosity.

The specific surface values are consistent with the values obtained for gravel and coarse sand.

The permeability values obtained show not only that the monoliths are well percolating, but also that the hydraulic conductivities obtained are consistent with characteristic values for coarse sands and gravels. For all monoliths, the permeability increases with pore size, which is logical.

#### 3.2. *3D Printing of the Monoliths*

In order to test the feasibility of the monolith models, Monolith 1 is 3D-printed using the Fused Filament Fabrication (FFF) technique in order to realize physical samples of the designed digital models. IceSL allows the direct slicing of the numerical model to the G-code and thus without passing by the STL file, this function is particularly interesting because it makes it possible to avoid the resolution loss and the limitations of the STL format. The RAISE3D E2 [42] 3D printer is used to fabricate Monolith 1 in PLA. Table 3 shows the main 3D printing parameters used to print it, while Figure 10 shows an image of the 3D-printed monolith.
<figure><img src="image_14.png" /><figcaption>**Figure 10.** 3D printed Monolith 1.</figcaption></figure>

# 4. Discussion

## 4.1. Granulometry

According to the script description (see Section 2.2.4), the granulometry should be mainly controlled by the “Grain Number” (GN) parameter and the “Infill” (InF). From Figure 11, the generated models have grain sizes ranging from 1 mm (coarse sand) to 12 mm (fine gravel). Comparing monoliths 1 and 2, which have the same value of InF, the impact of the GN parameter can be observed. As expected, the higher the GN is, the smaller the grains are, ranging from a characteristic size of coarse sand for GN = 0.3 to gravel for GN = 0.2. The comparison between Monolith 3 and Monoliths 1, 2, and 4, at the same GN value, shows the impact of the InF parameter on grain size. A decrease in the value of InF generates a decrease in grain size as well as a slight reduction in the size range. Finally, it should be pointed out that the root has no impact on the grain size distribution since it was introduced after the monolith creation.

## 4.2. Pore Size Distribution

By comparing Monoliths 1 and 2 (Figure 12), it can be seen that the distribution is also impacted by the GN parameter, with larger pore sizes when GN decreases. Finally, the important role of InF is shown when comparing Monolith 3 and Monoliths 1, 2, and 4. The pore sizes are significantly higher for Monolith 3, with a lower InF, and smaller for Monolith 4, with a higher InF.

## 4.3. Comparison with Printed Monolith

In order to assess the accuracy of the 3D printing, a printed Monolith 1 was imaged using X-ray microtomography Phoenix Nanotom. Figure 13 shows the image obtained. Some local printing artifacts may be observed. Firstly, the partial filling (see Table 3) leads to most of the grains being hollow (Figure 13). However, in most cases, the voids generated inside the grains remain disconnected from the intergranular porosity and, therefore, will not take part in fluid flow or particle transport within the sample. As a consequence, the following morphological comparison will be performed only considering the intergranular porosity. It should be noted that the non-connected intra-granular porosity is 2.5%. A second artifact may be observed with the apparition of bridges between grains (Figure 13).
<figure><img src="image_15.png" /><figcaption>**Figure 11.** Granulometry curves obtained for each monolith based on image analysis. For monolith 3, curves are generated for each grain type. GN and InF indicate, respectively, the ‘Grain Number’ and ‘Infill’ parameters used in the script (see Figures 5–8).</figcaption></figure>

<figure><img src="image_16.png" /><figcaption>**Figure 12.** Pore size distribution curves obtained for each monolith based on image analysis. InF indicates the ‘Infill’ parameter used in the script (see Figures 5–8).</figcaption></figure>
<figure><img src="image_17.png" /><figcaption>**Figure 13.** 3D printed monolith imaged by X-ray microtomography. Total image (**left**), cut view image (**right**). Red circle shows a hollow grain artifact, blue circle shows a bridge between two grains artifact.</figcaption></figure>

Despite these observed artifacts, the comparison of morphological and physical properties between the original data and printed material remains satisfactory as shown in Table 5 and Figure 14. A slight decrease in porosity and hydraulic conductivity is observed, potentially related to the existence of bridges. The specific surface is a little higher for the printed monolith.

<table><caption>**Table 5.** Comparison of Monolith 1 properties between digital and physical data.</caption><thead><tr><td>Property</td><td>Digital Monolith 1</td><td>3D-Printed Monolith 1</td></tr></thead><tbody><tr><td>Intergranular porosity</td><td>0.304</td><td>0.299</td></tr><tr><td>Specific surface [1/mm]</td><td>1.369</td><td>1.471</td></tr><tr><td>Tortuosity</td><td>1.000</td><td>1.049</td></tr><tr><td>Hydraulic conductivity [m/s]</td><td>0.186</td><td>0.182</td></tr></tbody></table>

<figure><img src="image_18.png" /><figcaption>**Figure 14.** Granulometry curve and pore size distribution curve comparison between digital and 3D-printed Monolith 1.</figcaption></figure>

The granulometry curve and pore size distribution curve demonstrate good consistency between the digital model data and the 3D-printed data of Monolith 1, with a slight discrepancy only occurring for larger grains (representing a larger volume for the printed monolith) and pores (representing a smaller volume for the printed monolith). Such observations may be related to the generation of bridges that may associate multiple grains as one grain and cut through pores.
**5. Conclusions**

This study successfully utilized an open-source toolchain consisting of a Lua script in IceSL with a free GUI to enable researchers to create and configure digital soil models without resorting to meshing algorithms. The designed monoliths were fabricated with common and accessible 3D printers in the most used filament, PLA, with layer thicknesses of 0.20, 0.12, and 0.08 mm. The images generated from the digital model slicing were analyzed using open-source ImageJ software to obtain information about internal geometrical shape, porosity, tortuosity, grain size distribution, and hydraulic conductivities. The results showed that the developed open-source script enabled all researchers to design reproducible numerical models that imitated soil structures with defined pore and grain sizes with the following observations:

* The tested model settings allowed the obtainment of materials similar to gravel and coarse sands.

* The “Grain Number” parameter allows to vary the grain size but keeps it small. To obtain a material with a more widespread granulometry, it is possible to use mixes of several sizes.

* The “Infill” parameter also modifies the grain size, at the risk of amplifying/counter-acting the effect of the “Grain Number”. This parameter also significantly modifies the total porosity, even to the point of disconnecting the grains from each other, which is not “physical” and requires adjustments to “bridges” for 3D printing. Therefore, it is recommended to not use values that are too low. The pore sizes can be modified by the grain number (via “Grain Number”) but probably also when size mixes are used.

* The morphological and physical properties seem globally consistent. However, when the grains are mostly disconnected from each other, “bridges” must be created for 3D printing in order to obtain a “stable” structure. This will likely generate significant impacts on the porosity and probably on the pore size distribution.

Samples that can be generated by the developed script would be expected to increase reproducibility as well as to be more accessible because of the open-source and low-cost methods involved.

This work can be expanded in the future by using a smaller nozzle for FFF printing and applying the technique to other forms of 3D printing with higher resolution as biocompatible materials for the fabrication of the monoliths.

**Author Contributions:** Conceptualization, A.H., A.-J.T., V.B., S.O., D.D. and M.-F.D.; methodology, R.B., J.A.-E. and A.H.; software, R.B.; validation, A.-J.T. and A.H.; formal analysis, A.-J.T.; investigation, A.H., A.-J.T., V.B., S.O., D.D. and M.-F.D.; resources, A.-J.T. and A.H.; data curation, A.-J.T.; writing—original draft preparation, R.B., J.A.-E., A.-J.T. and A.H.; writing—review and editing, R.B., J.A.-E., A.-J.T., V.B., J.M.P., D.D., M.-F.D. and A.H.; supervision, V.B., S.O., D.D., M.-F.D. and J.M.P.; project administration, V.B.; funding acquisition, A.H., A.-J.T. and V.B. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by ERPI Laboratory (Équipe de Recherche sur les Processus Innovatifs) for the internship of Romain Bedelland, by the French PIA project «Lorraine Université d'Excellence», reference ANR-15-IDEX-04-LUE and supported by the Thompson Endowment.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Data available upon request.

**Acknowledgments:** The authors thank Benjamin Ennesser-Serville at Lorraine Fab Living Lab® for his support in the 3D printing of the monoliths. They also thank Eric Lefevre and Christophe Morlot at GeoRessources for their contribution to the monolith analysis.

**Conflicts of Interest:** The authors declare no conflict of interest.
## References

1. Pearce, J.M. Open-Source Lab: How to Build Your Own Hardware and Reduce Research Costs. 2014. Available online: https://linkinghub.elsevier.com/retrieve/pii/C20120072493 (accessed on 14 April 2021).

2. Pearce, J.M. Building Research Equipment with Free, Open-Source Hardware. *Science* **2012**, *337*, 1303–1304. [CrossRef]

3. Coakley, M.; Hurt, D.E. 3D Printing in the Laboratory: Maximize Time and Funds with Customized and Open-Source Labware. *J. Lab. Autom.* **2016**, *21*, 489–495. [CrossRef]

4. Baden, T.; Chagas, A.M.; Gage, G.; Marzullo, T.; Prieto-Godino, L.L.; Euler, T. Open Labware: 3-D Printing Your Own Lab Equipment. *PLoS Biol.* **2015**, *13*, e1002086. [CrossRef]

5. Pearce, J.M. Economic savings for scientific free and open source technology: A review. *Hardw. X* **2020**, *8*, e00139. Available online: https://linkinghub.elsevier.com/retrieve/pii/S2468067220300481 (accessed on 15 April 2021). [CrossRef] [PubMed]

6. Vogler, D.; Walsh, S.; Dombrovski, E.; Perras, M. A comparison of tensile failure in 3D-printed and natural sandstone. *Eng. Geol.* **2017**, *226*, 221–235. [CrossRef]

7. Fereshtenejad, S.; Song, J.-J. Fundamental study on applicability of powder-based 3D printer for physical modeling in rock mechanics. *Rock Mech. Rock Eng.* **2016**, *49*, 2065–2074 [CrossRef]

8. Jiang, Q.; Feng, X.; Gong, Y.; Song, L.; Ran, S.; Cui, J. Reverse modelling of natural rock joints using 3D scanning and 3D printing. *Comput. Geotech.* **2016**, *73*, 210–220. [CrossRef]

9. Bodla, K.K.; Garimella, S.V.; Murthy, J.Y. 3D reconstruction and design of porous media from thin sections. *Int. J. Heat Mass Transf.* **2014**, *73*, 250–264. [CrossRef]

10. Liang, T.; Knappett, J.A.; Bengough, A.G.; Ke, Y.X. Small-scale modelling of plant root systems using 3D printing, with applications to investigate the role of vegetation on earthquake-induced landslides. *Landslides* **2017**, *14*, 1747–1765. [CrossRef]

11. Otten, W.; Pajor, R.; Schmidt, S.; Baveye, P.; Hague, R.; Falconer, R.E. Combining X-ray CT and 3D printing technology to produce microcosms with replicable, complex pore geometries. *Soil Biol. Biochem.* **2012**, *51*, 53–55. [CrossRef]

12. Dal Ferro, N.; Morari, F. From Real Soils to 3D-Printed Soils: Reproduction of Complex Pore Network at the Real Size in a Silty-Loam Soil. *Soil. Sci. Soc. Am. J.* **2015**, *79*, 1008. Available online: https://dl.sciencesocieties.org/publications/ssaj/abstracts/79/4/1008 (accessed on 4 March 2021). [CrossRef]

13. Daly, K.; Keyes, S.; Masum, S.; Roosevelt, T. Image based modeling of nutrient movement in and around the rhizosphere. *J. Exp. Bot.* **2016**, *67*, 1059–1070. [CrossRef] [PubMed]

14. Bacher, M. 3D-Printing of Undisturbed Soil Imaged by X-ray. Master's Thesis, Swedish University of Agricultural Sciences, Uppsala, Sweden, November 2013.

15. Ngom, N.F.; Monga, O.; Mohamed, M.M.O.; Garnier, P. 3D shape extraction segmentation and representation of soil microstructures using generalized cylinders. *Comput. Geosci.* **2012**, *39*, 50–63. [CrossRef]

16. Buj-Corral, I.; Bagheri, A.; Petit-Rojo, O. 3D Printing of Porous Scaffolds with Controlled Porosity and Pore Size Values. *Materials* **2018**, *11*, 1532. [CrossRef]

17. Arrieta-Escobar, J.A.; Derrien, D.; Ouvrard, S.; Asadollahi-Yazdi, E.; Hassan, A.; Boly, V.; Tinet, A.-J.; Dignac, M.-F. 3D printing: An emerging opportunity for soil science. *Geoderma* **2020**, *378*, 114588. [CrossRef]

18. Xie, G.; Chen, J.; Neamtiu, I. Towards a better understanding of software evolution: An empirical study on open source software. In Proceedings of the 2009 IEEE International Conference on Software Maintenance, Edmonton, AB, Canada, 20–26 September 2009; pp. 51–60. Available online: http://ieeexplore.ieee.org/document/5306356/ (accessed on 6 March 2021).

19. Wheeler, D.A. Why Open Source Software/Free Software (OSS/FS, FLOSS, or FOSS)? Look at the Numbers! 2015. Available online: http://dwheeler.com/oss_fs_why.html (accessed on 1 June 2021).

20. Comino, S.; Manenti, F.M.; Parisi, M.L. From planning to mature: On the success of open source projects. *Res. Policy* **2007**, *36*, 1575–1586. Available online: https://linkinghub.elsevier.com/retrieve/pii/S0048733307001709 (accessed on 1 June 2021). [CrossRef]

21. De Mendiburu, F.; Simon, R. Agricolae-Ten years of an open source statistical tool for experiments in breeding, agriculture and biology. *PeerJ* **2015**, *3*, 1–17.

22. Mesas-Carrascosa, F.; Santano, D.V.; Meroño, J.; de la Orden, M.S.; García-Ferrer, A. Open source hardware to monitor environmental parameters in precision agriculture. *Biosyst. Eng.* **2015**, *137*, 73–83. Available online: https://linkinghub.elsevier.com/retrieve/pii/S1537511015001208 (accessed on 10 June 2021). [CrossRef]

23. Leroux, C.; Jones, H.; Pichon, L.; Guillaume, S.; Lamour, J.; Taylor, J.; Naud, O.; Crestey, T.; Lablee, J.-L.; Tisseyre, B. GeoFIS: An Open Source, Decision-Support Tool for Precision Agriculture Data. *Agriculture* **2018**, *8*, 73. [CrossRef]

24. Lewis, B.; Smith, I.; Fowler, M.; Licato, J. The robot mafia: A test environment for deceptive robots. In Proceedings of the 28th Modern Artificial Intelligence and Cognitive Science Conference (MAICS), Fort Wayne, IN, USA, 28–29 April 2017; pp. 189–190.

25. Stočes, M.; Dit, F.; Vaněk, J.; Masner, J.; Pavlík, J. Internet of Things (IoT) in Agriculture—Selected Aspects. *Agris Online Pap. Econ. Inform.* **2016**, *8*, 83–88. Available online: https://ageconsearch.umn.edu/record/233969/ (accessed on 13 September 2021). [CrossRef]

26. Puri, V.; Nayyar, A.; Raja, L. Agriculture drones: A modern breakthrough in precision agriculture. *J. Stat. Manag. Syst.* **2017**, *20*, 507–518. [CrossRef]

27. IceSL: Advanced Modeling and Slicing for 3D Printing. Available online: https://icesl.loria.fr/ (accessed on 15 June 2021).
28. Tao, W.; Leu, M.C. Design of lattice structure for additive manufacturing. In Proceedings of the 2016 International Symposium on Flexible Automation (ISFA), Cleveland, OH, USA, 1–3 August 2016; pp. 325–332.

29. Masala, G.; Golosio, B.; Oliva, P. An improved Marching Cube algorithm for 3D data segmentation. *Comput. Phys. Commun.* **2013**, *184*, 777–782. [CrossRef]

30. Doubrovski, Z.; Verlinden, J.C.; Geraedts, J.M.P. Optimal Design for Additive Manufacturing: Opportunities and Challenges. In Proceedings of the ASME 2011 International Design Engineering Technical Conferences & Computers and Information in Engineering Conference, Washington, DC, USA, 28–31 August 2011; pp. 635–646.

31. Leitner, D.; Klepsch, S.; Bodner, G.; Schnepf, A. A dynamic root system growth model based on L-Systems. *Plant Soil* **2010**, *332*, 177–192. [CrossRef]

32. Ogolo, N.A.; Akinboro, O.G.; Inam, J.E.; Akpokere, F.E.; Onyekonwu, M.O. Effect of Grain Size on Porosity Revisited. In Proceedings of the: SPE Nigeria Annual International Conference and Exhibition NAICE, Lagos, Nigeria, 4–6 August 2015.

33. Zhang, Z.-H.; Li, X.-Y.; Yang, X.; Shi, Y.; Zhang, S.-Y.; Jiang, Z.-Y. Changes in soil properties following shrub encroachment in the semiarid Inner Mongolian grasslands of China. *Soil Sci. Plant Nutr.* **2020**, *66*, 369–378. [CrossRef]

34. Rai, R.K.; Singh, V.P.; Upadhyay, A. Soil Analysis. In *Planning and Evaluation of Irrigation Projects*; Elsevier: Amsterdam, The Netherlands, 2017; pp. 505–523. Available online: https://linkinghub.elsevier.com/retrieve/pii/B9780128117484000170 (accessed on 2 September 2021).

35. Vanneste, F.; Goury, O.; Martinez, J.; Lefebvre, S.; Delingette, H.; Duriez, C. Anisotropic Soft Robots Based on 3D Printed Meso-Structured Materials: Design, Modeling by Homogenization and Simulation. *IEEE Robot. Autom. Lett.* **2020**, *5*, 2380–2386. Available online: https://ieeexplore.ieee.org/document/8972411/ (accessed on 3 July 2021). [CrossRef]

36. Lua Programming Language. Available online: http://www lua.org/ (accessed on 15 July 2021).

37. Münch, B.; Holzer, L. Contradicting Geometrical Concepts in Pore Size Analysis Attained with Electron Microscopy and Mercury Intrusion. *J. Am. Ceram. Soc.* **2008**, *91*, 4059–4067. [CrossRef]

38. Legland, D.; Arganda-Carreras, I.; Andrey, P. MorphoLibJ: Integrated library and plugins for mathematical morphology with ImageJ. *Bioinformatics* **2016**, *32*, 3532–3534. [CrossRef]

39. Münch, B.; Gasser, P.; Holzer, L.; Flatt, R. FIB-Nanotomography of Particulate Systems-Part II: Particle Recognition and Effect of Boundary Truncation. *J. Am. Ceram. Soc.* **2006**, *89*, 2586–2595. [CrossRef]

40. Tinet, A.-J.; Corlay, Q.; Collon, P.; Golfier, F.; Kalo, K. Comparison of various 3D pore space reconstruction methods and implications on transport properties of nanoporous rocks. *Adv. Water Resour.* **2020**, *141*, 103615. Available online: https://linkinghub.elsevier.com/retrieve/pii/S0309170819312527 (accessed on 16 July 2021). [CrossRef]

41. Andrä, H.; Combaret, N.; Dvorkin, J.; Glatt, E.; Han, J.; Kabel, M.; Keehm, Y.; Krzikalla, F.; Lee, M.; Madonna, C.; et al. Digital rock physics benchmarks—Part II: Computing effective properties. *Comput. Geosci.* **2013**, *50*, 33–43. Available online: https://linkinghub.elsevier.com/retrieve/pii/S0098300412003172 (accessed on 30 August 2021). [CrossRef]

42. Raise3D E2. Available online: https://www raise3d com/products/e2/ (accessed on 31 August 2021).