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

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

#include <smoothIndicatorF3D.h>

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

Public Member Functions

 SmoothIndicatorCone3D (IndicatorCone3D< S > &indPtr, S epsilon, Vector< S, 3 > theta=Vector< S, 3 >(0., 0., 0.))
 
 SmoothIndicatorCone3D (Vector< S, 3 > center1, Vector< S, 3 > center2, S radius1, S radius2, S epsilon, Vector< S, 3 > theta=Vector< S, 3 >(0., 0., 0.))
 
IndicatorCone3D< 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
 
Vector< S, 3 > calcCenterOfMass () override
 

Detailed Description

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

implements a smooth particle cone in 3D with an _epsilon sector

Definition at line 130 of file smoothIndicatorF3D.h.

Constructor & Destructor Documentation

◆ SmoothIndicatorCone3D() [1/2]

template<typename T , typename S , bool PARTICLE>
olb::SmoothIndicatorCone3D< T, S, PARTICLE >::SmoothIndicatorCone3D ( IndicatorCone3D< S > & indPtr,
S epsilon,
Vector< S, 3 > theta = Vector<S,3> (0.,0.,0.) )

Definition at line 565 of file smoothIndicatorF3D.hh.

566 :SmoothIndicatorCone3D(ind.getCenter1(), ind.getCenter2(), ind.getRadius1(), ind.getRadius2(), epsilon, theta)
567{ }
SmoothIndicatorCone3D(IndicatorCone3D< S > &indPtr, S epsilon, Vector< S, 3 > theta=Vector< S, 3 >(0., 0., 0.))

◆ SmoothIndicatorCone3D() [2/2]

template<typename T , typename S , bool PARTICLE>
olb::SmoothIndicatorCone3D< T, S, PARTICLE >::SmoothIndicatorCone3D ( Vector< S, 3 > center1,
Vector< S, 3 > center2,
S radius1,
S radius2,
S epsilon,
Vector< S, 3 > theta = Vector<S,3> (0.,0.,0.) )

Definition at line 570 of file smoothIndicatorF3D.hh.

571 :_ind(center1, center2, radius1, radius2)
572{
573 this->_epsilon = epsilon;
574 _startPos = this->calcCenterOfMass();
575
576 if constexpr (!PARTICLE) {
577 this->_pos = _startPos;
578 this->_theta = util::degreeToRadian(theta);
579 }
580
581 Vector<T,3> dist = _ind.getCenter2() - _ind.getCenter1();
582 S const length = norm(dist);
583 initIndicatorCone3D(theta, length);
584}
Vector< S, 3 > calcCenterOfMass() override
decltype(Vector< decltype(util::sqrt(T())), D >()) degreeToRadian(const Vector< T, D > &angle)
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
Euclidean vector norm.

References olb::SmoothIndicatorCone3D< T, S, PARTICLE >::calcCenterOfMass(), olb::util::degreeToRadian(), and olb::norm().

+ Here is the call graph for this function:

Member Function Documentation

◆ calcCenterOfMass()

template<typename T , typename S , bool PARTICLE>
Vector< S, 3 > olb::SmoothIndicatorCone3D< T, S, PARTICLE >::calcCenterOfMass ( )
override

Definition at line 660 of file smoothIndicatorF3D.hh.

661{
662 T topRadius, baseRadius;
663 Vector<T,3> centerTop, centerBase;
664
665 if (_ind.getRadius1() < _ind.getRadius2()) {
666 topRadius = _ind.getRadius1();
667 baseRadius = _ind.getRadius2();
668 centerTop = _ind.getCenter1();
669 centerBase = _ind.getCenter2();
670 }
671 else if (_ind.getRadius1() > _ind.getRadius2()) {
672 topRadius = _ind.getRadius2();
673 baseRadius = _ind.getRadius1();
674 centerTop = _ind.getCenter2();
675 centerBase = _ind.getCenter1();
676 }
677 else {
678 std::cerr << "Error calculating a cone's center of mass." << std::endl;
679 assert(false);
680 }
681
682 const T height = norm(centerTop - centerBase);
683 const T centerOfMassHeight = 0.25*height * (baseRadius*baseRadius + 2*baseRadius*topRadius + 3*topRadius*topRadius)
684 / (baseRadius*baseRadius + baseRadius*topRadius + topRadius*topRadius);
685 return centerBase + normalize(centerTop-centerBase) * centerOfMassHeight;
686}
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:245

References olb::norm(), and olb::normalize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calcMofiAndMass()

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

Definition at line 632 of file smoothIndicatorF3D.hh.

633{
634 const T _radiusA = _ind.getRadius1();
635 const T _radiusB = _ind.getRadius2();
636
637 Vector<T,3> dist = _ind.getCenter2() - _ind.getCenter1();
638 S const length = norm(dist);
639
640 const T mass = getVolume()*density;
641 Vector<S,3> mofi;
642
643 //TODO: check for correctness
644 //TODO: Add check that orientation fits or give a warning
645 // This is only valid if the same orientation is chosen. If A and B are not chosen according to this definiton, the calculation will be wrong.
646 T topRadius = _radiusA;
647 T baseRadius = _radiusB;
648 if (_radiusA > _radiusB) {
649 topRadius = _radiusB;
650 baseRadius = _radiusA;
651 }
652 mofi[0] = 3/10.*mass*(util::pow(baseRadius,5) - util::pow(topRadius,5))/(util::pow(baseRadius,3) - util::pow(topRadius,3));
653 mofi[1] = 3/20.*mass*( (util::pow(baseRadius-topRadius, 2) + 4*length*length) * (util::pow(baseRadius,5) - util::pow(topRadius,5)) )
654 / (util::pow(baseRadius-topRadius,3) * (baseRadius*baseRadius+baseRadius*topRadius+topRadius*topRadius));
655 mofi[2] = mofi[1];
656 return Vector<S,4>(mofi[0], mofi[1], mofi[2], mass);
657}
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

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

+ Here is the call graph for this function:

◆ getIndicator()

template<typename T , typename S , bool PARTICLE>
IndicatorCone3D< S > & olb::SmoothIndicatorCone3D< T, S, PARTICLE >::getIndicator ( )

Definition at line 587 of file smoothIndicatorF3D.hh.

587 {
588 return _ind;
589}

◆ getVolume()

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

Definition at line 622 of file smoothIndicatorF3D.hh.

623{
624 const Vector<T,3> dist = _ind.getCenter2() - _ind.getCenter1();
625 S const length = norm(dist);
626 return (1/3.)*M_PI*length* (_ind.getRadius1()*_ind.getRadius1()
627 +_ind.getRadius1()*_ind.getRadius2()
628 +_ind.getRadius2()*_ind.getRadius2());
629}
#define M_PI

References M_PI, and olb::norm().

+ Here is the call graph for this function:

◆ signedDistance()

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

Definition at line 695 of file smoothIndicatorF3D.hh.

696{
697 // counter-clockwise rotation by _theta=-theta around the current position of the center of mass
698 Vector<S,3> p;
699 if constexpr(!PARTICLE) {
700 // counter-clockwise rotation by _theta=-theta around the current position of the center of mass & translation
701 p = util::executeRotation<S,3,true>(input, this->_rotMat, this->getPos());
702 }
703 else {
704 p = input;
705 }
706
707 // moving to indicator coordinate system by adding start position coordinate
708 return _ind.signedDistance(p + _startPos);
709}

◆ surfaceNormal()

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

Definition at line 689 of file smoothIndicatorF3D.hh.

690{
691 return _ind.surfaceNormal(pos, meshSize);
692}

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