OpenLB 1.7
Loading...
Searching...
No Matches
zeroGradientLatticePostProcessor3D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2023 Fedor Bukreev, Adrian Kummerländer
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
24#ifndef ZERO_GRADIENT_LATTICE_POST_PROCESSOR_3D_H
25#define ZERO_GRADIENT_LATTICE_POST_PROCESSOR_3D_H
26
27#include "core/blockStructure.h"
28#include "core/postProcessing.h"
29#include "core/util.h"
31#include "utilities/omath.h"
32
33
34namespace olb {
35
36//======================================================================
37// ======== Zero Gradient Boundary for AD 3D ======//
38//======================================================================
39template<typename T, typename DESCRIPTOR>
41{
43
44 int getPriority() const {
45 return 0;
46 }
47
48template <typename CELL>
49void apply(CELL& cell) any_platform{
50 for(int iPop = 0; iPop<DESCRIPTOR::q; iPop++){
51 const auto c = descriptors::c<DESCRIPTOR>(iPop);
52 T v = T{0.};
53 T fluidN = cell.neighbor({c[0], c[1], c[2]}).template getField<descriptors::NEIGHBOR>();
54 T fluidNN = cell.neighbor({2*c[0], 2*c[1], 2*c[2]}).template getField<descriptors::NEIGHBOR>();
55 v = fluidN * cell.neighbor({c[0], c[1], c[2]})[iPop] + fluidN * fluidNN * cell.neighbor({2*c[0], 2*c[1], 2*c[2]})[iPop];
56 v *= (fluidN - T{0.5} * fluidN * fluidNN);
57 cell[iPop] = v;
58 }
59}
60};
61}
62
63#endif
Descriptor for all types of 2D and 3D lattices.
Top level namespace for all of OpenLB.
OperatorScope
Block-wide operator application scopes.
Definition operator.h:54
@ PerCell
Per-cell application, i.e. OPERATOR::apply is passed a CELL concept implementation.
#define any_platform
Define preprocessor macros for device-side functions, constant storage.
Definition platform.h:78
Interface for post-processing steps – header file.
Set of functions commonly used in LB computations – header file.