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

: 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 conﬁgure their digital soil models, called monoliths, without using meshing algorithms or STL ﬁles which reduce the resolution of the model. Examples of monoliths are 3D-printed in polylactic acid using fused ﬁlament 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 deﬁned pore and grain sizes in a range between coarse sand (from 1 mm diameter) to ﬁne gravel (up to 12 mm diameter).


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][2][3][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 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 another 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, opensource makes the evolution of the modeling software easier [18][19][20]. For years, opensource 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][24][25][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.

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). 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.

Script Developement Methodology
 The monolith design software (or script) must be open-source in orde available to the scientific community and to allow for its evolution;  The design software (or script) should provide a user-friendly interface figuration of the monolith;  The 3D printer used to produce the monoliths should preferably be open  The design and fabrication of monoliths must be replicable;  The materials used for the 3D-printing of monoliths must be non-tox fauna, and fungi;  It is preferable that the script gives the possibility to add a root system to t model (i.e., to create a void root system). Figure 1 shows the main steps of the methodology for developing the scr for the generation of a porous structure. The following paragraphs describe e

Study of Mathematical Models
The first step in our approach is to study the different models and alg creating a complex porous structure. The model must allow the pseudo-stoch ation of interconnected solid cells. This notion of pseudo-stochastic is essentia hand, to mimic the internal random geometry of the soil, and, on the other, replicate the monolith model. In addition, the mathematical model makes i generate an open-cell porous structure that allows for the circulation of wa organisms (plants, fauna, fungi, etc.) within the monolith. As the monolith designed for 3D printing, the notion of lattices and foams, which are commo this manufacturing technique, is emphasized. A lattice structure is an architec by an array of spatial periodic unit cells with edges and faces, and they are oft cellular solids [28]. A foam is an architecture formed by a stochastic array of 2 shows the different categories of cellular solids.

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. In the following, some major algorithm approaches for designing structure are described:


Marching cubes is a computer graphics algorithm for extracting a p an iso-surface from a three-dimensional scalar field. It is widely u a surface from medical X-ray tomography scans and to create an algorithm is less adapted to our context because using the STL for the resolution of the generated structure.  The generation of lattices-periodic arrays of trusses (geometric combined, yield unique properties [30]. Morphological characteris such as their orientation, size, and spatial arrangement (random, can be optimized to improve the mechanical properties and manu tices, however, are more suitable for predefined internal structure dom internal structures as in the case of monoliths.  Generation of a trabecular structure, also called foam structure, is a lattice structure. The trabecular network is an open-cell random str connected voids. The trabecular structure is largely used in the 3D p bones.  The L-System, or Lindenmayer system, is a common tool in plant eling that is used for creating root architecture [31]. It will help i quired root system in the monolith model as described later As a result of this study, a trabecular structure is selected and an a ing its generation is employed in the developed script for the generatio open-cell structure. In addition, the L-System is used to generate the r monolith.

Study of Basic Soil Structures
Besides reviewing the mathematical principles, it is important to s 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.

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 Technologies 2021, 9, 67 6 of 17 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.
Technologies 2021, 9, x FOR PEER REVIEW Moreover, the distribution of the grain form, and thus their size, varies acco the depth. For some types of soil, soil sand content increased, and silt and clay decreased with soil depths [33].
The second factor refers to the grouping of soil grains into aggregates. The ment of these aggregates determines the soil structure. Soil structures are depen the studied environment, but the basic types are presented in [34] as shown in Fi Therefore, two key soil parameters are identified as inputs for the develope the grain number and the infill (material filling ratio in the geometrical volume).

Selection of the Development Software
To allow the design of the monoliths using mathematical models, it will firs essary to choose a modeling software for developing the design script. Indeed, monolith model is based on complex mathematical functions, only a developm that allows the implementation of such functions is interesting.
The development software must be open-source and meet the different functionalities and specifications. Many CAD and Slicing software programs e some of them combine both functionalities. A list of selection criteria has been est in order to objectively select the most adequate software. Table 1 shows these criteria and a comparison between different software and slicers according to the The symbol "×" means that the software has this functionality (i.e., it meets this c Three software packages are available offering the possibility to develop Blender is a powerful tool with interesting features; however, it is more adapted on meshes than on solids based on volume. OpenSCAD is more complete at th matical level, with libraries that avoid the implementation of complex mathemati 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).

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).

Software
Export STL Export G-Code Scripting Export Images G-Code Preview 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.

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.
Technologies 2021, 9, x FOR PEER REVIEW generate foam models respecting the constraints of 3D printing [35]. Thus, Ice sen to develop the monolith modeling script.

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

Command Description
Additional Form Allows additional forms in the monolith to mix the grain sizes or the parameters of grain on different layers, Form_1 is set by d Shape_Form_1 -> Form_1 Render monolith porous structure based on a Trabecular m Shape_Form_1 -> Hollow_1 Render the negative of monolith structure, corresponds to its poro Shape_Form_1 -> Hollow & Form Merge_1 Render monolith solid form and its porosity in order to print, for e porosity in soluble materials Diameter_1, Height_1, and Color_1 For each Form in the monolith, set the diameter of the cylinder ( height (mm), and the color Grain Number_1 Set the number of grains according to their size, the higher the v more numerous and smaller are the grains

Command Description
Additional Form 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 Shape_Form_1 -> Form_1 Render monolith porous structure based on a Trabecular model Shape_Form_1 -> Hollow_1 Render the negative of monolith structure, corresponds to its porous network

Shape_Form_1 -> Hollow & Form Merge_1
Render monolith solid form and its porosity in order to print, for example, the porosity in soluble materials Diameter_1, Height_1, and Color_1 For each Form in the monolith, set the diameter of the cylinder (mm), the height (mm), and the color Grain Number_1 Set the number of grains according to their size, the higher the value, the more numerous and smaller are the grains Table 2. Cont.

Infill_1
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 Form Translate X_1, Y_1, Z_1 To move the Form on the X, Y, or Z-axis, useful for multi-form modeling

Root_ -> Yes
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 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.             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

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. IceSL allows slicing of the model by images in SVG (Scalable Vect In order to evaluate the monoliths generated using the developed scrip used to compute monolith properties commonly used in soil science an neering. Figure 9 shows an example of an SVG image of a layer from M Figure 9. SVG image generated of the 135th layer of Monolith 3.
As a first step, the obtained data from the developed script we voxelized images. The size of a voxel is fixed at the layer thickness directions. This voxelization leads to staircase shapes of the interface and voids. Although this has little impact on the volumetric paramet the surface calculations. All image analyses were performed using th ware ImageJ and its plugins XLib [37] and MorphoLibJ [38]. The calcu as follows:


Intergranular porosity is the ratio of volume of voids to total vol  Specific surface is the ratio of the total interface between solid an ume. The interface between solid and voids is computed using t algorithm with C6 connectivity (voxels are considered connected a face in common) in the MorphoLibJ package [38]. 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 2 ) 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).

Analysis of the Digital Monoliths
The numerical models of the monoliths are analyzed using ImageJ software. Intergranular 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. 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.

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.
code and thus without passing by the STL file, this function is particularly intere cause it makes it possible to avoid the resolution loss and the limitations of the ST The RAISE3D E2 [42] 3D printer is used to fabricate Monolith 1 in PLA. Table 3 s main 3D printing parameters used to print it, while Figure 10 shows an image o printed monolith.

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

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.

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.

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).
x FOR PEER REVIEW 12 of 16 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).

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.

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.

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 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). 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. 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. 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.  Figure 14. Granulometry curve and pore size distribution curve comparison between digital and 3D-printed Monolith 1.

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 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.

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/counteracting 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.