Hello Lin,
My “container” is defined by the function createFluidBlocks
, which is modified from the example “generalExternalFlow” in palabos.
MultiScalarField3D<T> *rhoBar = nullptr;
MultiTensorField3D<T,3> *j = nullptr;
MultiContainerBlock3D *container = nullptr;
std::vector<MultiBlock3D*> lattice_rho_bar_j_arg;
createFluidBlocks(param, lattices, rhoBar, j, container, lattice_rho_bar_j_arg, order);
void createFluidBlocks(SimulationParameters& param, MultiLevelCoupling3D<T,DESCRIPTOR,RESCALER>*& lattices,
MultiScalarField3D<T>*& rhoBar, MultiTensorField3D<T,3>*& j, MultiContainerBlock3D*& container,
std::vector<MultiBlock3D*>& lattice_rho_bar_j_arg, plint& order)
{
Dynamics<T,DESCRIPTOR> *dynamics = new ConsistentSmagorinskyBGKdynamics<T,DESCRIPTOR>(param.omega[0], param.cSmago);
param.incompressibleModel = false;
pcout << "Dynamics: Smagorinsky BGK." << std::endl;
lattices = new MultiLevelCoupling3D<T,DESCRIPTOR,RESCALER>( param.ogs, dynamics->clone(), order );
for (plint iLevel = 0; iLevel < lattices->getNumLevels(); iLevel++) {
pcout << "Info for lattice at level: " << iLevel << std::endl;
pcout << getMultiBlockInfo(lattices->getLevel(iLevel)) << std::endl;
lattices->getLevel(iLevel).toggleInternalStatistics(false);
}
rhoBar = generateMultiScalarField<T>((MultiBlock3D&) lattices->getLevel(param.finestLevel), param.largeEnvelopeWidth).release();
rhoBar->toggleInternalStatistics(false);
j = generateMultiTensorField<T,3>((MultiBlock3D&) lattices->getLevel(param.finestLevel), param.largeEnvelopeWidth).release();
j->toggleInternalStatistics(false);
container = new MultiContainerBlock3D((MultiBlock3D&) *rhoBar);
lattice_rho_bar_j_arg.clear();
lattice_rho_bar_j_arg.push_back(&(lattices->getLevel(param.finestLevel)));
lattice_rho_bar_j_arg.push_back(rhoBar);
lattice_rho_bar_j_arg.push_back(j);
integrateProcessingFunctional(
new BoxRhoBarJfunctional3D<T,DESCRIPTOR>(),
lattices->getLevel(param.finestLevel).getBoundingBox(), lattice_rho_bar_j_arg, 0);
integrateProcessingFunctional(
new ComputeWallVelocityFunctional<T,DESCRIPTOR>(¶m),
lattices->getLevel(param.finestLevel).getBoundingBox(), lattice_rho_bar_j_arg, 1);
// Integrate the immersed boundary processors in the lattice multi-block.
std::vector<MultiBlock3D*> args;
plint pl = 2;
args.resize(0);
args.push_back(container);
integrateProcessingFunctional(
new InstantiateImmersedWallDataWithIndexedTagging3D<T>(param.vertices, param.areas, param.flags),
container->getBoundingBox(), lattices->getLevel(param.finestLevel), args, pl);
pl++;
for (plint i = 0; i < param.ibIter; i++) {
args.resize(0);
args.push_back(rhoBar);
args.push_back(j);
args.push_back(container);
integrateProcessingFunctional(
new IndexedInamuroIteration3D<T,VelFunction>(
VelFunction(param), 1.0 / param.omega[param.finestLevel], param.incompressibleModel),
rhoBar->getBoundingBox(), lattices->getLevel(param.finestLevel), args, pl);
pl++;
}
integrateProcessingFunctional(
new ExternalRhoJcollideAndStream3D<T,DESCRIPTOR>(),
lattices->getLevel(param.finestLevel).getBoundingBox(), lattice_rho_bar_j_arg, pl);
}