.. _ucPorosity: Porosity Estimation =================== Goal ---- Use the included scripts to get quantitative estimates of the presence of pores and other defects of the material Introduction ------------ The script ``/opt/KiSSAM/scripts/calcPorosity.x`` calculates porosity of the VDB file ant outputs 1D, 2D and 3D maps of the resulted geometry bulk densities (and separately for the whole solid region and only for remelted material). For the analysis: 1. Get the geometry VDB file. 2. Find an area where the porosity should be analyzed (box). 3. Choose the averaging strategy: one value for the whole box; porosity vs x, y, or z axis; 2D or 3D porosity map in the volume. The script works as follows: The input box is subdivided into voxels, the size of each voxel is defined in the options. In each voxel, the total volume of the voxel, the total volume of the fluid or solid material is found, and the ratio is taken as the estimate of the porosity. User Case --------- Let us take :download:`../jsonfiles/Layer04.vdb` as an input file. This is a geometry which was obtained in the 5th layer of a multilayer simulation. The relevant parameters of the 5th layer simulation are: .. code:: json 'sizes': { 'FullXapprox': 0.01, 'FullYapprox': 0.01, 'FullZapprox': 0.005, 'substrate': 0.0028 }, 'PowderBedGenerator': { 'KnifeZposition': 0.0029, ... } 'ScanStrategy': { 'Type': 'SquareLayer', 'SquareLayer': { 'dimX': 0.004, 'dimY': 0.004, 'startPosX': 0.003, 'startPosY': 0.003, } } In the first layer, the substrate was at the 2.6 mm position: .. code:: json 'sizes': { 'substrate': 0.0026 ... }, 'PowderBedGenerator': { 'KnifeZposition': 0.0027, ... } Visual examination ------------------ Here is the rendering of the VDB file made in the Blender software. .. figure:: ucdata/Porosity/blender.png Rendered volume in the :math:`03.2` mm, there is no material. 2D porosity maps ---------------- Let us make a 2D map of the defect concentration in the layer. To do this, the box is subdivided into voxels, and a value is output for each voxel. The voxel size is specified with the `--voxel_size` option as three values: the size in the x, y, and z axes. If the value is set to :math:`-1`, the voxel size in that direction is equal to the size of the whole box. To get a dependency of the porosity on a direction, the size of the voxel in that direction has to be much smaller than the box size in the same direction. Let us take a box that covers the whole domain in x and y (:math:`0 poremap.dat Where we redirected the output to the text file :file:`poremap.dat`. .. code:: gnuplot # ... Creating assistant Grid to mask above void region ... # Averaging over the voxels : 29 29 29 # Total bulk density XY- map 59.93276 62.93821 63.74185 62.33548 ... .... #--------------------------------------------------------------------------- #-----: Total volume (w/ pores) : 20.085391 mm^3 #-----: Remelted volume(w/o pores) : 0.076000 mm^3 #--------------------------------------------------------------------------- #-----: Total bulk density : 68.55905 % #--------------------------------------------------------------------------- The 2D array in the output is the ratio :math:`v` of the volume occupied by solid or fluid material in a voxel to the whole volume of the voxel. The porosity can be estimated as :math:`100\%-v`. In the comment at the end of the file, the data of the bulk volume of the box is provided. Let us plot the 2D array with the :download:`matplotlib script`: .. figure:: ucdata/Porosity/poremap-2.8.png Plot of the output data If we repeat the procedure for a more shallow box :math:`2.6 poremap.dat some voxels appear denser: .. figure:: ucdata/Porosity/poremap-2.7.png Plot of the output data Do not use the ``--obviate-above`` option when creating 2D maps. If we take the z range bigger and ignore the area above the sample for the porosity estimation: .. code:: bash /opt/KiSSAM/scripts/calcPorosity.x Layer04.vdb --box 0,0,2.6 10,10,10 --voxel_size 0.2,0.2,-1 --obviate_above > poremap.dat we get the following result: .. figure:: ucdata/Porosity/poremap-o.png Plot of the output data Here, the porosity of powder is 0 since the initial void region is not a pore. The volume of the void that is neglected in the total volume calculation is found with a percolation procedure. The lack of fusion defects are taken into account only if they are trapped inside the sample. The highest porosity value in the last image shows an example of such an occurence.