Hello everbody,
I got now a new problem and would be glad to get some help from you : )
The example below has no deeper sense but represents my problem:
I divide the multiblock in 3 atomic blocks manually and then I want to get the probability densities of one direction (2 in this example). But the program displays only the values of the first atomic block and I don’t know why.
I use only the bulk without the envelope because I don’t want to change dynamics or the internal state. To my unterstanding I do not need global indices in this example because I don’t make space dependent decisions. I don’t change variables, so I use modif::nothing. I tested also modiff::staticVariables.
[code=“cpp”]
#include “palabos2D.h”
#ifndef PLB_PRECOMPILED
#include “palabos2D.hh”
#endif
#include
#include
#include
#include
#include
#include
#include
using namespace plb;
using namespace std;
typedef double T;
Array<T,2> ustart(0.,0.);
#define DESCRIPTOR plb::descriptors::D2Q9Descriptor
template<typename T, template class Descriptor>
class dataprocessor : public BoxProcessingFunctional2D_L<T,Descriptor>
{
public:
BlockDomain::DomainT appliesTo() const
{return BlockDomain::bulk;}
void getModificationPattern(std::vector<bool>& isWritten) const
{
isWritten[0]=true;
isWritten[1]=true;
isWritten[2]=true;
}
virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const
{
modified[0] = modif::nothing;
modified[1] = modif::nothing;
modified[2] = modif::nothing;
};
virtual dataprocessor<T,Descriptor>* clone() const
{return new dataprocessor<T,Descriptor>(*this);}
virtual void process(Box2D domain, BlockLattice2D<T,Descriptor>& lattice)
{
for (plint iX=domain.x0; iX<=domain.x1; ++iX)
{
for (plint iY=domain.y0; iY<=domain.y1; ++iY)
{
Cell<T,Descriptor>& cell = lattice.get(iX,iY);
pcout<<cell[2]<<endl;
}
}
}
};
int main(int argc, char* argv[])
{
plbInit(&argc, &argv);
global::directories().setOutputDir("./tmp/");
T omega=(T)0.2857;
plint nx=15;
plint ny=1;
plint maxt=3;
plint x0 =5;
plint x1 =9;
plint envelopeWidth =1;
SparseBlockStructure2D sparseBlock(nx,ny);
sparseBlock.addBlock(Box2D(0,x0,0,ny-1),sparseBlock.nextIncrementalId());
sparseBlock.addBlock(Box2D(x0+1,x1,0,ny-1),sparseBlock.nextIncrementalId());
sparseBlock.addBlock(Box2D(x1+1,nx-1,0,ny-1),sparseBlock.nextIncrementalId());
MultiBlockLattice2D<T, DESCRIPTOR> lattice (
MultiBlockManagement2D(sparseBlock,defaultMultiBlockPolicy2D().getThreadAttribution(), envelopeWidth ),
defaultMultiBlockPolicy2D().getBlockCommunicator(),
defaultMultiBlockPolicy2D().getCombinedStatistics(),
defaultMultiBlockPolicy2D().getMultiCellAccess<T,DESCRIPTOR>(),
new BGKdynamics<T,DESCRIPTOR>(omega)
);
Box2D PG(0,14,0,0);
initializeAtEquilibrium(lattice,PG,1.,ustart);
lattice.periodicity().toggleAll(true);
for (plint it=0; it<maxt; ++it)
{
applyProcessingFunctional(new dataprocessor<T,DESCRIPTOR>(),PG,lattice);
}
}
Regards Palabosfan