OpenLB 1.7
Loading...
Searching...
No Matches
Functions
olb::particles::subgrid Namespace Reference

Functions

template<typename T , typename PARTICLETYPE , typename DESCRIPTOR >
void initializeParticleVelocity (SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, DESCRIPTOR::d > &superGeometry, UnitConverter< T, DESCRIPTOR > const &converter, SuperParticleSystem< T, PARTICLETYPE > &supParticleSystem)
 
template<typename T , typename PARTICLETYPE >
void addParticles (SuperParticleSystem< T, PARTICLETYPE > &supParticleSystem, IndicatorF3D< T > &ind, T partRho, T radius, const std::size_t noOfParticles, util::Randomizer< T > &randomizer)
 
template<typename T , typename PARTICLETYPE , bool verbose = true>
void captureStatistics (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, SuperIndicatorMaterial< T, PARTICLETYPE::d > &materialIndicatorOutput, std::size_t &noActive, std::size_t reprParticleID=0)
 

Function Documentation

◆ addParticles()

template<typename T , typename PARTICLETYPE >
void olb::particles::subgrid::addParticles ( SuperParticleSystem< T, PARTICLETYPE > & supParticleSystem,
IndicatorF3D< T > & ind,
T partRho,
T radius,
const std::size_t noOfParticles,
util::Randomizer< T > & randomizer )

Definition at line 75 of file subgridUtilities.h.

78{
79 Vector<T,3> pos(0.);
80 std::size_t noP = 0;
81 while (noP<noOfParticles){
82 //Generate randomized position
83 pos[0] = ind.getMin()[0]
84 + randomizer.generate() * (ind.getMax()[0] - ind.getMin()[0]);
85 pos[1] = ind.getMin()[1]
86 + randomizer.generate() * (ind.getMax()[1] - ind.getMin()[1]);
87 pos[2] = ind.getMin()[2]
88 + randomizer.generate() * (ind.getMax()[2] - ind.getMin()[2]);
89 //Call sub-grid creator if in indicator domain
90 bool inside[1] = { false };
91 ind(inside, pos.data());
92 if (inside[0]){
93 creators::addSubgridSphere3D( supParticleSystem, pos, radius, partRho );
94 noP++;
95 }
96 }
97}
virtual Vector< S, 3 > & getMax()
virtual Vector< S, 3 > & getMin()
Plain old scalar vector.
Definition vector.h:47
O generate()
Generate scalar or vector filled with scalars.
Definition random.hh:90

References olb::particles::creators::addSubgridSphere3D(), olb::Vector< T, D >::data(), olb::util::Randomizer< T, useStored >::generate(), olb::IndicatorF3D< S >::getMax(), and olb::IndicatorF3D< S >::getMin().

+ Here is the call graph for this function:

◆ captureStatistics()

template<typename T , typename PARTICLETYPE , bool verbose = true>
void olb::particles::subgrid::captureStatistics ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
SuperIndicatorMaterial< T, PARTICLETYPE::d > & materialIndicatorOutput,
std::size_t & noActive,
std::size_t reprParticleID = 0 )

Definition at line 104 of file subgridUtilities.h.

107{
108 noActive = 0;
109 std::size_t noFound = 0;
110 std::size_t noExcaped = 0;
111 communication::forParticlesInSuperParticleSystem(sParticleSystem,
112 [&](Particle<T,PARTICLETYPE>& particle,
113 ParticleSystem<T,PARTICLETYPE>& particleSystem, int globiC){
114 //Check activity
115 bool active = access::isActive(particle);
116 if (active){
117 noActive++;
118 //Check whether representative particle and potentially print
119 std::size_t globalId = access::getGlobalID(particle);
120 if constexpr (verbose){
121 if (globalId==reprParticleID){
122 particles::io::printSubgridParticleInfo( particle );
123 }
124 }
125 }
126 //Check individual material vicinities
127 bool outputVicinity = boundaries::checkMaterialVicinity(
128 materialIndicatorOutput, particle );
129 if (outputVicinity){ noExcaped++; }
130 //Increase particle counter
131 noFound++;
132 });
133 singleton::mpi().reduceAndBcast(noActive, MPI_SUM);
134 singleton::mpi().reduceAndBcast(noFound, MPI_SUM);
135 singleton::mpi().reduceAndBcast(noExcaped, MPI_SUM);
136
137 //Calculate escape and capture rate
138 T escapeRate = T(noExcaped)/T(noFound);
139 T captureRate = 1.-escapeRate;
140
141 //Output
142 if constexpr (verbose){
143 OstreamManager clout( std::cout, "captureStatistics" );
144 clout << "globalNumOfParticles=" << noFound;
145 clout << "; activeParticles=" << noActive;
146 clout << "; escapedParticles=" << noExcaped << std::endl;
147 clout << "captureRate=" << captureRate << "; escapeRate=" << escapeRate;
148 clout << std::endl;
149 }
150}

References olb::particles::boundaries::checkMaterialVicinity(), olb::particles::communication::forParticlesInSuperParticleSystem(), olb::particles::access::getGlobalID(), olb::particles::access::isActive(), olb::singleton::mpi(), olb::particles::io::printSubgridParticleInfo(), and olb::singleton::MpiManager::reduceAndBcast().

+ Here is the call graph for this function:

◆ initializeParticleVelocity()

template<typename T , typename PARTICLETYPE , typename DESCRIPTOR >
void olb::particles::subgrid::initializeParticleVelocity ( SuperLattice< T, DESCRIPTOR > & sLattice,
SuperGeometry< T, DESCRIPTOR::d > & superGeometry,
UnitConverter< T, DESCRIPTOR > const & converter,
SuperParticleSystem< T, PARTICLETYPE > & supParticleSystem )

Definition at line 40 of file subgridUtilities.h.

45{
46 using namespace descriptors;
47 constexpr unsigned D = DESCRIPTOR::d;
48 // Iterate over individual particle systems
49 communication::forSystemsInSuperParticleSystem( supParticleSystem,
50 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
51 // Retrieve block quantities
52 auto& blockLattice = sLattice.getBlock(iC);
53 auto& blockGeometry = superGeometry.getBlockGeometry(iC);
54 const auto& cuboid = blockGeometry.getCuboid();
55 // Create block velocity interpolation functor
57 blockLattice, converter, cuboid);
58 // Loop over all particles in particle system
59 forParticlesInParticleSystem<T,PARTICLETYPE>( particleSystem,
60 [&](Particle<T,PARTICLETYPE>& particle){
61 // Retrieve particle position
62 Vector<T,D> position = particle.template getField<GENERAL,POSITION>();
63 // Calculate interpolated velocity
64 Vector<T,D> fluidVel(0.);
65 blockInterpPhysVelF(fluidVel.data(), position.data());
66 //Apply velocity to particle
67 particle.template setField<MOBILITY,VELOCITY>( fluidVel );
68 });
69 });
70}
BlockGeometry< T, D > & getBlockGeometry(int locIC)
Read and write access to a single block geometry.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
constexpr const T * data() const any_platform
Definition vector.h:161
std::conditional_t< DESCRIPTOR::d==2, BlockLatticeInterpPhysVelocity2D< T, DESCRIPTOR >, BlockLatticeInterpPhysVelocity3D< T, DESCRIPTOR > > BlockLatticeInterpPhysVelocity
Definition aliases.h:360

References olb::Vector< T, D >::data(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::SuperLattice< T, DESCRIPTOR >::getBlock(), and olb::SuperGeometry< T, D >::getBlockGeometry().

+ Here is the call graph for this function: