OpenLB 1.7
Loading...
Searching...
No Matches
collisionModifiers.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2021-2023 Adrian Kummerlaender
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 DYNAMICS_COLLISION_MODIFIERS_H
25#define DYNAMICS_COLLISION_MODIFIERS_H
26
27#include "lbm.h"
28#include "descriptorField.h"
29
30namespace olb {
31
32namespace collision {
33
35template <typename PARAMETER, typename COLLISION>
37 using parameters = typename COLLISION::parameters::template include<PARAMETER>;
38
39 static std::string getName() {
40 return "ParameterFromCell<" + COLLISION::getName() + ">";
41 }
42
43 template <typename DESCRIPTOR, typename MOMENTA, typename EQUILIBRIUM>
44 struct type {
45 using CollisionO = typename COLLISION::template type<DESCRIPTOR, MOMENTA, EQUILIBRIUM>;
46
47 template <CONCEPT(MinimalCell) CELL, typename PARAMETERS, typename V=typename CELL::value_t>
48 CellStatistic<V> apply(CELL& cell, PARAMETERS& parameters) any_platform {
49 parameters.template set<PARAMETER>(
50 cell.template getField<PARAMETER>());
51 return CollisionO().apply(cell, parameters);
52 }
53 };
54};
55
57template <typename COLLISION>
59
61template <typename COLLISION>
63 using parameters = typename COLLISION::parameters::template include<
65 >;
66
67 static std::string getName() {
68 return "OmegaFromCellTauEff<" + COLLISION::getName() + ">";
69 }
70
71 template <typename DESCRIPTOR, typename MOMENTA, typename EQUILIBRIUM>
72 struct type {
73 using CollisionO = typename COLLISION::template type<DESCRIPTOR, MOMENTA, EQUILIBRIUM>;
74
75 template <CONCEPT(MinimalCell) CELL, typename PARAMETERS, typename V=typename CELL::value_t>
76 CellStatistic<V> apply(CELL& cell, PARAMETERS& parameters) any_platform {
77 parameters.template set<descriptors::OMEGA>(
78 V{1} / cell.template getField<descriptors::TAU_EFF>());
79 return CollisionO().apply(cell, parameters);
80 }
81 };
82};
83
85template <typename COLLISION>
87 using parameters = typename COLLISION::parameters::template include<descriptors::LATTICE_TIME>;
88
89 static std::string getName() {
90 return "TrackAverageVelocity<" + COLLISION::getName() + ">";
91 }
92
93 template <typename DESCRIPTOR, typename MOMENTA, typename EQUILIBRIUM>
94 struct type {
95 using MomentaF = typename MOMENTA::template type<DESCRIPTOR>;
96 using CollisionO = typename COLLISION::template type<DESCRIPTOR, MOMENTA, EQUILIBRIUM>;
97
98 template <CONCEPT(MinimalCell) CELL, typename PARAMETERS, typename V=typename CELL::value_t>
99 CellStatistic<V> apply(CELL& cell, PARAMETERS& parameters) any_platform {
100 auto statistics = CollisionO().apply(cell, parameters);
101
103 MomentaF().computeU(cell, u);
104
105 std::size_t iT = parameters.template get<descriptors::LATTICE_TIME>();
106 auto uAvg = cell.template getField<descriptors::AVERAGE_VELOCITY>();
107 cell.template setField<descriptors::AVERAGE_VELOCITY>((uAvg * (iT-1) + u) / iT);
108
109 return statistics;
110 }
111 };
112};
113
114}
115
116}
117
118#endif
Plain old scalar vector.
Definition vector.h:47
Top level namespace for all of OpenLB.
#define any_platform
Define preprocessor macros for device-side functions, constant storage.
Definition platform.h:78
Return value of any collision.
Definition interface.h:43
CellStatistic< V > apply(CELL &cell, PARAMETERS &parameters) any_platform
typename COLLISION::template type< DESCRIPTOR, MOMENTA, EQUILIBRIUM > CollisionO
Override COLLISION parameter OMEGA with inverse of cell field TAU_EFF.
typename COLLISION::parameters::template include< descriptors::OMEGA > parameters
CellStatistic< V > apply(CELL &cell, PARAMETERS &parameters) any_platform
typename COLLISION::template type< DESCRIPTOR, MOMENTA, EQUILIBRIUM > CollisionO
Override COLLISION parameter PARAMETER with cell field PARAMETER.
typename COLLISION::parameters::template include< PARAMETER > parameters
typename COLLISION::template type< DESCRIPTOR, MOMENTA, EQUILIBRIUM > CollisionO
typename MOMENTA::template type< DESCRIPTOR > MomentaF
CellStatistic< V > apply(CELL &cell, PARAMETERS &parameters) any_platform
Track time-averaged velocity of COLLISION into cell field AVERAGE_VELOCITY.
typename COLLISION::parameters::template include< descriptors::LATTICE_TIME > parameters