OpenLB 1.7
Loading...
Searching...
No Matches
dualFunctors3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2014 Mathias J. Krause
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef DUAL_FUNCTORS_3D_HH
25#define DUAL_FUNCTORS_3D_HH
26
27
29
30
31namespace olb {
32
33namespace opti {
34
35template <typename T, typename DESCRIPTOR>
37 BlockLattice<T,DESCRIPTOR>& blockLattice,
38 int overlap,
39 const UnitConverter<T,DESCRIPTOR>& converter)
40 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice,DESCRIPTOR::q),
41 _overlap(overlap),
42 _converter(converter)
43{
44 this->getName() = "dPhysDissipationDf";
45}
46
47template <typename T, typename DESCRIPTOR>
49{
50 T omega = _converter.getLatticeRelaxationFrequency();
51 T dt = _converter.getConversionFactorTime();
52
53 T rho;
54 T u[3];
55 T pi[6];
56
57 /*const int localLatticeR[3] = {
58 latticeR[0] + _overlap,
59 latticeR[1] + _overlap,
60 latticeR[2] + _overlap
61 };
62 this->_blockLattice.get(localLatticeR).computeAllMomenta(rho, u, pi);*/
63 this->_blockLattice.get(latticeR).computeAllMomenta(rho, u, pi);
64
65 for (int i=0; i<DESCRIPTOR::q; i++) { //output default 0
66 dDdf[i] = T();
67 }
68
69 T pi2[DESCRIPTOR::d][DESCRIPTOR::d];
70
71 pi2[0][0]=pi[0];
72 pi2[0][1]=pi[1];
74 pi2[0][2]=pi[2];
75 }
76 else {
77 pi2[1][1]=pi[2];
78 }
79 pi2[1][0]=pi[1];
81 pi2[1][1]=pi[3];
82 pi2[1][2]=pi[4];
83 pi2[2][0]=pi[2];
84 pi2[2][1]=pi[4];
85 pi2[2][2]=pi[5];
86 }
87
88 for (int jPop=0; jPop < DESCRIPTOR::q; ++jPop) {
89 for (int iDim=0; iDim < DESCRIPTOR::d; ++iDim) {
90 for (int jDim=0; jDim < DESCRIPTOR::d; ++jDim) {
91 T dPidf2ndTerm = T();
92 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
93 dPidf2ndTerm += descriptors::c<DESCRIPTOR>(iPop)[iDim] * descriptors::c<DESCRIPTOR>(iPop)[jDim]
94 * dualLbHelpers<T,DESCRIPTOR>::equilibrium(iPop, jPop, rho, u);
95 }
96 T dpidf = descriptors::c<DESCRIPTOR>(jPop,iDim)*descriptors::c<DESCRIPTOR>(jPop,jDim) - dPidf2ndTerm;
97 // rho2 instead of rho vs simon!
98 dDdf[jPop] += 2.*(pi2[iDim][jDim]*(dpidf - pi2[iDim][jDim]/2./rho*2.));
99 }
100 }
101 dDdf[jPop] *= util::pow(omega*descriptors::invCs2<T,DESCRIPTOR>()/rho,2)/2.*_converter.getPhysViscosity()/_converter.getLatticeViscosity()/dt/dt;
102 }
103 return true;
104}
105
106template <typename T, typename DESCRIPTOR>
109 : SuperLatticePhysF3D<T,DESCRIPTOR>(sLattice, converter, DESCRIPTOR::q*DESCRIPTOR::d)
110{
111 this->getName() = "dPhysDissipationDf";
112 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
113 this->_blockF.emplace_back(
115 sLattice.getBlock(iC),
116 sLattice.getOverlap(),
117 converter)
118 );
119 }
120}
121
122template <typename T, typename DESCRIPTOR>
124{
125 auto& load = this->_sLattice.getLoadBalancer();
126 if (load.isLocal(input[0])) {
127 return this->getBlockF(load.loc(input[0]))(output, &input[1]);
128 }
129 else {
130 return false;
131 }
132}
133
134
135template <typename T, typename DESCRIPTOR>
137 BlockLattice<T,DESCRIPTOR>& blockLattice,
138 int overlap,
139 const UnitConverter<T,DESCRIPTOR>& converter,
140 int nDim, int extractDim)
141 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice,DESCRIPTOR::q*DESCRIPTOR::d),
142 _overlap(overlap),
143 _converter(converter),
144 _nDim(nDim), _extractDim(extractDim)
145{
146 this->getName() = "dPhysVelocityDf";
147}
148
149template <typename T, typename DESCRIPTOR>
150bool BlockLatticeDphysVelocityDf3D<T,DESCRIPTOR>::operator()(T dVelocityDf[], const int latticeR[])
151{
152 for (int i=0; i<DESCRIPTOR::d*DESCRIPTOR::q; i++) {
153 dVelocityDf[i] = T();
154 }
155
156 T rho;
157 T u[3];
158 /*const int localLatticeR[3] = {
159 latticeR[0] + _overlap,
160 latticeR[1] + _overlap,
161 latticeR[2] + _overlap
162 };
163
164 this->_blockLattice.get(localLatticeR).computeRhoU(rho, u);*/
165 this->_blockLattice.get(latticeR).computeRhoU(rho, u);
166
167 for (int jPop=0; jPop < DESCRIPTOR::q; ++jPop) {
168 for (int iDim=0; iDim < DESCRIPTOR::d; ++iDim) {
169 if (iDim != _extractDim && _extractDim != -1) {
170 dVelocityDf[jPop*DESCRIPTOR::d + iDim] = T(0);
171 }
172 else {
173 dVelocityDf[jPop*DESCRIPTOR::d + iDim] = (descriptors::c<DESCRIPTOR>(jPop,iDim)-u[iDim])/rho;
174 }
175 }
176 }
177 return true;
178}
179
180template <typename T, typename DESCRIPTOR>
183 : SuperLatticePhysF3D<T,DESCRIPTOR>(sLattice, converter, DESCRIPTOR::q)
184{
185 this->getName() = "dPhysVelocityDf";
186 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
187 this->_blockF.emplace_back(
189 sLattice.getBlock(iC),
190 sLattice.getOverlap(),
191 converter,
192 -1, -1)
193 );
194 }
195}
196
197template <typename T, typename DESCRIPTOR>
200 const UnitConverter<T,DESCRIPTOR>& converter,
202 : SuperLatticePhysF3D<T,DESCRIPTOR>(sLattice, converter, DESCRIPTOR::q)
203{
204 this->getName() = "dPhysVelocityDf";
205 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
206 this->_blockF.emplace_back(
208 sLattice.getBlock(iC),
209 sLattice.getOverlap(),
210 converter,
211 1, sExtract.getExtractDim())
212 );
213 }
214}
215
216template <typename T, typename DESCRIPTOR>
218{
219 auto& load = this->_sLattice.getLoadBalancer();
220 if (load.isLocal(input[0])) {
221 return this->getBlockF(load.loc(input[0]))(output, &input[1]);
222 }
223 else {
224 return false;
225 }
226}
227
228
229template <typename T, typename DESCRIPTOR>
234 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
235 : SuperIdentity3D<T,T>([&]()
236{
237 using namespace functor_dsl;
238
239 auto wantedLatticeF = restrictF(wantedF.toShared(), sLattice);
240 auto differenceF = norm<2>(f.toShared() - wantedLatticeF, indicatorF.toShared());
241
242 return util::pow(differenceF, 2) / T(2.0);
243}())
244{
245 this->getName() = "differenceObjective";
246}
247
248template<typename T, typename DESCRIPTOR>
252 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
254 f->getSuperLattice(),
255 std::static_pointer_cast<SuperF3D<T,T>>(f.toShared()),
256 std::forward<decltype(wantedF)>(wantedF),
257 std::forward<decltype(indicatorF)>(indicatorF))
258{ }
259
260template<typename T, typename DESCRIPTOR>
265 SuperGeometry<T,3>& geometry,
266 int material)
268 sLattice,
269 std::forward<decltype(f)>(f),
270 std::forward<decltype(wantedF)>(wantedF),
271 geometry.getMaterialIndicator(material))
272{ }
273
274
275template <typename T, typename DESCRIPTOR>
277 BlockLattice<T,DESCRIPTOR>& blockLattice,
278 BlockF3D<T>& f,
279 BlockF3D<T>& dFdF,
280 BlockF3D<T>& wantedF,
281 BlockIndicatorF3D<T>& indicatorF,
282 T weight)
283 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, f.getTargetDim()),
284 _f(f),
285 _dFdF(dFdF),
286 _wantedF(wantedF),
287 _indicatorF(indicatorF),
288 _weight(weight)
289{
290 this->getName() = "BlockDdifferenceObjectiveDf";
291}
292
293template <typename T, typename DESCRIPTOR>
295{
296 for (int i=0; i < DESCRIPTOR::q; i++) {
297 dJdF[i] = T();
298 }
299
300 if (_indicatorF(latticeR)) {
301 const int nDim = _f.getTargetDim();
302
303 std::vector<T> dJdD(nDim,T());
304
305 T f[nDim];
306 _f(f, latticeR);
307
308 T wantedF[nDim];
309 _wantedF(wantedF, latticeR);
310
311 T dFdF[nDim*DESCRIPTOR::q];
312 _dFdF(dFdF,latticeR);
313
314 for (int iDim=0; iDim<nDim; iDim++) {
315 dJdD[iDim] = (f[iDim] - wantedF[iDim]) * _weight*_weight;
316
317 for (int jPop=0; jPop < DESCRIPTOR::q; ++jPop) {
318 dJdF[jPop] += dJdD[iDim] * dFdF[jPop*nDim + iDim];
319 }
320 }
321 }
322
323 return true;
324}
325
326template <typename T, typename DESCRIPTOR>
331 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
332 : SuperLatticeF3D<T,DESCRIPTOR>(f->getSuperLattice(), f->getTargetDim()),
333 _f(std::move(f)),
334 _dFdF(std::move(dFdF)),
335 _wantedF(std::forward<decltype(wantedF)>(wantedF), f->getSuperLattice()),
336 _indicatorF(std::move(indicatorF))
337{
338 this->getName() = "dDifferenceObjectiveDf";
339
340 const T weight = util::pow(_f->getSuperStructure().getCuboidGeometry().getMinDeltaR(), 3);
341
342 for (int iC = 0; iC < this->getSuperLattice().getLoadBalancer().size(); ++iC) {
343 this->_blockF.emplace_back(
345 this->getSuperLattice().getBlock(iC),
346 _f->getBlockF(iC),
347 _dFdF->getBlockF(iC),
348 _wantedF.getBlockF(iC),
349 _indicatorF->getBlockIndicatorF(iC),
350 weight)
351 );
352 }
353}
354
355template <typename T, typename DESCRIPTOR>
356bool DdifferenceObjectiveDf3D<T,DESCRIPTOR>::operator()(T dJdF[], const int latticeR[])
357{
358 for (int i=0; i < DESCRIPTOR::q; ++i) {
359 dJdF[i] = T();
360 }
361
362 auto& load = this->getSuperLattice().getLoadBalancer();
363
364 if (load.isLocal(latticeR[0])) {
365 return this->getBlockF(load.loc(latticeR[0]))(dJdF, &latticeR[1]);
366 }
367 else {
368 return true;
369 }
370}
371
372
373template<typename T, typename DESCRIPTOR>
378 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
379 : SuperIdentity3D<T,T>([&]()
380{
381 using namespace functor_dsl;
382
383 auto wantedLatticeF = restrictF(wantedF.toShared(), sLattice);
384 auto relativeDifferenceF = norm<2>(f.toShared() - wantedLatticeF, indicatorF.toShared()) /
385 norm<2>(wantedLatticeF, indicatorF.toShared());
386
387 return pow(relativeDifferenceF, 2) / T(2.0);
388}())
389{
390 this->getName() = "relativeDifferenceObjective";
391}
392
393template<typename T, typename DESCRIPTOR>
397 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
399 f->getSuperLattice(),
400 std::static_pointer_cast<SuperF3D<T,T>>(f.toShared()),
401 std::forward<decltype(wantedF)>(wantedF),
402 std::forward<decltype(indicatorF)>(indicatorF))
403{ }
404
405template<typename T, typename DESCRIPTOR>
410 SuperGeometry<T,3>& geometry,
411 std::vector<int> materials)
413 sLattice,
414 std::forward<decltype(f)>(f),
415 std::forward<decltype(wantedF)>(wantedF),
416 geometry.getMaterialIndicator(materials))
417{ }
418
419template<typename T, typename DESCRIPTOR>
424 SuperGeometry<T,3>& geometry,
425 int material)
427 sLattice,
428 std::forward<decltype(f)>(f),
429 std::forward<decltype(wantedF)>(wantedF),
430 geometry.getMaterialIndicator(material))
431{ }
432
433template<typename T, typename DESCRIPTOR>
437 FunctorPtr<SuperF3D<T,T>>&& wantedF,
438 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
439 : SuperIdentity3D<T,T>([&]()
440{
441 using namespace functor_dsl;
442
443 // auto wantedLatticeF = restrictF(wantedF.toShared(), sLattice);
444 auto relativeDifferenceF = norm<2>(f.toShared() - wantedF.toShared(), indicatorF.toShared()) /
445 norm<2>(wantedF.toShared(), indicatorF.toShared());
446
447 return pow(relativeDifferenceF, 2) / T(2.0);
448}())
449{
450 this->getName() = "relativeDifferenceObjective";
451}
452
453
454template <typename T, typename DESCRIPTOR>
456 BlockStructureD<3>& blockStructure,
457 BlockF3D<T>& f,
458 BlockF3D<T>& dFdF,
459 BlockF3D<T>& wantedF,
460 BlockIndicatorF3D<T>& indicatorF,
461 T globalValue,
462 T weight):
463 BlockF3D<T>(blockStructure, DESCRIPTOR::q),
464 _f(f), _dFdF(dFdF), _wantedF(wantedF), _indicatorF(indicatorF),
465 _globalValue(globalValue), _weight(weight)
466{
467 this->getName() = "BlockDrelativeDifferenceObjectiveDf";
468}
469
470template <typename T, typename DESCRIPTOR>
472{
473 for (int jPop=0; jPop < DESCRIPTOR::q; ++jPop) {
474 dJdF[jPop] = T{};
475 }
476
477 if (_indicatorF(latticeR)) {
478 const int nDim = DESCRIPTOR::d;
479
480 T dJdD[nDim] {};
481
482 T f[nDim] {};
483 _f(f, latticeR);
484
485 T wantedF[nDim] {};
486 _wantedF(wantedF, latticeR);
487
488 T dFdF[nDim*DESCRIPTOR::q] {};
489 _dFdF(dFdF, latticeR);
490
491 for (int iDim=0; iDim < nDim; ++iDim) {
492 dJdD[iDim] = (f[iDim] - wantedF[iDim]) / _globalValue * _weight*_weight;
493
494 for (int jPop=0; jPop < DESCRIPTOR::q; ++jPop) {
495 dJdF[jPop] += dJdD[iDim] * dFdF[jPop*nDim + iDim];
496 }
497 }
498 }
499
500 return true;
501}
502
503template <typename T, typename DESCRIPTOR>
509 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
510 : SuperF3D<T,T>(sLattice, DESCRIPTOR::q),
511 _f(std::move(f)),
512 _dFdF(std::move(dFdF)),
513 _wantedF(std::forward<decltype(wantedF)>(wantedF), sLattice),
514 _indicatorF(std::move(indicatorF))
515{
516 this->getName() = "dRelativeDifferenceObjectiveDf";
517
518 SuperL2Norm3D<T> wantedFlp(_wantedF, *_indicatorF);
519 T output[1] {};
520 wantedFlp(output, nullptr);
521
522 const T globalValue = util::pow(output[0], 2);
523 const T weight = util::pow(_f->getSuperStructure().getCuboidGeometry().getMinDeltaR(), 3);
524
525 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
526 this->_blockF.emplace_back(
528 sLattice.getBlock(iC),
529 _f->getBlockF(iC),
530 _dFdF->getBlockF(iC),
531 _wantedF.getBlockF(iC),
532 _indicatorF->getBlockIndicatorF(iC),
533 globalValue,
534 weight)
535 );
536 }
537}
538
539template <typename T, typename DESCRIPTOR>
545 SuperGeometry<T,3>& geometry,
546 std::vector<int> materials)
548 std::forward<decltype(f)>(f),
549 std::forward<decltype(dFdF)>(dFdF),
550 std::forward<decltype(wantedF)>(wantedF),
551 geometry.getMaterialIndicator(materials))
552{ }
553
554template <typename T, typename DESCRIPTOR>
560 SuperGeometry<T,3>& geometry,
561 int material)
563 std::forward<decltype(f)>(f),
564 std::forward<decltype(dFdF)>(dFdF),
565 std::forward<decltype(wantedF)>(wantedF),
566 geometry.getMaterialIndicator(material))
567{ }
568
569template <typename T, typename DESCRIPTOR>
571{
572 for (int i=0; i < DESCRIPTOR::q; ++i) {
573 dJdF[i] = T{};
574 }
575
576 auto& load = _f->getSuperStructure().getLoadBalancer();
577
578 if (load.isLocal(latticeR[0])) {
579 return this->getBlockF(load.loc(latticeR[0]))(dJdF, &latticeR[1]);
580 }
581 else {
582 return true;
583 }
584}
585
586template <typename T, typename DESCRIPTOR>
591 FunctorPtr<SuperF3D<T,T>>&& wantedF,
592 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
593 : SuperF3D<T,T>(sLattice, DESCRIPTOR::q),
594 _f(std::move(f)),
595 _dFdF(std::move(dFdF)),
596 _wantedF(std::move(wantedF)),
597 _indicatorF(std::move(indicatorF))
598{
599 this->getName() = "dRelativeDifferenceObjectiveDf_Lattice";
600
601 SuperL2Norm3D<T> wantedFlp(*_wantedF, *_indicatorF);
602 T output[1] {};
603 wantedFlp(output, nullptr);
604
605 const T globalValue = util::pow(output[0], 2);
606 const T weight = util::pow(sLattice.getCuboidGeometry().getMinDeltaR(), 3);
607 // util::pow(_f->getSuperStructure().getCuboidGeometry().getMinDeltaR(), 3);
608
609 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
610 this->_blockF.emplace_back(
612 sLattice.getBlock(iC),
613 _f->getBlockF(iC),
614 _dFdF->getBlockF(iC),
615 _wantedF->getBlockF(iC),
616 _indicatorF->getBlockIndicatorF(iC),
617 globalValue,
618 weight)
619 );
620 }
621}
622
623template <typename T, typename DESCRIPTOR>
625{
626 for (int i=0; i < DESCRIPTOR::q; ++i) {
627 dJdF[i] = T{};
628 }
629
630 auto& load = _f->getSuperStructure().getLoadBalancer();
631
632 if (load.isLocal(latticeR[0])) {
633 return this->getBlockF(load.loc(latticeR[0]))(dJdF, &latticeR[1]);
634 }
635 else {
636 return true;
637 }
638}
639
640
641template <typename T, typename DESCRIPTOR>
643 BlockStructureD<3>& blockStructure,
645 BlockF3D<T>& dFdF,
646 BlockF3D<T>& wantedF,
647 BlockIndicatorF3D<T>& indicatorF,
648 T globalValue,
649 T weight):
650 BlockF3D<T>(blockStructure, DESCRIPTOR::q),
651 _f(f), _dFdF(dFdF), _wantedF(wantedF), _indicatorF(indicatorF),
652 _extractDim(f.getExtractDim()), _globalValue(globalValue), _weight(weight)
653{
654 this->getName() = "BlockDrelativeDifferenceObjectiveComponentDf";
655}
656
657template <typename T, typename DESCRIPTOR>
659{
660 for (int jPop=0; jPop < DESCRIPTOR::q; ++jPop) {
661 dJdF[jPop] = T{};
662 }
663
664 if (_indicatorF(latticeR)) {
665 const int nDim = DESCRIPTOR::d;
666
667 T dJdD[nDim] {};
668
669 T f[1] {};
670 _f(f, latticeR);
671
672 T wantedF[nDim] {};
673 _wantedF(wantedF, latticeR);
674
675 T dFdF[nDim*DESCRIPTOR::q] {};
676 _dFdF(dFdF, latticeR);
677
678 for (int iDim=0; iDim < nDim; ++iDim) {
679 if (iDim == _extractDim) {
680 // Note that by convention wantedF is always one-dimensional.
681 // This is why f[0] - wantedF[0] is correct (as compared to f[0] - wantedF[iDim])
682 dJdD[iDim] = (f[0] - wantedF[0]) / _globalValue * _weight*_weight;
683 }
684
685 for (int jPop=0; jPop < DESCRIPTOR::q; ++jPop) {
686 dJdF[jPop] += dJdD[iDim] * dFdF[jPop*nDim + iDim];
687 }
688 }
689 }
690
691 return true;
692}
693
694template <typename T, typename DESCRIPTOR>
697 FunctorPtr<SuperF3D<T,T>>&& f, int extractDim,
700 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
701 : SuperF3D<T,T>(sLattice, DESCRIPTOR::q),
702 _f(std::forward<decltype(f)>(f), extractDim),
703 _dFdF(std::move(dFdF)),
704 _wantedF(std::forward<decltype(wantedF)>(wantedF), sLattice),
705 _indicatorF(std::move(indicatorF))
706{
707 this->getName() = "dRelativeDifferenceObjectiveDf";
708
709 SuperL2Norm3D<T> wantedFlp(_wantedF, *_indicatorF);
710 T output[1] {};
711 wantedFlp(output, nullptr);
712
713 const T globalValue = util::pow(output[0], 2);
714 const T weight = util::pow(_f.getSuperStructure().getCuboidGeometry().getMinDeltaR(), 3);
715
716 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
717 this->_blockF.emplace_back(
719 sLattice.getBlock(iC),
720 static_cast<BlockExtractComponentF3D<T>&>(_f.getBlockF(iC)),
721 _dFdF->getBlockF(iC),
722 _wantedF.getBlockF(iC),
723 _indicatorF->getBlockIndicatorF(iC),
724 globalValue,
725 weight)
726 );
727 }
728}
729
730template <typename T, typename DESCRIPTOR>
732{
733 for (int i=0; i < DESCRIPTOR::q; ++i) {
734 dJdF[i] = T{};
735 }
736
737 auto& load = _f.getSuperStructure().getLoadBalancer();
738
739 if (load.isLocal(latticeR[0])) {
740 return this->getBlockF(load.loc(latticeR[0]))(dJdF, &latticeR[1]);
741 }
742 else {
743 return true;
744 }
745}
746
747} // namespace opti
748
749} // namespace olb
750
751#endif
AnalyticalF are applications from DD to XD, where X is set by the constructor.
functor to extract one component
represents all functors that operate on a cuboid in general, mother class of BlockLatticeF,...
Base block indicator functor.
represents all functors that operate on a DESCRIPTOR in general, e.g. getVelocity(),...
Platform-abstracted block lattice for external access and inter-block interaction.
Base of a regular block.
Smart pointer for managing the various ways of passing functors around.
Definition functorPtr.h:60
std::string & getName()
read and write access to name
Definition genericF.hh:51
functor to extract one component
represents all functors that operate on a SuperStructure<T,3> in general
SuperStructure< T, 3 > & getSuperStructure()
BlockF3D< W > & getBlockF(int iCloc)
std::vector< std::unique_ptr< BlockF3D< T > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
Representation of a statistic for a parallel 2D geometry.
identity functor for memory management
Base indicator functor (discrete)
represents all functors that operate on a SuperLattice in general, e.g. getVelocity(),...
SuperLattice< T, DESCRIPTOR > & getSuperLattice()
represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(),...
Super class maintaining block lattices for a cuboid decomposition.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
Functor that returns the Lp norm over omega of the the euklid norm of the input functor.
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.
int getOverlap()
Read and write access to the overlap.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Conversion between physical and lattice units, as well as discretization.
functor to compute 0.5*(f-f_wanted)^2 on a lattice
BlockDdifferenceObjectiveDf3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &f, BlockF3D< T > &dFdF, BlockF3D< T > &wantedF, BlockIndicatorF3D< T > &indicatorF, T weight)
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
functor to compute 0.5*(f[extractDim]-f_wanted[0])^2/f_wanted^2 on a lattice
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
BlockDrelativeDifferenceObjectiveComponentDf3D(BlockStructureD< 3 > &blockStructure, BlockExtractComponentF3D< T > &f, BlockF3D< T > &dFdF, BlockF3D< T > &wantedF, BlockIndicatorF3D< T > &indicatorF, T globalValue, T weight)
functor to compute 0.5(f-f_wanted)^2/f_wanted^2 on a lattice
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
BlockDrelativeDifferenceObjectiveDf3D(BlockStructureD< 3 > &blockStructure, BlockF3D< T > &f, BlockF3D< T > &dFdF, BlockF3D< T > &wantedF, BlockIndicatorF3D< T > &indicatorF, T globalValue, T weight)
functor to get the pointwise dual dissipation density on local lattices, if globIC is not on the loca...
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
BlockLatticeDphysDissipationDf3D(BlockLattice< T, DESCRIPTOR > &blockLattice, int overlap, const UnitConverter< T, DESCRIPTOR > &converter)
functor to get pointwise dual velocity density on local lattices, if globIC is not on the local proce...
BlockLatticeDphysVelocityDf3D(BlockLattice< T, DESCRIPTOR > &blockLattice, int overlap, const UnitConverter< T, DESCRIPTOR > &converter, int nDim, int extractDim)
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
bool operator()(T output[], const int input[])
DdifferenceObjectiveDf3D(FunctorPtr< SuperLatticePhysF3D< T, DESCRIPTOR > > &&f, FunctorPtr< SuperLatticePhysF3D< T, DESCRIPTOR > > &&dFdF, FunctorPtr< AnalyticalF3D< T, T > > &&wantedF, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
functor to compute 0.5*L2Norm(f-f_wanted)^2 on a lattice
DifferenceObjective3D(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, T > > &&f, FunctorPtr< AnalyticalF3D< T, T > > &&wantedF, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
DrelativeDifferenceObjectiveComponentDf3D(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, T > > &&f, int extractDim, FunctorPtr< SuperF3D< T, T > > &&dFdF, FunctorPtr< AnalyticalF3D< T, T > > &&wantedF, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
bool operator()(T output[], const int input[])
DrelativeDifferenceObjectiveDf3D_Lattice(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, T > > &&f, FunctorPtr< SuperF3D< T, T > > &&dFdF, FunctorPtr< SuperF3D< T, T > > &&wantedF, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
bool operator()(T output[], const int input[])
functor to compute 0.5(f-f_wanted)^2/f_wanted^2 on a lattice
bool operator()(T output[], const int input[])
DrelativeDifferenceObjectiveDf3D(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, T > > &&f, FunctorPtr< SuperF3D< T, T > > &&dFdF, FunctorPtr< AnalyticalF3D< T, T > > &&wantedF, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
functor to compute 0.5*L2Norm(f-f_wanted)^2/L2Norm(f_wanted)^2 on a lattice
RelativeDifferenceObjective3D(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, T > > &&f, FunctorPtr< AnalyticalF3D< T, T > > &&wantedF, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
SuperLatticeDphysDissipationDf3D(SuperLattice< T, DESCRIPTOR > &sLattice, const UnitConverter< T, DESCRIPTOR > &converter)
bool operator()(T output[], const int input[])
bool operator()(T output[], const int input[])
SuperLatticeDphysVelocityDf3D(SuperLattice< T, DESCRIPTOR > &sLattice, const UnitConverter< T, DESCRIPTOR > &converter)
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112
Top level namespace for all of OpenLB.
Optimization Code.
static T equilibrium(int iPop, int jPop, T rho, const T u[DESCRIPTOR::d])
Compute number of elements of a symmetric d-dimensional tensor.
Definition util.h:210