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

factorizable output smooth cuboid in 2D with a tangiant or ramp epsilon sector More...

#include <smoothIndicatorF2D.h>

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

Public Member Functions

 SmoothIndicatorFactoredCuboid2D (Vector< S, 2 > center, S xLength, S yLength, S epsilon, S density=0, Vector< S, 2 > vel=Vector< S, 2 >(0., 0.), S omega=0, S factor=1.)
 
bool operator() (T output[], const S input[]) override
 
Vector< S, 2 > calcMofiAndMass (const S density) override
 

Detailed Description

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

factorizable output smooth cuboid in 2D with a tangiant or ramp epsilon sector

Definition at line 186 of file smoothIndicatorF2D.h.

Constructor & Destructor Documentation

◆ SmoothIndicatorFactoredCuboid2D()

template<typename T , typename S , bool PARTICLE>
olb::SmoothIndicatorFactoredCuboid2D< T, S, PARTICLE >::SmoothIndicatorFactoredCuboid2D ( Vector< S, 2 > center,
S xLength,
S yLength,
S epsilon,
S density = 0,
Vector< S, 2 > vel = Vector<S,2> (0.,0.),
S omega = 0,
S factor = 1. )

Definition at line 596 of file smoothIndicatorF2D.hh.

597 : _xLength(xLength), _yLength(yLength), _factor(factor)
598{
599 this->_epsilon = epsilon;
600 if constexpr (!PARTICLE) {
601 this->_pos = center;
602 }
603
604 this->_circumRadius = .5*(util::sqrt(util::pow( xLength, 2)+util::pow( yLength, 2))) + 0.5*epsilon;
605 if constexpr (!PARTICLE) {
606 this->_myMin = {
607 this->_pos[0] - this->getCircumRadius(),
608 this->_pos[1] - this->getCircumRadius()
609 };
610 this->_myMax = {
611 this->_pos[0] + this->getCircumRadius(),
612 this->_pos[1] + this->getCircumRadius()
613 };
614 this->init();
615 }
616}
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

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

+ Here is the call graph for this function:

Member Function Documentation

◆ calcMofiAndMass()

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

Definition at line 619 of file smoothIndicatorF2D.hh.

620{
621 T mass = _xLength*_yLength*density;
622 T mofi = 1./12.*mass*(_xLength*_xLength+_yLength*_yLength);
623 return Vector<S,2>(mofi, mass);
624}

◆ operator()()

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

Definition at line 628 of file smoothIndicatorF2D.hh.

629{
630 T d;
631 if(_xLength == 0){
632 T distToCenter2 = util::pow(this->getPos()[1]-input[1], 2);
633 d = util::sqrt(distToCenter2) - this->_yLength/2. /*+ this->getEpsilon()/2*/;
634 }
635 else if(_yLength == 0){
636 T distToCenter2 = util::pow(this->getPos()[0]-input[0], 2);
637 d = util::sqrt(distToCenter2) - this->_xLength/2. + this->getEpsilon()/2;
638 }
639 else{
640 T distToCenter2x = util::pow(this->getPos()[0]-input[0], 2);
641 T distToCenter2y = util::pow(this->getPos()[1]-input[1], 2);
642 T ratio = util::sqrt(distToCenter2y)/util::sqrt(distToCenter2x);
643 if(ratio >= _yLength/_xLength){
644 d = util::sqrt(distToCenter2y) - this->_yLength/2. + this->getEpsilon()/2;
645 }
646 else{
647 d = util::sqrt(distToCenter2x) - this->_xLength/2. + this->getEpsilon()/2;
648 }
649 }
650
651 /*if(d <= 0){
652 output[0] = T(this->_factor);
653 return true;
654 }
655 else if(d > 0 && d <= this->getEpsilon()){
656 output[0] = T(- this->_factor*(d-this->getEpsilon())/this->getEpsilon());
657 return true;
658 }
659 else{
660 output[0] = 0;
661 return false;
662 }*/
663 output[0] = T(this->_factor*(1.-tanh(d/this->getEpsilon()))/2.);
664 return true;
665}
constexpr int d() any_platform
ADf< T, DIM > tanh(const ADf< T, DIM > &a)
Definition aDiff.h:663

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

+ Here is the call graph for this function:

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