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
169 #endif
170
171 clout << "inletArea=" << _inletArea << std::endl;
172
173
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
197}
void reduceAndBcast(T &reductVal, MPI_Op op, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Reduction operation, followed by a broadcast.
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
@ Simulation
Data available on host for e.g. functor evaluation.