Varying Smagorinsky constant

Dear all,

I am looking for a way to set the Smagorinsky “constant” for each cell individually to model high-Re flow through a bed of spheres. In the Palabos user guide [1] it is mentioned that this can be realized through a data processor, however I did not yet find out how to access this value on each cell. Has anyone done this yet?

thanks for any help & regards,


Did you ever figure out how to do this? I’m trying to understand how I can vary the constant and would very much appreciate any help.

Thank you

Hi maxpower,

back when I asked that question, I did not really follow up on that. However, nowadays I would do it in the following way (assuming that you want two Smagorinsky constants, one for bulk and one close to walls for instance):

  • define your bulk Smagorinsky constant upon creation of the lattice
  • create a DomainFunctional3D where operator() returns true for the locations where you want to have your other Smagorinsky constant
  • use defineDynamics(lattice,lattice.getBoundingBox(),myfunctional,new SmagorinskyDynamics(omega,alternative_c_smago)) to create dynamics objects with your alternative constant at the desired grid cells

hope that helped

Thank you very much for the reply, I will give your method a try since the way I was trying to do it hasn’t worked.

On a related note, I came across what I think is the implementation of variable cSmago in the library, however it seems like it’s missing the class " SmagoFunction" as I could not find it defined anywhere. You can see the implementation here in “smagorinskyGenerics3D.h[/url]" which calcualtes the cSmago depending on the cell location, this is then called in "[url=]smagorinskyDynamics3D.h” (specifically these lines) :

template<typename T, template class Descriptor, class SmagoFunction>
void instantiateStaticSmagorinsky(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, SmagoFunction smagoFunction, T cSmago0);

template<typename T, template class Descriptor, class SmagoFunction>
void instantiateStaticSmagorinsky(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, SmagoFunction smagoFunction, T cSmago0);

Im not sure if this is a bug (ie missing code) that should be reported or that I’m missing something since I couldn’t find any instruction on how to call the above function.

Any thoughts on this?

This is not faulty code, but template metaprogramming. You have to implement a class, give it as template parameter, and hand an instance of that class to the function.

Here is an article on how to use functors (function objects) in c++:

Thank you very much for taking the time to reply.