Error message

Hi,

I am trying to simulate flow in porous media using palabos and I intend to impose periodic boundaries with bounceback condition on obstacles. However, I get the following error message and I think its from my definition of bounceback, which I think was done correctly. I would appreciate if my mistake is pointed out to me

Error message
womersley.cpp: In function ‘void porousmediadomain(plb::MultiBlockLattice3D<T, plb::descriptors::ForcedD3Q19Descriptor>&, const plb::IncomprFlowParam&, plb::MultiScalarField3D&)’:
womersley.cpp:127: error: no matching function for call to ‘defineDynamics(plb::MultiBlockLattice3D<T, plb::descriptors::ForcedD3Q19Descriptor>&, plb::MultiScalarField3D&, plb::BounceBack<T, plb::descriptors::ForcedD3Q19Descriptor>*, bool)’
scons: *** [womersley.o] Error 1
scons: building terminated because of errors.
make: *** [compile] Error 2

The code is shown below.

#include “palabos3D.h”
#ifndef PLB_PRECOMPILED // Unless precompiled version is used,
#include “palabos3D.hh” // include full template code
#endif
#include
#include
#include
#include

using namespace plb;
using namespace std;

typedef double T;
#define DESCRIPTOR descriptors::ForcedD3Q19Descriptor
T poiseuilleforce = 1e-4;

void porousmediadomain( MultiBlockLattice3D<T,DESCRIPTOR>& lattice,
IncomprFlowParam const& parameters,
MultiScalarField3D& mediadomain)
{
const plint nx = lattice.getNx();
const plint ny = lattice.getNy();
const plint nz = lattice.getNz();

	pcout << "Definition of the geometry." << endl;
    // Where "geometry" evaluates to 1, use bounce-back.
          defineDynamics(lattice, mediadomain, new BounceBack<T,DESCRIPTOR>(), true);        //this is line 127
 

    pcout << "Initilization of rho and u." << endl;

	Array<T,3>u(0.,0.,0.);
	initializeAtEquilibrium( lattice, lattice.getBoundingBox(), 1.0, u);

	Array<T,3>force(poiseuilleforce, T(), T() );
	//Array<T,3> & force(1e-3, T(),T());
//	setExternalVector(lattice,lattice.getBoundingBox(),
//				  DESCRIPTOR<T>::ExternalField::forceBeginsAt,DESCRIPTOR<T>::ExternalField::sizeOfForce, force);
    
setExternalVector(lattice,lattice.getBoundingBox(),DESCRIPTOR<T>::ExternalField::forceBeginsAt, force);
    

lattice.initialize();

}

int main(int argc, char* argv[]) {

plbInit(&argc, &argv);
global::directories().setOutputDir("./tmp/");

IncomprFlowParam<T> parameters(
							   (T) 1e-2,  // uMax
							   (T) 7.5,  // Re
							   num,       // N
							   1.,        // lx
							   1.,        // ly
							   1.         // lz
							   );

const T logT     = (T)1/(T)100;
const T imSave   = (T)1/(T)10;
const T vtkSave  = (T)1/10;
const T maxT     = (T)15.;

writeLogFile(parameters, "Porous media");

const plint nx = parameters.getNx();
const plint ny = parameters.getNy();
const plint nz = parameters.getNz();
const T omega = parameters.getOmega();

    pcout << "Creation of the lattice." << endl;
    MultiBlockLattice3D<T, DESCRIPTOR> lattice (nx, ny, nz, new HeExternalForceBGKdynamics<T, DESCRIPTOR>( omega) );



    // Switch off periodicity.
    lattice.periodicity().toggleAll(true);

    pcout << "Reading the geometry file." << endl;

    MultiScalarField3D<T> mediadomain(nx, ny, nz);
    plb_ifstream fileinput("fccsphs100.txt");
    
	if(!fileinput.is_open()) {
            pcout << "Error: could not open geometry file " << endl;
            return -1;
    }
    fileinput >> mediadomain;

   
    porousmediadomain(lattice, parameters, mediadomain);

// define convergence

    pcout << "Simulation begins" << endl;
    plint iT=0;
1 Like

Hey there,

try removing the () brackets behind the “new BounceBack<T,DESCRIPTOR>()” in line 127:

so it looks like:

defineDynamics(lattice, mediadomain, new BounceBack<T,DESCRIPTOR>, true);

hope that helps,

cheers,
chris

Hi, I tried it and it did not work. I decided to use an earlier version of palabos and I get this message.

make
python …/…/scons/scons.py -f …/…/SConstruct palabosRoot=…/… projectFiles=“cavity3d.cpp” precompiled=false optimize=true debug=false profile=false MPIparallel=false SMPparallel=false usePOSIX=true useCVMLCPP=false serialCXX=g++ parallelCXX= compileFlags="" linkFlags="" optimFlags="-O3" debugFlags="-g" profileFlags="-pg" libraryPaths="" includePaths="" libraries=""
scons: Reading SConscript files …
scons: done reading SConscript files.
scons: Building targets …
g++ -o cavity3d.o -c -O3 -DPLB_USE_POSIX -I/Users/chukwudichukwudozie/Desktop/why/src -I/Users/chukwudichukwudozie/Desktop/why/externalLibraries cavity3d.cpp
cavity3d.cpp: In function ‘void porousmediadomain(plb::MultiBlockLattice3D<T, plb::descriptors::ForcedD3Q19Descriptor>&, const plb::IncomprFlowParam&, plb::MultiScalarField3D&)’:
cavity3d.cpp:140: error: ‘setExternalVector’ was not declared in this scope
scons: *** [cavity3d.o] Error 1
scons: building terminated because of errors.
make: *** [compile] Error 2
chukwudi-chukwudozies-macbook:cgate3 chukwudichukwudozie$

Hi again,

I use exactly the same method for my simulations, and the only difference I noticed were those brackets, so I really don´t understand why its not working - what errormessage did you get when the brackets were gone ?

The reason why you get the message with an earlier version is because the implementation for the force-vector was more complicated, and the command did not exist until… not sure either 0.7r1 or 07r2

the old method looked like this (in 2D):


template<typename T, template<typename U> class Descriptor>
class ExternalForceInitializer : public OneCellIndexedFunctional2D<T,Descriptor> {
public:
    ExternalForceInitializer(T force_)
        : force(force_)
    { }
	
    ExternalForceInitializer<T,Descriptor>* clone() const {
        return new ExternalForceInitializer<T,Descriptor>(*this);
    }
    virtual void execute(plint iX, plint iY, Cell<T,Descriptor>& cell) const {
        T force_x = force;
	T force_y = 0;
        Array<T,2> forcefield (force_x, force_y);
	Array<T,2> zeroVelocity (0.,0.);
        T rho = (T)1.;
		
        //pcout << "Force: Fx = " << force_x << ", Fy = " << force_y << endl;
	iniCellAtEquilibrium(cell, rho, zeroVelocity);
		// Initialize the value of the force in the external scalars.
        cell.setExternalField (
               Descriptor<T>::ExternalField::forceBeginsAt,
               Descriptor<T>::ExternalField::sizeOfForce, &forcefield[0] );

    }
private:
    T force;
};

and in the main function:


applyIndexed(lattice, Box2D(0, nx-1, 0, ny-1), new ExternalForceInitializer<T,DESCRIPTOR>(force) );

I looked again through your code and saw no difference (other than you using HeExternalForceBGKdynamics and I use GuoExternalForceBGKdynamics), maybe I´m just overlooking something, here is my part of the code - which works fine:


MultiBlockLattice3D<T, DESCRIPTOR> lattice (nxx, nyy, nzz,
	new GuoExternalForceBGKdynamics<T,DESCRIPTOR>(units.getOmega()) );
    
    lattice.periodicity().toggle(0, true); // periodic along the x-axis
    lattice.periodicity().toggle(1, true); // periodic along the y-axis
	
    
    OnLatticeBoundaryCondition3D<T,DESCRIPTOR>* boundaryCondition = createLocalBoundaryCondition3D<T,DESCRIPTOR>();
	
    Box3D topWall(1, nxx-2, 0, nyy-1, nzz-1, nzz-1);
    Box3D bottomWall(0, nxx-1, 0, nyy-1, 0, 0);
    boundaryCondition->setVelocityConditionOnBlockBoundaries (lattice, topWall, boundary::freeslip);
    
   
    setExternalVector (lattice, lattice.getBoundingBox(), DESCRIPTOR<T>::ExternalField::forceBeginsAt, Array<T,3>(force, 0., 0.));

    MultiScalarField3D<bool> boolMask(nxx, nyy, nzz);
   
    plb_ifstream ifile(inputfile.c_str());
    ifile >> boolMask;    
    defineDynamics(lattice, boolMask, new BounceBack<T,DESCRIPTOR>, true);
    lattice.initialize();

nxx, nyy and nzz are the dimensions of the lattice obtained with the parameters.getNx()-command.
And the value for was also defined earlier.

I use 0.7r2 at the moment, post the errormessage if its still not working.

chris

Hey Chuckdee,

I finally found the problem:
In earlier releases, the MultiScalarFieldxD could only be of datatype, which was a bit weird if you needed a boolmask. I think in the 0.7r they changed it, and from now on it can be (and has to be in some cases) of different datatypes.

So for the boolmask, instead of

MultiScalarField3D mediadomain(nx, ny, nz);

use

MultiScalarField3D mediadomain (nx, ny, nz);

I just compiled your code without any errormessage, so it looks good.
But like I mentioned in my first post, dont use these () brackets.

hopefully it works now,

cheers,
chris