OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE > Class Template Referencefinal

implements a smooth particle ellipsoid in 3D with an _epsilon sector. More...

#include <smoothIndicatorF3D.h>

+ Inheritance diagram for olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >:
+ Collaboration diagram for olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >:

Public Member Functions

 SmoothIndicatorEllipsoid3D (IndicatorEllipsoid3D< S > &ind, S epsilon, Vector< S, 3 > theta=Vector< S, 3 >(0., 0., 0.))
 
 SmoothIndicatorEllipsoid3D (Vector< S, 3 > center, Vector< S, 3 > radius, S epsilon, Vector< S, 3 > theta=Vector< S, 3 >(0., 0., 0.))
 
IndicatorEllipsoid3D< S > & getIndicator ()
 
Vector< S, 3 > surfaceNormal (const Vector< S, 3 > &pos, const S meshSize) override
 
const S signedDistance (const PhysR< S, 3 > input) override
 
getVolume () override
 
Vector< S, 4 > calcMofiAndMass (const S density) override
 
bool operator() (T output[], const S input[]) override
 has to be implemented for 'every' derived class
 
- Public Member Functions inherited from olb::SmoothIndicatorF3D< T, S, false >
void init ()
 
const Vector< S, 3 > & getMin () const
 
const Vector< S, 3 > & getMax () const
 
const Vector< S, 3 > & getPos () const
 
const Vector< S, 9 > & getRotationMatrix () const
 
const Vector< S, 3 > & getTheta () const
 
const S & getCircumRadius () const
 
const S & getEpsilon () const
 
std::string name ()
 
void setPos (Vector< S, 3 > pos)
 
void setTheta (Vector< S, 3 > theta)
 
void setEpsilon (S epsilon)
 
virtual Vector< S, 3 > calcCenterOfMass ()
 
virtual Vector< S, 3 > surfaceNormal (const Vector< S, 3 > &pos, const S meshSize, std::function< Vector< S, 3 >(const Vector< S, 3 > &)> transformPos)
 
virtual const S signedDistance (const PhysR< T, 3 > input)
 
virtual bool distance (S &distance, const Vector< S, 3 > &origin, const Vector< S, 3 > &direction, S precision, S pitch)
 
bool isInsideCircumRadius (const PhysR< S, 3 > &input)
 
SmoothIndicatorF3D< T, S, false > & operator+ (SmoothIndicatorF3D< T, S, false > &rhs)
 
- 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
 
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)
 

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::SmoothIndicatorF3D< T, S, false >
 SmoothIndicatorF3D ()
 
- 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 inherited from olb::SmoothIndicatorF3D< T, S, false >
Vector< S, 3 > _myMin
 
Vector< S, 3 > _myMax
 
Vector< S, 3 > _pos
 
Vector< S, 9 > _rotMat
 
_circumRadius
 
Vector< S, 3 > _theta
 
_epsilon
 
std::string _name = "smoothIndicator3D"
 

Detailed Description

template<typename T, typename S, bool PARTICLE = false>
class olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >

implements a smooth particle ellipsoid in 3D with an _epsilon sector.

Definition at line 59 of file smoothIndicatorF3D.h.

Constructor & Destructor Documentation

◆ SmoothIndicatorEllipsoid3D() [1/2]

template<typename T , typename S , bool PARTICLE>
olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >::SmoothIndicatorEllipsoid3D ( IndicatorEllipsoid3D< S > & ind,
S epsilon,
Vector< S, 3 > theta = Vector<S,3> (0.,0.,0.) )

Definition at line 133 of file smoothIndicatorF3D.hh.

135 :SmoothIndicatorEllipsoid3D(ind.getCenter(), ind.getRadius(), epsilon, theta)
136{ }
SmoothIndicatorEllipsoid3D(IndicatorEllipsoid3D< S > &ind, S epsilon, Vector< S, 3 > theta=Vector< S, 3 >(0., 0., 0.))

◆ SmoothIndicatorEllipsoid3D() [2/2]

template<typename T , typename S , bool PARTICLE>
olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >::SmoothIndicatorEllipsoid3D ( Vector< S, 3 > center,
Vector< S, 3 > radius,
S epsilon,
Vector< S, 3 > theta = Vector<S,3> (0.,0.,0.) )

Definition at line 139 of file smoothIndicatorF3D.hh.

141 :_ind(center, radius)
142{
143 this->_epsilon = epsilon;
144 if constexpr (!PARTICLE) {
145 this->_pos = center;
146 this->_theta = util::degreeToRadian(theta);
147 }
148
149 T const max_axis = util::max( radius[0], util::max(radius[1], radius[2]) );
150 this->_circumRadius = max_axis+0.5*epsilon;
151 if constexpr (!PARTICLE) {
152 this->_myMin = {
153 this->_pos[0] - this->getCircumRadius(),
154 this->_pos[1] - this->getCircumRadius(),
155 this->_pos[2] - this->getCircumRadius()
156 };
157 this->_myMax = {
158 this->_pos[0] + this->getCircumRadius(),
159 this->_pos[1] + this->getCircumRadius(),
160 this->_pos[2] + this->getCircumRadius()
161 };
162 this->init();
163 }
164}
Expr max(Expr a, Expr b)
Definition expr.cpp:245
decltype(Vector< decltype(util::sqrt(T())), D >()) degreeToRadian(const Vector< T, D > &angle)

References olb::SmoothIndicatorF3D< T, S, false >::_circumRadius, olb::SmoothIndicatorF3D< T, S, false >::_epsilon, olb::SmoothIndicatorF3D< T, S, false >::_myMax, olb::SmoothIndicatorF3D< T, S, false >::_myMin, olb::SmoothIndicatorF3D< T, S, false >::_pos, olb::SmoothIndicatorF3D< T, S, false >::_theta, olb::util::degreeToRadian(), olb::SmoothIndicatorF3D< T, S, false >::getCircumRadius(), olb::SmoothIndicatorF3D< T, S, false >::init(), and olb::util::max().

+ Here is the call graph for this function:

Member Function Documentation

◆ calcMofiAndMass()

template<typename T , typename S , bool PARTICLE>
Vector< S, 4 > olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >::calcMofiAndMass ( const S density)
overridevirtual

Reimplemented from olb::SmoothIndicatorF3D< T, S, false >.

Definition at line 179 of file smoothIndicatorF3D.hh.

180{
181 Vector<S,3> const radius = _ind.getRadius();
182 T const mass = getVolume()*density;
183 T const xHalfAxis2 = radius[0]*radius[0];
184 T const yHalfAxis2 = radius[1]*radius[1];
185 T const zHalfAxis2 = radius[2]*radius[2];
186 Vector<S,3> mofi;
187 mofi[0] = 0.2*mass*(yHalfAxis2+zHalfAxis2);
188 mofi[1] = 0.2*mass*(xHalfAxis2+zHalfAxis2);
189 mofi[2] = 0.2*mass*(yHalfAxis2+xHalfAxis2);
190 return Vector<S,4>(mofi[0], mofi[1], mofi[2], mass);
191}

◆ getIndicator()

template<typename T , typename S , bool PARTICLE>
IndicatorEllipsoid3D< S > & olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >::getIndicator ( )

Definition at line 167 of file smoothIndicatorF3D.hh.

167 {
168 return _ind;
169}

◆ getVolume()

template<typename T , typename S , bool PARTICLE>
S olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >::getVolume ( )
overridevirtual

Reimplemented from olb::SmoothIndicatorF3D< T, S, false >.

Definition at line 172 of file smoothIndicatorF3D.hh.

173{
174 Vector<S,3> const radius = _ind.getRadius();
175 return 4./3.*M_PI*radius[0]*radius[1]*radius[2];
176}
#define M_PI

References M_PI.

◆ operator()()

template<typename T , typename S , bool PARTICLE>
bool olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >::operator() ( T output[],
const S input[] )
overridevirtual

has to be implemented for 'every' derived class

Reimplemented from olb::SmoothIndicatorF3D< T, S, false >.

Definition at line 216 of file smoothIndicatorF3D.hh.

217{
218 Vector<T,3> pos(0.);
219 Vector<T,9> rotMatrix = {1, 0, 0, 0, 1, 0, 0, 0, 1};
220 if constexpr (!PARTICLE) {
221 pos = this->getPos();
222 rotMatrix = this->getRotationMatrix();
223 }
224
225 //1.Calculate distance between point and center of unrotated indicator
226 T xDist = input[0] - pos[0];
227 T yDist = input[1] - pos[1];
228 T zDist = input[2] - pos[2];
229
230 //2.Calculate point projected to rotated indicator
231 // counter-clockwise rotation by _theta=-theta around center
232 T x = pos[0] + rotMatrix[0]*xDist + rotMatrix[3]*yDist + rotMatrix[6]*zDist;
233 T y = pos[1] + rotMatrix[1]*xDist + rotMatrix[4]*yDist + rotMatrix[7]*zDist;
234 T z = pos[2] + rotMatrix[2]*xDist + rotMatrix[5]*yDist + rotMatrix[8]*zDist;
235
236 T a = (x - pos[0]) / (_ind.getRadius()[0] - 0.5*this->getEpsilon() );
237 T b = (y - pos[1]) / (_ind.getRadius()[1] - 0.5*this->getEpsilon() );
238 T c = (z - pos[2]) / (_ind.getRadius()[2] - 0.5*this->getEpsilon() );
239 T aEps = (x - pos[0]) / (_ind.getRadius()[0] + 0.5*this->getEpsilon() );
240 T bEps = (y - pos[1]) / (_ind.getRadius()[1] + 0.5*this->getEpsilon() );
241 T cEps = (z - pos[2]) / (_ind.getRadius()[2] + 0.5*this->getEpsilon() );
242
243 if ( (a*a+b*b+c*c) <= 1. ) {
244 output[0] = 1.;
245 return true;
246 }
247 if ( (aEps*aEps+bEps*bEps+cEps*cEps) <= 1. ) {
248 // TODO: Here the correct distance to the ellipsoid has to be calculated for smooth transition
249 // For now the epsilon region is taken to be 0.5
250 output[0] = .5;
251 return true;
252 }
253 output[0] = 0.;
254 return false;
255}
const Vector< S, 9 > & getRotationMatrix() const
platform_constant int c[Q][D]
Definition functions.h:57
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>

◆ signedDistance()

template<typename T , typename S , bool PARTICLE>
const S olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >::signedDistance ( const PhysR< S, 3 > input)
override

Definition at line 200 of file smoothIndicatorF3D.hh.

201{
202 // counter-clockwise rotation by _theta=-theta around the center of mass
203 Vector<S,3> p;
204 if constexpr(!PARTICLE) {
205 // counter-clockwise rotation by _theta=-theta around the current position of the center of mass & translation
206 p = util::executeRotation<S,3,true>(input, this->_rotMat, this->getPos());
207 }
208 else {
209 p = input;
210 }
211 return _ind.signedDistance(p + _ind.getCenter());
212}
Vector< T, D > executeRotation(const Vector< T, D > &input, const Vector< T, utilities::dimensions::convert< D >::matrix > &rotationMatrix, const Vector< T, D > &rotationCenter=Vector< T, D >(0.))
Rotates the input around the rotationCenter with a given rotationMatrix.

References olb::util::executeRotation().

+ Here is the call graph for this function:

◆ surfaceNormal()

template<typename T , typename S , bool PARTICLE>
Vector< S, 3 > olb::SmoothIndicatorEllipsoid3D< T, S, PARTICLE >::surfaceNormal ( const Vector< S, 3 > & pos,
const S meshSize )
overridevirtual

Reimplemented from olb::SmoothIndicatorF3D< T, S, false >.

Definition at line 194 of file smoothIndicatorF3D.hh.

195{
196 return _ind.surfaceNormal(pos, meshSize);
197}

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