OpenLB 1.7
Loading...
Searching...
No Matches
reactingSpecies2D.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 REACTING_SPECIES_2D_HH
29#define REACTING_SPECIES_2D_HH
30
31namespace olb {
32
33
35
36template <typename T, typename DESCRIPTOR, typename SOURCE, typename IMPL>
38 : _stoichioCoeff(stoichioCoeff)
39{}
40
41template <typename T, typename DESCRIPTOR, typename SOURCE, typename IMPL>
43{
44 return _stoichioCoeff;
45}
47template <typename T, typename DESCRIPTOR, typename SOURCE, typename IMPL>
49{
50 return (static_cast<IMPL*>(this))->getField(blockStructure, iX, iY);
51}
53template <typename T, typename DESCRIPTOR, typename SOURCE, typename IMPL>
55{
56 return static_cast<BlockLattice<T,DESCRIPTOR>*>(blockStructure)->get(iX, iY).template getFieldPointer<SOURCE>()[0];
57}
58
59template <typename T, typename DESCRIPTOR, typename SOURCE, typename IMPL>
61{
62 static_cast<BlockLattice<T,DESCRIPTOR>*>(blockStructure)->get(iX, iY).template setField<SOURCE>(val + getSource(blockStructure, iX, iY));
63}
64
65template <typename T, typename DESCRIPTOR, typename SOURCE, typename IMPL>
67{
68 static_cast<BlockLattice<T,DESCRIPTOR>*>(blockStructure)->get(iX, iY).template setField<SOURCE>(T());
69}
70
71
73
74template <typename T, typename DESCRIPTOR, typename SOURCE, typename FIELD>
76FiniteDifferenceReactingSpecies2D(T stoichioCoeff, std::size_t& iT)
77 : ReactingSpecies2D<T,DESCRIPTOR,SOURCE,FiniteDifferenceReactingSpecies2D<T,DESCRIPTOR,SOURCE,FIELD>>(stoichioCoeff),
78 _iT(iT)
79{
80 static_assert(DESCRIPTOR::template size<FIELD>() == 2, "FIELD must have size 2." );
81 static_assert(DESCRIPTOR::template size<SOURCE>() == 1, "SOURCE must have size 1.");
82}
83
84template <typename T, typename DESCRIPTOR, typename SOURCE, typename FIELD>
86{
87 return *fd::accessNew<T,FIELD>(static_cast<BlockLattice<T,DESCRIPTOR>*>(blockStructure)->get(iX, iY), this->_iT);
88}
89
90
92
93template <typename T, typename DESCRIPTOR, typename SOURCE>
98
99template <typename T, typename DESCRIPTOR,typename SOURCE>
101{
102 return static_cast<BlockLattice<T,DESCRIPTOR>*>(blockStructure)->get(iX, iY).computeRho();
103}
104
105
106} // namespace olb
107
108#endif
Platform-abstracted block lattice for external access and inter-block interaction.
Base of a regular block.
T getField(BlockStructureD< 2 > *blockStructure, int iX, int iY)
FiniteDifferenceReactingSpecies2D(T stoichioCoeff, std::size_t &iT)
T getField(BlockStructureD< 2 > *blockStructure, int iX, int iY)
ReactingSpecies2D(T stoichioCoeff)
void incrementSource(BlockStructureD< 2 > *blockStructure, T val, int iX, int iY)
T getField(BlockStructureD< 2 > *blockStructure, int iX, int iY)
T getSource(BlockStructureD< 2 > *blockStructure, int iX, int iY)
void resetSource(BlockStructureD< 2 > *blockStructure, int iX, int iY)
Top level namespace for all of OpenLB.