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

#include <smoothIndicatorF3D.h>

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

Public Member Functions

 SmoothIndicatorCustom3D (T latticeSpacing, std::shared_ptr< IndicatorF3D< T > > indPtr, Vector< T, 3 > pos, T epsilon, Vector< T, 3 > theta=Vector< T, 3 >(0.))
 
Vector< T, 3 > getLocalCenter ()
 
getVolume () override
 
Vector< T, 4 > calcMofiAndMass (T rhoP) override
 
Vector< S, 3 > surfaceNormal (const Vector< S, 3 > &pos, const S meshSize) override
 
Vector< S, 3 > surfaceNormal (const Vector< S, 3 > &pos, const S meshSize, std::function< Vector< S, 3 >(const Vector< S, 3 > &)> transformPos) override
 
const S signedDistance (const PhysR< S, 3 > input) override
 
bool regardCell (int input[3])
 
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, 4 > calcMofiAndMass (S density)
 
virtual Vector< S, 3 > calcCenterOfMass ()
 
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::SmoothIndicatorCustom3D< T, S, PARTICLE >

Definition at line 155 of file smoothIndicatorF3D.h.

Constructor & Destructor Documentation

◆ SmoothIndicatorCustom3D()

template<typename T , typename S , bool PARTICLE>
olb::SmoothIndicatorCustom3D< T, S, PARTICLE >::SmoothIndicatorCustom3D ( T latticeSpacing,
std::shared_ptr< IndicatorF3D< T > > indPtr,
Vector< T, 3 > pos,
T epsilon,
Vector< T, 3 > theta = Vector<T,3>(0.) )

Definition at line 714 of file smoothIndicatorF3D.hh.

719 : _indPtr(indPtr),
720 _latticeSpacing(latticeSpacing),
721 _center(3)
722{
723 OstreamManager clout(std::cout,"createIndicatorCustom3D");
724 this->_name = "custom3D";
725 this->_epsilon = epsilon;
726 if constexpr (!PARTICLE) {
727 this->_pos = pos; // global position of the local center
728 this->_theta = util::degreeToRadian(theta);
729 this->init();
730 }
731
732 initBlockData(*indPtr);
733
734 // calculate mass and centerpoint for rotation
735 calcCenter();
736 // calculate min and max from circumRadius
737 calcCircumRadius();
738}
decltype(Vector< decltype(util::sqrt(T())), D >()) degreeToRadian(const Vector< T, D > &angle)

References olb::SmoothIndicatorF3D< T, S, false >::_epsilon, olb::SmoothIndicatorF3D< T, S, false >::_name, olb::SmoothIndicatorF3D< T, S, false >::_pos, olb::SmoothIndicatorF3D< T, S, false >::_theta, olb::util::degreeToRadian(), and olb::SmoothIndicatorF3D< T, S, false >::init().

+ Here is the call graph for this function:

Member Function Documentation

◆ calcMofiAndMass()

template<typename T , typename S , bool PARTICLE>
Vector< T, 4 > olb::SmoothIndicatorCustom3D< T, S, PARTICLE >::calcMofiAndMass ( T rhoP)
override

Definition at line 806 of file smoothIndicatorF3D.hh.

807{
808 // TODO - calculation
809 T cuboidMofi = util::pow(this->_latticeSpacing, 2)/ 6.0; // Single cuboid mofi at center of gravity
810 unsigned nCells = 0;
811 Vector<T,3> mofi = {T(0), T(0), T(0)};
812 T dx, dy, dz;
813 int input[3];
814 for (input[0] = 0; input[0] < this->_blockData->getNx(); ++input[0]) {
815 dx = util::abs(this->_latticeSpacing*input[0] - this->_center[0]);
816 for (input[1] = 0; input[1] < this->_blockData->getNy(); ++input[1]) {
817 dy = util::abs(this->_latticeSpacing*input[1] - this->_center[1]);
818 for (input[2] = 0; input[2] < this->_blockData->getNz(); ++input[2]) {
819 if (regardCell(input)) {
820 dz = util::abs(this->_latticeSpacing*input[2] - this->_center[2]);
821 mofi[0] += (dy*dy+dz*dz+cuboidMofi);
822 mofi[1] += (dx*dx+dz*dz+cuboidMofi);
823 mofi[2] += (dx*dx+dy*dy+cuboidMofi);
824 ++nCells;
825 }
826 }
827 }
828 }
829 _volume = nCells * util::pow(_latticeSpacing,3);
830 const T mass = rhoP * _volume;
831 const T cuboidMass = mass/nCells;
832 mofi *= cuboidMass;
833
834 return Vector<T,4>(mofi[0], mofi[1], mofi[2], mass);
835}
ADf< T, DIM > abs(const ADf< T, DIM > &a)
Definition aDiff.h:1019
Expr pow(Expr base, Expr exp)
Definition expr.cpp:235
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>

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

+ Here is the call graph for this function:

◆ getLocalCenter()

template<typename T , typename S , bool PARTICLE>
Vector< T, 3 > olb::SmoothIndicatorCustom3D< T, S, PARTICLE >::getLocalCenter ( )

Definition at line 877 of file smoothIndicatorF3D.hh.

878{
879 return this->_center;
880}

◆ getVolume()

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

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

Definition at line 800 of file smoothIndicatorF3D.hh.

801{
802 return _volume;
803}

◆ operator()()

template<typename T , typename S , bool PARTICLE>
bool olb::SmoothIndicatorCustom3D< 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 931 of file smoothIndicatorF3D.hh.

932{
933 PhysR<T,3> pos(input[0], input[1], input[2]);
934 if constexpr(!PARTICLE) {
935 if(norm(this->getPos() - pos) > this->_circumRadius) {
936 output[0] = T{0};
937 return false;
938 }
939 pos = util::executeRotation<S,3,true>(pos, this->_rotMat, this->getPos());
940 }
941 if(norm(pos) < this->_circumRadius) {
942 return SmoothIndicatorF3D<T, S, PARTICLE>::operator()(output, input);
943 }
944 output[0] = T{0};
945 return false;
946}
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.
Vector< T, D > PhysR
Type for spatial (physical) coordinates.
constexpr T norm(const ScalarVector< T, D, IMPL > &a) any_platform
Euclidean vector norm.

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

+ Here is the call graph for this function:

◆ regardCell()

template<typename T , typename S , bool PARTICLE>
bool olb::SmoothIndicatorCustom3D< T, S, PARTICLE >::regardCell ( int input[3])

Definition at line 925 of file smoothIndicatorF3D.hh.

926{
927 return this->_blockData->get(input) < std::numeric_limits<T>::epsilon();
928}

◆ signedDistance()

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

Definition at line 896 of file smoothIndicatorF3D.hh.

897{
898 PhysR<T,3> position = input;
899 if constexpr (!PARTICLE) {
900 // translation, counter-clockwise rotation by _theta=-theta around (0/0) and movement from rotation center to local center
901 position = util::executeRotation<T,3,true>(input, this->_rotMat, this->getPos());
902 }
903 // The block data originates in (0,0,0) therefore we translate the input position which is relative to center of mass
904 const PhysR<T,3> positionInCache = this->_center + position;
905
906 T signedDistance(0.);
907 if(_interpolateCache->operator()(&signedDistance, positionInCache.data())) {
908 return signedDistance;
909 }
910
911 // If all points were outside return an estimation instead
912 LatticeR<3> latticePosition;
913 PhysR<T,3> extraDistance;
914 for(unsigned iDim=0; iDim<3; ++iDim) {
915 latticePosition[iDim] = util::round( positionInCache[iDim] / this->_latticeSpacing );
916 latticePosition[iDim] = util::max(0, latticePosition[iDim]);
917 latticePosition[iDim] = util::min(this->_blockData->getExtent()[iDim] - 1, latticePosition[iDim]);
918 // The extra distance is always positive because it must be outside the geometry
919 extraDistance[iDim] = util::abs(_latticeSpacing * latticePosition[iDim] - positionInCache[iDim]);
920 }
921 return this->_blockData->get(latticePosition.data()) + norm(extraDistance);
922}
const S signedDistance(const PhysR< S, 3 > input) override
Expr min(Expr a, Expr b)
Definition expr.cpp:249
Expr max(Expr a, Expr b)
Definition expr.cpp:245
ADf< T, DIM > round(const ADf< T, DIM > &a)
Definition aDiff.h:928
Vector< std::int32_t, D > LatticeR
Type for spatial block-local lattice coordinates.

References olb::util::abs(), olb::Vector< T, Size >::data(), olb::util::executeRotation(), olb::util::max(), olb::util::min(), olb::norm(), and olb::util::round().

+ Here is the call graph for this function:

◆ surfaceNormal() [1/2]

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

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

Definition at line 883 of file smoothIndicatorF3D.hh.

884{
885 return _indPtr->surfaceNormalExact(pos, meshSize);
886}

◆ surfaceNormal() [2/2]

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

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

Definition at line 889 of file smoothIndicatorF3D.hh.

891{
892 return _indPtr->surfaceNormalExact( pos, meshSize, transformPos );
893}

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