Hi,
Can I load multiple STL files into a single simulation and have them structured in the same way they are structured when I open them with blender?
I ask, because I ran into that problem when importing outlets from STL. They work now, but they are in the wrong positions (and it seems like they are too big).
What I do:
/** Add outlet from STL
*
* Add an outlet according to an STL file.
*
* axis defines into which direction the boundary should face: x, -x, y, -y, z, -z.
*
* An outlet *must* be placed in such a way that its back end is closed (for example at the closed end of a pipe.
*/
template <typename T, template <typename U> class Descriptor>
void addOutletFromStl( MultiBlockLattice3D<T,Descriptor>& lattice, string stlFile, plint N, plint limitDepth, string axis)
{
// Now we read in the STL file. TreeReader3D<int>* treeReader =
createUniformTreeReader3D(stlFile, N, limitDepth);
// treeReader::getDomains() gives a std::vector of Box3D
cout << treeReader->getNx();
// then we need a boundary condition object
OnLatticeBoundaryCondition3D<T,Descriptor>* boundaryCondition
= createLocalBoundaryCondition3D<T,Descriptor>();
// and define the walls as outlets
// for outlet in treeReader::getDomains():
// boundaryCondition->addPressureBoundary{xyz}{NP}(outlet, lattice);
// setBoundaryDensity(lattice, outlet, (T)1.);
// treeReader->analyzeTree(); ? private :(
vector<Box3D> treeDomains = treeReader->getDomains();
cout << "Number of Box3Ds in the outlet STL: " << treeDomains.size() << endl;
std::vector< Box3D >::iterator it = treeDomains.begin();
while (it != treeDomains.end())
{
Box3D box = *it;
// Get the sheet at the front side of the box and use it as outlet.
Box3D sheet;
// The rest of the box becomes a bounceback boundary behind the outlet.
Box3D beforeSheet;
if (axis == "x"){…}
else if (axis == "z"){
// Get the sheet at the front side of the box and use it as outlet.
sheet = Box3D(box.x0, box.x1, box.y0, box.y1, box.z0, box.z0);
cout << box.z0 << " " << box.z1 << " " << N << endl;
// The rest of the box becomes a bounceback boundary behind the outlet.
beforeSheet = Box3D(box.x0, box.x1, box.y0, box.y1, box.z0+1, box.z1);
boundaryCondition->addPressureBoundary2P(sheet, lattice);
defineDynamics(lattice, beforeSheet, new BounceBack<T,Descriptor>(truncation_bbDensity));
}
else if {
…
}
setBoundaryDensity(lattice, sheet, (T)1.); // outlet = neutral = 1.0
++it;
}
cout << "stl boundaries setup";
// finally we cleanup no longer needed objects.
delete treeReader;