OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
olb::RectangleTrigonometricPoiseuille3D< T > Class Template Referencefinal

#include <frameChangeF3D.h>

+ Inheritance diagram for olb::RectangleTrigonometricPoiseuille3D< T >:
+ Collaboration diagram for olb::RectangleTrigonometricPoiseuille3D< T >:

Public Member Functions

 RectangleTrigonometricPoiseuille3D (std::vector< T > &x0_, std::vector< T > &x1_, std::vector< T > &x2_, std::vector< T > &maxVelocity, int numOfPolynoms_=1)
 
 RectangleTrigonometricPoiseuille3D (SuperGeometry< T, 3 > &superGeometry_, int material_, std::vector< T > &maxVelocity_, T offsetX, T offsetY, T offsetZ, int numOfPolynoms_=1)
 constructor from material numbers
 
getProfilePeak ()
 
getRatioAvgToPeak ()
 
bool operator() (T output[], const T x[]) override
 
- Public Member Functions inherited from olb::AnalyticalF< D, T, S >
AnalyticalF< D, T, S > & operator- (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator+ (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator* (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator/ (AnalyticalF< D, T, S > &rhs)
 
- Public Member Functions inherited from olb::GenericF< T, S >
virtual ~GenericF ()=default
 
int getSourceDim () const
 read only access to member variable _m
 
int getTargetDim () const
 read only access to member variable _n
 
std::string & getName ()
 read and write access to name
 
std::string const & getName () const
 read only access to name
 
virtual bool operator() (T output[], const S input[])=0
 has to be implemented for 'every' derived class
 
bool operator() (T output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (T output[], S input0)
 
bool operator() (T output[], S input0, S input1)
 
bool operator() (T output[], S input0, S input1, S input2)
 
bool operator() (T output[], S input0, S input1, S input2, S input3)
 

Protected Member Functions

void calcPeakAndAvg ()
 
- Protected Member Functions inherited from olb::AnalyticalF< D, T, S >
 AnalyticalF (int n)
 
- Protected Member Functions inherited from olb::GenericF< T, S >
 GenericF (int targetDim, int sourceDim)
 

Protected Attributes

OstreamManager clout
 
std::vector< T > x0
 
std::vector< T > x1
 
std::vector< T > x2
 
std::vector< T > maxVelocity
 
int numOfPolynoms
 
profilePeak
 
profileRatioAvgToPeak
 

Additional Inherited Members

- Public Types inherited from olb::AnalyticalF< D, T, S >
using identity_functor_type = AnalyticalIdentity<D,T,S>
 
- Public Types inherited from olb::GenericF< T, S >
using targetType = T
 
using sourceType = S
 
- Public Attributes inherited from olb::GenericF< T, S >
std::shared_ptr< GenericF< T, S > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Static Public Attributes inherited from olb::AnalyticalF< D, T, S >
static constexpr unsigned dim = D
 

Detailed Description

template<typename T>
class olb::RectangleTrigonometricPoiseuille3D< T >

Definition at line 264 of file frameChangeF3D.h.

Constructor & Destructor Documentation

◆ RectangleTrigonometricPoiseuille3D() [1/2]

template<typename T >
olb::RectangleTrigonometricPoiseuille3D< T >::RectangleTrigonometricPoiseuille3D ( std::vector< T > & x0_,
std::vector< T > & x1_,
std::vector< T > & x2_,
std::vector< T > & maxVelocity,
int numOfPolynoms_ = 1 )

Definition at line 518 of file frameChangeF3D.hh.

520 : AnalyticalF3D<T,T>(3), clout(std::cout,"RectangleTrigonometricPoiseille3D"), x0(x0_), x1(x1_),
521 x2(x2_), maxVelocity(maxVelocity_), numOfPolynoms(numOfPolynoms_)
522{
524}

References olb::RectangleTrigonometricPoiseuille3D< T >::calcPeakAndAvg().

+ Here is the call graph for this function:

◆ RectangleTrigonometricPoiseuille3D() [2/2]

template<typename T >
olb::RectangleTrigonometricPoiseuille3D< T >::RectangleTrigonometricPoiseuille3D ( SuperGeometry< T, 3 > & superGeometry_,
int material_,
std::vector< T > & maxVelocity_,
T offsetX,
T offsetY,
T offsetZ,
int numOfPolynoms_ = 1 )

constructor from material numbers

offsetX,Y,Z is a positive number denoting the distance from border voxels of material_ to the zerovelocity boundary

Definition at line 528 of file frameChangeF3D.hh.

530 : AnalyticalF3D<T,T>(3), clout(std::cout, "RectangleTrigonometricPoiseuille3D"), maxVelocity(maxVelocity_),
531 numOfPolynoms(numOfPolynoms_)
532{
533 std::vector<T> min = superGeometry_.getStatistics().getMinPhysR(material_);
534 std::vector<T> max = superGeometry_.getStatistics().getMaxPhysR(material_);
535 // set three corners of the plane, move by offset to land on the v=0
536 // boundary and adapt certain values depending on the orthogonal axis to get
537 // different points
538 x0 = min;
539 x1 = min;
540 x2 = min;
541 if ( util::nearZero(max[0]-min[0]) ) { // orthogonal to x-axis
542 x0[1] -= offsetY;
543 x0[2] -= offsetZ;
544 x1[1] -= offsetY;
545 x1[2] -= offsetZ;
546 x2[1] -= offsetY;
547 x2[2] -= offsetZ;
548
549 x1[1] = max[1] + offsetY;
550 x2[2] = max[2] + offsetZ;
551 }
552 else if ( util::nearZero(max[1]-min[1]) ) { // orthogonal to y-axis
553 x0[0] -= offsetX;
554 x0[2] -= offsetZ;
555 x1[0] -= offsetX;
556 x1[2] -= offsetZ;
557 x2[0] -= offsetX;
558 x2[2] -= offsetZ;
559
560 x1[0] = max[0] + offsetX;
561 x2[2] = max[2] + offsetZ;
562 }
563 else if ( util::nearZero(max[2]-min[2]) ) { // orthogonal to z-axis
564 x0[0] -= offsetX;
565 x0[1] -= offsetY;
566 x1[0] -= offsetX;
567 x1[1] -= offsetY;
568 x2[0] -= offsetX;
569 x2[1] -= offsetY;
570
571 x1[0] = max[0] + offsetX;
572 x2[1] = max[1] + offsetY;
573 }
574 else {
575 clout << "Error: constructor from material number works only for axis-orthogonal planes" << std::endl;
576 }
578}
SuperGeometryStatistics< T, D > & getStatistics()
Returns the statistics object.
Pack< T > min(Pack< T > rhs, Pack< T > lhs)
Definition 256.h:406
Pack< T > max(Pack< T > rhs, Pack< T > lhs)
Definition 256.h:416
bool nearZero(const ADf< T, DIM > &a)
Definition aDiff.h:1087

References olb::RectangleTrigonometricPoiseuille3D< T >::calcPeakAndAvg(), olb::RectangleTrigonometricPoiseuille3D< T >::clout, olb::SuperGeometry< T, D >::getStatistics(), olb::util::nearZero(), olb::RectangleTrigonometricPoiseuille3D< T >::x0, olb::RectangleTrigonometricPoiseuille3D< T >::x1, and olb::RectangleTrigonometricPoiseuille3D< T >::x2.

+ Here is the call graph for this function:

Member Function Documentation

◆ calcPeakAndAvg()

template<typename T >
void olb::RectangleTrigonometricPoiseuille3D< T >::calcPeakAndAvg ( )
protected

Definition at line 582 of file frameChangeF3D.hh.

583{
584 //2006_Bruus_Lecture Theoretical microfluidics
585 T sumMax = 0;
586 T sumAvg = 0;
587 for (int i=1; i<=numOfPolynoms; ++i) { //TODO: higher polynoms still to be tested
588 T n = i*2-1; //Creating only odd indices
589 T A = util::sin(n*M_PI*0.5);
590 T max = (1./util::pow(n,3)) * (1.-(1 / util::cosh(n*M_PI / 2 ))) * A;
591 //TODO: only for y,z=1 //TODO: Maximum calculation needs to be adapted for different edge ratios
592 T avg = 2. * A * A * (n*M_PI-2*util::tanh(n*M_PI*0.5)) / (util::pow(n,5)*M_PI*M_PI);
593 sumMax += max;
594 sumAvg += avg;
595 }
596 profilePeak = sumMax;
597 profileRatioAvgToPeak = sumAvg / sumMax;
598}
#define M_PI
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
ADf< T, DIM > cosh(const ADf< T, DIM > &a)
Definition aDiff.h:657
ADf< T, DIM > tanh(const ADf< T, DIM > &a)
Definition aDiff.h:663

References olb::util::cosh(), M_PI, olb::util::pow(), olb::util::sin(), and olb::util::tanh().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProfilePeak()

template<typename T >
T olb::RectangleTrigonometricPoiseuille3D< T >::getProfilePeak ( )

Definition at line 602 of file frameChangeF3D.hh.

603{
604 return profilePeak;
605}

◆ getRatioAvgToPeak()

template<typename T >
T olb::RectangleTrigonometricPoiseuille3D< T >::getRatioAvgToPeak ( )

Definition at line 608 of file frameChangeF3D.hh.

609{
611}

◆ operator()()

template<typename T >
bool olb::RectangleTrigonometricPoiseuille3D< T >::operator() ( T output[],
const T x[] )
override

Definition at line 614 of file frameChangeF3D.hh.

615{
616 OstreamManager clout( std::cout,"RectPois" ); //TODO: to be removed
617
618 // create plane normals and supports, (E1,E2) and (E3,E4) are parallel
619 std::vector<std::vector<T> > n(4,std::vector<T>(3,0)); // normal vectors
620 std::vector<std::vector<T> > s(4,std::vector<T>(3,0)); // support vectors
621 for (int iD = 0; iD < 3; iD++) {
622 n[0][iD] = x1[iD] - x0[iD];
623 n[1][iD] = -x1[iD] + x0[iD];
624 n[2][iD] = x2[iD] - x0[iD];
625 n[3][iD] = -x2[iD] + x0[iD];
626 s[0][iD] = x0[iD];
627 s[1][iD] = x1[iD];
628 s[2][iD] = x0[iD];
629 s[3][iD] = x2[iD];
630 }
631 for (int iP = 0; iP < 4; iP++) {
632 n[iP] = util::normalize(n[iP]);
633 }
634
635 // determine plane coefficients in the coordinate equation E_i: Ax+By+Cz+D=0
636 // given form: (x-s)*n=0 => A=n1, B=n2, C=n3, D=-(s1n1+s2n2+s3n3)
637 std::vector<T> A(4,0);
638 std::vector<T> B(4,0);
639 std::vector<T> C(4,0);
640 std::vector<T> D(4,0);
641
642 for (int iP = 0; iP < 4; iP++) {
643 A[iP] = n[iP][0];
644 B[iP] = n[iP][1];
645 C[iP] = n[iP][2];
646 D[iP] = -(s[iP][0]*n[iP][0] + s[iP][1]*n[iP][1] + s[iP][2]*n[iP][2]);
647 }
648
649 // determine distance to the walls by formula
650 std::vector<T> d(4,0);
651 T aabbcc(0);
652 for (int iP = 0; iP < 4; iP++) {
653 aabbcc = A[iP]*A[iP] + B[iP]*B[iP] + C[iP]*C[iP];
654 d[iP] = util::fabs(A[iP]*x[0]+B[iP]*x[1]+C[iP]*x[2]+D[iP])*util::pow(aabbcc,-0.5);
655 }
656
657 // length and width of the rectangle
658 std::vector<T> l(2,0);
659 l[0] = d[0] + d[1] ;
660 l[1] = d[2] + d[3] ;
661
662 std::vector<T> dl(2,0);
663 dl[0] = d[0] / l[0];
664 dl[1] = d[2] / l[1];
665
666 //Polynomial creation for odd indices (2i-i) from:
667 //2006_Bruus_Lecture Theoretical microfluidics
668 T sumPoly = 0;
669 for (int i=1; i<=numOfPolynoms; ++i) { //TODO: higher polynoms still to be tested
670 T n = i*2-1;
671 T poly = (1./util::pow(n,3)) * (1.-(util::cosh(n*M_PI*(dl[0]-0.5)) / util::cosh(n*M_PI/ (2) ))) * util::sin(n*M_PI*dl[1]);
672 sumPoly += poly;
673 }
674
675 output[0] = maxVelocity[0] * ( sumPoly / profilePeak);
676 output[1] = maxVelocity[1] * ( sumPoly / profilePeak);
677 output[2] = maxVelocity[2] * ( sumPoly / profilePeak);
678 return true;
679}
platform_constant Fraction s[Q]
constexpr int d() any_platform
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
Definition pack.h:106
Vector< T, D > normalize(const Vector< T, D > &a)

References olb::util::cosh(), olb::util::fabs(), M_PI, olb::util::normalize(), olb::util::pow(), and olb::util::sin().

+ Here is the call graph for this function:

Member Data Documentation

◆ clout

template<typename T >
OstreamManager olb::RectangleTrigonometricPoiseuille3D< T >::clout
protected

Definition at line 266 of file frameChangeF3D.h.

◆ maxVelocity

template<typename T >
std::vector<T> olb::RectangleTrigonometricPoiseuille3D< T >::maxVelocity
protected

Definition at line 270 of file frameChangeF3D.h.

◆ numOfPolynoms

template<typename T >
int olb::RectangleTrigonometricPoiseuille3D< T >::numOfPolynoms
protected

Definition at line 271 of file frameChangeF3D.h.

◆ profilePeak

template<typename T >
T olb::RectangleTrigonometricPoiseuille3D< T >::profilePeak
protected

Definition at line 272 of file frameChangeF3D.h.

◆ profileRatioAvgToPeak

template<typename T >
T olb::RectangleTrigonometricPoiseuille3D< T >::profileRatioAvgToPeak
protected

Definition at line 273 of file frameChangeF3D.h.

◆ x0

template<typename T >
std::vector<T> olb::RectangleTrigonometricPoiseuille3D< T >::x0
protected

Definition at line 267 of file frameChangeF3D.h.

◆ x1

template<typename T >
std::vector<T> olb::RectangleTrigonometricPoiseuille3D< T >::x1
protected

Definition at line 268 of file frameChangeF3D.h.

◆ x2

template<typename T >
std::vector<T> olb::RectangleTrigonometricPoiseuille3D< T >::x2
protected

Definition at line 269 of file frameChangeF3D.h.


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