OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
olb::vanWachemSmoothingFunctional< T, Lattice > Class Template Reference

Smoothing functional as in Evrard, Denner and van Wachem (2019). More...

#include <smoothingFunctionals3D.h>

+ Inheritance diagram for olb::vanWachemSmoothingFunctional< T, Lattice >:
+ Collaboration diagram for olb::vanWachemSmoothingFunctional< T, Lattice >:

Public Member Functions

 vanWachemSmoothingFunctional (T kernelLength, UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, T radius, int nVoxelInterpPoints)
 Constructor.
 
virtual bool update (T physPosP[], int globic) override
 
- Public Member Functions inherited from olb::SmoothingFunctional< T, Lattice >
const std::deque< LatticePosAndWeight< T > > getData () const
 
int getNvoxelInterpPoints ()
 

Protected Member Functions

virtual T smoothingFunction (T delta) override
 The actual smoothing function.
 
void updateContinuousPhaseFraction (T physPosP[], int globic)
 Updates _latticePosAndWeight with contribution from continuous phase fraction. To be called AFTER compute(...) where required.
 
- Protected Member Functions inherited from olb::LinearAveragingSmoothingFunctional< T, Lattice >
 LinearAveragingSmoothingFunctional (T kernelLength, UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, int nVoxelInterpPoints=2)
 Constructor.
 
virtual T compute (T physPosP[], T physPosL[]) override
 Returns the weight for smoothing.
 
- Protected Member Functions inherited from olb::SmoothingFunctional< T, Lattice >
 SmoothingFunctional (T kernelLength, UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, int nVoxelInterpPoints=2)
 Constructor.
 

Protected Attributes

_radius
 
- Protected Attributes inherited from olb::SmoothingFunctional< T, Lattice >
_kernelLength
 
UnitConverter< T, Lattice > & _converter
 
SuperLattice< T, Lattice > & _sLattice
 
std::deque< LatticePosAndWeight< T > > _latticePosAndWeight
 
int _nVoxelInterpPoints
 

Detailed Description

template<typename T, typename Lattice>
class olb::vanWachemSmoothingFunctional< T, Lattice >

Smoothing functional as in Evrard, Denner and van Wachem (2019).

Definition at line 123 of file smoothingFunctionals3D.h.

Constructor & Destructor Documentation

◆ vanWachemSmoothingFunctional()

template<typename T , typename Lattice >
olb::vanWachemSmoothingFunctional< T, Lattice >::vanWachemSmoothingFunctional ( T kernelLength,
UnitConverter< T, Lattice > & converter,
SuperLattice< T, Lattice > & sLattice,
T radius,
int nVoxelInterpPoints )

Constructor.

Definition at line 189 of file smoothingFunctionals3D.hh.

191 : LinearAveragingSmoothingFunctional<T, Lattice>(kernelLength, converter, sLattice, nVoxelInterpPoints),
192 _radius(radius)
193{}

Member Function Documentation

◆ smoothingFunction()

template<typename T , typename Lattice >
T olb::vanWachemSmoothingFunctional< T, Lattice >::smoothingFunction ( T delta)
overrideprotectedvirtual

The actual smoothing function.

Implements olb::SmoothingFunctional< T, Lattice >.

Definition at line 208 of file smoothingFunctionals3D.hh.

209{
210 T x = delta / this->_kernelLength;
211 return (4.0 * x + 1.0) * util::pow(1.0 - x, 4);
212}
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

References olb::util::pow().

+ Here is the call graph for this function:

◆ update()

template<typename T , typename Lattice >
bool olb::vanWachemSmoothingFunctional< T, Lattice >::update ( T physPosP[],
int globic )
overridevirtual

Reimplemented from olb::SmoothingFunctional< T, Lattice >.

Definition at line 196 of file smoothingFunctionals3D.hh.

197{
198 if ( ! SmoothingFunctional<T, Lattice>::update(physPosP, globic) ) {
199 return false;
200 }
201
202 updateContinuousPhaseFraction(physPosP, globic);
203
204 return true;
205}
virtual bool update(T physPosP[], int globic)
void updateContinuousPhaseFraction(T physPosP[], int globic)
Updates _latticePosAndWeight with contribution from continuous phase fraction. To be called AFTER com...

◆ updateContinuousPhaseFraction()

template<typename T , typename Lattice >
void olb::vanWachemSmoothingFunctional< T, Lattice >::updateContinuousPhaseFraction ( T physPosP[],
int globic )
protected

Updates _latticePosAndWeight with contribution from continuous phase fraction. To be called AFTER compute(...) where required.

Definition at line 215 of file smoothingFunctionals3D.hh.

216{
217 for (auto&& i : this->_latticePosAndWeight) {
218 T iPhysPos[3] = {T(), T(), T()};
219 this->_sLattice.getCuboidGeometry().get(globic).getPhysR (
220 iPhysPos, i.latticePos );
221
222 T iExtremaMin[3] = {T(), T(), T()};
223 iExtremaMin[0] = util::max( physPosP[0] - this->_kernelLength, iPhysPos[0] - 0.5 *this->_converter.getPhysDeltaX() );
224 iExtremaMin[1] = util::max( physPosP[1] - this->_kernelLength, iPhysPos[1] - 0.5 *this->_converter.getPhysDeltaX() );
225 iExtremaMin[2] = util::max( physPosP[2] - this->_kernelLength, iPhysPos[2] - 0.5 *this->_converter.getPhysDeltaX() );
226
227 T iExtremaMax[3] = {T(), T(), T()};
228 iExtremaMax[0] = util::min( physPosP[0] + this->_kernelLength, iPhysPos[0] + 0.5 *this->_converter.getPhysDeltaX() );
229 iExtremaMax[1] = util::min( physPosP[1] + this->_kernelLength, iPhysPos[1] + 0.5 *this->_converter.getPhysDeltaX() );
230 iExtremaMax[2] = util::min( physPosP[2] + this->_kernelLength, iPhysPos[2] + 0.5 *this->_converter.getPhysDeltaX() );
231
232 T discretePhaseFraction = T();
233 for (int nx=1; nx<=this->_nVoxelInterpPoints; nx++) {
234 for (int ny=1; ny<=this->_nVoxelInterpPoints; ny++) {
235 for (int nz=1; nz<=this->_nVoxelInterpPoints; nz++) {
236 T physPosNm[3] = {T(), T(), T()};
237 physPosNm[0] = iExtremaMin[0] + nx * (iExtremaMax[0] - iExtremaMin[0]) / ((T) this->_nVoxelInterpPoints + 1.0);
238 physPosNm[1] = iExtremaMin[1] + ny * (iExtremaMax[1] - iExtremaMin[1]) / ((T) this->_nVoxelInterpPoints + 1.0);
239 physPosNm[2] = iExtremaMin[2] + nz * (iExtremaMax[2] - iExtremaMin[2]) / ((T) this->_nVoxelInterpPoints + 1.0);
240
241 discretePhaseFraction += ( util::pow(physPosNm[0] - physPosP[0], 2)
242 + util::pow(physPosNm[1] - physPosP[1], 2)
243 + util::pow(physPosNm[2] - physPosP[2], 2)
244 <= util::pow(this->_radius, 2)
245 ) ? 0.5 : 0.0;
246
247 T physPosNp[3] = {T(), T(), T()};
248 physPosNp[0] = iExtremaMin[0] + (nx - 1.0) * (iExtremaMax[0] - iExtremaMin[0]) / ((T) this->_nVoxelInterpPoints - 1.0);
249 physPosNp[1] = iExtremaMin[1] + (ny - 1.0) * (iExtremaMax[1] - iExtremaMin[1]) / ((T) this->_nVoxelInterpPoints - 1.0);
250 physPosNp[2] = iExtremaMin[2] + (nz - 1.0) * (iExtremaMax[2] - iExtremaMin[2]) / ((T) this->_nVoxelInterpPoints - 1.0);
251
252 discretePhaseFraction += ( util::pow(physPosNp[0] - physPosP[0], 2)
253 + util::pow(physPosNp[1] - physPosP[1], 2)
254 + util::pow(physPosNp[2] - physPosP[2], 2)
255 <= util::pow(this->_radius, 2)
256 ) ? 0.5 : 0.0;
257 }
258 }
259 }
260
261 discretePhaseFraction *= (iExtremaMax[0]-iExtremaMin[0]) * (iExtremaMax[1]-iExtremaMin[1]) * (iExtremaMax[2]-iExtremaMin[2])
263
264 i.continuousPhaseFraction = 1.0 - discretePhaseFraction;
265 }
266}
std::deque< LatticePosAndWeight< T > > _latticePosAndWeight
UnitConverter< T, Lattice > & _converter
SuperLattice< T, Lattice > & _sLattice
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.
constexpr T getPhysDeltaX() const
returns grid spacing (voxel length) in m
cpu::simd::Pack< T > min(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:124
cpu::simd::Pack< T > max(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:130

References olb::util::max(), olb::util::min(), and olb::util::pow().

+ Here is the call graph for this function:

Member Data Documentation

◆ _radius

template<typename T , typename Lattice >
T olb::vanWachemSmoothingFunctional< T, Lattice >::_radius
protected

Definition at line 135 of file smoothingFunctionals3D.h.


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