Skip to content

applying the force into Fluid in the openLB code not DEFINITION

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics applying the force into Fluid in the openLB code not DEFINITION

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #7813
    Massload
    Participant

    I am new to openLB and LBM. There are still many things I don’t understand. I am looking at the examples/turbulence/channel3d file, but where in the code is the FORCE defined in sLattice.defineField<FORCE>(superGeometry, 1, forceSolScaled); applied to the flow field? Where in the code is the FORCE defined in I thought it was sLattice.collapseAndStream(); but it was not easy.
    I also looked at the poiseille flow code, and it was easy to see where the FORCE is defined(sLattice.defineField<FORCE>(superGeometry, 1, force);), but not where the FORCE is applied to the flow field.

    #7828
    FBukreev
    Keymaster

    Hello,

    the application of the force takes place in the dynamics, in that case SmagorinskyForcedBGKdynamics. You can find these definitions in src/dynamics/smagorinskyBGKdynamics.h
    The force is then taked from the force fiels and applied in the collision.

    #7829
    Massload
    Participant

    Thanks.
    In addition, after DEFINING boundary conddition(setInterpolatedVelocityBoundary and setInterpolatedPressureBoundary ) in the function of prepareLattice and in the function of setBoundaryValues( sLattice.defineU( superGeometry, 3, poiseuilleU );), when dose these boundary conddition apply to flow field and where dose these applyig are written in the openLB codes?

    Now I look in cylinder3d.cpp.

    #7834
    shota
    Participant

    Dear Massload,

    the boundary conditions are applied depending on being a local or non-local operation (e.g., the interpolatedVelocityboundary is non-local as it requires interpolation from neighboring cells) at different stages during collideAndStream() managed by STAGE (e.g., PreCollide(), PostCollide(), etc.).

    When you look into src/boundary/setInterpolatedVelocityBoundary3D.hh, the used dynamics and postprocessors (for the local and non-local operations respectively) are listed depending on the alignment of the boundary. In the definitions of the applied dynamics and post-processors, you can find the actually applied boundary treatments. At this point, I kindly recommend you to refer to our User-Guide Chap. 2 about core concepts of OpenLB.

    #7839
    Massload
    Participant

    Thanks.
    While I read your User-Guide chap.2, I got what I am confused about cell and core data.
    1) Is Core Data related to Cell? Cell has Core Data? If not, What is Core Data and Which Class?
    2) In my understanding, SuperLattice class has BlockLattice class. And BlockLattice class has Cell class which has dynamics. Is my understanding right?
    3) If No2 is not right, what popose dose Core Data exit for?
    4) I could not understand cell-local and block-local. I think Cell-local means that is like BGK and calclationg velocity and so on. Is it right? I could not understand what is block-local especially.

    #7840
    Adrian
    Keymaster

    A Cell is a view of the “core data” (this is only the term I used to refer to the core data structures of OpenLB, not a distinct class).

    The block lattice contains the data for all cells of the blocks. however, this data is not stored in Cell classes but in a column-structured data structure (again, of which the Cell is only a view).

    Each cell (as in each spatial cell location) is assigned a Dynamics class that implements its model.

    Cell-local data are fields that exist for each cell, e.g. population or a force field.

    Block-local data are e.g. global parameters of the various dynamics and non-local operators (e.g. the relaxation time OMEGA).

    The per-cell models are described using Dynamics in OpenLB. You only need to look at them to understand how e.g. a forcing scheme is applied. (there is also a section on Dynamics in the user guide).

    #7870
    Massload
    Participant

    Thanks.

    I am not familiar wiht a word of “view”. In cell.h, there is a cell class. How is Cell class used?
    And even if I am reading the user guide, I cannot understand what “FIELD” means. What is “FIELD”?I understand “FIELD” has distribution functions and force and so on like in descriptor.h. When is FIELD most effectivly used?

    #7874
    Adrian
    Keymaster

    A “view” is a common term for a class that doesn’t store data but only provides a view of data (stored in some other class). This way the data structures and the actual access can be abstracted. This is also the way we use the concept in OpenLB. There is a central, per-block, column storage where all field data (populations, forces, …) are stored for each cell location of the lattice. The various Cell classes then access this structure and expose it to to the user via convenient functions (get/setField, operator[](iPop), computeRho, …).

    The cell you found is probably olb::Cell in src/core/cell.h. This is only used for high-level access during pre- / post-processing and is the cell you as a user commonly interact with. The actual high-performance model implementations in the framework (e.g. on GPUs or when using SIMD) are provided with different, more optimized but less flexible, cells.

    Most of this, including fields, is covered by chapter 2 (Core Data) of the user guide. All data you have access to on the cell-level is stored in fields. i.e. there is also descriptors::POPULATION which declares the population functions used by the LB algorithm.

    In case your actual goal is not understanding OpenLB in depth so you can e.g. modify the core code but to use OpenLB for your application (including implementing new models) you do not need to understand the details here. This abstraction one of the points of a framework – you can focus on only the model and case setup without caring of how this is implemented to run on different platforms and be efficiently parallelized.

    In any case I can also recommend our annual Spring School where both the core concepts and the practical usage of OpenLB are covered in detail.

    #7875
    Massload
    Participant

    Thanks. I would like to understand OpenLB in depth.
    Yes, I am looking at olb::Cell in src/core/cell.h.
    I want to understand how to computeRho in olb::Cell in src/core/cell.h firstly would like to understand it with simply SISD. As I follow your code to compute rho, I come across “return getDynamics()->computeRho(self());” in cell.hh. And getDynamics defines return this->_block.getDynamics(this->_iCell); in cell.hh. In blockLattice.hh, I cannot follow getDynamics towords getting and computing Rho, and arriving at FieldArray or column now.

    I’m sorry to trouble you, but could you please let me know?

    #7892
    Adrian
    Keymaster

    You can simply continue to follow the function calls. i.e. within the block lattice it will fetch a pointer to the dynamics instances that is assigned to the queried cell. This instance implements the momenta computation and so on. Where specifically are you getting lost?

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