Smagorinsky/Turbulence – Modification Code
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Smagorinsky/Turbulence – Modification Code
- This topic has 8 replies, 2 voices, and was last updated 6 years, 11 months ago by Marc.
-
AuthorPosts
-
October 2, 2017 at 2:23 am #1946pedrobritoMember
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.October 2, 2017 at 1:48 pm #2729MarcParticipantHey 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,
MarcOctober 2, 2017 at 11:02 pm #2730pedrobritoMemberHi, 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.October 3, 2017 at 12:19 pm #2731MarcParticipantHi 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,
MarcOctober 6, 2017 at 6:41 pm #2732pedrobritoMemberHi Marc.
Thank you. It is working well now.
Best,
Pedro.October 9, 2017 at 4:48 pm #2733pedrobritoMemberHi,
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.October 9, 2017 at 6:39 pm #2734MarcParticipantHi 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,
MarcOctober 9, 2017 at 11:35 pm #2735pedrobritoMemberHi 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.October 10, 2017 at 1:21 pm #2736MarcParticipantHi Pedro,
we don’t have grid refinement in our Code. SuperLattice and the underlying BlockLattice is used in every example.
Best,
Marc -
AuthorPosts
- You must be logged in to reply to this topic.