Skip to content

Smagorinsky/Turbulence – Modification Code

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Smagorinsky/Turbulence – Modification Code

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1946
    pedrobrito
    Member

    Hi.

    In order to change the code CYLINDER2D and make it able to simulate turbulent flows, what else do I need to change/insert in the code besides the following lines?

    #define Smagorinsky

    Dynamics<T, DESCRIPTOR>* bulkDynamics;

    bulkDynamics = new SmagorinskyBGKdynamics<T, DESCRIPTOR>( converter.getOmega(), instances::getBulkMomenta<T, DESCRIPTOR>(),
    0.15);

    I had the following message (error) when I tried to compile:

    cylinder2d.cpp: In function ‘int main(int, char**)’:
    cylinder2d.cpp:360:111: error: invalid initialization of reference of type ‘olb::Dynamics<double, olb::descriptors::D2Q9Descriptor>&’ from expression of type
    olb::Dynamics<double, olb::descriptors::D2Q9Descriptor>*’
    prepareLattice( sLattice, converter, bulkDynamics, sBoundaryCondition, sOffBoundaryCondition, superGeometry );
    ^
    cylinder2d.cpp:112:6: note: in passing argument 3 of ‘void prepareLattice(olb::SuperLattice2D<double, olb::descriptors::D2Q9Descriptor>&, const olb::LBconverter<double>&, olb::Dynamics<double, olb::descriptors::D2Q9Descriptor>&, olb::sOnLatticeBoundaryCondition2D<double, olb::descriptors::D2Q9Descriptor>&, olb::sOffLatticeBoundaryCondition2D<double, olb::descriptors::D2Q9Descriptor>&, olb::SuperGeometry2D<double>&)’
    void prepareLattice( SuperLattice2D<T,DESCRIPTOR>& sLattice,
    ^
    Makefile:63: recipe for target ‘/mnt/c/Users/pedro/Documents/olb/examples/cylinder2d/cylinder2d.o’ failed
    make: *** [/mnt/c/Users/pedro/Documents/olb/examples/cylinder2d/cylinder2d.o] Error 1
    root@DESKTOP-TR9LPLJ:/mnt/c/Users/pedro/Documents/olb/examples/cylinder2d#

    Regards,
    Pedro.

    #2729
    Marc
    Participant

    Hey Pedro,
    if you want to use a Dynamics pointer you have to adapt the arguments in the function prepareLattice.
    The easiest way to run the model is to change the line:
    BGKdynamics<T, DESCRIPTOR> bulkDynamics( converter.getOmega(), instances::getBulkMomenta<T, DESCRIPTOR>() );
    to
    SmagorinskyBGKdynamics<T, DESCRIPTOR>bulkDynamics( converter.getOmega(), instances::getBulkMomenta<T, DESCRIPTOR>(), 0.15);
    Good luck with your turbulence Simulation!
    Best,
    Marc

    #2730
    pedrobrito
    Member

    Hi, Marc.

    Thank you for answering me so quickly. I made the modification that you suggested. However, I keep receiving one error message.

    cylinder2d.cpp: In function ‘int main(int, char**)’:
    cylinder2d.cpp:381:10: error: type ‘class olb::SmagorinskyBGKdynamics<double, olb::descriptors::D2Q9Descriptor>’ argument given to ‘delete’, expected pointer
    delete bulkDynamics;
    ^
    Makefile:63: recipe for target ‘/mnt/c/Users/pedro/Documents/olb/examples/cylinder2d/cylinder2d.o’ failed
    make: *** [/mnt/c/Users/pedro/Documents/olb/examples/cylinder2d/cylinder2d.o] Error 1
    root@DESKTOP-TR9LPLJ:/mnt/c/Users/pedro/Documents/olb/examples/cylinder2d#

    What else should I modify to make it run?

    Best,
    Pedro.

    #2731
    Marc
    Participant

    Hi Pedro,
    the first step is to delete the line:
    delete bulkDynamics;
    because you don’t have a pointer anymore.
    If you still get an error message, use the original cylinder2d.cpp file and modify just the code line that I send you in the last post. This should compile without errors. Then you can apply your modifications step by step.
    Best,
    Marc

    #2732
    pedrobrito
    Member

    Hi Marc.

    Thank you. It is working well now.

    Best,
    Pedro.

    #2733
    pedrobrito
    Member

    Hi,

    I tried to simulate the cylinder case for Re = 100000 using the BGK Smagorinsky (C=0.15). The size of the inlet was increased to 1m and I applied periodic BC at the walls of the domain (y-direction). However, the results are very different when a put the cylinder at the center line or dislocated some lattice units. When centered we do not see vortices and the Cd are considerably lower than the literature (when not centered the Cd is too high and does not show physical significance). Is there any mistake in my set up?

    The resolution of the simulation was N=5 and M=2. Physical time was 20sec.
    I tried to insert the MRT, it compiled with no warnings, but it always diverges.

    Best,
    Pedro.

    #2734
    Marc
    Participant

    Hi Pedro,
    for such high Reynoldsnumbers you have to be careful with your spacing. A y+ around 2 should fit for a LES Simulation. Which turbulence model did you use for MRT?
    I would highly recommend you to come to our springschool in March to learn more about the simulation of turbulent flows.
    Best,
    Marc

    #2735
    pedrobrito
    Member

    Hi Marc,

    I used the Smagorinsky turbulence model, by calling the SmagorinskyMRTdynamic
    and by defining the MTR D2Q9 lattice arrangement.

    Is there a limitation in the LBM for the number of refinement levels? (multi-grid approach) Is there an example in the folder where the SuperLatice/BlockLattice is used?

    Best,
    Pedro.

    #2736
    Marc
    Participant

    Hi Pedro,
    we don’t have grid refinement in our Code. SuperLattice and the underlying BlockLattice is used in every example.
    Best,
    Marc

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