本文整理汇总了C++中Param::getInletVelocity方法的典型用法代码示例。如果您正苦于以下问题:C++ Param::getInletVelocity方法的具体用法?C++ Param::getInletVelocity怎么用?C++ Param::getInletVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Param
的用法示例。
在下文中一共展示了Param::getInletVelocity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runProgram
//.........这里部分代码省略.........
}
// Number of sponge zone lattice nodes at all the outer domain boundaries.
// So: 0 means the boundary at x = 0
// 1 means the boundary at x = nx-1
// 2 means the boundary at y = 0
// and so on...
numSpongeCells[0] = 0;
numSpongeCells[1] = param.numOutletSpongeCells;
numSpongeCells[2] = 0;
numSpongeCells[3] = 0;
numSpongeCells[4] = 0;
numSpongeCells[5] = 0;
std::vector<MultiBlock3D*> args;
args.push_back(lattice);
if (param.outletSpongeZoneType == 0) {
applyProcessingFunctional(new ViscositySpongeZone<T,DESCRIPTOR>(
param.nx, param.ny, param.nz, bulkValue, numSpongeCells),
lattice->getBoundingBox(), args);
} else {
applyProcessingFunctional(new SmagorinskySpongeZone<T,DESCRIPTOR>(
param.nx, param.ny, param.nz, bulkValue, param.targetSpongeCSmago, numSpongeCells),
lattice->getBoundingBox(), args);
}
}
/*
* Setting the initial conditions.
*/
// Initial condition: Constant pressure and velocity-at-infinity everywhere.
Array<T,3> uBoundary(param.getInletVelocity(0), 0.0, 0.0);
initializeAtEquilibrium(*lattice, lattice->getBoundingBox(), 1.0, uBoundary);
applyProcessingFunctional(
new BoxRhoBarJfunctional3D<T,DESCRIPTOR>(),
lattice->getBoundingBox(), lattice_rho_bar_j_arg); // Compute rhoBar and j before VirtualOutlet is executed.
lattice->executeInternalProcessors(1); // Execute all processors except the ones at level 0.
lattice->executeInternalProcessors(2);
lattice->executeInternalProcessors(3);
/*
* Particles (streamlines).
*/
// This part of the code that relates to particles, is purely for visualization
// purposes. Particles are used to compute streamlines essentially.
// Definition of a particle field.
MultiParticleField3D<ParticleFieldT>* particles = 0;
if (param.useParticles) {
particles = new MultiParticleField3D<ParticleFieldT> (
lattice->getMultiBlockManagement(),
defaultMultiBlockPolicy3D().getCombinedStatistics() );
std::vector<MultiBlock3D*> particleArg;
particleArg.push_back(particles);
std::vector<MultiBlock3D*> particleFluidArg;
particleFluidArg.push_back(particles);
particleFluidArg.push_back(lattice);
// Functional that advances the particles to their new position at each predefined time step.
integrateProcessingFunctional (
示例2: outerDomainBoundaries
// Instantiate the boundary conditions for the outer domain.
void outerDomainBoundaries(MultiBlockLattice3D<T,DESCRIPTOR> *lattice,
MultiScalarField3D<T> *rhoBar,
MultiTensorField3D<T,3> *j,
OnLatticeBoundaryCondition3D<T,DESCRIPTOR> *bc)
{
Array<T,3> uBoundary(param.getInletVelocity(0), 0.0, 0.0);
if (param.lateralFreeSlip) {
pcout << "Free-slip lateral boundaries." << std::endl;
lattice->periodicity().toggleAll(false);
rhoBar->periodicity().toggleAll(false);
j->periodicity().toggleAll(false);
bc->setVelocityConditionOnBlockBoundaries(*lattice, param.inlet, boundary::dirichlet);
setBoundaryVelocity(*lattice, param.inlet, uBoundary);
bc->setVelocityConditionOnBlockBoundaries(*lattice, param.lateral1, boundary::freeslip);
bc->setVelocityConditionOnBlockBoundaries(*lattice, param.lateral2, boundary::freeslip);
bc->setVelocityConditionOnBlockBoundaries(*lattice, param.lateral3, boundary::freeslip);
bc->setVelocityConditionOnBlockBoundaries(*lattice, param.lateral4, boundary::freeslip);
// The VirtualOutlet is a sophisticated outflow boundary condition.
Box3D globalDomain(lattice->getBoundingBox());
std::vector<MultiBlock3D*> bcargs;
bcargs.push_back(lattice);
bcargs.push_back(rhoBar);
bcargs.push_back(j);
T outsideDensity = 1.0;
int bcType = 1;
integrateProcessingFunctional(new VirtualOutlet<T,DESCRIPTOR>(outsideDensity, globalDomain, bcType),
param.outlet, bcargs, 2);
} else {
pcout << "Periodic lateral boundaries." << std::endl;
lattice->periodicity().toggleAll(true);
rhoBar->periodicity().toggleAll(true);
j->periodicity().toggleAll(true);
lattice->periodicity().toggle(0, false);
rhoBar->periodicity().toggle(0, false);
j->periodicity().toggle(0, false);
bc->addVelocityBoundary0N(param.inlet, *lattice);
setBoundaryVelocity(*lattice, param.inlet, uBoundary);
// The VirtualOutlet is a sophisticated outflow boundary condition.
// The "globalDomain" argument for the boundary condition must be
// bigger than the actual bounding box of the simulation for
// the directions which are periodic.
Box3D globalDomain(lattice->getBoundingBox());
globalDomain.y0 -= 2; // y-periodicity
globalDomain.y1 += 2;
globalDomain.z0 -= 2; // z-periodicity
globalDomain.z1 += 2;
std::vector<MultiBlock3D*> bcargs;
bcargs.push_back(lattice);
bcargs.push_back(rhoBar);
bcargs.push_back(j);
T outsideDensity = 1.0;
int bcType = 1;
integrateProcessingFunctional(new VirtualOutlet<T,DESCRIPTOR>(outsideDensity, globalDomain, bcType),
param.outlet, bcargs, 2);
}
}