Assertion failure in Aneurysm example

Hi,

I’m getting assertion failure when running the Aneurysm example that ships with Palabos v1.5r1. Other examples I have tried worked ok. My environment is:


MacOS Sierra 10.12.2
XCode 8.2.1
Compiler:
    Apple LLVM version 8.0.0 (clang-800.0.42.1)
    Target: x86_64-apple-darwin16.3.0
    Thread model: posix
Open-MPI 2.0.1

The example was run with all the default parameters, default STL file and default options in Makefile except for the added flag for OSX compilation: -DPLB_MAC_OS_X. However, turning off optimizations, or MPI doesn’t seem to affect the issue.

Below is the output from running ./aneurysm param.xml:


Reynolds number, based on provided inlet diameter: 64.8001

Running new simulation at level 0
uLB=0.0373738
nuLB=0.0062
tau=0.5186
dx=0.0011163
dt=0.00208602
Inner radius of inlet 0 : 5.23417 lattice nodes
Size of the multi-block:     50-by-65-by-107
Number of atomic-blocks:     26
Smallest atomic-block:       25-by-21-by-21
Largest atomic-block:        25-by-22-by-22
Number of allocated cells:   0.30155 million
Fraction of allocated cells: 86.7146 percent

Number of fluid cells: 34636
Assertion failed: (wallDistance <= NextNeighbor<T>::d[iNeighbor]), function computeNeighborData, file /Users/huhtanen/Downloads/palabos-v1.5r1_2/src/offLattice/guoOffLatticeModel3D.hh, line 306.
[MacBook-Pro:90529] *** Process received signal ***
[MacBook-Pro:90529] Signal: Abort trap: 6 (6)
[MacBook-Pro:90529] Signal code:  (0)
[MacBook-Pro:90529] [ 0] 0   libsystem_platform.dylib            0x00007fffd0c2bbba _sigtramp + 26
[MacBook-Pro:90529] [ 1] 0   libsystem_malloc.dylib              0x00007fffd0ba1977 tiny_malloc_from_free_list + 431
[MacBook-Pro:90529] [ 2] 0   libsystem_c.dylib                   0x00007fffd0ab2420 abort + 129
[MacBook-Pro:90529] [ 3] 0   libsystem_c.dylib                   0x00007fffd0a79893 basename_r + 0
[MacBook-Pro:90529] [ 4] 0   aneurysm                            0x000000010a693518 _ZN3plb14GuoAlgorithm3DIdNS_11descriptors15D3Q19DescriptorEE19computeNeighborDataEv + 616
[MacBook-Pro:90529] [ 5] 0   aneurysm                            0x000000010a693255 _ZN3plb20GuoOffLatticeModel3DIdNS_11descriptors15D3Q19DescriptorEE14cellCompletionERNS_14BlockLattice3DIdS2_EERKNS_5Dot3DERKNSt3__16vectorINSA_4pairIiiEENSA_9allocatorISD_EEEERKNSB_IlNSE_IlEEEES9_RNS_5ArrayIdLm3EEERKNSB_IPKNS_13AtomicBlock3DENSE_ISS_EEEE + 213
[MacBook-Pro:90529] [ 6] 0   aneurysm                            0x000000010a690dff _ZN3plb20GuoOffLatticeModel3DIdNS_11descriptors15D3Q19DescriptorEE18boundaryCompletionERNS_13AtomicBlock3DERNS_22AtomicContainerBlock3DERKNSt3__16vectorIPKS4_NS8_9allocatorISB_EEEE + 287
[MacBook-Pro:90529] [ 7] 0   aneurysm                            0x000000010a697a28 _ZN3plb32OffLatticeCompletionFunctional3DIdNS_11descriptors15D3Q19DescriptorENS_5ArrayIdLm3EEEE20processGenericBlocksENS_5Box3DENSt3__16vectorIPNS_13AtomicBlock3DENS7_9allocatorISA_EEEE + 1208
[MacBook-Pro:90529] [ 8] 0   aneurysm                            0x000000010a6b40bd _ZN3plb14BoxProcessor3D7processEv + 253
[MacBook-Pro:90529] [ 9] 0   aneurysm                            0x000000010a6af9ee _ZN3plb13AtomicBlock3D25executeInternalProcessorsEl + 110
[MacBook-Pro:90529] [10] 0   aneurysm                            0x000000010a6ec1d8 _ZN3plb12MultiBlock3D25executeInternalProcessorsEv + 216
[MacBook-Pro:90529] [11] 0   aneurysm                            0x000000010a63e87e _Z10iniLatticeRN3plb19MultiBlockLattice3DIdNS_11descriptors15D3Q19DescriptorEEERNS_17VoxelizedDomain3DIdEE + 478
[MacBook-Pro:90529] [12] 0   aneurysm                            0x000000010a64332c _Z3runlPN3plb19MultiBlockLattice3DIdNS_11descriptors15D3Q19DescriptorEEE + 4108
[MacBook-Pro:90529] [13] 0   aneurysm                            0x000000010a64acdc main + 860
[MacBook-Pro:90529] [14] 0   libdyld.dylib                       0x00007fffd0a1e255 start + 1
[MacBook-Pro:90529] *** End of error message ***

Any idea what might be going wrong?

/Jani

Dear Jani,

thank you for your post. The problem you mention is known and will be fixed in the upcoming Palabos release (along with the rest of the compilation warnings on the Mac). For you to be able to progress with your work, please replace the file:

palabos-v1.5r1/src/offLattice/nextNeighbors3D.h

with the:


/* This file is part of the Palabos library.
 *
 * Copyright (C) 2011-2017 FlowKit Sarl
 * Route d'Oron 2
 * 1010 Lausanne, Switzerland
 * E-mail contact: contact@flowkit.com
 *
 * The most recent release of Palabos can be downloaded at 
 * <http://www.palabos.org/>
 *
 * The library Palabos is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * The library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef NEXT_NEIGHBORS_3D_H
#define NEXT_NEIGHBORS_3D_H

#include "core/globalDefs.h"

namespace plb {

template <typename T>
struct NextNeighbor {
    static const int numNeighbors;
    static const int c[26][3];
    static const T d1;
    static const T d2;
    static const T d3;
    static const T d[26];
    static const T id1;
    static const T id2;
    static const T id3;
    static const T invD[26];
};

template<typename T, template<typename U> class Descriptor>
struct NextNeighborPop {
    NextNeighborPop();
    int ids[NextNeighbor<T>::numNeighbors];
};

template<typename T, template<typename U> class Descriptor>
inline plint nextNeighborPop(plint iNeighbor) {
    static NextNeighborPop<T,Descriptor> instance;
    return instance.ids[iNeighbor];
}

}  // namespace plb

#endif  // NEXT_NEIGHBORS_3D_H

and the file:

palabos-v1.5r1/src/offLattice/nextNeighbors3D.hh

with the:


/* This file is part of the Palabos library.
 *
 * Copyright (C) 2011-2017 FlowKit Sarl
 * Route d'Oron 2
 * 1010 Lausanne, Switzerland
 * E-mail contact: contact@flowkit.com
 *
 * The most recent release of Palabos can be downloaded at 
 * <http://www.palabos.org/>
 *
 * The library Palabos is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * The library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef NEXT_NEIGHBORS_3D_HH
#define NEXT_NEIGHBORS_3D_HH

#include "offLattice/nextNeighbors3D.h"
#include "latticeBoltzmann/geometricOperationTemplates.h"
#include "latticeBoltzmann/externalFieldAccess.h"
#include <cmath>

namespace plb {

template <typename T>
const int NextNeighbor<T>::numNeighbors = 26;

template <typename T>
const int NextNeighbor<T>::c[26][3] =
{             { 0, 0, 1}, { 0, 0,-1},
  { 0, 1, 0}, { 0, 1, 1}, { 0, 1,-1},
  { 0,-1, 0}, { 0,-1, 1}, { 0,-1,-1},

  { 1, 0, 0}, { 1, 0, 1}, { 1, 0,-1},
  { 1, 1, 0}, { 1, 1, 1}, { 1, 1,-1},
  { 1,-1, 0}, { 1,-1, 1}, { 1,-1,-1},

  {-1, 0, 0}, {-1, 0, 1}, {-1, 0,-1},
  {-1, 1, 0}, {-1, 1, 1}, {-1, 1,-1},
  {-1,-1, 0}, {-1,-1, 1}, {-1,-1,-1}
};

template <typename T>
const T NextNeighbor<T>::d1 = (T) 1;
template <typename T>
const T NextNeighbor<T>::d2 = std::sqrt((T) 2);
template <typename T>
const T NextNeighbor<T>::d3 = std::sqrt((T) 3);

template <typename T>
const T NextNeighbor<T>::d[26] =
{                     (T) 1,            (T) 1,
    (T) 1,            std::sqrt((T) 2), std::sqrt((T) 2),
    (T) 1,            std::sqrt((T) 2), std::sqrt((T) 2),
    (T) 1,            std::sqrt((T) 2), std::sqrt((T) 2),
    std::sqrt((T) 2), std::sqrt((T) 3), std::sqrt((T) 3),
    std::sqrt((T) 2), std::sqrt((T) 3), std::sqrt((T) 3),
    (T) 1,            std::sqrt((T) 2), std::sqrt((T) 2),
    std::sqrt((T) 2), std::sqrt((T) 3), std::sqrt((T) 3),
    std::sqrt((T) 2), std::sqrt((T) 3), std::sqrt((T) 3) };

template <typename T>
const T NextNeighbor<T>::id1 = (T) 1;
template <typename T>
const T NextNeighbor<T>::id2 = (T) 1 / std::sqrt((T) 2);
template <typename T>
const T NextNeighbor<T>::id3 = (T) 1 / std::sqrt((T) 3);

template <typename T>
const T NextNeighbor<T>::invD[26] =
{                             (T) 1,                    (T) 1,
    (T) 1,                    (T) 1 / std::sqrt((T) 2), (T) 1 / std::sqrt((T) 2),
    (T) 1,                    (T) 1 / std::sqrt((T) 2), (T) 1 / std::sqrt((T) 2),
    (T) 1,                    (T) 1 / std::sqrt((T) 2), (T) 1 / std::sqrt((T) 2),
    (T) 1 / std::sqrt((T) 2), (T) 1 / std::sqrt((T) 3), (T) 1 / std::sqrt((T) 3),
    (T) 1 / std::sqrt((T) 2), (T) 1 / std::sqrt((T) 3), (T) 1 / std::sqrt((T) 3),
    (T) 1,                    (T) 1 / std::sqrt((T) 2), (T) 1 / std::sqrt((T) 2),
    (T) 1 / std::sqrt((T) 2), (T) 1 / std::sqrt((T) 3), (T) 1 / std::sqrt((T) 3),
    (T) 1 / std::sqrt((T) 2), (T) 1 / std::sqrt((T) 3), (T) 1 / std::sqrt((T) 3) };

template<typename T, template<typename U> class Descriptor>
NextNeighborPop<T,Descriptor>::NextNeighborPop()
{
    typedef Descriptor<T> D;
    for (plint iNeighbor=0; iNeighbor<NextNeighbor<T>::numNeighbors; ++iNeighbor) {
        int const* c = NextNeighbor<T>::c[iNeighbor];
        ids[iNeighbor] = -1;
        for (plint iPop=0; iPop<D::q; ++iPop) {
            if (D::c[iPop][0]==c[0] && D::c[iPop][1]==c[1] && D::c[iPop][2]==c[2]) {
                ids[iNeighbor] = iPop;
                break;
            }
        }
    }
}

}  // namespace plb

#endif  // NEXT_NEIGHBORS_3D_HH

Best,
Dimitris

With these files simulation now works ok.

Thank you for prompt response, much appreciated!

/Jani