Skip to content

Reply To: Incorrect geometry creation – forward-facing 2D step

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB Bug Reports Incorrect geometry creation – forward-facing 2D step Reply To: Incorrect geometry creation – forward-facing 2D step

#5133
vthk
Participant

Hi Adrian,

Thanks very much for your response and for posting the work-around for the bug.
I found one of my own also using the IndicatorF2D() and IndicatorIdentity2D() approach shown below.

Thanks once again for taking the time to respond.

Warm regards,
User-Vthk.

int main( int argc, char* argv[] ) {

// === 2nd Step: Prepare Geometry ===
// Instantiation of a superGeometry
std::vector<T> extend = { lx0, ly0 };
std::vector<T> origin = { 0, 0 };
IndicatorCuboid2D<T> cuboid(extend,origin);

#ifdef PARALLEL_MODE_MPI
CuboidGeometry2D<T> cGeometry( cuboid, converter.getPhysDeltaX(), singleton::mpi().getSize() );
#else
CuboidGeometry2D<T> cGeometry( cuboid, converter.getPhysDeltaX() );
#endif

// Instantiation of loadbalancer
HeuristicLoadBalancer<T> loadBalancer( cGeometry );
loadBalancer.print();

SuperGeometry2D<T> superGeometry( cGeometry,loadBalancer );
prepareGeometry(superGeometry, converter );


}

void prepareGeometry( SuperGeometry2D<T>& superGeometry, UnitConverter<T,DESCRIPTOR> const& converter )
{

// setup channel
Vector<T,2> extendChannel( lx0,ly0 );
Vector<T,2> originChannel( 0, 0 );
std::shared_ptr<IndicatorF2D<T>> channel = std::make_shared<IndicatorCuboid2D<T>>( extendChannel,
originChannel );

// setup step
Vector<T,2> extendStep( lx0-lx1,ly1 );
Vector<T,2> originStep( lx1, 0 );
std::shared_ptr<IndicatorF2D<T>> step = std::make_shared<IndicatorCuboid2D<T>>( extendStep,
originStep );

// setup boolean operation for the geometry
IndicatorIdentity2D<T> fstep2d( channel – step ); //

// material numbers from zero to 2 inside geometry defined by indicator
superGeometry.rename( 0,2,fstep2d );
superGeometry.rename( 2,1,1,1 );

}