OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
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
 

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 715 of file smoothIndicatorF3D.hh.

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

References olb::util::degreeToRadian().

+ 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 807 of file smoothIndicatorF3D.hh.

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

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

+ 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 878 of file smoothIndicatorF3D.hh.

879{
880 return this->_center;
881}

◆ getVolume()

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

Definition at line 801 of file smoothIndicatorF3D.hh.

802{
803 return _volume;
804}

◆ operator()()

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

Definition at line 932 of file smoothIndicatorF3D.hh.

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

References 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 926 of file smoothIndicatorF3D.hh.

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

◆ 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 897 of file smoothIndicatorF3D.hh.

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

References olb::util::abs(), olb::Vector< T, D >::data(), 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 )
override

Definition at line 884 of file smoothIndicatorF3D.hh.

885{
886 return _indPtr->surfaceNormal(pos, meshSize);
887}

◆ 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 )
override

Definition at line 890 of file smoothIndicatorF3D.hh.

892{
893 return _indPtr->surfaceNormal( pos, meshSize, transformPos );
894}

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