OpenLB 1.7
Loading...
Searching...
No Matches
analyticalF.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2012 Lukas Baron, Tim Dornieden, Mathias J. Krause, Albert Mink
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 ANALYTICAL_F_HH
25#define ANALYTICAL_F_HH
26
27#include<vector>
28#include<cmath> // for lpnorm
29#include<stdlib.h> // for random
30#include <iostream>
31#include<time.h>
32
33#include "analyticalF.h"
34#include "core/singleton.h"
36#include "utilities/calc.h"
39
40
41
42#ifndef M_PI
43#define M_PI 3.14159265358979323846
44#endif
45
46namespace olb {
47
48
49template <unsigned D, typename T, typename S>
51 : AnalyticalF<D,T,S>(f.size())
52{
53 if (D != f.size()) {
54 throw std::length_error("D does not match with f.size().");
55 }
56 this->getName() = "composed";
57 for (auto&& i : f) {
58 _f.push_back(i);
59 }
60}
61
62template <unsigned D, typename T, typename S>
63bool AnalyticalComposed<D,T,S>::operator()(T output[], const S x[])
64{
65 for (unsigned int i=0; i<D; ++i) {
66 T outputTmp[_f[i].get().getTargetDim()];
67 _f[i].get()(outputTmp,x);
68 output[i]=outputTmp[0];
69 }
70 return true;
71}
72
73
74template <unsigned D, typename T, typename S>
75AnalyticalConst<D,T,S>::AnalyticalConst(const std::vector<T>& value)
76 : AnalyticalF<D,T,S>(value.size()), _c(value)
77{
78 this->getName() = "const";
79}
80
81template <unsigned D, typename T, typename S>
83 : AnalyticalF<D,T,S>(1)
84{
85 _c.push_back(value);
86 this->getName() = "const";
87}
88
89template <unsigned D, typename T, typename S>
91 : AnalyticalF<D,T,S>(2)
92{
93 _c.push_back(value0);
94 _c.push_back(value1);
95 this->getName() = "const";
96}
97
98template <unsigned D, typename T, typename S>
99AnalyticalConst<D,T,S>::AnalyticalConst(T value0, T value1, T value2)
100 : AnalyticalF<D,T,S>(3)
101{
102 _c.push_back(value0);
103 _c.push_back(value1);
104 _c.push_back(value2);
105 this->getName() = "const";
106}
107
108template <unsigned D, typename T, typename S>
110 : AnalyticalF<D,T,S>(2)
111{
112 _c.reserve(2);
113 _c.push_back(value[0]);
114 _c.push_back(value[1]);
115 this->getName() = "const";
117
118template <unsigned D, typename T, typename S>
120 : AnalyticalF<D,T,S>(3)
121{
122 _c.reserve(3);
123 _c.push_back(value[0]);
124 _c.push_back(value[1]);
125 _c.push_back(value[2]);
126 this->getName() = "const";
127}
128
129template <unsigned D, typename T, typename S>
130bool AnalyticalConst<D,T,S>::operator()(T output[], const S x[])
131{
132 for ( unsigned i = 0; i < _c.size(); ++i) {
133 output[i] = _c[i];
134 }
135 return true;
136}
137
138
139template <unsigned D, typename T, typename S>
140AnalyticalNormal<D,T,S>::AnalyticalNormal(std::vector<T> mean, T stdDev)
141 : AnalyticalF<D,T,S>(1), _mean(mean), _stdDev(stdDev)
142{
143 this->getName() = "normal";
146template <unsigned D, typename T, typename S>
147bool AnalyticalNormal<D,T,S>::operator()(T output[], const S x[])
148{
149 T r2 = T();
150 for ( unsigned i = 0; i < D; ++i) {
151 r2 += (x[i] - _mean[i]) * (x[i] - _mean[i]);
152 }
153 output[0] = util::exp(-r2/(2*_stdDev*_stdDev)) / (_stdDev*util::sqrt(2.*M_PI));
154 return true;
155}
156
157
158template <unsigned D, typename T, typename S>
160 : AnalyticalF<D,T,S>(1),
161 gen{rd()}
162{
163 this->getName() = "random";
164}
166template <unsigned D, typename T, typename S, unsigned seed>
168 : AnalyticalF<D,T,S>(1),
169 gen(seed)
170{
171 this->getName() = "randomSeeded";
172}
173
174template <unsigned D, typename T, typename S>
176 : AnalyticalRandomBase<D,T,S>(),
177 distro{minVal, maxVal}
178{ }
179
180template <unsigned D, typename T, typename S>
182{
183 output[0] = distro(this->gen);
184 return true;
185}
186
187
188template <unsigned D, typename T, typename S>
190 : AnalyticalRandomBase<D,T,S>(),
191 distro{mean, stdDev}
192{ }
193
194template <unsigned D, typename T, typename S>
195bool AnalyticalRandomNormal<D,T,S>::operator()(T output[], const S x[])
196{
197 output[0] = distro(this->gen);
198 return true;
199}
200
201template <unsigned D, typename T, typename S, unsigned seed>
203 : AnalyticalRandomSeededBase<D,T,S,seed>(),
204 distro{mean, stdDev}
205{ }
206
207template <unsigned D, typename T, typename S, unsigned seed>
209{
210 output[0] = distro(this->gen);
211 return true;
212}
213
214
215template <unsigned D, typename T, typename S>
217 : AnalyticalRandomNormal<D,T,S>(mean, stdDev),
218 _min(mean - n*stdDev),
219 _max(mean + n*stdDev)
220{ }
221
222template <unsigned D, typename T, typename S>
224{
225 do {
226 output[0] = this->distro(this->gen);
227 }
228 while (output[0] < _min || output[0] > _max);
229 return true;
230}
231
232
233template <unsigned D, typename T, typename S>
235 : AnalyticalF<D,T,S>(1)
236{
237#ifdef PARALLEL_MODE_MPI
238 int nameLen, numProcs, myID;
239 char processorName[MPI_MAX_PROCESSOR_NAME];
240 MPI_Comm_rank(MPI_COMM_WORLD,&myID);
241 MPI_Comm_size(MPI_COMM_WORLD,&numProcs);
242 MPI_Get_processor_name(processorName,&nameLen);
243 srand(time(0)+myID*numProcs + nameLen);
244#else
245 srand(time(nullptr));
246#endif
247 this->getName() = "random";
248}
249
250template <unsigned D, typename T, typename S>
251bool AnalyticalRandomOld<D,T,S>::operator()(T output[], const S x[])
252{
253 output[0]=(rand()%RAND_MAX)/(T)RAND_MAX;
254 return true;
255}
256
257
258template <typename T, typename S, typename DESCRIPTOR>
263 : AnalyticalF<DESCRIPTOR::d,T,S>(DESCRIPTOR::d),
264 _position(position),
265 _velocity(velocity),
266 _angularVelocity(angularVelocity)
267{
268 this->getName() = "EccentricVelocityField";
269}
270
271template <typename T, typename S, typename DESCRIPTOR>
273{
274 constexpr unsigned D = DESCRIPTOR::d;
275
276 Vector<T,D> localVel = util::calculateLocalVelocity(_position, _velocity, _angularVelocity, Vector<T,D>(input));
277 for (unsigned iDim=0; iDim<D; ++iDim) {
278 output[iDim] = localVel[iDim];
279 }
280
281 return true;
282}
283
284template <typename T, typename S, typename DESCRIPTOR>
289 UnitConverter<T,DESCRIPTOR> const& converter )
290 : AnalyticalF<DESCRIPTOR::d,T,S>(DESCRIPTOR::d),
291 _position(position),
292 _velocity(velocity),
293 _angularVelocity(angularVelocity),
294 _converter(converter)
295{
296 this->getName() = "EccentricLatticeVelocityField";
297}
298
299template <typename T, typename S, typename DESCRIPTOR>
301{
302 constexpr unsigned D = DESCRIPTOR::d;
303
304 Vector<T,D> localVel = util::calculateLocalVelocity(_position, _velocity, _angularVelocity, Vector<T,D>(input));
305 for (unsigned iDim=0; iDim<D; ++iDim) {
306 output[iDim] = _converter.getLatticeVelocity( localVel[iDim] );
307 }
308
309 return true;
310}
311
312
313template <unsigned D, typename T, typename S>
315 T period, T amplitude, T difference)
316 : AnalyticalF<D,T,S>(1), _period(period),
317 _amplitude(amplitude), _difference(difference)
318{ }
319
320template <unsigned D, typename T, typename S>
321bool AnalyticalSquareWave<D,T,S>::operator()(T output[], const S x[])
322{
323 if ( util::fmod_pos(x[0],_period) <= (_difference * _period)) {
324 output[0] = _amplitude;
325 }
326 else {
327 output[0] = - _amplitude;
328 }
329 return true;
330}
331
332
333template <unsigned D, typename T, typename S>
335 T period, T amplitude, T difference, T epsilon)
336 : AnalyticalSquareWave<D,T,S>(period, amplitude, difference),
337 _epsilon(epsilon)
338{
339 OLB_ASSERT(epsilon < difference, "Smoothing region is to large for given phase difference");
340}
341
342template <unsigned D, typename T, typename S>
344{
345 if ( util::fmod_pos(x[0],this->_period) <= 0.5 * _epsilon) {
346 output[0] = this->_amplitude * util::sin(M_PI * util::fmod_pos(x[0],this->_period) / _epsilon);
347 }
348 else if ( util::fmod_pos(x[0],this->_period) <= this->_difference * this->_period - 0.5 * _epsilon ) {
349 output[0] = this->_amplitude;
350 }
351 else if ( util::fmod_pos(x[0],this->_period) <= this->_difference * this->_period + 0.5 * _epsilon ) {
352 output[0] = - this->_amplitude
353 * util::sin(M_PI * (util::fmod_pos(x[0],this->_period) - this->_difference * this->_period) / _epsilon);
354 }
355 else if ( util::fmod_pos(x[0],this->_period) <= this->_period - 0.5 * _epsilon ) {
356 output[0] = - this->_amplitude;
357 }
358 else {
359 output[0] = this->_amplitude
360 * util::sin(M_PI * (util::fmod_pos(x[0],this->_period) - this->_period) / _epsilon);
361 }
362 return true;
363}
364
365
366
367
369
371template <typename T, typename S>
373 : AnalyticalF1D<T,S>(1), _a(a), _b(b)
374{
375 this->getName() = "linear";
376}
377
378template <typename T, typename S>
380 : AnalyticalF1D<T,S>(1)
381{
382 if ( util::nearZero(x1-x0) ) {
383 std::cout << "Error: x1-x2=0" << std::endl;
384 }
385 else {
386 _a = ( v1-v0 ) / ( x1-x0 );
387 _b = v0 - _a*x0;
388 }
389 this->getName() = "linear";
390}
391
392template <typename T, typename S>
393bool AnalyticalLinear1D<T,S>::operator()(T output[], const S x[])
394{
395 output[0]=_a*x[0] + _b;
396 return true;
397}
398
399
400template <typename T, typename S>
402 : AnalyticalF1D<T,S>(1), _cp(cp), _r(r), _maxi(maxi)
403{
404 this->getName() = "square";
405}
406
407template <typename T, typename S>
408bool AnalyticalSquare1D<T,S>::operator()(T output[], const S x[])
409{
410 output[0]=_maxi*(1-(x[0]-_cp) * (x[0]-_cp) / (T)_r / (T)_r);
411 return true;
412}
413
414
415
417template <typename T, typename S>
419 : AnalyticalF1D<T,S>(1), _numTimeSteps(numTimeSteps), _maxValue(maxValue)
420{
421 this->getName() = "polyStartScale";
422}
423
424template <typename T, typename S>
425bool PolynomialStartScale<T,S>::operator()(T output[], const S x[])
426{
427 output[0]=(T) x[0] / (T) _numTimeSteps;
428 output[0]=_maxValue * output[0]*output[0]*output[0] * ( 10.0 + output[0] * (6.0*output[0] - 15.0) );
429 return true;
430}
431
432
433template <typename T, typename S>
434SinusStartScale<T,S>::SinusStartScale(int numTimeSteps, T maxValue)
435 : AnalyticalF1D<T,S>(1), _numTimeSteps(numTimeSteps), _maxValue(maxValue)
436{
437 this->getName() = "sinusStartScale";
438}
439
440template <typename T, typename S>
441bool SinusStartScale<T,S>::operator()(T output[], const S x[])
442{
443 output[0]=(_maxValue * (util::sin(-M_PI / 2.0 + (T)x[0] / (T)_numTimeSteps * M_PI) + 1.0)) / 2.0;
444 return true;
445}
446
447
448template <typename T, typename S>
449Sinus<T,S>::Sinus(T period, T amplitude)
450 : AnalyticalF1D<T,S>(1), _period(period), _amplitude(amplitude)
451{
452 this->getName() = "Sinus";
453}
454
455template <typename T, typename S>
456bool Sinus<T,S>::operator()(T output[], const S x[])
457{
458 output[0] = _amplitude * util::sin((x[0] / _period) * 2 * M_PI);
459 return true;
460}
461
462
463template <typename T, typename S>
464Cosinus<T,S>::Cosinus(T period, T amplitude)
465 : AnalyticalF1D<T,S>(1),
466 _period(period),
467 _amplitude(amplitude)
468{
469 this->getName() = "Cosinus";
470}
471
472template <typename T, typename S>
473bool Cosinus<T,S>::operator()(T output[], const S x[])
474{
475 output[0] = _amplitude * util::cos((x[0] / _period) * T(2) * M_PI);
476 return true;
477}
478
479template <typename T, typename S>
480CosinusComposite<T,S>::CosinusComposite(T period, T amplitude, T difference)
481 : AnalyticalF1D<T,S>(1),
482 _period(period),
483 _difference(difference),
484 _amplitude(amplitude)
485{
486 this->getName() = "CosinusComposite";
487}
488
489template <typename T, typename S>
490bool CosinusComposite<T,S>::operator()(T output[], const S x[])
491{
492 if ( util::fmod_pos(x[0],_period) <= (_difference * _period)) {
493 output[0] = _amplitude
494 * util::cos(((util::fmod_pos(x[0], _period))
495 / (_difference * _period)) * M_PI);
496 }
497 else {
498 output[0] = _amplitude
499 * util::cos(((util::fmod_pos(x[0], _period) - (_difference * _period))
500 / (_period - (_difference * _period))) * M_PI + M_PI);
501 }
502 return true;
503}
504
505
506
507
509template <typename T, typename S>
511 : AnalyticalF2D<T,S>(1), _a(a), _b(b), _c(c)
512{
513 this->getName() = "linear";
514}
515
516template <typename T, typename S>
518 T v1, S x2, S y2, T v2)
519 : AnalyticalF2D<T,S>(1)
520{
521 this->getName() = "linear";
522 T n2= (x1-x0)*(y2-y0) - (y1-y0)*(x2-x0);
523 if ( util::nearZero(n2) ) {
524 std::cout << "Error function" << std::endl;
525 }
526 else {
527 T n0 = (y1-y0)*(v2-v0) - (v1-v0)*(y2-y0);
528 T n1 = (v1-v0)*(x2-x0) - (x1-x0)*(v2-v0);
529 _a = -n0 / n2;
530 _b = -n1 / n2;
531 _c = (x0*n0 + y0*n1 + v0*n2) / n2;
532 }
533}
534
535template <typename T, typename S>
536bool AnalyticalLinear2D<T,S>::operator()(T output[], const S x[])
537{
538 output[0]=_a*x[0] + _b*x[1] + _c;
539 return true;
540}
541
542template <typename T, typename S>
543AnalyticalParticleAdsorptionLinear2D<T,S>::AnalyticalParticleAdsorptionLinear2D(T center[], T radius, T maxValue) : AnalyticalF2D<T,S>(2), _radius(radius), _maxValue(maxValue)
544{
545 _center[0] = center[0];
546 _center[1] = center[1];
547 this->getName() = "particleAdsorptionLinear2D";
548}
549
550template <typename T, typename S>
552{
553 T dist = util::sqrt((input[0]-_center[0])*(input[0]-_center[0]) + (input[1]-_center[1])*(input[1]-_center[1]));
554
555 if (dist > _radius) {
556 output[0] = T();
557 output[1] = T();
558 return true;
559 }
560 else {
561 output[0] = _maxValue*(T(1) - dist/_radius)*(_center[0]-input[0])/_radius;
562 output[1] = _maxValue*(T(1) - dist/_radius)*(_center[1]-input[1])/_radius;
563 return true;
564 }
565}
566
567
568
570template <typename T, typename S>
572 : AnalyticalF3D<T,S>(1), _a(a), _b(b), _c(c), _d(d)
573{
574 this->getName() = "linear";
575}
576
577template <typename T, typename S>
579 S y1, S z1, T v1, S x2, S y2, S z2, T v2, S x3, S y3, S z3, T v3)
580 : AnalyticalF3D<T,S>(1)
581{
582 this->getName() = "linear";
583 T n = ( (y3-y0)*(x1-x0)-(x3-x0)*(y1-y0) ) * ( (x2-x0)*(z1-z0)-(z2-z0)*(x1-x0) )
584 +( (z3-z0)*(x1-x0)-(x3-x0)*(z1-z0) ) * ( (y2-y0)*(x1-x0)-(x2-x0)*(y1-y0) );
585 if ( util::nearZero(n) ) {
586 std::cout << "Error function" << std::endl;
587 }
588 else {
589 T w = ( (y1-y0)*(x3-x0)-(x1-x0)*(y3-y0) ) * ( (v2-v0)-(x2-x0)*(v1-v0) / (x1-x0) )
590 /( (y2-y0)*(x1-x0)-(x2-x0)*(y1-y0) ) + (v3-v0) - (x3-x0)*(v1-v0) / (x1-x0);
591 T zx = (y1-y0)*( (x2-x0)*(z1-z0)-(z2-z0)*(x1-x0) )
592 -(z1-z0)*( (y2-y0)*(x1-x0)-(x2-x0)*(y1-y0) );
593 T rx = (v1-v0)/(x1-x0) - (y1-y0)*(v2-v0) / ( (y2-y0)*(x1-x0)-(x2-x0)*(y1-y0) )
594 +(y1-y0)*(x2-x0)*(v1-v0) / ( (y2-y0)*(x1-x0)*(x1-x0)-(x2-x0)*(y1-y0)*(x1-x0) );
595 T zy = (x1-x0)*( (x2-x0)*(z1-z0)-(z2-z0)*(x1-x0) );
596 T ry = ( (x1-x0)*(v2-v0)-(x2-x0)*(v1-v0) ) / ( (y2-y0)*(x1-x0)-(x2-x0)*(y1-y0) );
597 T zz = (x1-x0)*( (y2-y0)*(x1-x0)-(x2-x0)*(y1-y0) );
598 T h = w/n;
599 _a = rx + zx*h;
600 _b = ry + zy*h;
601 _c = zz*h;
602 _d = v0 - x0*_a - y0*_b - z0*_c;
603 }
604}
605
606template <typename T, typename S>
607bool AnalyticalLinear3D<T,S>::operator()(T output[], const S x[])
608{
609 output[0]=_a*x[0] + _b*x[1] + _c*x[2] + _d;
610 return true;
611}
612
613
614template <typename T, typename S>
616 : AnalyticalF3D<T,S>(f.getTargetDim()), _f(f), _scale(scale)
617{
618 this->getName() = "scaled";
619}
620
621template <typename T, typename S>
622bool AnalyticalScaled3D<T,S>::operator()(T output[], const S x[])
623{
624 T outputTmp[_f.getTargetDim()];
625 _f(outputTmp,x);
626 for (int iDim = 0; iDim < this->getTargetDim(); ++iDim) {
627 output[iDim] = _scale*outputTmp[iDim];
628 }
629 return true;
630}
631
632
633// see Mink et al. 2016 in Sec.3.1.
634template <typename T, typename S, typename DESCRIPTOR>
636 : AnalyticalF3D<T,S>(1),
637 _physSigmaEff(util::sqrt( converter.getPhysAbsorption() / converter.getPhysDiffusion() )),
638 _physDiffusionCoefficient(converter.getPhysDiffusion())
639{
640 this->getName() = "PLSsolution3D";
641}
642
643template <typename T, typename S, typename DESCRIPTOR>
644bool PLSsolution3D<T,S,DESCRIPTOR>::operator()(T output[1], const S x[3])
645{
646 double r = util::sqrt( x[0]*x[0] + x[1]*x[1] + x[2]*x[2] );
647 output[0] = 1. / (4.0*M_PI*_physDiffusionCoefficient*r) *util::exp(-_physSigmaEff * r);
648 return true;
649}
650
651
652template <typename T, typename S, typename DESCRIPTOR>
654 : AnalyticalF3D<T,S>(1),
655 _physSigmaEff(util::sqrt( converter.getPhysAbsorption() / converter.getPhysDiffusion() )),
656 _physDiffusionCoefficient(converter.getPhysDiffusion()),
657 _center(center)
658{
659 this->getName() = "LightSourceCylindrical3D";
660}
661
662template <typename T, typename S, typename DESCRIPTOR>
664{
665 double r = util::sqrt( (x[0]-_center[0])*(x[0]-_center[0]) + (x[1]-_center[1])*(x[1]-_center[1]) );
666 if ( util::nearZero(r) ) {
667 std::cout << "Warning: evaluation of \"LightSourceCylindrical3D\" functor close to singularity." << std::endl;
668 }
669 output[0] = 1. / (4.0*M_PI*_physDiffusionCoefficient*r) *util::exp(-_physSigmaEff * r);
670 return true;
671}
672
673
674template <typename T, typename S>
675Spotlight<T,S>::Spotlight(Vector<T,3> position, Vector<T,3> direction, T falloff)
676 : AnalyticalF3D<T,S>(1), _position(position), _orientation(direction[0]/norm(direction), direction[1]/norm(direction), direction[2]/norm(direction)), _falloff(falloff)
677{
678 this->getName() = "Spotlight";
679}
680
681template <typename T, typename S>
682bool Spotlight<T,S>::operator()(T output[1], const S x[3])
683{
684 Vector<T,3> w(x[0] -_position[0], x[1] -_position[1], x[2] -_position[2]);
685 w = normalize(w);
686 T cosPhi = w*_orientation;
687 output[0] = 1. / (norm(w)*norm(w)) * util::pow(util::max(0., cosPhi), _falloff);
688 return true;
689}
690
691
692template <typename T, typename S>
694 : AnalyticalF2D<T,S>(1), _sigma(sigma), _x0(x0[0],x0[1]), _c0(c0)
695{
696 this->getName() = "GaussianHill";
697}
698
699template <typename T, typename S>
700bool GaussianHill2D<T,S>::operator()(T output[1], const S x[2])
701{
702 output[0] = _c0 * util::exp(- ((x[0]-_x0[0])*(x[0]-_x0[0]) + (x[1]-_x0[1])*(x[1]-_x0[1])) / (2*_sigma*_sigma) );
703 return true;
704}
705
706
707template <typename T, typename S>
709 : AnalyticalF2D<T,S>(1), _sigma02(sigma0*sigma0), _D(D), _t(t), _x0(x0[0],x0[1]), _u(u[0],u[1]), _c0(c0)
710{
711 this->getName() = "GaussianHillTimeEvolution";
712}
713
714template <typename T, typename S>
715bool GaussianHillTimeEvolution2D<T,S>::operator()(T output[1], const S x[2])
716{
717 output[0] = _sigma02 / (_sigma02+2*_D*_t) * _c0 * util::exp(- ((x[0]-_x0[0]-_u[0]*_t)*(x[0]-_x0[0]-_u[0]*_t) + (x[1]-_x0[1]-_u[1]*_t)*(x[1]-_x0[1]-_u[1]*_t)) / (2*(_sigma02+2*_D*_t) ));
718 return true;
719}
720
721
722
723
724} // end namespace olb
725
726#endif
#define M_PI
Some arithmetic helper functions.
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalComposed(AnalyticalF< D, T, S > &f0, AnalyticalF< D, T, S > &f1)
Definition analyticalF.h:60
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalF are applications from DD to XD, where X is set by the constructor.
bool operator()(T output[], const S x[]) override
returns line _a*x + _b
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalLinear2D(T a, T b, T c)
AnalyticalLinear3D(T a, T b, T c, T d)
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalNormal(std::vector< T > mean, T stdDev)
bool operator()(T output[], const S x[])
has to be implemented for 'every' derived class
AnalyticalParticleAdsorptionLinear2D(T center[], T radius, T maxValue)
AnalyticalRandomBase: virtual base class for all the random functionals.
AnalyticalRandomNormal: DD -> 1D with random image in (0,1)
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalRandomNormal(T mean=0., T stdDev=1.)
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalRamdomSeededBase: alternative version with seed specification.
AnalyticalRandomSeededNormal(T mean=0., T stdDev=1.)
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalRandomTruncatedNormal(T mean=0., T stdDev=1., T n=3.)
AnalyticalRandomUniform(T minVal=0., T maxVal=1.)
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalScaled3D(AnalyticalF3D< T, S > &f, T scale)
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalSmoothedSquareWave(T period=1, T amplitude=1, T difference=0.5, T epsilon=1.e-3)
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalSquare1D(S cp, S r, T maxi)
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
Square wave with given period length, amplitude, difference (= length of positive time / length of pe...
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
AnalyticalSquareWave(T period=1, T amplitude=1, T difference=0.5)
CosinusComposite(T period=1, T amplitude=1, T difference=1)
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
Cosinus(T period=1, T amplitude=1)
EccentricLatticeVelocityField(Vector< T, DESCRIPTOR::d > position, Vector< T, DESCRIPTOR::d > velocity, Vector< T, utilities::dimensions::convert< DESCRIPTOR::d >::rotation > angularVelocity, UnitConverter< T, DESCRIPTOR > const &converter)
bool operator()(T output[], const S input[]) override
has to be implemented for 'every' derived class
bool operator()(T output[], const S input[]) override
has to be implemented for 'every' derived class
EccentricVelocityField(Vector< T, DESCRIPTOR::d > position, Vector< T, DESCRIPTOR::d > velocity, Vector< T, utilities::dimensions::convert< DESCRIPTOR::d >::rotation > angularVelocity)
bool operator()(T output[1], const S x[2]) override
GaussianHill2D(T sigma, Vector< T, 2 > x0, T c0)
bool operator()(T output[1], const S x[2]) override
GaussianHillTimeEvolution2D(T sigma0, T D, T t, Vector< T, 2 > x0, Vector< T, 2 > u, T c0)
std::string & getName()
read and write access to name
Definition genericF.hh:51
bool operator()(T output[1], const S x[3]) override
LightSourceCylindrical3D(RadiativeUnitConverter< T, DESCRIPTOR > const &converter, Vector< T, 3 > center={T(0), T(0), T(0)})
PLSsolution3D(RadiativeUnitConverter< T, DESCRIPTOR > const &converter)
bool operator()(T output[1], const S x[3]) override
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
PolynomialStartScale(S numTimeSteps=S(1), T maxValue=T(1))
Conversion between physical and lattice units, as well as discretization.
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
SinusStartScale(int numTimeSteps=1, T maxValue=1)
bool operator()(T output[], const S x[]) override
has to be implemented for 'every' derived class
Sinus(T period=1, T amplitude=1)
bool operator()(T output[1], const S x[3]) override
Spotlight(Vector< T, 3 > position, Vector< T, 3 > direction, T falloff)
Conversion between physical and lattice units, as well as discretization.
Plain old scalar vector.
Definition vector.h:47
Wrapper functions that simplify the use of MPI.
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100
cpu::simd::Pack< T > max(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:130
auto fmod_pos(T a, S b)
Variant of fmod (floating point modulo) that always returns positive values.
Definition calc.h:39
ADf< T, DIM > sin(const ADf< T, DIM > &a)
Definition aDiff.h:569
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112
constexpr Vector< T, D > calculateLocalVelocity(const Vector< T, D > &rotationCenter, const Vector< T, D > &velocity, const Vector< T, utilities::dimensions::convert< D >::rotation > &angularVelocity, const Vector< T, D > &position)
Calculate local velocity.
bool nearZero(const ADf< T, DIM > &a)
Definition aDiff.h:1087
ADf< T, DIM > exp(const ADf< T, DIM > &a)
Definition aDiff.h:455
ADf< T, DIM > cos(const ADf< T, DIM > &a)
Definition aDiff.h:578
Top level namespace for all of OpenLB.
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
Euclidean vector norm.
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:245
#define OLB_ASSERT(COND, MESSAGE)
Definition olbDebug.h:45
Unit conversion handling – header file.
Definition of singletons: global, publicly available information.
Converts dimensions by deriving from given cartesian dimension D.