Skip to content

DynSmagorinskyBGKdynamics – Error

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics DynSmagorinskyBGKdynamics – Error

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1838

    Hello everyone,rnrnI tried to implement the Dynamic Smagorinsky turbulence model (DynSmagorinskyBGKdynamics ) in the cylinder2d example. I changed the code as :rn

    Code:
    rn/// … rntypedef double T;rn// #define DESCRIPTOR D2Q9Descriptorrn#define DESCRIPTOR DynSmagorinskyD2Q9Descriptorrnrn/// … rnrnint main(int argc, char* argv[])rn{rn /// …rn// BGKdynamics<T, DESCRIPTOR> bulkDynamics(converter.getOmega(), instances::getBulkMomenta<T, DESCRIPTOR>());rn DynSmagorinskyBGKdynamics<T,DESCRIPTOR> bulkDynamics(converter.getOmega(), rn instances::getBulkMomenta<T, DESCRIPTOR>(),rn converter.getLatticeL(), rn converter.physTime() );rnrn/// …rn}rn

    rnrnI tried to compiled and I get this error :rn

    Code:
    rnaclarobarr@urgc-hu21:~/Documents/olb-1.0r0/Test_alejandro/cylinder2d_test6_wall_function$ makernCreate dependencies for cylinder2d.cpprnCompile cylinder2d.cpprnmpic++ -DPARALLEL_MODE_MPI -O3 -Wall -std=c++11 -I../../src -I../../src/ -I../../src/external -c cylinder2d.cpp -o /home/aclarobarr/Documents/olb-1.0r0/Test_alejandro/cylinder2d_test6_wall_function/cylinder2d.ornIn file included from ../../src/dynamics/dynamics2D.h:55:0,rn from ../../src/olb2D.h:3,rn from cylinder2d.cpp:40:rn../../src/dynamics/smagorinskyBGKdynamics.h: In instantiation of ‘class olb::DynSmagorinskyBGKdynamics<double, olb::descriptors::DynSmagorinskyD2Q9Descriptor>’:rncylinder2d.cpp:340:56: required from herern../../src/dynamics/smagorinskyBGKdynamics.h:164:18: error: ‘constexpr’ needed for in-class initialization of static data member ‘const double olb::DynSmagorinskyBGKdynamics<double, olb::descriptors::DynSmagorinskyD2Q9Descriptor>::smagoConstIsAt’ of non-integral type [-fpermissive]rn const static T smagoConstIsAt = Lattice<T>::ExternalField::smagoConstIsAt;rn ^rn../../src/dynamics/smagorinskyBGKdynamics.h: In instantiation of ‘const double olb::DynSmagorinskyBGKdynamics<double, olb::descriptors::DynSmagorinskyD2Q9Descriptor>::smagoConstIsAt’:rn../../src/dynamics/smagorinskyBGKdynamics.hh:381:48: required from ‘T olb::DynSmagorinskyBGKdynamics<T, Lattice>::computeOmega(T, T, T, T*, olb::Cell<T, Lattice>&) [with T = double; Lattice = olb::descriptors::DynSmagorinskyD2Q9Descriptor]’rn../../src/dynamics/smagorinskyBGKdynamics.hh:328:71: required from ‘void olb::DynSmagorinskyBGKdynamics<T, Lattice>::collide(olb::Cell<T, Lattice>&, olb::LatticeStatistics<T>&) [with T = double; Lattice = olb::descriptors::DynSmagorinskyD2Q9Descriptor]’rncylinder2d.cpp:374:1: required from herern../../src/dynamics/smagorinskyBGKdynamics.h:164:18: error: ‘constexpr’ needed for in-class initialization of static data member ‘const double olb::DynSmagorinskyBGKdynamics<double, olb::descriptors::DynSmagorinskyD2Q9Descriptor>::smagoConstIsAt’ of non-integral type [-fpermissive]rnmake: *** [/home/aclarobarr/Documents/olb-1.0r0/Test_alejandro/cylinder2d_test6_wall_function/cylinder2d.o] Erreur 1rn

    rnrnShould the class DynSmagorinskyBGKdynamics be modified as:rn

    Code:
    template<typename T, template<typename U> class Lattice>rn class DynSmagorinskyBGKdynamics : public BGKdynamics<T,Lattice> {rn public:rn DynSmagorinskyBGKdynamics(T omega_, Momenta<T,Lattice>& momenta_, T dx_, T dt_);rn virtual void collide(Cell<T,Lattice>& cell, LatticeStatistics<T>& statistics_);rn virtual void staticCollide(Cell<T,Lattice>& cell, const T u[Lattice<T>::d],rn LatticeStatistics<T>& statistics_);rn virtual void setOmega(T omega_);rn virtual T getSmagorinskyOmega(Cell<T,Lattice>& cell_);rn rn private:rn T computePreFactor(T omega_, T smagoConst_, T dx_, T dt_);rn T computeOmega(T omega0_, T preFactor_, T rho_, T pi_[util::TensorVal<Lattice<T> >::n],rn Cell<T,Lattice>& cell);rn T tau_eff;rn T dx;rn T dt;rn // old versionrn // const static T smagoConstIsAt = Lattice<T>::ExternalField::smagoConstIsAt;rn // new versionrn const static int smagoConstIsAt = Lattice<T>::ExternalField::smagoConstIsAt;rn };

    rnrnDoes anyone know how to fix this error? and Do I need to redefine the class DynSmagorinskyBGKdynamics as indicated before?rnrnBest Regards,rnrnAlejandro

    #2381
    mathias
    Keymaster

    Did you compile in the mode “”precompiled”” or “”generic””. It should be “”generic””. See documenation. Best Mathias

    #2383

    Hi Mathias,rnrnI checked the “”Makefile.inc”” and I changed to “”generic””.rnrn

    Code:
    #BUILDTYPE := precompiledrnBUILDTYPE := generic

    rnrnAlso, I tested with the Shear Smagorinsky and ADM turbulence models and both complied well (not errors).rnrnBest regards,rnrnAlejandro rn

    #2390

    Hi Mathias,rnrnI redefine the DynSmagorinskyBGKdynamics as:rn

    Code:
    template<typename T, template<typename U> class Lattice>rnclass DynSmagorinskyBGKdynamicsNew : public BGKdynamics<T,Lattice> {rnpublic:rn /// Constructorrn DynSmagorinskyBGKdynamicsNew(T omega_, Momenta<T,Lattice>& momenta_, T dx_, T dt_);rn /// Collision steprn virtual void collide(Cell<T,Lattice>& cell, LatticeStatistics<T>& statistics_);rn /// Collide with fixed velocityrn virtual void staticCollide(Cell<T,Lattice>& cell, const T u[Lattice<T>::d],rn LatticeStatistics<T>& statistics_);rn /// Set local relaxation parameter of the dynamicsrn virtual void setOmega(T omega_);rn /// Get local smagorinsky relaxation parameter of the dynamicsrn virtual T getSmagorinskyOmega(Cell<T,Lattice>& cell_);rnrnprivate:rn /// Computes a constant prefactor in order to speed up the computationrn T computePreFactor(T omega_, T smagoConst_, T dx_, T dt_);rn /// Computes the local smagorinsky relaxation parameterrn T computeOmega(T omega0_, T preFactor_, T rho_, T pi_[util::TensorVal<Lattice<T> >::n],rn Cell<T,Lattice>& cell);rn /// effective collision time based upon Smagorisnky approachrn T tau_eff;rn T dx;rn T dt;rn const static int smagoConstIsAt = Lattice<T>::ExternalField::smagoConstIsAt;rn};

    rnrnIt should be noted that the smagoConstIsAt attribut have been defined as const static int (before was const static T).

    Quote:
    This phrase have been modified, it have been changed const static int by const static T

    rnrnThe code compile well.rnrnNow, I some kind of confused about the real implementation of this turbulence model. I know that in this model determines the Smagorinsky parameter (Csm) in each cell at each time step. I understood that

    Code:
    const static int smagoConstIsAt = Lattice<T>::ExternalField::smagoConstIsAt

    give the position vector for a external field of the lattice. However, I have not figured out in which moment this “”external field”” have been created.rnrnShould the user give an initial value of this parameter by using for example:rn

    Code:
    template<typename T, template<typename U> class Lattice>rnvoid SuperLattice2D<T,Lattice>::defineExternalField(SuperGeometry2D<T>& sGeometry,rn int material, int fieldBeginsAt, int sizeOfField, AnalyticalF2D<T,T>& field)

    rnAs for the “”Poiseuille-Forced-2D”” example?rnrnBest regards,rnAlejandro

    #2391
    mathias
    Keymaster

    Hi,rnrnthe data is in the Cell. As I rememeber, there is a functor (functors/turbulent3d.*) that updates the constant in each cell. There will be a paper and a PhD thesis hopefully soon available on this topic by Patrick Nathan. rnrnBestrnMathias

    #2392
    mathias
    Keymaster

    What did you change “”It should be noted that the smagoConstIsAt attribut have been defined as const static int (before was const static int).””?

    #2393

    Hi Mathias,rnrnMy phrase have been modified because it was incorrect.

    Quote:
    It should be noted that the smagoConstIsAt attribut have been defined as const static int (before was const static int)

    rnrnThe Lattice<T>::ExternalField::smagoConstIsAt returns a const static int not a const static T. Thus, I changed the type of return of the private attribute smagoConstIsAt in the class DynSmagorinskyBGKdynamics.rnrnThe collide method of the class DynSmagorinskyBGKdynamics seem to obtain the Smagorinsky parameter with the *cell.getExternal(Lattice<T>::ExternalField::smagoConstIsAt). However, I do not see where this parameter it is changed by the collide method of the class. It is changed by other method of the class?rnrnBest regards,rnAlejandro

    #2408
    mathias
    Keymaster

    Dear Alejandro,rnrn There are several issues to be discussed for that topic. Further, we will have a spring school in March 2017 for LBM and OpenLB, where we can help to get started. Please contact me to proceed.rnrnBestrnMathias

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