Skip to content

Problem on Material selection on FallingDrop2d

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Problem on Material selection on FallingDrop2d

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8846
    Dan rowling
    Participant

    I tried to modify the example code FallingDrop2D case.I tried to modify the code for interaction between solid and water. But after simulation, the water is set only to the boundary of intended water region. Or maybe the water region is again renamed by solid.I am new to this method, and any suggestions on how to learn this method will help.
    Here are parts of the code:
    void prepareGeometry(UnitConverter<T, DESCRIPTOR> const& converter, SuperGeometry<T, 2>& superGeometry) {
    OstreamManager clout(std::cout, “prepareGeometry”);
    clout << “Prepare Geometry …” << std::endl;

    superGeometry.rename(0, 2);
    superGeometry.rename(2, 1, {1, 1});

    superGeometry.clean();
    superGeometry.innerClean();
    superGeometry.checkForErrors();

    superGeometry.print();
    clout << “Prepare Geometry … OK” << std::endl;
    }

    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.);

    FreeSurfaceFallingDrop2D<T, DESCRIPTOR> cells_analytical{lattice_size, {0., 1., 2.}};
    FreeSurfaceFallingDrop2D<T, DESCRIPTOR> mass_analytical{lattice_size, {0., 1., 1.}};
    AnalyticalConst2D<T, T> force_zero{0., 0.};

    sLattice.defineField<FreeSurface::MASS>(superGeometry, 1, zero);
    sLattice.defineField<FreeSurface::EPSILON>(superGeometry, 1, zero);
    sLattice.defineField<FreeSurface::CELL_TYPE>(superGeometry, 1, zero);
    sLattice.defineField<FreeSurface::CELL_FLAGS>(superGeometry, 1, zero);
    sLattice.defineField<descriptors::FORCE>(superGeometry, 1, 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);

    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 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;

    sLattice.defineDynamics<SmagorinskyForcedBGKdynamics>(superGeometry, 1);
    setBounceBackBoundary(sLattice, superGeometry, 2);

    sLattice.setParameter<descriptors::OMEGA>(converter.getLatticeRelaxationFrequency());
    sLattice.setParameter<collision::LES::Smagorinsky>(T(0.2));

    prepareFallingDrop(converter, sLattice, superGeometry, lattice_size, helper);
    clout << “Prepare Lattice … OK” << std::endl;
    }

    #8890
    TimBingert
    Participant

    Hi Dan!

    Just from looking at the code, in your case the material number 2 are the solid nodes as you are using the bounce back boundary. How are you taking into account solid-water interaction, as I cannot see any other post processor or something similar that you assign to material number 2?

    And compared to the original example of FallingDrop2d, you are not assigning the material numbers 0 and 2 with the fields of MASS, CELL_TYPE and EPSILON, which could definitely cause problems with the implementation of the free surface model.

    From my point of view, you could keep the original FallingDrop2d case and add a post processor on the boundary nodes to account for solid-water interaction.

    Hope, this helps!
    Tim

    #8901
    Dan rowling
    Participant

    Actually, Im reading from the userguide but its little hard for me to understand. Can you suggest which C++ basics I should learn to understand the code better and provide any other suggestions for my case.

    #8937
    TimBingert
    Participant

    In general, it would be helpful to understand templates when working with OpenLB and how we implement boundary conditions in OpenLB. There is the contactAngle2d example that already provides an implementation of solid-liquid interaction in terms of wetting phenomena.

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