Welcome! Log In Create A New Profile

Advanced

Norm of a MultiTensorField<T,6>

Posted by MercierpMercierp  
Norm of a MultiTensorField<T,6>
April 06, 2018 07:55AM
Hi everyone,

I get a compilation error when computing the norm of a MultiTensorField<T,6>.
The following command

Language: C++
MultiScalarField3D<T> strainRateTensorNorm = *computeNorm(*computeStrainRate(*computeVelocity(lattices.getLevel(iLevel),lattices.getLevel(iLevel).getBoundingBox())));

lead to the following errors :

Language: C++
/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/latticeBoltzmann/geometricOperationTemplates.h(130): error: class "plb::SymmetricTensorImpl<T={double}, 6>" has no member "n" static void symTensorProduct(Array<T,d> const &u, Array<T,d> const &v, Array<T,SymmetricTensorImpl<T,d>::n> &result) { ^ detected during: instantiation of class "plb::VectorTemplateImpl<T, d> [with T=T={double}, d=6]" at line 5012 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisFunctional3D.hh" instantiation of "void plb::ComputeNormFunctional3D<T, nDim>::process(plb::Box3D, plb::ScalarField3D<T> &, plb::TensorField3D<T, nDim> &) [with T=T={double}, nDim=6]" at line 3961 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" implicit generation of "plb::ComputeNormFunctional3D<T, nDim>::~ComputeNormFunctional3D() [with T=T={double}, nDim=6]" at line 3961 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" instantiation of class "plb::ComputeNormFunctional3D<T, nDim> [with T=T={double}, nDim=6]" at line 3961 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" implicit generation of "plb::ComputeNormFunctional3D<T, nDim>::ComputeNormFunctional3D() [with T=T={double}, nDim=6]" at line 3961 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" instantiation of class "plb::ComputeNormFunctional3D<T, nDim> [with T=T={double}, nDim=6]" at line 3961 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" instantiation of "void plb::computeNorm(plb::MultiTensorField3D<T, nDim> &, plb::MultiScalarField3D<T> &, plb::Box3D) [with T=T={double}, nDim=6]" at line 3977 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" instantiation of "std::auto_ptr<plb::MultiScalarField3D<T>> plb::computeNorm(plb::MultiTensorField3D<T, nDim> &, plb::Box3D) [with T=T={double}, nDim=6]" at line 3984 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" instantiation of "std::auto_ptr<plb::MultiScalarField3D<T>> plb::computeNorm(plb::MultiTensorField3D<T, nDim> &) [with T=T={double}, nDim=6]" at line 2292 of "offLatticeExternalFlow.cpp"   /gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/latticeBoltzmann/geometricOperationTemplates.h(141): error: class "plb::SymmetricRankThreeTensorImpl<T={double}, 6>" has no member "n" Array<T,SymmetricRankThreeTensorImpl<T,d>::n> &result) { ^ detected during: instantiation of class "plb::VectorTemplateImpl<T, d> [with T=T={double}, d=6]" at line 5012 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisFunctional3D.hh" instantiation of "void plb::ComputeNormFunctional3D<T, nDim>::process(plb::Box3D, plb::ScalarField3D<T> &, plb::TensorField3D<T, nDim> &) [with T=T={double}, nDim=6]" at line 3961 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" implicit generation of "plb::ComputeNormFunctional3D<T, nDim>::~ComputeNormFunctional3D() [with T=T={double}, nDim=6]" at line 3961 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" instantiation of class "plb::ComputeNormFunctional3D<T, nDim> [with T=T={double}, nDim=6]" at line 3961 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" implicit generation of "plb::ComputeNormFunctional3D<T, nDim>::ComputeNormFunctional3D() [with T=T={double}, nDim=6]" at line 3961 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" instantiation of class "plb::ComputeNormFunctional3D<T, nDim> [with T=T={double}, nDim=6]" at line 3961 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" instantiation of "void plb::computeNorm(plb::MultiTensorField3D<T, nDim> &, plb::MultiScalarField3D<T> &, plb::Box3D) [with T=T={double}, nDim=6]" at line 3977 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" instantiation of "std::auto_ptr<plb::MultiScalarField3D<T>> plb::computeNorm(plb::MultiTensorField3D<T, nDim> &, plb::Box3D) [with T=T={double}, nDim=6]" at line 3984 of "/gpfs1/home/2016014/pmerci01/guoOffLattice/palabos_v2/src/dataProcessors/dataAnalysisWrapper3D.hh" instantiation of "std::auto_ptr<plb::MultiScalarField3D<T>> plb::computeNorm(plb::MultiTensorField3D<T, nDim> &) [with T=T={double}, nDim=6]" at line 2292 of "offLatticeExternalFlow.cpp"

It seems that the two definitions of function "symTensorProduct" aren't compiling in src/latticeBoltzmann/geometricOperationTemplates.h, while they aren't nedded for the norm calculation.

I commented them and everything works fine, but I am not sure it would or not cause problems somewhere else.

Thank you,

Philippe
Re: Norm of a MultiTensorField<T,6>
April 16, 2018 11:05AM
Dear Philippe,

thank you very much for this bug report. This is indeed a bug, and a way to fix it would be the following. Please go to the file:

src/latticeBoltzmann/geometricOperationTemplates.h

and replace the part:

Language: C++
template <typename T, int d> struct SymmetricTensorImpl { };

with:

Language: C++
template <typename T, int d> struct SymmetricTensorImpl { static const int n = d * (d + 1) / 2; };

Also, replace the part:

Language: C++
template <typename T, int d> struct SymmetricRankThreeTensorImpl { };

with:

Language: C++
template <typename T, int d> struct SymmetricRankThreeTensorImpl { static const int n = d * (d + 1) * (d + 2) / 6; };

Please let me know if the problem persists.

Thanks once again for spotting this bug!

Best Regards,
Dimitris
Sorry, you do not have permission to post/reply in this forum.