OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
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, int nTime, T sigma, T intensity, Vector< T, 3 > axisDirection)
 
void setProfile (std::shared_ptr< AnalyticalF3D< T, T > > profileF)
 
void apply (std::size_t iT)
 

Detailed Description

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

Definition at line 54 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,
int nTime,
T sigma,
T intensity,
Vector< T, 3 > axisDirection )

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

References olb::SuperStructure< T, D >::getCuboidGeometry(), 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 274 of file vortexMethod.h.

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

◆ setProfile()

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

Definition at line 266 of file vortexMethod.h.

267{
268 _profileF = profileF;
269 _sLattice.template defineField<U_PROFILE>(*_inletLatticeI, *_profileF);
270 //_sLattice.template setProcessingContext<Array<U_PROFILE>>(ProcessingContext::Simulation);
271}

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