Reply To: Geometry creation
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Geometry creation › Reply To: Geometry creation
December 1, 2021 at 3:30 pm
#6207
sahilbhapkar30
Participant
Hello,
Thank-you for your reply.
I already have went through the venturi3d example. However, the geometry in this example, they have added the primitives geometry in it. I am facing the problem in the subtraction of the primitives. For example:
Following is the implementation which I have tried for the bstep3d example. However, when I run the following code, the geometry shape does not match with the original geometry of bstep3d.
// Parameters for the simulation setup
const T lx1 = 5.0; // length of step
const T ly1 = 0.75; // height of step
const T lx0 = 18.0; // length of channel
const T ly0 = 1.5; // height of channel
const T lz0 = 1.5; // width of channel
const int N = 20; // resolution of the model
const int M = 25; // resolution of the model
const T maxPhysT = 40.; // max. simulation time in s, SI unit
// Stores geometry information in form of material numbers
//void prepareGeometry( UnitConverter<T,DESCRIPTOR> const& converter,
// SuperGeometry3D<T>& superGeometry )
SuperGeometry3D<T> prepareGeometry( UnitConverter<T,DESCRIPTOR> const& converter )
{
OstreamManager clout( std::cout,"prepareGeometry" );
clout << "Prepare Geometry ..." << std::endl;
//#ifdef PARALLEL_MODE_MPI
//const int noOfCuboids = singleton::mpi().getSize();
//#else
const int noOfCuboids = 10;
//#endif
// setup channel
Vector<T,3> extendChannel( lx0, ly0, lz0 );
Vector<T,3> originChannel( 0, 0,0);
std::shared_ptr<IndicatorF3D<T>> channel = std::make_shared<IndicatorCuboid3D<T>>( extendChannel, originChannel );
// setup step
Vector<T,3> extendStep( lx1, ly1, lz0);
Vector<T,3> originStep( 0, 0,0);
std::shared_ptr<IndicatorF3D<T>> step = std::make_shared<IndicatorCuboid3D<T>>( extendStep, originStep );
CuboidGeometry3D<T>* cuboidGeometry = new CuboidGeometry3D<T>( *(channel-step), converter.getConversionFactorLength(), noOfCuboids );
HeuristicLoadBalancer<T>* loadBalancer = new HeuristicLoadBalancer<T>( *cuboidGeometry );
// Instantiation of a superGeometry
SuperGeometry3D<T> superGeometry( *cuboidGeometry, *loadBalancer, 2 );
// material numbers from zero to 2 inside geometry defined by indicator
superGeometry.rename(0,2, *(channel-step) );
superGeometry.rename(2,1,1,1,1);
//superGeometry.rename( 0,2 );
//superGeometry.rename( 2,1,1,1,1 );
//Vector<T,3> extend( lx1, ly1, lz0 );
//Vector<T,3> origin;
//IndicatorCuboid3D<T> cuboid2( extend, origin );
//superGeometry.rename( 1,2,cuboid2 );
Vector<T,3> extend;
Vector<T,3> origin;
// Set material number for inflow
extend = {2*converter.getConversionFactorLength(), ly0, lz0};
origin[0] -= converter.getConversionFactorLength()/2.;
IndicatorCuboid3D<T> inflow( extend, origin );
superGeometry.rename( 2,3,1,inflow );
// Set material number for outflow
origin[0] = lx0 - converter.getConversionFactorLength()*1.5;
IndicatorCuboid3D<T> outflow( extend, origin );
superGeometry.rename( 2,4,1,outflow );
// Removes all not needed boundary voxels outside the surface
superGeometry.clean();
// Removes all not needed boundary voxels inside the surface
superGeometry.innerClean();
superGeometry.checkForErrors();
//superGeometry.print();
superGeometry.getStatistics().print();
clout << "Prepare Geometry ... OK" << std::endl;
return superGeometry;
}
Could you tell me what could have went wrong in the above implementation?
Thankyou,
Best regards,
Sahil Bhapkar