OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::VortexMethodTurbulentVelocityBoundary< T, DESCRIPTOR > Class Template Referencefinal

#include <vortexMethod.h>

+ Collaboration diagram for olb::VortexMethodTurbulentVelocityBoundary< T, DESCRIPTOR >:

Public Member Functions

 VortexMethodTurbulentVelocityBoundary (FunctorPtr< SuperIndicatorF3D< T > > &&inletLatticeI, FunctorPtr< IndicatorF3D< T > > &&inletPhysI, UnitConverter< T, DESCRIPTOR > &converter, SuperLattice< T, DESCRIPTOR > &sLattice, int nSeeds, T nTime, T sigma, Vector< T, 3 > axisDirection)
 
void setVelocityProfile (std::shared_ptr< AnalyticalF3D< T, T > > velocityProfileF)
 
void setIntensityProfile (std::shared_ptr< AnalyticalF3D< T, T > > intensityProfileF)
 
void apply (std::size_t iT)
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::VortexMethodTurbulentVelocityBoundary< T, DESCRIPTOR >

Definition at line 55 of file vortexMethod.h.

Constructor & Destructor Documentation

◆ VortexMethodTurbulentVelocityBoundary()

template<typename T , typename DESCRIPTOR >
olb::VortexMethodTurbulentVelocityBoundary< T, DESCRIPTOR >::VortexMethodTurbulentVelocityBoundary ( FunctorPtr< SuperIndicatorF3D< T > > && inletLatticeI,
FunctorPtr< IndicatorF3D< T > > && inletPhysI,
UnitConverter< T, DESCRIPTOR > & converter,
SuperLattice< T, DESCRIPTOR > & sLattice,
int nSeeds,
T nTime,
T sigma,
Vector< T, 3 > axisDirection )

Definition at line 100 of file vortexMethod.h.

109 : _inletLatticeI(std::move(inletLatticeI)),
110 _inletPhysI(std::move(inletPhysI)),
111 _converter(converter),
112 _sLattice(sLattice),
113 _nSeeds(nSeeds),
114 _nTime(nTime),
115 _sigma(sigma),
116 _axisDirection(axisDirection),
117 _AiC(_sLattice.getLoadBalancer().size()),
118 _NiC(_sLattice.getLoadBalancer().size()),
119 _seeds(sLattice.getCuboidDecomposition(),
120 sLattice.getLoadBalancer()),
121 _seedsVorticity(sLattice.getCuboidDecomposition(),
122 sLattice.getLoadBalancer())
123{
124 OstreamManager clout(std::cout, "VortexMethod");
125
126 sLattice.template addPostProcessor<stage::VortexMethod>(*_inletLatticeI,
127 meta::id<VortexMethodPreProcessor>{});
128 SuperIndicatorLayer3D<T> extendedLatticeInletI(*_inletLatticeI);
129 sLattice.template addPostProcessor<stage::VortexMethod>(extendedLatticeInletI,
130 meta::id<VortexMethodPostProcessor>{});
131
132 if (_sigma < _converter.getPhysDeltaX()) {
133 _sigma = _converter.getPhysDeltaX();
134 }
135
136 _inletArea = 0.;
137
138 auto& cGeometry = sLattice.getCuboidDecomposition();
139 Cuboid3D<T> indicatorCuboid(*inletPhysI, _converter.getPhysDeltaX());
140
141 auto& load = _sLattice.getLoadBalancer();
142 for (int iC=0; iC < load.size(); ++iC) {
143 _AiC[iC] = 0.;
144 auto& cuboid = cGeometry.get(load.glob(iC));
145 if (cuboid.intersects(indicatorCuboid)) {
146 auto& block = _sLattice.getBlock(iC);
147 for (int iX=0; iX < block.getNx(); ++iX) {
148 for (int iY=0; iY < block.getNy(); ++iY) {
149 for (int iZ=0; iZ < block.getNz(); ++iZ) {
150 int latticeR[3] {iX, iY, iZ};
151 auto physR = cuboid.getPhysR(latticeR);
152 block.get(iX,iY,iZ).template setField<descriptors::LOCATION>(physR);
153 bool inInlet{};
154 _inletPhysI(&inInlet, physR.data());
155 if (inInlet) {
156 _AiC[iC] += util::pow(_converter.getPhysDeltaX(), 2.);
157 }
158 }
159 }
160 }
161 }
162 _inletArea += _AiC[iC];
163 }
164
165 #ifdef PARALLEL_MODE_MPI
166 singleton::mpi().reduceAndBcast(_inletArea, MPI_SUM);
167 #endif
168
169 clout << "inletArea=" << _inletArea << std::endl;
170
171 // initial seeding of random vortex points of number N
172 for (int iC=0; iC < load.size(); ++iC) {
173 _NiC[iC] = int(_nSeeds*_AiC[iC] / _inletArea);
174 _seeds.getBlock(iC).resize(_NiC[iC]);
175 _seedsVorticity.getBlock(iC).resize(_NiC[iC]);
176 }
177
178 for (int iC=0; iC < load.size(); ++iC) {
179 if (_NiC[iC] > 0) {
180 auto& block = _sLattice.getBlock(iC);
181 block.template setParameter<SEEDS_COUNT>(_NiC[iC]);
182 block.template setParameter<SEEDS>(_seeds.getBlock(iC));
183 block.template setParameter<SEEDS_VORTICITY>(_seedsVorticity.getBlock(iC));
184 block.template getField<VELOCITY_OLD>();
185 block.template getField<U_PROFILE>();
186 }
187 }
188
189 _sLattice.template setParameter<CONVERSION_FACTOR_LENGTH>(_converter.getConversionFactorLength());
190 _sLattice.template setParameter<CONVERSION_FACTOR_VELOCITY>(_converter.getConversionFactorVelocity());
191 _sLattice.template setParameter<SIGMA>(_sigma);
192 _sLattice.template setParameter<AXIS_DIRECTION>(axisDirection);
193
194 _sLattice.setProcessingContext(ProcessingContext::Simulation);
195}
void reduceAndBcast(T &reductVal, MPI_Op op, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Reduction operation, followed by a broadcast.
MpiManager & mpi()
Expr pow(Expr base, Expr exp)
Definition expr.cpp:235
@ Simulation
Data available on host for e.g. functor evaluation.
Cuboid< T, 3 > Cuboid3D
Definition cuboid.h:151

References olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::singleton::mpi(), olb::util::pow(), olb::singleton::MpiManager::reduceAndBcast(), and olb::Simulation.

+ Here is the call graph for this function:

Member Function Documentation

◆ apply()

template<typename T , typename DESCRIPTOR >
void olb::VortexMethodTurbulentVelocityBoundary< T, DESCRIPTOR >::apply ( std::size_t iT)

Definition at line 280 of file vortexMethod.h.

281{
282 generateSeeds();
283 updateSeedsVorticity(iT);
284
285 {
286 auto& load = _sLattice.getLoadBalancer();
287 for (int iC=0; iC < load.size(); ++iC) {
288 if (_NiC[iC] > 0) {
289 auto& block = _sLattice.getBlock(iC);
290 block.template setParameter<SEEDS_COUNT>(_NiC[iC]);
291 block.template setParameter<SEEDS>(_seeds.getBlock(iC));
292 block.template setParameter<SEEDS_VORTICITY>(_seedsVorticity.getBlock(iC));
293 }
294 }
295 _sLattice.template setParameter<SIGMA>(_sigma);
296 _sLattice.template setParameter<AXIS_DIRECTION>(_axisDirection);
297 }
298 _sLattice.executePostProcessors(stage::VortexMethod{});
299}

◆ setIntensityProfile()

template<typename T , typename DESCRIPTOR >
void olb::VortexMethodTurbulentVelocityBoundary< T, DESCRIPTOR >::setIntensityProfile ( std::shared_ptr< AnalyticalF3D< T, T > > intensityProfileF)

Definition at line 274 of file vortexMethod.h.

275{
276 _intensityProfileF = intensityProfileF;
277}

◆ setVelocityProfile()

template<typename T , typename DESCRIPTOR >
void olb::VortexMethodTurbulentVelocityBoundary< T, DESCRIPTOR >::setVelocityProfile ( std::shared_ptr< AnalyticalF3D< T, T > > velocityProfileF)

Definition at line 267 of file vortexMethod.h.

268{
269 _velocityProfileF = velocityProfileF;
270 _sLattice.template defineField<U_PROFILE>(*_inletLatticeI, *_velocityProfileF);
271}

The documentation for this class was generated from the following file: