OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::SmoothIndicatorSuperEllipsoid3D< T, S, PARTICLE > Class Template Referencefinal

implements a smooth particle super-ellipsoid in 3D. The epsilon sector is currently missing. More...

#include <smoothIndicatorF3D.h>

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

Public Member Functions

 SmoothIndicatorSuperEllipsoid3D (IndicatorSuperEllipsoid3D< S > &ind, S epsilon, Vector< S, 3 > theta=Vector< S, 3 >(0., 0., 0.))
 
 SmoothIndicatorSuperEllipsoid3D (Vector< S, 3 > center, S xHalfAxis, S yHalfAxis, S zHalfAxis, S exponent1, S exponent2, S epsilon, Vector< S, 3 > theta=Vector< S, 3 >(0., 0., 0.))
 
IndicatorSuperEllipsoid3D< S > & getIndicator ()
 
beta (S arg1, S arg2)
 
moments (S p, S q, S r)
 
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
 

Detailed Description

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

implements a smooth particle super-ellipsoid in 3D. The epsilon sector is currently missing.

Definition at line 76 of file smoothIndicatorF3D.h.

Constructor & Destructor Documentation

◆ SmoothIndicatorSuperEllipsoid3D() [1/2]

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

Definition at line 261 of file smoothIndicatorF3D.hh.

263 :SmoothIndicatorSuperEllipsoid3D(ind.getCenter(), ind.getXHalfAxis(), ind.getYHalfAxis(), ind.getZHalfAxis(), ind.getExponent1(), ind.getExponent2(), epsilon, theta)
264{ }
SmoothIndicatorSuperEllipsoid3D(IndicatorSuperEllipsoid3D< S > &ind, S epsilon, Vector< S, 3 > theta=Vector< S, 3 >(0., 0., 0.))

◆ SmoothIndicatorSuperEllipsoid3D() [2/2]

template<typename T , typename S , bool PARTICLE>
olb::SmoothIndicatorSuperEllipsoid3D< T, S, PARTICLE >::SmoothIndicatorSuperEllipsoid3D ( Vector< S, 3 > center,
S xHalfAxis,
S yHalfAxis,
S zHalfAxis,
S exponent1,
S exponent2,
S epsilon,
Vector< S, 3 > theta = Vector<S,3> (0.,0.,0.) )

Definition at line 267 of file smoothIndicatorF3D.hh.

270 :_ind(center, xHalfAxis, yHalfAxis, zHalfAxis, exponent1, exponent2)
271{
272 this->_epsilon = epsilon;
273 if constexpr (!PARTICLE) {
274 this->_pos = _ind.getCenter();
275 this->_theta = util::degreeToRadian(theta);
276 }
277
278 T const max_axis = util::max( xHalfAxis, util::max(yHalfAxis, zHalfAxis) );
279 this->_circumRadius = util::sqrt(2.)*max_axis+0.5*epsilon;
280 if constexpr (!PARTICLE) {
281 this->_myMin = {
282 this->_pos[0] - this->getCircumRadius(),
283 this->_pos[1] - this->getCircumRadius(),
284 this->_pos[2] - this->getCircumRadius()
285 };
286 this->_myMax = {
287 this->_pos[0] + this->getCircumRadius(),
288 this->_pos[1] + this->getCircumRadius(),
289 this->_pos[2] + this->getCircumRadius()
290 };
291 this->init();
292 }
293}
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100
cpu::simd::Pack< T > max(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:130
decltype(Vector< decltype(util::sqrt(T())), D >()) degreeToRadian(const Vector< T, D > &angle)

References olb::util::degreeToRadian(), olb::util::max(), and olb::util::sqrt().

+ Here is the call graph for this function:

Member Function Documentation

◆ beta()

template<typename T , typename S , bool PARTICLE>
S olb::SmoothIndicatorSuperEllipsoid3D< T, S, PARTICLE >::beta ( S arg1,
S arg2 )

Definition at line 318 of file smoothIndicatorF3D.hh.

319{
320 return (std::tgamma(arg1)*std::tgamma(arg2)) / std::tgamma(arg1+arg2);
321}

◆ calcMofiAndMass()

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

Definition at line 307 of file smoothIndicatorF3D.hh.

308{
309 T const mass = getVolume() * density;
310 Vector<S,3> mofi;
311 mofi[0] = ( moments(0., 2., 0.) + moments(0., 0., 2.) ) * density;
312 mofi[1] = ( moments(2., 0., 0.) + moments(0., 0., 2.) ) * density;
313 mofi[2] = ( moments(0., 2., 0.) + moments(2., 0., 0.) ) * density;
314 return Vector<S,4>(mofi[0], mofi[1], mofi[2], mass);
315}

◆ getIndicator()

template<typename T , typename S , bool PARTICLE>
IndicatorSuperEllipsoid3D< S > & olb::SmoothIndicatorSuperEllipsoid3D< T, S, PARTICLE >::getIndicator ( )

Definition at line 296 of file smoothIndicatorF3D.hh.

296 {
297 return _ind;
298}

◆ getVolume()

template<typename T , typename S , bool PARTICLE>
S olb::SmoothIndicatorSuperEllipsoid3D< T, S, PARTICLE >::getVolume ( )
override

Definition at line 301 of file smoothIndicatorF3D.hh.

302{
303 return moments(0., 0., 0.);
304}

◆ moments()

template<typename T , typename S , bool PARTICLE>
S olb::SmoothIndicatorSuperEllipsoid3D< T, S, PARTICLE >::moments ( S p,
S q,
S r )

Definition at line 324 of file smoothIndicatorF3D.hh.

325{
326 S ex1 = 2./_ind.getExponent1();
327 S ex2 = 2./_ind.getExponent2();
328 S tmp1 = 2./(p+q+2.);
329 S tmp2 = util::pow(_ind.getXHalfAxis(), p+1.) * util::pow(_ind.getYHalfAxis(), q+1.) * util::pow(_ind.getZHalfAxis(), r+1.) * ex1 * ex2;
330 S tmp3 = beta( (r+1.)*(ex1/2.), (p+q+2.)*(ex2/2.)+1. ) * beta( (q+1.)*(ex2/2.), (p+1.)*(ex2/2.) );
331 return tmp1 * tmp2 * tmp3;
332}
constexpr int q() any_platform
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

References olb::util::pow().

+ Here is the call graph for this function:

◆ operator()()

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

Definition at line 356 of file smoothIndicatorF3D.hh.

357{
358 Vector<T,3> pos(0.);
359 Vector<T,9> rotMatrix = {1, 0, 0, 0, 1, 0, 0, 0, 1};
360 if constexpr (!PARTICLE) {
361 pos = this->getPos();
362 rotMatrix = this->getRotationMatrix();
363 }
364
365 //1.Calculate distance between point and center of unrotated indicator
366 T xDist = input[0] - pos[0];
367 T yDist = input[1] - pos[1];
368 T zDist = input[2] - pos[2];
369
370 //2.Calculate point projected to rotated indicator
371 // counter-clockwise rotation by _theta=-theta around center
372 T x = pos[0] + rotMatrix[0]*xDist + rotMatrix[3]*yDist + rotMatrix[6]*zDist;
373 T y = pos[1] + rotMatrix[1]*xDist + rotMatrix[4]*yDist + rotMatrix[7]*zDist;
374 T z = pos[2] + rotMatrix[2]*xDist + rotMatrix[5]*yDist + rotMatrix[8]*zDist;
375
376 T a = util::pow ( util::abs( (x-pos[0]) / _ind.getXHalfAxis() ), _ind.getExponent1() );
377 T b = util::pow ( util::abs( (y-pos[1]) / _ind.getYHalfAxis() ), _ind.getExponent1() );
378 T c = util::pow ( util::abs( (z-pos[2]) / _ind.getZHalfAxis() ), _ind.getExponent2() );
379 T ab = util::pow( a+b, _ind.getExponent2()/_ind.getExponent1() );
380
381 if ( (ab+c) <= 1. ) {
382 output[0] = 1.;
383 return true;
384 }
385
386 output[0] = 0.;
387 return false;
388}
platform_constant int c[Q][D]
Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::matrix > getRotationMatrix(Particle< T, PARTICLETYPE > particle)
ADf< T, DIM > abs(const ADf< T, DIM > &a)
Definition aDiff.h:1019

References olb::util::abs(), and olb::util::pow().

+ Here is the call graph for this function:

◆ signedDistance()

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

Definition at line 341 of file smoothIndicatorF3D.hh.

342{
343 // counter-clockwise rotation by _theta=-theta around the center of mass
344 Vector<S,3> p;
345 if constexpr(!PARTICLE) {
346 // counter-clockwise rotation by _theta=-theta around the current position of the center of mass & translation
347 p = util::executeRotation<S,3,true>(input, this->_rotMat, this->getPos());
348 }
349 else {
350 p = input;
351 }
352 return _ind.signedDistance(p + _ind.getCenter());
353}

◆ surfaceNormal()

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

Definition at line 335 of file smoothIndicatorF3D.hh.

336{
337 return _ind.surfaceNormal(pos, meshSize);
338}

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