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

This functor gives a linar profile in an annulus for a given point x between the inner and outer radius as it computes the distance between x and the inner and outer radius. More...

#include <frameChangeF3D.h>

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

Public Member Functions

 RotatingLinearAnnulus3D (std::vector< T > axisPoint_, std::vector< T > axisDirection_, T w_, T ri_, T ro_, T scale_=1)
 
bool operator() (T output[], const T x[])
 
- 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

std::vector< T > axisPoint
 
std::vector< T > axisDirection
 
w
 
ri
 
ro
 
scale
 

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::RotatingLinearAnnulus3D< T >

This functor gives a linar profile in an annulus for a given point x between the inner and outer radius as it computes the distance between x and the inner and outer radius.

The field in outcome is the velocity field of q rotating solid in an annulus Functor with a linear profile e.g. for rotating velocity fields.

Definition at line 95 of file frameChangeF3D.h.

Constructor & Destructor Documentation

◆ RotatingLinearAnnulus3D()

template<typename T >
olb::RotatingLinearAnnulus3D< T >::RotatingLinearAnnulus3D ( std::vector< T > axisPoint_,
std::vector< T > axisDirection_,
T w_,
T ri_,
T ro_,
T scale_ = 1 )

Definition at line 64 of file frameChangeF3D.hh.

66 : AnalyticalF3D<T,T>(3), axisPoint(axisPoint_), axisDirection(axisDirection_),
67 w(w_), ri(ri_), ro(ro_), scale(scale_) { }

Member Function Documentation

◆ operator()()

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

Definition at line 71 of file frameChangeF3D.hh.

72{
73
74 if ( (util::sqrt((x[0]-axisPoint[0])*(x[0]-axisPoint[0])+(x[1]-axisPoint[1])*(x[1]-axisPoint[1])) < ri) || (util::sqrt((x[0]-axisPoint[0])*(x[0]-axisPoint[0])+(x[1]-axisPoint[1])*(x[1]-axisPoint[1])) >= ro) ) {
75 output[0] = 0.;
76 output[1] = 0.;
77 output[2] = 0.;
78 }
79 else {
80 T L[3];
81 T si[3];
82 T so[3];
83 int sign1 = 1;
84 int sign2 = 1;
85 if ( (axisDirection[2] && (x[0] == axisPoint[0])) || (axisDirection[1] && (x[2] == axisPoint[2])) || (axisDirection[0] && (x[1] == axisPoint[1])) ) {
86 int sign = 1;
87 if ( (axisDirection[2] && (x[1] < axisPoint[1])) || (axisDirection[1] && (x[0] < axisPoint[0])) || (axisDirection[0] && (x[2] < axisPoint[2])) ) {
88 sign = -1;
89 }
90 //Compute point of intersection between the inner cylinder and the line between axisPoint and x
91 si[0] = axisDirection[0]*x[0] + axisDirection[1]*(axisPoint[0]+sign*ri) + axisDirection[2]*x[0];
92 si[1] = axisDirection[0]*x[1] + axisDirection[1]*x[1] + axisDirection[2]*(axisPoint[1]+sign*ri);
93 si[2] = axisDirection[0]*(axisPoint[2]+sign*ri) + axisDirection[1]*x[2] + axisDirection[2]*x[2];
94 //Compute point of intersection between the outer cylinder and the line between axisPoint and x
95 so[0] = axisDirection[0]*x[0] + axisDirection[1]*(axisPoint[0]+sign*ro) + axisDirection[2]*x[0];
96 so[1] = axisDirection[0]*x[1] + axisDirection[1]*x[1] + axisDirection[2]*(axisPoint[1]+sign*ro);
97 so[2] = axisDirection[0]*(axisPoint[2]+sign*ro) + axisDirection[1]*x[2] + axisDirection[2]*x[2];
98 }
99 else {
100 T alpha;
101 //which quadrant
102 if ( (axisDirection[2] && (x[0] < axisPoint[0])) || (axisDirection[1] && (x[2] < axisPoint[2])) || (axisDirection[0] && (x[1] < axisPoint[1])) ) {
103 sign1 = -1;
104 }
105 if ( (axisDirection[2] && (x[1] < axisPoint[1])) || (axisDirection[1] && (x[0] < axisPoint[0])) || (axisDirection[0] && (x[2] < axisPoint[2])) ) {
106 sign2 = -1;
107 }
108 alpha = util::atan( ( sign2*(axisDirection[0]*(x[2]-axisPoint[2]) + axisDirection[1]*(x[0]-axisPoint[0]) + axisDirection[2]*(x[1]-axisPoint[1]) ) ) / \
109 (sign1*(axisDirection[0]*(x[1]-axisPoint[1]) + axisDirection[1]*(x[2]-axisPoint[2]) + axisDirection[2]*(x[0]-axisPoint[0]))) );
110 si[0] = axisDirection[0]*x[0] + axisDirection[1]*sign2*util::sin(alpha)*ri + axisDirection[2]*sign1*util::cos(alpha)*ri;
111 si[1] = axisDirection[0]*sign1*util::cos(alpha)*ri + axisDirection[1]*x[1] + axisDirection[2]*sign2*util::sin(alpha)*ri;
112 si[2] = axisDirection[0]*sign2*util::sin(alpha)*ri + axisDirection[1]*sign1*util::cos(alpha)*ri + axisDirection[2]*x[2];
113 so[0] = axisDirection[0]*x[0] + axisDirection[1]*sign2*util::sin(alpha)*ro + axisDirection[2]*sign1*util::cos(alpha)*ro;
114 so[1] = axisDirection[0]*sign1*util::cos(alpha)*ro + axisDirection[1]*x[1] + axisDirection[2]*sign2*util::sin(alpha)*ro;
115 so[2] = axisDirection[0]*sign2*util::sin(alpha)*ro + axisDirection[1]*sign1*util::cos(alpha)*ro + axisDirection[2]*x[2];
116 }
117
118 //Compute difference of intersections in all directions
119 L[0] = so[0]-si[0];
120 L[1] = so[1]-si[1];
121 L[2] = so[2]-si[2];
122 bool b0 = (L[0] == 0.);
123 bool b1 = (L[1] == 0.);
124 bool b2 = (L[2] == 0.);
125
126 output[0] = ((axisDirection[1]*(axisPoint[2]-si[2]) - axisDirection[2]*(axisPoint[1]-si[1])) *
127 (1 - (axisDirection[1]*(x[2]-si[2])/(L[2]+b2) + axisDirection[2]*(x[1]-si[1])/(L[1]+b1))) )*w*scale;
128 output[1] = ((axisDirection[2]*(axisPoint[0]-si[0]) - axisDirection[0]*(axisPoint[2]-si[2])) *
129 (1 - (axisDirection[2]*(x[0]-si[0])/(L[0]+b0) + axisDirection[0]*(x[2]-si[2])/(L[2]+b2))) )*w*scale;
130 output[2] = ((axisDirection[0]*(axisPoint[1]-si[1]) - axisDirection[1]*(axisPoint[0]-si[0])) *
131 (1 - (axisDirection[0]*(x[1]-si[1])/(L[1]+b1) + axisDirection[1]*(x[0]-si[0])/(L[0]+b0))) )*w*scale;
132
133 }
134 return true;
135}
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100
ADf< T, DIM > sin(const ADf< T, DIM > &a)
Definition aDiff.h:569
int sign(T val)
Definition util.h:54
ADf< T, DIM > atan(const ADf< T, DIM > &a)
Definition aDiff.h:614
ADf< T, DIM > cos(const ADf< T, DIM > &a)
Definition aDiff.h:578

References olb::util::atan(), olb::util::cos(), olb::util::sin(), and olb::util::sqrt().

+ Here is the call graph for this function:

Member Data Documentation

◆ axisDirection

template<typename T >
std::vector<T> olb::RotatingLinearAnnulus3D< T >::axisDirection
protected

Definition at line 98 of file frameChangeF3D.h.

◆ axisPoint

template<typename T >
std::vector<T> olb::RotatingLinearAnnulus3D< T >::axisPoint
protected

Definition at line 97 of file frameChangeF3D.h.

◆ ri

template<typename T >
T olb::RotatingLinearAnnulus3D< T >::ri
protected

Definition at line 100 of file frameChangeF3D.h.

◆ ro

template<typename T >
T olb::RotatingLinearAnnulus3D< T >::ro
protected

Definition at line 101 of file frameChangeF3D.h.

◆ scale

template<typename T >
T olb::RotatingLinearAnnulus3D< T >::scale
protected

Definition at line 102 of file frameChangeF3D.h.

◆ w

template<typename T >
T olb::RotatingLinearAnnulus3D< T >::w
protected

Definition at line 99 of file frameChangeF3D.h.


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