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

This functor returns a Poiseuille profile for use with a pipe with square shaped cross-section. More...

#include <frameChangeF3D.h>

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

Public Member Functions

 RectanglePoiseuille3D (olb::Vector< T, 3 > &x0_, olb::Vector< T, 3 > &x1_, olb::Vector< T, 3 > &x2_, std::vector< T > &maxVelocity_)
 
 RectanglePoiseuille3D (SuperGeometry< T, 3 > &superGeometry_, int material_, std::vector< T > &maxVelocity_, T offsetX, T offsetY, T offsetZ)
 constructor from material numbers
 
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 Attributes

OstreamManager clout
 
olb::Vector< T, 3 > x0
 
olb::Vector< T, 3 > x1
 
olb::Vector< T, 3 > x2
 
std::vector< T > maxVelocity
 

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
 
- 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)
 

Detailed Description

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

This functor returns a Poiseuille profile for use with a pipe with square shaped cross-section.

velocity profile for pipes with rectangular cross-section.

Definition at line 245 of file frameChangeF3D.h.

Constructor & Destructor Documentation

◆ RectanglePoiseuille3D() [1/2]

template<typename T >
olb::RectanglePoiseuille3D< T >::RectanglePoiseuille3D ( olb::Vector< T, 3 > & x0_,
olb::Vector< T, 3 > & x1_,
olb::Vector< T, 3 > & x2_,
std::vector< T > & maxVelocity_ )

Definition at line 401 of file frameChangeF3D.hh.

403 : AnalyticalF3D<T,T>(3), clout(std::cout,"RectanglePoiseille3D"), x0(x0_), x1(x1_),
404 x2(x2_), maxVelocity(maxVelocity_) { }

◆ RectanglePoiseuille3D() [2/2]

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

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

410 : AnalyticalF3D<T,T>(3), clout(std::cout, "RectanglePoiseuille3D"), maxVelocity(maxVelocity_)
411{
412 olb::Vector<T, 3> min = superGeometry_.getStatistics().getMinPhysR(material_);
413 olb::Vector<T, 3> max = superGeometry_.getStatistics().getMaxPhysR(material_);
414 // set three corners of the plane, move by offset to land on the v=0
415 // boundary and adapt certain values depending on the orthogonal axis to get
416 // different points
417 x0 = min;
418 x1 = min;
419 x2 = min;
420 if ( util::nearZero(max[0]-min[0]) ) { // orthogonal to x-axis
421 x0[1] -= offsetY;
422 x0[2] -= offsetZ;
423 x1[1] -= offsetY;
424 x1[2] -= offsetZ;
425 x2[1] -= offsetY;
426 x2[2] -= offsetZ;
427
428 x1[1] = max[1] + offsetY;
429 x2[2] = max[2] + offsetZ;
430 }
431 else if ( util::nearZero(max[1]-min[1]) ) { // orthogonal to y-axis
432 x0[0] -= offsetX;
433 x0[2] -= offsetZ;
434 x1[0] -= offsetX;
435 x1[2] -= offsetZ;
436 x2[0] -= offsetX;
437 x2[2] -= offsetZ;
438
439 x1[0] = max[0] + offsetX;
440 x2[2] = max[2] + offsetZ;
441 }
442 else if ( util::nearZero(max[2]-min[2]) ) { // orthogonal to z-axis
443 x0[0] -= offsetX;
444 x0[1] -= offsetY;
445 x1[0] -= offsetX;
446 x1[1] -= offsetY;
447 x2[0] -= offsetX;
448 x2[1] -= offsetY;
449
450 x1[0] = max[0] + offsetX;
451 x2[1] = max[1] + offsetY;
452 }
453 else {
454 clout << "Error: constructor from material number works only for axis-orthogonal planes" << std::endl;
455 }
456}
SuperGeometryStatistics< T, D > & getStatistics()
Returns the statistics object.
Plain old scalar vector.
Definition vector.h:47
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::RectanglePoiseuille3D< T >::clout, olb::SuperGeometry< T, D >::getStatistics(), olb::util::nearZero(), olb::RectanglePoiseuille3D< T >::x0, olb::RectanglePoiseuille3D< T >::x1, and olb::RectanglePoiseuille3D< T >::x2.

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

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

Definition at line 460 of file frameChangeF3D.hh.

461{
462 std::vector<T> velocity(3,T());
463
464 // create plane normals and supports, (E1,E2) and (E3,E4) are parallel
465 std::vector<std::vector<T> > n(4,std::vector<T>(3,0)); // normal vectors
466 std::vector<std::vector<T> > s(4,std::vector<T>(3,0)); // support vectors
467 for (int iD = 0; iD < 3; iD++) {
468 n[0][iD] = x1[iD] - x0[iD];
469 n[1][iD] = -x1[iD] + x0[iD];
470 n[2][iD] = x2[iD] - x0[iD];
471 n[3][iD] = -x2[iD] + x0[iD];
472 s[0][iD] = x0[iD];
473 s[1][iD] = x1[iD];
474 s[2][iD] = x0[iD];
475 s[3][iD] = x2[iD];
476 }
477 for (int iP = 0; iP < 4; iP++) {
478 n[iP] = util::normalize(n[iP]);
479 }
480
481 // determine plane coefficients in the coordinate equation E_i: Ax+By+Cz+D=0
482 // given form: (x-s)*n=0 => A=n1, B=n2, C=n3, D=-(s1n1+s2n2+s3n3)
483 std::vector<T> A(4,0);
484 std::vector<T> B(4,0);
485 std::vector<T> C(4,0);
486 std::vector<T> D(4,0);
487
488 for (int iP = 0; iP < 4; iP++) {
489 A[iP] = n[iP][0];
490 B[iP] = n[iP][1];
491 C[iP] = n[iP][2];
492 D[iP] = -(s[iP][0]*n[iP][0] + s[iP][1]*n[iP][1] + s[iP][2]*n[iP][2]);
493 }
494
495 // determine distance to the walls by formula
496 std::vector<T> d(4,0);
497 T aabbcc(0);
498 for (int iP = 0; iP < 4; iP++) {
499 aabbcc = A[iP]*A[iP] + B[iP]*B[iP] + C[iP]*C[iP];
500 d[iP] = util::fabs(A[iP]*x[0]+B[iP]*x[1]+C[iP]*x[2]+D[iP])*util::pow(aabbcc,-0.5);
501 }
502
503 // length and width of the rectangle
504 std::vector<T> l(2,0);
505 l[0] = d[0] + d[1];
506 l[1] = d[2] + d[3];
507
508 T positionFactor = 16.*d[0]/l[0]*d[1]/l[0]*d[2]/l[1]*d[3]/l[1]; // between 0 and 1
509
510 output[0] = maxVelocity[0]*positionFactor;
511 output[1] = maxVelocity[1]*positionFactor;
512 output[2] = maxVelocity[2]*positionFactor;
513 return true;
514}
platform_constant Fraction s[Q]
constexpr int d() any_platform
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112
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::fabs(), olb::util::normalize(), and olb::util::pow().

+ Here is the call graph for this function:

Member Data Documentation

◆ clout

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

Definition at line 247 of file frameChangeF3D.h.

◆ maxVelocity

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

Definition at line 251 of file frameChangeF3D.h.

◆ x0

template<typename T >
olb::Vector<T, 3> olb::RectanglePoiseuille3D< T >::x0
protected

Definition at line 248 of file frameChangeF3D.h.

◆ x1

template<typename T >
olb::Vector<T, 3> olb::RectanglePoiseuille3D< T >::x1
protected

Definition at line 249 of file frameChangeF3D.h.

◆ x2

template<typename T >
olb::Vector<T, 3> olb::RectanglePoiseuille3D< T >::x2
protected

Definition at line 250 of file frameChangeF3D.h.


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