Gloriousface
Forum Replies Created
-
AuthorPosts
-
GloriousfaceParticipant
Thank you very much for your reply
GloriousfaceParticipantHello everyone
I have read 《The Lattice Boltzmann method》by Krüger et al, and have a thorough understanding of the principle of unit conversion, but I don’t understand the application of unit conversion in the program. For example, there are two things I don’t understand in the following code:
void prepareGeometry( UnitConverter<T, DESCRIPTOR> const& converter,
SuperGeometry2D<T>& superGeometry )
{
Vector<T,2> extend( lengthX,lengthY );
Vector<T,2> center( centerCylinderX,centerCylinderY );
Vector<T,2> origin;
IndicatorCircle2D<T> circle( center, radiusCylinder );superGeometry.rename( 0,2 );
superGeometry.rename( 2,1,1,1 );extend[0] = 2.*L;
origin[0] = -L;
IndicatorCuboid2D<T> inflow( extend, origin );
superGeometry.rename( 2,3,1,inflow );
origin[0] = lengthX-L;
IndicatorCuboid2D<T> outflow( extend, origin );
superGeometry.rename( 2,4,1,outflow );
superGeometry.rename( 1,5,circle );
}
1. Why there is unit conversion in function parameters but not in function body;2. When constructing geometry, SI units are used instead of lattice units. Under what circumstances should lattice units be used?
I hope you can help me solve this problem. I would appreciate it.
GloriousfaceParticipantThank you very much for your reply,But I don’t quite understand this sentence “functor_dsl::lift(densityF) – 1.0”,I hope you can help me solve this problem. Thank you again.
GloriousfaceParticipantHello,all
I want to output the pressure difference between two positions (lattice units), but I find that the output pressure in cyliner2d is a physical unit. Is there a function that can help me output the pressure in lattice units?
Thanks
GloriousfaceParticipantDear stephan,
Thank you for your reply in your busy schedule. I plan to read these two books first to understand the connotation of boundary conditions.
Best
GloriousfaceGloriousfaceParticipantDear stephan,
Thank you very much for your reply. After reading microFluidics2d, I tried to set the inlet speed and outlet pressure boundary for latticeone (water) and latticetwo (oil) respectively, but the program is still divergent. Do I need to set the speed for the oil drop itself? The flow of oil droplets in the water has been bothering me for a long time. I can’t successfully set the boundary and don’t know where the problem is. I hope you can help me solve this problem and I would like to express my sincere thanks.
GloriousfaceParticipantThank you very much for your reply.
GloriousfaceParticipantThank you for answering my question in your busy schedule. In the parameter initialization of velocity and pressure boundary in bstep2d, set the density to 1.
setLocalVelocityBoundary<T,DESCRIPTOR>(sLattice, converter.getLatticeRelaxationFrequency(), superGeometry, 3);
setLocalPressureBoundary<T,DESCRIPTOR>(sLattice, converter.getLatticeRelaxationFrequency(), superGeometry, 4);
AnalyticalConst2D<T,T> rho( 1. );
sLattice.defineRhoU( bulkIndicator, rho, u );
sLattice.iniEquilibrium( bulkIndicator, rho, u );How to assign the density in the initial condition of velocity and pressure boundary in multicomponent flow?
GloriousfaceParticipantThank you very much for your reply. In fact, the oil-water two-phase density I simulated should be fixed. I have some questions about the speed setting,
T distance2Wall = 0.1;
What is the function of distance2Wall?
GloriousfaceParticipantThank you very much for your reply. Sorry to disturb you again. I’m simulating the flow of oil drops in water. According to the example of cylinder2d, I set the velocity boundary at the entrance of two lattices and the pressure boundary at the exit, but the program can’t work normally. I hope you can help me solve this problem, I will be very grateful.
The main parts of the procedure are as follows:
void prepareGeometry(SuperGeometry2D<T>& superGeometry )
{
Vector<T,2> origin1( 0, 0 );
Vector<T,2> extend1( nx,ny );
IndicatorCuboid2D<T> channel( extend1, origin1 );
superGeometry.rename( 0,2 );
superGeometry.rename( 2,1,1,1 );
Vector<T,2> origin2( 0, 0);
Vector<T,2> extend2( 0, ny );
IndicatorCuboid2D<T> inflow( extend2, origin2 );
superGeometry.rename( 2,3,1,inflow );
Vector<T,2> origin3( nx-1, 0);
Vector<T,2> extend3( 1, ny );
IndicatorCuboid2D<T> outflow( extend3, origin3 );
superGeometry.rename( 2,4,1,outflow );
Vector<T,2> center( nx/2, 35);
IndicatorCircle2D<T> circle( center, 30 );
superGeometry.rename( 1,5,circle );
}void prepareLattice( SuperLattice2D<T, DESCRIPTOR>& sLatticeOne,
SuperLattice2D<T, DESCRIPTOR>& sLatticeTwo,
Dynamics<T, DESCRIPTOR>& bulkDynamics1,
Dynamics<T, DESCRIPTOR>& bulkDynamics2,
Dynamics<T, DESCRIPTOR>& bounceBackRho0,
Dynamics<T, DESCRIPTOR>& bounceBackRho1,
SuperGeometry2D<T>& superGeometry )
{
const T omega = 1;
sLatticeOne.defineDynamics( superGeometry, 0, &instances::getNoDynamics<T, DESCRIPTOR>() );
sLatticeTwo.defineDynamics( superGeometry, 0, &instances::getNoDynamics<T, DESCRIPTOR>() );
sLatticeOne.defineDynamics( superGeometry, 1, &bulkDynamics1 );
sLatticeOne.defineDynamics( superGeometry, 2, &bulkDynamics1 );
sLatticeOne.defineDynamics( superGeometry, 3, &bulkDynamics1 );
sLatticeOne.defineDynamics( superGeometry, 4, &bulkDynamics1 );
sLatticeOne.defineDynamics( superGeometry, 5, &bulkDynamics1 );
sLatticeTwo.defineDynamics( superGeometry, 1, &bulkDynamics2 );
sLatticeTwo.defineDynamics( superGeometry, 2, &bulkDynamics2 );
sLatticeTwo.defineDynamics( superGeometry, 3, &bulkDynamics2 );
sLatticeTwo.defineDynamics( superGeometry, 4, &bulkDynamics2 );
sLatticeTwo.defineDynamics( superGeometry, 5, &bulkDynamics2 );setLocalVelocityBoundary<T,DESCRIPTOR>(sLatticeOne, omega, superGeometry, 3);
setLocalPressureBoundary<T,DESCRIPTOR>(sLatticeOne, omega, superGeometry, 4);
setLocalVelocityBoundary<T,DESCRIPTOR>(sLatticeTwo, omega, superGeometry, 3);
setLocalPressureBoundary<T,DESCRIPTOR>(sLatticeTwo, omega, superGeometry, 4);sLatticeOne.defineDynamics( superGeometry, 2, &bounceBackRho0 );
sLatticeTwo.defineDynamics( superGeometry, 2, &bounceBackRho1 );
}void setBoundaryValues( SuperLattice2D<T, DESCRIPTOR>& sLatticeOne,
SuperLattice2D<T, DESCRIPTOR>& sLatticeTwo,
T force, int iT, SuperGeometry2D<T>& superGeometry )
{
if ( iT==0 ) {
AnalyticalConst2D<T,T> noise( 4.e-2 );
std::vector<T> v( 2,T() );
AnalyticalConst2D<T,T> zeroV( v );
AnalyticalConst2D<T,T> zero( 1.e-6 );
AnalyticalLinear2D<T,T> one( 0.,-force*invCs2<T,DESCRIPTOR>(),0.98+force*ny*invCs2<T,DESCRIPTOR>() );
AnalyticalConst2D<T,T> onePlus( 0.98+force*ny/2.*invCs2<T,DESCRIPTOR>() );
AnalyticalRandom2D<T,T> random;
AnalyticalIdentity2D<T,T> randomOne( random*noise+one );
AnalyticalIdentity2D<T,T> randomPlus( random*noise+onePlus );
std::vector<T> F( 2,T() );
F[1] = -force;
AnalyticalConst2D<T,T> f( F );sLatticeOne.defineRhoU( superGeometry, 5, zero, zeroV );
sLatticeOne.iniEquilibrium( superGeometry, 5, zero, zeroV );
sLatticeOne.defineField<descriptors::EXTERNAL_FORCE>( superGeometry, 5, f );
sLatticeTwo.defineRhoU( superGeometry, 5, randomPlus, zeroV );
sLatticeTwo.iniEquilibrium( superGeometry, 5, randomPlus, zeroV );sLatticeOne.defineRhoU( superGeometry, 1, randomOne, zeroV );
sLatticeOne.iniEquilibrium( superGeometry, 1, randomOne, zeroV );
sLatticeOne.defineField<descriptors::EXTERNAL_FORCE>( superGeometry, 1, f );
sLatticeTwo.defineRhoU( superGeometry, 1, zero, zeroV );
sLatticeTwo.iniEquilibrium( superGeometry, 1, zero, zeroV );sLatticeOne.defineRhoU(superGeometry, 3, randomOne, zeroV);
sLatticeOne.iniEquilibrium(superGeometry, 3, randomOne, zeroV);
sLatticeOne.defineField<descriptors::EXTERNAL_FORCE>(superGeometry, 3, f);
sLatticeTwo.defineRhoU(superGeometry, 3, randomOne, zeroV);
sLatticeTwo.iniEquilibrium(superGeometry, 3, randomOne, zeroV);sLatticeOne.defineRhoU(superGeometry, 4, randomPlus, zeroV);
sLatticeOne.iniEquilibrium(superGeometry, 4, randomPlus, zeroV);
sLatticeOne.defineField<descriptors::EXTERNAL_FORCE>(superGeometry, 4, f);
sLatticeTwo.defineRhoU(superGeometry, 4, randomPlus, zeroV);
sLatticeTwo.iniEquilibrium(superGeometry, 4, randomPlus, zeroV);sLatticeOne.defineRhoU(superGeometry, 2, zero, zeroV);
sLatticeOne.iniEquilibrium(superGeometry, 2, zero, zeroV);
sLatticeOne.defineField<descriptors::EXTERNAL_FORCE>(superGeometry, 2, f);
sLatticeTwo.defineRhoU(superGeometry, 2, zero, zeroV);
sLatticeTwo.iniEquilibrium(superGeometry, 2, zero, zeroV);PolynomialStartScale<T,T> StartScale( maxIter, T( 1 ) );
T iTvec[1] = {T( iT )};
T frac[1] = {};
StartScale( frac,iTvec );
T maxVelocity = 0.02*3./2.*frac[0];
T distance2Wall = 0.1;
Poiseuille2D<T> poiseuilleU( superGeometry, 3, maxVelocity, distance2Wall );
sLatticeOne.defineU( superGeometry, 3, poiseuilleU );
sLatticeTwo.defineU( superGeometry, 3, poiseuilleU );sLatticeOne.initialize();
sLatticeTwo.initialize();
}
}GloriousfaceParticipantI changed the contact angle by changing the virtual density in rayleighTaylor2d, but I’m not sure whether it reflects the fluid solid force. I don’t understand why changing the virtual density and the value of force will change the contact angle? I would appreciate it if you could answer my question.
Best
Gloriousface- This reply was modified 3 years ago by Gloriousface.
GloriousfaceParticipantThank you very much for your reply.
GloriousfaceParticipantThank you very much for your reply, but I have another question. The user guide says that the density of each component in the free energy model is the same. How can I achieve different densities?
GloriousfaceParticipantThank you very much!
Gloriousface
GloriousfaceParticipantThanks for your reply and I have another question.
I’m looking at bstep2d. I find that the thickness of the import boundary is 0, but the thickness of the export boundary is certain. What’s the difference between the two methods? The code is attached below.
Vector<T,2> extendBC_out( 0 + 1.*converter.getPhysDeltaX(),heightChannel );
Vector<T,2> extendBC_in( 0, heightInlet );
Vector<T,2> originBC_out( lengthChannel – 1.*converter.getPhysDeltaX(),0 );
Vector<T,2> originBC_in( 0, heightStep);IndicatorCuboid2D<T> inflow( extendBC_in, originBC_in );
// Set material number for inflow
superGeometry.rename( 2,3,1,inflow );IndicatorCuboid2D<T> outflow( extendBC_out, originBC_out );
// Set material number for outflow
superGeometry.rename( 2,4,1,outflow ); -
AuthorPosts