OpenLB 1.7
Loading...
Searching...
No Matches
reactionPostProcessor2D.h
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 REACTION_POST_PROCESSOR_2D_H
29#define REACTION_POST_PROCESSOR_2D_H
30
31#include "rate.h"
32#include "reactingSpecies2D.h"
33
34namespace olb {
35
37/*
38 * Postprocessor to perform a generic chemical reactions
39 */
40template<typename T, typename DESCRIPTOR, typename REACTIONS>
41class ReactionPostProcessor2D : public LocalPostProcessor2D<T,DESCRIPTOR> {
42public:
43 ReactionPostProcessor2D ( int x0, int x1, int y0, int y1,
44 std::vector<std::shared_ptr<Rate<T>>> rate, std::shared_ptr<REACTIONS> reactions,
45 std::vector<BlockStructureD<2>*> partners );
46 ReactionPostProcessor2D ( std::vector<std::shared_ptr<Rate<T>>> rate, std::shared_ptr<REACTIONS> reactions,
47 std::vector<BlockStructureD<2>*> partners );
48 int extent() const override
49 {
50 return 1;
51 }
52 int extent(int whichDirection) const override
53 {
54 return 1;
55 }
56 void process(BlockLattice<T,DESCRIPTOR>& blockLattice) override;
58 int x0, int x1, int y0, int y1 ) override;
59private:
60 template <typename VECT_TYPE, typename F>
61 void functOverReactions(std::vector<VECT_TYPE>& vect, F&& f);
62 int _x0, _x1, _y0, _y1;
63 std::vector<size_t> _sizes;
64 std::vector<std::shared_ptr<Rate<T>>> _rate;
65 std::shared_ptr<REACTIONS> _reactions;
66 std::vector<BlockStructureD<2>*> _partners;
67};
68
69template<typename T, typename DESCRIPTOR, typename REACTIONS>
70class ReactionGenerator2D final : public LatticeCouplingGenerator2D<T,DESCRIPTOR> {
71public:
72 ReactionGenerator2D ( int x0_, int x1_, int y0_, int y1_,
73 std::vector<std::shared_ptr<Rate<T>>> rate, REACTIONS&& reactions );
74 ReactionGenerator2D ( std::vector<std::shared_ptr<Rate<T>>> rate, REACTIONS&& reactions );
75 PostProcessor2D<T,DESCRIPTOR>* generate(std::vector<BlockStructureD<2>*> partners) const override;
77private:
78 std::vector<std::shared_ptr<Rate<T>>> _rate;
79 std::shared_ptr<REACTIONS> _reactions;
80};
81
82
83} // namespace olb
84
85#endif
Platform-abstracted block lattice for external access and inter-block interaction.
Base of a regular block.
Interface of 2D post-processing steps.
ReactionGenerator2D(int x0_, int x1_, int y0_, int y1_, std::vector< std::shared_ptr< Rate< T > > > rate, REACTIONS &&reactions)
LatticeCouplingGenerator2D< T, DESCRIPTOR > * clone() const override
PostProcessor2D< T, DESCRIPTOR > * generate(std::vector< BlockStructureD< 2 > * > partners) const override
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
int extent() const override
Extent of application area (0 for purely local operations)
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0, int x1, int y0, int y1) override
Execute post-processing step on a sublattice.
int extent(int whichDirection) const override
Extent of application area along a direction (0 or 1)
ReactionPostProcessor2D(int x0, int x1, int y0, int y1, std::vector< std::shared_ptr< Rate< T > > > rate, std::shared_ptr< REACTIONS > reactions, std::vector< BlockStructureD< 2 > * > partners)
Top level namespace for all of OpenLB.
Base class to implement a generic reaction rate - to be derived to get the specific rate – header fil...
Classes to provide access to a reacting species - may be a LB density, or an external field.