OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::BlockLaplacian3D< T > Class Template Reference

functor to get pointwise finite difference Laplacian operator More...

#include <latticeDerivatives3D.h>

+ Inheritance diagram for olb::BlockLaplacian3D< T >:
+ Collaboration diagram for olb::BlockLaplacian3D< T >:

Public Member Functions

 BlockLaplacian3D (BlockGeometry< T, 3 > &blockGeometry, BlockF3D< T > &blockFunctor, bool forthOrder)
 
bool operator() (T output[], const int input[]) override
 has to be implemented for 'every' derived class
 
- Public Member Functions inherited from olb::BlockF3D< T >
 ~BlockF3D () override
 virtual destructor for defined behaviour
 
virtual BlockStructureD< 3 > & getBlockStructure () const
 
BlockF3D< T > & operator- (BlockF3D< T > &rhs)
 
BlockF3D< T > & operator+ (BlockF3D< T > &rhs)
 
BlockF3D< T > & operator* (BlockF3D< T > &rhs)
 
BlockF3D< T > & operator/ (BlockF3D< T > &rhs)
 
- Public Member Functions inherited from olb::GenericF< T, int >
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[], int input0)
 
bool operator() (T output[], int input0, int input1)
 
bool operator() (T output[], int input0, int input1, int input2)
 
bool operator() (T output[], int input0, int input1, int input2, int input3)
 

Additional Inherited Members

- Public Types inherited from olb::GenericF< T, int >
using targetType
 
using sourceType
 
- Public Attributes inherited from olb::GenericF< T, int >
std::shared_ptr< GenericF< T, int > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Protected Member Functions inherited from olb::BlockF3D< T >
 BlockF3D (BlockStructureD< 3 > &blockStructure, int targetDim)
 
- Protected Member Functions inherited from olb::GenericF< T, int >
 GenericF (int targetDim, int sourceDim)
 
- Protected Attributes inherited from olb::BlockF3D< T >
BlockStructureD< 3 > & _blockStructure
 

Detailed Description

template<typename T>
class olb::BlockLaplacian3D< T >

functor to get pointwise finite difference Laplacian operator

Definition at line 99 of file latticeDerivatives3D.h.

Constructor & Destructor Documentation

◆ BlockLaplacian3D()

template<typename T >
olb::BlockLaplacian3D< T >::BlockLaplacian3D ( BlockGeometry< T, 3 > & blockGeometry,
BlockF3D< T > & blockFunctor,
bool forthOrder )

Definition at line 283 of file latticeDerivatives3D.hh.

286 : BlockF3D<T>(blockFunctor.getBlockStructure(), blockFunctor.getTargetDim()),
287 _blockGeometry(blockGeometry), _blockFunctor(blockFunctor),
288 _forthOrder(forthOrder)
289{
290 this->getName() = "Laplacian(" + blockFunctor.getName() + ")";
291 _n[0] = this-> _blockGeometry.getNx()-1;
292 _n[1] = this-> _blockGeometry.getNy()-1;
293 _n[2] = this-> _blockGeometry.getNz()-1;
294}
int getNy() const
Read only access to block height.
int getNx() const
Read only access to block width.
int getNz() const
Read only access to block height.
std::string & getName()
read and write access to name
Definition genericF.hh:51

References olb::GenericF< T, S >::getName(), olb::GenericF< T, int >::getName(), olb::BlockStructureD< D >::getNx(), olb::BlockStructureD< D >::getNy(), and olb::BlockStructureD< D >::getNz().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

template<typename T >
bool olb::BlockLaplacian3D< T >::operator() ( T output[],
const int input[] )
overridevirtual

has to be implemented for 'every' derived class

Implements olb::GenericF< T, int >.

Definition at line 297 of file latticeDerivatives3D.hh.

298{
299 for (int i=0; i<this->getTargetDim(); ++i) {
300 output[i] = 0;
301 }
302 int inputMod[3];
303 for (int j=0; j<3; ++j) {
304 inputMod[j] = input[j];
305 }
306 T u_0[this->getTargetDim()];
307 T u_m[this->getTargetDim()];
308 T u_p[this->getTargetDim()];
309
310 // only used for forth order dq
311 T u_2m[this->getTargetDim()];
312 T u_2p[this->getTargetDim()];
313
314 // compute discrete second derivatives for each direction and add them
315 for (int j=0; j<3; ++j) {
316 if (input[j] < 1) {
317 // use forward difference quotient at the boundary
318 _blockFunctor.operator()(u_m, inputMod);
319 inputMod[j] += 1;
320 _blockFunctor.operator()(u_0, inputMod);
321 inputMod[j] += 1;
322 _blockFunctor.operator()(u_p, inputMod);
323 } else if (input[j] > _n[j]-1) {
324 // use backward difference quotient at the boundary
325 _blockFunctor.operator()(u_p, inputMod);
326 inputMod[j] -= 1;
327 _blockFunctor.operator()(u_0, inputMod);
328 inputMod[j] -= 1;
329 _blockFunctor.operator()(u_m, inputMod);
330 } else {
331 // use central difference quotient
332 _blockFunctor.operator()(u_0, inputMod);
333 inputMod[j] -= 1;
334 _blockFunctor.operator()(u_m, inputMod);
335 inputMod[j] += 2;
336 _blockFunctor.operator()(u_p, inputMod);
337 }
338 inputMod[j] = input[j]; // reset
339
340 if ((_forthOrder) && (input[j] > 1) && (input[j] < _n[j]-1)) {
341 // additional evaluations
342 inputMod[j] -= 2;
343 _blockFunctor.operator()(u_2m, inputMod);
344 inputMod[j] += 4;
345 _blockFunctor.operator()(u_2p, inputMod);
346 inputMod[j] = input[j]; // reset
347
348 // forth order dq
349 for (int i=0; i<this->getTargetDim(); ++i) {
350 output[i] += fd::centralSecondDeriv(u_2m[i], u_m[i], u_0[i], u_p[i], u_2p[i]);
351 }
352 } else {
353 // second order dq
354 for (int i=0; i<this->getTargetDim(); ++i) {
355 output[i] += fd::centralSecondDeriv(u_m[i], u_0[i], u_p[i]);
356 }
357 }
358 }
359 return true;
360/*
361 // todo: enable treating all spatial directions at once?
362 _blockFunctor.operator()(u_0, inputMod);
363
364 inputMod[0] -= 1;
365 _blockFunctor.operator()(u_xm1, inputMod);
366 inputMod[0] += 2;
367 _blockFunctor.operator()(u_xp1, inputMod);
368 inputMod[0] -= 1;
369
370 inputMod[1] -= 1;
371 _blockFunctor.operator()(u_ym1, inputMod);
372 inputMod[1] += 2;
373 _blockFunctor.operator()(u_yp1, inputMod);
374 inputMod[1] -= 1;
375
376 inputMod[2] -= 1;
377 _blockFunctor.operator()(u_zm1, inputMod);
378 inputMod[2] += 2;
379 _blockFunctor.operator()(u_zp1, inputMod);
380 inputMod[2] -= 1;
381
382 for (int i=0; i<_targetDim; ++i) {
383 output[i] = fd::laplacian3D(u_xm1[i], u_ym1[i], u_zm1[i], u_0[i], u_xp1[i], u_yp1[i], u_zp1[i]);
384 }
385*/
386}
int getTargetDim() const
read only access to member variable _n
Definition genericF.hh:45
constexpr T centralSecondDeriv(T u_m1, T u_0, T u_p1) any_platform
Second order central second derivative (u_p1 = u(x+1))

References olb::fd::centralSecondDeriv().

+ Here is the call graph for this function:

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