OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Help on understanding DeepFallingDrop2d case.

Viewing 3 posts - 1 through 3 (of 3 total)
• Author
Posts
• #8994
Dip
Participant

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();
}

#9006