OpenLB
1.8.1
Loading...
Searching...
No Matches
src
reaction
explicitFiniteDifference
fdPostProcessor2D.hh
Go to the documentation of this file.
1
/* This file is part of the OpenLB library
2
*
3
* Copyright (C) 2020 Davide Dapelo
4
* E-mail contact: info@openlb.net
5
* The most recent release of OpenLB can be downloaded at
6
* <http://www.openlb.net/>
7
*
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License
10
* as published by the Free Software Foundation; either version 2
11
* of the License, or (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public
19
* License along with this program; if not, write to the Free
20
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
* Boston, MA 02110-1301, USA.
22
*/
23
28
#ifndef AD_POST_PROCESSOR_2D_DEV03_HH
29
#define AD_POST_PROCESSOR_2D_DEV03_HH
30
31
namespace
olb
{
32
33
35
36
template
<
typename
T,
typename
DESCRIPTOR,
typename
FIELD,
typename
SOURCE>
37
FdBasePostProcessor2D<T,DESCRIPTOR,FIELD,SOURCE>::FdBasePostProcessor2D
()
38
{
39
static_assert
(DESCRIPTOR::template size<FIELD>() == 2,
"FIELD must have size 2."
);
40
}
41
42
template
<
typename
T,
typename
DESCRIPTOR,
typename
FIELD,
typename
SOURCE>
43
template
<
typename
CELL>
44
void
FdBasePostProcessor2D <T,DESCRIPTOR,FIELD,SOURCE>::applySourceTerm
(T* fNew, CELL& cell)
45
{
46
if
constexpr
(! std::is_void<SOURCE>::value) {
47
*fNew += cell.template getFieldPointer<SOURCE>()[0];
48
}
49
}
50
51
53
54
template
<
typename
T,
typename
DESCRIPTOR,
typename
MODEL,
typename
PARAMS,
typename
FIELD,
typename
SOURCE>
55
FdPostProcessor2D <T,DESCRIPTOR,MODEL,PARAMS,FIELD,SOURCE>::FdPostProcessor2D
()
56
:
FdBasePostProcessor2D
<T,DESCRIPTOR,FIELD,SOURCE>()
57
{
58
}
59
60
template
<
typename
T,
typename
DESCRIPTOR,
typename
MODEL,
typename
PARAMS,
typename
FIELD,
typename
SOURCE>
61
int
FdPostProcessor2D <T,DESCRIPTOR,MODEL,PARAMS,FIELD,SOURCE>::getPriority
()
const
62
{
63
return
1;
64
}
65
66
template
<
typename
T,
typename
DESCRIPTOR,
typename
MODEL,
typename
PARAMS,
typename
FIELD,
typename
SOURCE>
67
template
<
typename
CELL,
typename
PARAMETERS>
68
void
FdPostProcessor2D<T,DESCRIPTOR,MODEL,PARAMS,FIELD,SOURCE>::apply
(CELL& cell, PARAMETERS& vars)
69
{
70
std::size_t iT = vars.template get<fd::fdParams::Timestep>();
71
T f[MODEL::extent()*DESCRIPTOR::d], F[MODEL::extent()*DESCRIPTOR::d];
72
T u[DESCRIPTOR::d];
73
T* fNew =
fd::accessNew<T,FIELD>
(cell, iT);
74
T* f0 =
fd::accessOld<T,FIELD>
(cell, iT);
75
for
(
int
iN=1; iN<=MODEL::extent(); ++iN) {
76
f[
fd::getArrayPos<MODEL::extent()>
(iN-1,0)] = *
fd::accessOld<T,FIELD>
( cell.neighbor({-iN, 0}), iT );
77
F[
fd::getArrayPos<MODEL::extent()>
(iN-1,0)] = *
fd::accessOld<T,FIELD>
( cell.neighbor({+iN, 0}), iT );
78
f[
fd::getArrayPos<MODEL::extent()>
(iN-1,1)] = *
fd::accessOld<T,FIELD>
( cell.neighbor({ 0, -iN}), iT );
79
F[
fd::getArrayPos<MODEL::extent()>
(iN-1,1)] = *
fd::accessOld<T,FIELD>
( cell.neighbor({ 0, +iN}), iT );
80
}
81
cell.computeU(u);
82
MODEL::template apply<PARAMETERS>(fNew, f0, f, F, u, vars);
83
this->applySourceTerm(fNew, cell);
84
}
85
86
}
// namespace olb
87
88
#endif
olb::FdBasePostProcessor2D
Definition
fdPostProcessor2D.h:40
olb::FdBasePostProcessor2D::FdBasePostProcessor2D
FdBasePostProcessor2D()
Definition
fdPostProcessor2D.hh:37
olb::FdBasePostProcessor2D::applySourceTerm
void applySourceTerm(T *fNew, CELL &cell) any_platform
Definition
fdPostProcessor2D.hh:44
olb::FdPostProcessor2D::FdPostProcessor2D
FdPostProcessor2D()
Definition
fdPostProcessor2D.hh:55
olb::FdPostProcessor2D::apply
void apply(CELL &cell, PARAMETERS &vars) any_platform
Definition
fdPostProcessor2D.hh:68
olb::FdPostProcessor2D::getPriority
int getPriority() const
Definition
fdPostProcessor2D.hh:61
olb::fd::accessNew
T * accessNew(CELL cell, std::size_t iT) any_platform
Definition
fdAccessFunctions.h:56
olb::fd::accessOld
T * accessOld(CELL cell, std::size_t iT) any_platform
Definition
fdAccessFunctions.h:50
olb::fd::getArrayPos
constexpr unsigned getArrayPos(const unsigned iExt, const unsigned iD) any_platform
Definition
fdAccessFunctions.h:63
olb
Top level namespace for all of OpenLB.
Definition
advectionDiffusionDirichlet.h:27
Generated on Sat May 17 2025 10:48:05 for OpenLB by
1.12.0