OpenLB 1.8.1
Loading...
Searching...
No Matches
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 303 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 544 of file frameChangeF3D.hh.

546 : AnalyticalF3D<T,T>(3), clout(std::cout,"RectangleTrigonometricPoiseille3D"), x0(x0_), x1(x1_),
547 x2(x2_), maxVelocity(maxVelocity_), numOfPolynoms(numOfPolynoms_)
548{
550}
AnalyticalF< 3, T, S > AnalyticalF3D

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 554 of file frameChangeF3D.hh.

556 : AnalyticalF3D<T,T>(3), clout(std::cout, "RectangleTrigonometricPoiseuille3D"), maxVelocity(maxVelocity_),
557 numOfPolynoms(numOfPolynoms_)
558{
559 std::vector<T> min = superGeometry_.getStatistics().getMinPhysR(material_);
560 std::vector<T> max = superGeometry_.getStatistics().getMaxPhysR(material_);
561 // set three corners of the plane, move by offset to land on the v=0
562 // boundary and adapt certain values depending on the orthogonal axis to get
563 // different points
564 x0 = min;
565 x1 = min;
566 x2 = min;
567 if ( util::nearZero(max[0]-min[0]) ) { // orthogonal to x-axis
568 x0[1] -= offsetY;
569 x0[2] -= offsetZ;
570 x1[1] -= offsetY;
571 x1[2] -= offsetZ;
572 x2[1] -= offsetY;
573 x2[2] -= offsetZ;
574
575 x1[1] = max[1] + offsetY;
576 x2[2] = max[2] + offsetZ;
577 }
578 else if ( util::nearZero(max[1]-min[1]) ) { // orthogonal to y-axis
579 x0[0] -= offsetX;
580 x0[2] -= offsetZ;
581 x1[0] -= offsetX;
582 x1[2] -= offsetZ;
583 x2[0] -= offsetX;
584 x2[2] -= offsetZ;
585
586 x1[0] = max[0] + offsetX;
587 x2[2] = max[2] + offsetZ;
588 }
589 else if ( util::nearZero(max[2]-min[2]) ) { // orthogonal to z-axis
590 x0[0] -= offsetX;
591 x0[1] -= offsetY;
592 x1[0] -= offsetX;
593 x1[1] -= offsetY;
594 x2[0] -= offsetX;
595 x2[1] -= offsetY;
596
597 x1[0] = max[0] + offsetX;
598 x2[1] = max[1] + offsetY;
599 }
600 else {
601 clout << "Error: constructor from material number works only for axis-orthogonal planes" << std::endl;
602 }
604}
bool nearZero(T a) any_platform
return true if a is close to zero
Definition util.h:402

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 608 of file frameChangeF3D.hh.

609{
610 //2006_Bruus_Lecture Theoretical microfluidics
611 T sumMax = 0;
612 T sumAvg = 0;
613 for (int i=1; i<=numOfPolynoms; ++i) { //TODO: higher polynoms still to be tested
614 T n = i*2-1; //Creating only odd indices
615 T A = util::sin(n*M_PI*0.5);
616 T max = (1./util::pow(n,3)) * (1.-(1 / util::cosh(n*M_PI / 2 ))) * A;
617 //TODO: only for y,z=1 //TODO: Maximum calculation needs to be adapted for different edge ratios
618 T avg = 2. * A * A * (n*M_PI-2*util::tanh(n*M_PI*0.5)) / (util::pow(n,5)*M_PI*M_PI);
619 sumMax += max;
620 sumAvg += avg;
621 }
622 profilePeak = sumMax;
623 profileRatioAvgToPeak = sumAvg / sumMax;
624}
#define M_PI
ADf< T, DIM > sin(const ADf< T, DIM > &a)
Definition aDiff.h:569
Expr pow(Expr base, Expr exp)
Definition expr.cpp:235
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
constexpr T max(const ScalarVector< T, D, IMPL > &v)
Definition vector.h:466

References olb::util::cosh(), M_PI, olb::max(), 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 628 of file frameChangeF3D.hh.

629{
630 return profilePeak;
631}

◆ getRatioAvgToPeak()

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

Definition at line 634 of file frameChangeF3D.hh.

635{
637}

◆ operator()()

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

Definition at line 640 of file frameChangeF3D.hh.

641{
642 OstreamManager clout( std::cout,"RectPois" ); //TODO: to be removed
643
644 // create plane normals and supports, (E1,E2) and (E3,E4) are parallel
645 std::vector<std::vector<T> > n(4,std::vector<T>(3,0)); // normal vectors
646 std::vector<std::vector<T> > s(4,std::vector<T>(3,0)); // support vectors
647 for (int iD = 0; iD < 3; iD++) {
648 n[0][iD] = x1[iD] - x0[iD];
649 n[1][iD] = -x1[iD] + x0[iD];
650 n[2][iD] = x2[iD] - x0[iD];
651 n[3][iD] = -x2[iD] + x0[iD];
652 s[0][iD] = x0[iD];
653 s[1][iD] = x1[iD];
654 s[2][iD] = x0[iD];
655 s[3][iD] = x2[iD];
656 }
657 for (int iP = 0; iP < 4; iP++) {
658 n[iP] = util::normalize(n[iP]);
659 }
660
661 // determine plane coefficients in the coordinate equation E_i: Ax+By+Cz+D=0
662 // given form: (x-s)*n=0 => A=n1, B=n2, C=n3, D=-(s1n1+s2n2+s3n3)
663 std::vector<T> A(4,0);
664 std::vector<T> B(4,0);
665 std::vector<T> C(4,0);
666 std::vector<T> D(4,0);
667
668 for (int iP = 0; iP < 4; iP++) {
669 A[iP] = n[iP][0];
670 B[iP] = n[iP][1];
671 C[iP] = n[iP][2];
672 D[iP] = -(s[iP][0]*n[iP][0] + s[iP][1]*n[iP][1] + s[iP][2]*n[iP][2]);
673 }
674
675 // determine distance to the walls by formula
676 std::vector<T> d(4,0);
677 T aabbcc(0);
678 for (int iP = 0; iP < 4; iP++) {
679 aabbcc = A[iP]*A[iP] + B[iP]*B[iP] + C[iP]*C[iP];
680 d[iP] = util::fabs(A[iP]*x[0]+B[iP]*x[1]+C[iP]*x[2]+D[iP])*util::pow(aabbcc,-0.5);
681 }
682
683 // length and width of the rectangle
684 std::vector<T> l(2,0);
685 l[0] = d[0] + d[1] ;
686 l[1] = d[2] + d[3] ;
687
688 std::vector<T> dl(2,0);
689 dl[0] = d[0] / l[0];
690 dl[1] = d[2] / l[1];
691
692 //Polynomial creation for odd indices (2i-i) from:
693 //2006_Bruus_Lecture Theoretical microfluidics
694 T sumPoly = 0;
695 for (int i=1; i<=numOfPolynoms; ++i) { //TODO: higher polynoms still to be tested
696 T n = i*2-1;
697 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]);
698 sumPoly += poly;
699 }
700
701 output[0] = maxVelocity[0] * ( sumPoly / profilePeak);
702 output[1] = maxVelocity[1] * ( sumPoly / profilePeak);
703 output[2] = maxVelocity[2] * ( sumPoly / profilePeak);
704 return true;
705}
platform_constant Fraction s[Q]
Definition mrt.h:65
constexpr int d() any_platform
Definition functions.h:127
Vector< T, D > normalize(const Vector< T, D > &a)
Expr fabs(Expr x)
Definition expr.cpp:230

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 305 of file frameChangeF3D.h.

◆ maxVelocity

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

Definition at line 309 of file frameChangeF3D.h.

◆ numOfPolynoms

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

Definition at line 310 of file frameChangeF3D.h.

◆ profilePeak

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

Definition at line 311 of file frameChangeF3D.h.

◆ profileRatioAvgToPeak

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

Definition at line 312 of file frameChangeF3D.h.

◆ x0

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

Definition at line 306 of file frameChangeF3D.h.

◆ x1

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

Definition at line 307 of file frameChangeF3D.h.

◆ x2

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

Definition at line 308 of file frameChangeF3D.h.


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