Skip to content

Open Top – Boundary Condition

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Open Top – Boundary Condition

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1861
    ivan
    Member

    Hello, everybody,

    I am simulating a rising droplet of a lighter fluid in a heavier one in a channel and I would like the top/outlet to be open ( RelPressure=0 ). I am trying to set the boundary conditions basing myself on the “cylinder2d” example and I get a lot of error messages, mostly related to the descriptors (my simulation was built up from the “MultiComponent2d” example, by the way). Could anybody give me a detailed description of which descriptors and declarations I should use and where they should be in the code? I can send my code by email if necessary.

    #2454
    mathias
    Keymaster

    Dear Ivan,

    basically for multi-phase/-component flows you can revese the setting of inlet and outlet as it is done in cylinder3d, i.e. at the inlet you fix the density of both phases by a pressure bc (addPressure..) and at the outlet you fix the velovity by a velovity bc (addVelocity).

    Best
    Mathias

    #2455
    ivan
    Member

    Thank you, Mathias,

    As I am simulating something closer to a recipient, there would be no inlet, just an open air top with a pressure boundary condition. And yes, I have been basing myself in the cylinder example, but the main problem is I do not know which descriptors should be included along the addPressure function in order to make it work properly. Besides that, there are some other obstacles before it.

    For example, that’s how I’ve set my Geometry

    Code:
    // Sets material number for fluid and boundary
    superGeometry.rename(0,1);

    std::vector<T> origin1(2,T());
    origin1[0] = 0;
    origin1[1] = 0;

    std::vector<T> origin2(2,T());
    origin2[0] = 0;
    origin2[1] = ny-wallThickness;

    std::vector<T> origin3(2,T());
    origin3[0] = 0;
    origin3[1] = wallThickness;

    std::vector<T> origin4(2,T());
    origin4[0] = nx-wallThickness-1;
    origin4[1] = wallThickness;

    std::vector<T> extend1(2,T());
    extend1[0] = nx;
    extend1[1] = wallThickness;

    std::vector<T> extend2(2,T());
    extend2[0] = wallThickness;
    extend2[1] = ny-wallThickness;

    Vector<T,2> centerDroplet(centerDropletX,centerDropletY);

    IndicatorCuboid2D<T> bottom(extend1, origin1);
    IndicatorCuboid2D<T> top(extend1, origin2);
    IndicatorCuboid2D<T> leftwall(extend2, origin3);
    IndicatorCuboid2D<T> rightwall(extend2, origin4);
    IndicatorCircle2D<T> droplet(centerDroplet, radiusDroplet);

    superGeometry.rename(1,2,droplet);
    superGeometry.rename(1,3,bottom);
    superGeometry.rename(1,3,leftwall);
    superGeometry.rename(1,3,rightwall);
    superGeometry.rename(1,4,top);

    And that’s the dynamics of the material numbers:

    Code:
    /// define lattice Dynamics
    sLatticeOne.defineDynamics(superGeometry, 0, &instances::getBounceBack<T, DESCRIPTOR>());
    sLatticeOne.defineDynamics(superGeometry, 1, &bulkDynamics1);
    sLatticeOne.defineDynamics(superGeometry, 2, &bulkDynamics1);
    sLatticeOne.defineDynamics(superGeometry, 3, &instances::getBounceBack<T, DESCRIPTOR>());
    sLatticeOne.defineDynamics(superGeometry, 4, &instances::getBounceBack<T, DESCRIPTOR>());

    sLatticeTwo.defineDynamics(superGeometry, 0, &instances::getBounceBack<T, DESCRIPTOR>());
    sLatticeTwo.defineDynamics(superGeometry, 1, &bulkDynamics2);
    sLatticeTwo.defineDynamics(superGeometry, 2, &bulkDynamics2);
    sLatticeTwo.defineDynamics(superGeometry, 3, &instances::getBounceBack<T, DESCRIPTOR>());
    sLatticeTwo.defineDynamics(superGeometry, 4, &instances::getBounceBack<T, DESCRIPTOR>());

    So basically number 1 is my static fluid, number 2 is the lighter immiscible fluid, number 3 are the walls and number 4 is the open air top, which for now is randomly set with bounce back as well. First thing I should do in order to include the pressure boundary condition is to set material number 4 as the static fluid as well. The problem is for some reason, if I switch the previous code to the following one

    Code:
    /// define lattice Dynamics
    sLatticeOne.defineDynamics(superGeometry, 0, &instances::getBounceBack<T, DESCRIPTOR>());
    sLatticeOne.defineDynamics(superGeometry, 1, &bulkDynamics1);
    sLatticeOne.defineDynamics(superGeometry, 2, &bulkDynamics1);
    sLatticeOne.defineDynamics(superGeometry, 3, &instances::getBounceBack<T, DESCRIPTOR>());
    [b] sLatticeOne.defineDynamics(superGeometry, 4, &bulkDynamics1);[/b]

    sLatticeTwo.defineDynamics(superGeometry, 0, &instances::getBounceBack<T, DESCRIPTOR>());
    sLatticeTwo.defineDynamics(superGeometry, 1, &bulkDynamics2);
    sLatticeTwo.defineDynamics(superGeometry, 2, &bulkDynamics2);
    sLatticeTwo.defineDynamics(superGeometry, 3, &instances::getBounceBack<T, DESCRIPTOR>());
    [b] sLatticeTwo.defineDynamics(superGeometry, 4, &bulkDynamics2);[/b]

    The material number 4 is set as the lighter fluid as well. How can I set it as the static fluid without using the same material number?

    #2456
    ivan
    Member

    Okay, I have just noticed that is has to do with this part of the code

    Code:
    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(0.);
    AnalyticalLinear2D<T,T> one(0.,-force*DESCRIPTOR<T>::invCs2,0.98+force*ny*DESCRIPTOR<T>::invCs2);
    AnalyticalConst2D<T,T> onePlus(0.98+force*ny/2.*DESCRIPTOR<T>::invCs2);
    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);

    /// for each material set the defineRhou and the Equilibrium

    sLatticeOne.defineRhoU(superGeometry, 1, zero, zeroV);
    sLatticeOne.iniEquilibrium(superGeometry, 1, zero, zeroV);
    sLatticeOne.defineExternalField(superGeometry, 1,DESCRIPTOR<T>::ExternalField::externalForceBeginsAt,
    DESCRIPTOR<T>::ExternalField::sizeOfExternalForce, f );

    sLatticeOne.defineRhoU(superGeometry, 2, randomOne, zeroV);
    sLatticeOne.iniEquilibrium(superGeometry, 2, randomOne, zeroV);
    sLatticeOne.defineExternalField(superGeometry, 2, DESCRIPTOR<T>::ExternalField::externalForceBeginsAt,DESCRIPTOR<T>::ExternalField::sizeOfExternalForce, f );

    sLatticeTwo.defineRhoU(superGeometry, 1, randomPlus, zeroV);
    sLatticeTwo.iniEquilibrium(superGeometry, 1, randomPlus, zeroV);

    sLatticeTwo.defineRhoU(superGeometry, 2, zero, zeroV);
    sLatticeTwo.iniEquilibrium(superGeometry, 2, zero, zeroV);

    Which is atributing the densities and equilibrium. So, what I tried to do is to copy the exact same code for material number 4, once I want it to behave exactly like number 1, so:

    Code:
    /// for each material set the defineRhou and the Equilibrium

    sLatticeOne.defineRhoU(superGeometry, 1, zero, zeroV);
    sLatticeOne.iniEquilibrium(superGeometry, 1, zero, zeroV);
    sLatticeOne.defineExternalField(superGeometry, 1, DESCRIPTOR<T>::ExternalField::externalForceBeginsAt,DESCRIPTOR<T>::ExternalField::sizeOfExternalForce, f );

    [b] sLatticeOne.defineRhoU(superGeometry, 4, zero, zeroV);
    sLatticeOne.iniEquilibrium(superGeometry, 4, zero, zeroV);
    sLatticeOne.defineExternalField(superGeometry, 4, DESCRIPTOR<T>::ExternalField::externalForceBeginsAt,DESCRIPTOR<T>::ExternalField::sizeOfExternalForce, f );[/b]

    sLatticeOne.defineRhoU(superGeometry, 2, randomOne, zeroV);
    sLatticeOne.iniEquilibrium(superGeometry, 2, randomOne, zeroV);
    sLatticeOne.defineExternalField(superGeometry, 2, DESCRIPTOR<T>::ExternalField::externalForceBeginsAt,DESCRIPTOR<T>::ExternalField::sizeOfExternalForce, f );

    sLatticeTwo.defineRhoU(superGeometry, 1, randomPlus, zeroV);
    sLatticeTwo.iniEquilibrium(superGeometry, 1, randomPlus, zeroV);
    [b]
    sLatticeTwo.defineRhoU(superGeometry, 4, randomPlus, zeroV);
    sLatticeTwo.iniEquilibrium(superGeometry, 4, randomPlus, zeroV);[/b]

    sLatticeTwo.defineRhoU(superGeometry, 2, zero, zeroV);
    sLatticeTwo.iniEquilibrium(superGeometry, 2, zero, zeroV);

    And right now I do get the static fluid on material 4 BUT for some reason the droplet of the lighter immiscible fluid (material number 2) is unable to flow through it, as if it was a barrier, or a discontinuity. Any idea of how to make the cuboid with material number 4 a continuous part of the static fluid of the bigger cuboid of material number one?

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.