Help on understanding DeepFallingDrop2d case.
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Help on understanding DeepFallingDrop2d case.
- This topic has 2 replies, 3 voices, and was last updated 4 months, 1 week ago by k8vina.
-
AuthorPosts
-
July 24, 2024 at 6:20 pm #8994DipParticipant
Can anyone help me understand, how this part works? I understand basic things, but not this part. Like why the one,two, three and four. And how can I define material properties and how can I introduce new material(solid) into the simulation?
void prepareFallingDrop(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. );
FreeSurfaceDeepFallingDrop2D<T,DESCRIPTOR> cells_analytical{ lattice_size, {0., 1., 2.}};
FreeSurfaceDeepFallingDrop2D<T,DESCRIPTOR> mass_analytical{ lattice_size, {0., 0.5, 1.}};AnalyticalConst2D<T,T> force_zero{0., 0.};
for (int i: {0,1,2}) {
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);
}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);}
void setInitialValues(SuperLattice<T, DESCRIPTOR>& sLattice, SuperGeometry<T,2>& sGeometry, T lattice_length, UnitConverter<T,DESCRIPTOR> const& converter, const FreeSurfaceAppHelper& helper){
OstreamManager clout( std::cout,”setInitialValues” );std::array<T,DESCRIPTOR::d> lattice_speed;
for(size_t i = 0; i < DESCRIPTOR::d; ++i){
lattice_speed[i] = helper.initial_falling_speed[i] * converter.getPhysDeltaT() / converter.getPhysDeltaX();
}FreeSurfaceDeepFallingDropVel2D<T,DESCRIPTOR> u{lattice_length, lattice_speed};
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 );
}// Set up free surface communicator stages
FreeSurface::initialize(sLattice);
// Make the lattice ready for simulation
sLattice.initialize();
}July 26, 2024 at 8:31 pm #9006AdrianKeymasterFor modeling solid walls you can simply assign some no-slip / slip boundary condition where you want the solid obstacle to be. This is also used for the outer walls preventing the fluid from moving outside the domain in e.g. the breaking dam case.
July 29, 2024 at 6:02 pm #9019k8vinaParticipantThanks
-
AuthorPosts
- You must be logged in to reply to this topic.