STL file voxelization

I am trying to run a simulation and my geometry is in the form of an stl file. After voxelizing the geometry, i am realising that flow is taking place inside the walls of my geometry, i have tried all the tweaks i could and i dont seem to be getting anywhere. the geometry is a porous medium. my code is as follows.

TriangleSet triangleSet(stlFileName, DBL);
DEFscaledMesh defMesh(triangleSet, 0, 0, margin, extraLayer);
defMesh.getMesh().computeBoundingBox(xRange, yRange, zRange);

lx = xRange[1]-xRange[0];
ly = yRange[1]-yRange[0];
lz = zRange[1]-zRange[0];
dx = lx/(T)N;
nx = (plint)(lx/dx + 0.5);
ny = (plint)(ly/dx + 0.5);
nz = (plint)(lz/dx + 0.5);

location = Array<T,3>(xRange[0], yRange[0], zRange[0]);




TriangleBoundary3D<T> boundary(defMesh);

Box3D mediaDomain_LU(-layer, nx-1 + layer, -layer, ny-1 + layer, -layer, nz-1 + layer);
int flowType = voxelFlag::outside;
VoxelizedDomain3D<T>voxelizedDomain(boundary, flowType, mediaDomain_LU, borderWidth,
                                    envelopeWidth, blockSize);

MultiScalarField3D<int>flagMatrix_tmp((MultiBlock3D&) voxelizedDomain.getVoxelMatrix());
setToConstant(flagMatrix_tmp, flagMatrix_tmp.getBoundingBox(), 0);
setToConstant(flagMatrix_tmp, voxelizedDomain.getVoxelMatrix(),
                voxelFlag::inside, flagMatrix_tmp.getBoundingBox(), 1);
setToConstant(flagMatrix_tmp, voxelizedDomain.getVoxelMatrix(),
                voxelFlag::innerBorder, flagMatrix_tmp.getBoundingBox(), 1);

Box3D copyDomain(0, nx-1, 0, ny-1, 1, nz-2);
std::unique_ptr<MultiScalarField3D>upright (
add(1, *multiply(-1, flagMatrix_tmp)));
copy(*upright, copyDomain, *solidFlags, copyDomain);

Hi Ikadzungura,
Which boundary condition are you applying on the .stl? For some of them, there will indeed be a flow inside the geometry, that should not affect what happens outside of it.