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

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

136 :SmoothIndicatorEllipsoid3D(ind.getCenter(), ind.getRadius(), epsilon, theta)
137{ }
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 140 of file smoothIndicatorF3D.hh.

142 :_ind(center, radius)
143{
144 this->_epsilon = epsilon;
145 if constexpr (!PARTICLE) {
146 this->_pos = center;
147 this->_theta = util::degreeToRadian(theta);
148 }
149
150 T const max_axis = util::max( radius[0], util::max(radius[1], radius[2]) );
151 this->_circumRadius = max_axis+0.5*epsilon;
152 if constexpr (!PARTICLE) {
153 this->_myMin = {
154 this->_pos[0] - this->getCircumRadius(),
155 this->_pos[1] - this->getCircumRadius(),
156 this->_pos[2] - this->getCircumRadius()
157 };
158 this->_myMax = {
159 this->_pos[0] + this->getCircumRadius(),
160 this->_pos[1] + this->getCircumRadius(),
161 this->_pos[2] + this->getCircumRadius()
162 };
163 this->init();
164 }
165}
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(), 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)
override

Definition at line 180 of file smoothIndicatorF3D.hh.

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

◆ getIndicator()

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

Definition at line 168 of file smoothIndicatorF3D.hh.

168 {
169 return _ind;
170}

◆ getVolume()

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

Definition at line 173 of file smoothIndicatorF3D.hh.

174{
175 Vector<S,3> const radius = _ind.getRadius();
176 return 4./3.*M_PI*radius[0]*radius[1]*radius[2];
177}
#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[] )
override

Definition at line 217 of file smoothIndicatorF3D.hh.

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

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

202{
203 // counter-clockwise rotation by _theta=-theta around the center of mass
204 Vector<S,3> p;
205 if constexpr(!PARTICLE) {
206 // counter-clockwise rotation by _theta=-theta around the current position of the center of mass & translation
207 p = util::executeRotation<S,3,true>(input, this->_rotMat, this->getPos());
208 }
209 else {
210 p = input;
211 }
212 return _ind.signedDistance(p + _ind.getCenter());
213}

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

Definition at line 195 of file smoothIndicatorF3D.hh.

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

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