Viewing 4 posts - 1 through 4 (of 4 total)
• Author
Posts
• #6205
sahilbhapkar30
Participant

Hello,

Is it possible to create the geometry using primitives in bstep3d like how it was done in bstep2d? I tried to recreate the geometry of bstep3d using the implementation used in bstep2d where there is primitives subtraction is done for the channel and the step. When I tried to create the geometry in bstep3d, I got a Segmentation fault. Is primitives subtraction only valid in 2d geometry? Could you please help me to create the bstep3d using primitives subtraction?

Thank-you

Best regards,
Sahil

#6206
Keymaster

This basic approach also works in 3D. See e.g. `turbulence/venturi3d` for an example (XML is used there to describe the indicators but this is optional)

#6207
sahilbhapkar30
Participant

Hello,

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 );
// 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

#6216