How to get a material moving?
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › How to get a material moving?
- This topic has 3 replies, 2 voices, and was last updated 1 month, 1 week ago by Adrian.
-
AuthorPosts
-
July 26, 2024 at 7:59 pm #9003DipParticipant
Here, in the breakingDam2d, I set a solid circle at some height. My target is to make it fall due to gravity. But it is not moving. What is the problem here?
void prepareGeometry( UnitConverter<T,DESCRIPTOR> const& converter,
SuperGeometry<T,2>& superGeometry) {OstreamManager clout( std::cout,”prepareGeometry” );
clout << “Prepare Geometry …” << std::endl;IndicatorCircle2D<T> solid({0.5,0.7},0.1);
superGeometry.rename( 0,2 );
superGeometry.rename( 2,1,{1,1} );
superGeometry.rename( 1,4,solid );superGeometry.clean();
superGeometry.innerClean();
superGeometry.checkForErrors();superGeometry.print();
clout << “Prepare Geometry … OK” << std::endl;
}void prepareBreakingDam(UnitConverter<T,DESCRIPTOR> const& converter,
SuperLattice<T, DESCRIPTOR>& sLattice,
SuperGeometry<T,2>& superGeometry, T lattice_size, const FreeSurfaceAppHelper& helper)
{
AnalyticalConst2D<T,T> zero( 0. );
AnalyticalConst2D<T,T> one( 1. );
AnalyticalConst2D<T,T> two( 2. );
AnalyticalConst2D<T,T> four( 4. );
AnalyticalConst2D<T,T> five( 5. );
FreeSurfaceBreakingDam2D<T,DESCRIPTOR> cells_analytical{ lattice_size, {0., 1., 2.}, helper.area};
FreeSurfaceBreakingDam2D<T,DESCRIPTOR> mass_analytical{ lattice_size, {0., 0.5, 1.}, helper.area};AnalyticalConst2D<T,T> force_zero{0., 0.};
for (int i: {0,1,2,4}) {
sLattice.defineField<FreeSurface::MASS>(superGeometry, i, zero);
sLattice.defineField<FreeSurface::EPSILON>(superGeometry, i, zero);
sLattice.defineField<FreeSurface::CELL_TYPE>(superGeometry, i, zero);
sLattice.defineField<FreeSurface::CELL_FLAGS>(superGeometry, i, zero);
sLattice.defineField<descriptors::FORCE>(superGeometry, i, force_zero);
}sLattice.defineField<FreeSurface::CELL_TYPE>(superGeometry, 1, cells_analytical);
sLattice.defineField<FreeSurface::MASS>(superGeometry, 1, mass_analytical);
sLattice.defineField<FreeSurface::EPSILON>(superGeometry, 1, mass_analytical);for (int i: {0,2}) {
sLattice.defineField<FreeSurface::MASS>(superGeometry, i, one);
sLattice.defineField<FreeSurface::EPSILON>(superGeometry, i, one);
sLattice.defineField<FreeSurface::CELL_TYPE>(superGeometry, i, four);
}sLattice.defineField<FreeSurface::MASS>(superGeometry, 4, two);
sLattice.defineField<FreeSurface::EPSILON>(superGeometry, 4, two);
sLattice.defineField<FreeSurface::CELL_TYPE>(superGeometry, 4, four);
sLattice.defineField<FreeSurface::CELL_FLAGS>(superGeometry, 4, zero);T force_factor = 1./ converter.getConversionFactorForce() * converter.getConversionFactorMass();
AnalyticalConst2D<T,T> force_a{helper.gravity_force[0] * force_factor, helper.gravity_force[1] * force_factor};
sLattice.defineField<descriptors::FORCE>(superGeometry.getMaterialIndicator({1}), force_a);
sLattice.defineField<descriptors::FORCE>(superGeometry.getMaterialIndicator({4}), force_a);}
void prepareLattice( UnitConverter<T,DESCRIPTOR> const& converter,
SuperLattice<T, DESCRIPTOR>& sLattice,
SuperGeometry<T,2>& superGeometry, T lattice_size, const FreeSurfaceAppHelper& helper) {OstreamManager clout( std::cout,”prepareLattice” );
clout << “Prepare Lattice …” << std::endl;// Material=0 –>do nothing
sLattice.defineDynamics<NoDynamics<T,DESCRIPTOR>>(superGeometry, 0);
// Material=1 –>bulk dynamics
sLattice.defineDynamics<SmagorinskyForcedBGKdynamics<T,DESCRIPTOR>>( superGeometry, 1);
// Material=2 –>no-slip boundary
sLattice.defineDynamics<BounceBack<T,DESCRIPTOR>>( superGeometry, 2);
//setSlipBoundary<T,DESCRIPTOR>(sLattice, superGeometry, 2);
sLattice.defineDynamics<BounceBack<T,DESCRIPTOR>>( superGeometry, 4);
sLattice.setParameter<descriptors::OMEGA>(converter.getLatticeRelaxationFrequency());
sLattice.setParameter<collision::LES::Smagorinsky>(T(0.2));prepareBreakingDam(converter, sLattice, superGeometry, lattice_size, helper);
clout << “Prepare Lattice … OK” << std::endl;
}void setInitialValues(SuperLattice<T, DESCRIPTOR>& sLattice, SuperGeometry<T,2>& sGeometry, T lattice_length, UnitConverter<T,DESCRIPTOR> const& converter){
OstreamManager clout( std::cout,”setInitialValues” );AnalyticalConst2D<T,T> u{0., 0.};
AnalyticalConst2D<T,T> one(1.);sLattice.defineRhoU( sGeometry.getMaterialIndicator({0,1,2}), one, u );
for (int i: {0,1,2}) {
sLattice.iniEquilibrium( sGeometry, i, one, u );
}
AnalyticalConst2D<T,T> u_1{0,-1.8};
AnalyticalConst2D<T,T> seven(7.);
sLattice.defineRhoU( sGeometry.getMaterialIndicator(4), seven, u_1 );
// sLattice.iniEquilibrium(sGeometry.getMaterialIndicator(4), seven, u_1);// Set up free surface communicator stages
FreeSurface::initialize(sLattice);
// Make the lattice ready for simulation
sLattice.initialize();
}July 26, 2024 at 8:27 pm #9004AdrianKeymasterUnfortunately fluid structure interaction is not as simple as making a material-number-described region fall down. Material numbers are only a proxy used to refer to certain subsets of cells for e.g. assigning per-cell dynamics.
For simulating the sedimentation of a solid circle in a non-free-surface context you can check out e.g. the
particles/dkt2d
example case. This case uses our HLBM-based resolved particle code to simulate the common “drafting-kissing-tumbling” behavior of two spheres (immersed in a fluid) being pulled down by gravity. After that the next step would be to develop e.g. some kind of combined HLBM-FreeSurface model.July 27, 2024 at 4:53 pm #9012DipParticipantIs there any other example regarding working with two types of condition. Like the descriptor definition is different in these two cases.
July 27, 2024 at 6:21 pm #9013AdrianKeymasterYou mean e.g. multi phase or multi component models? We have quite a few examples for those, you can find them in the example folder and the user guide (there is also an overview table)
-
AuthorPosts
- You must be logged in to reply to this topic.