24#ifndef ADVECTION_DIFFUSSION_REACTION_COUPLING_POST_PROCESSOR_2D_H
25#define ADVECTION_DIFFUSSION_REACTION_COUPLING_POST_PROCESSOR_2D_H
44template<
typename T,
typename DESCRIPTOR>
50 int x0_,
int x1_,
int y0_,
int y1_,
51 const std::vector<T>& stochiometricCoeff_,
52 const std::vector<T> latticeReactionCoeff_,
53 const std::vector<T>& react_order_,
55 : x0(x0_), x1(x1_), y0(y0_), y1(y1_),
56 stochiometricCoeff(stochiometricCoeff_),
57 latticeReactionCoeff(latticeReactionCoeff_),
58 react_order(react_order_), partners(partners_) {
59 this->
getName() =
"ConcentrationAdvectionDiffusionCouplingPostProcessor2D";
60 reaction_number =
static_cast<int>(latticeReactionCoeff.size());
61 component_number =
static_cast<int>(partners.size())+1;
62 for (
int i = 0; i<component_number; i++) {
63 tpartners.emplace_back(
72 int extent(
int whichDirection)
const override {
81 int x0_,
int x1_,
int y0_,
int y1_)
override {
83 int newX0, newX1, newY0, newY1;
87 newX0, newX1, newY0, newY1 ) ) {
89 for (
int iX=newX0; iX<=newX1; ++iX) {
90 for (
int iY=newY0; iY<=newY1; ++iY) {
94 T conc[component_number];
95 conc[0] = blockLattice.
get(iX,iY).computeRho();
96 for (
int iter_component = 1; iter_component<component_number; ++iter_component) {
97 conc[iter_component] = tpartners[iter_component-1]->get(iX,iY).computeRho();
100 T sources[component_number];
103 blockLattice.
get(iX,iY).template setField<descriptors::SOURCE>(sources[0]);
104 for (
int iter_component = 1; iter_component<component_number; ++iter_component) {
105 tpartners[iter_component-1]->get(iX,iY).template setField<descriptors::SOURCE>(
106 sources[iter_component]);
114 T lambda[reaction_number];
116 for (
int iter_reaction = 0; iter_reaction<reaction_number; ++iter_reaction) {
117 lambda[iter_reaction] = 0;
119 for(
int iter_component = 0; iter_component<component_number; ++iter_component) {
120 reaction_rate *=
util::pow(concentrations[iter_component],
121 react_order[iter_reaction*component_number+iter_component]);
123 lambda[iter_reaction] = reaction_rate*latticeReactionCoeff[iter_reaction];
126 for (
int iter_component = 0; iter_component<component_number; ++iter_component) {
127 sources[iter_component] = 0;
128 for (
int iter_reaction = 0; iter_reaction<reaction_number; ++iter_reaction) {
129 sources[iter_component]
130 += stochiometricCoeff[iter_reaction*component_number+iter_component]*lambda[iter_reaction];
138 int component_number;
139 const std::vector<T>& stochiometricCoeff;
140 const std::vector<T> latticeReactionCoeff;
141 const std::vector<T>& react_order;
142 std::vector<BlockLattice<T,DESCRIPTOR>*> tpartners;
143 std::vector<BlockStructureD<2>* > partners;
146template<
typename T,
typename DESCRIPTOR>
152 int x0_,
int x1_,
int y0_,
int y1_,
153 const std::vector<T>& stochiometricCoeff_,
154 const std::vector<T> latticeReactionCoeff_,
155 const std::vector<T>& react_order_)
157 stochiometricCoeff(stochiometricCoeff_), latticeReactionCoeff(latticeReactionCoeff_), react_order(react_order_)
163 this->
x0,this->
x1,this->
y0,this->
y1, stochiometricCoeff, latticeReactionCoeff, react_order, partners);
171 const std::vector<T>& stochiometricCoeff;
172 const std::vector<T> latticeReactionCoeff;
173 const std::vector<T>& react_order;
Platform-abstracted block lattice for external access and inter-block interaction.
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
ConcentrationAdvectionDiffusionCouplingGenerator2D(int x0_, int x1_, int y0_, int y1_, const std::vector< T > &stochiometricCoeff_, const std::vector< T > latticeReactionCoeff_, const std::vector< T > &react_order_)
LatticeCouplingGenerator2D< T, DESCRIPTOR > * clone() const override
PostProcessor2D< T, DESCRIPTOR > * generate(std::vector< BlockStructureD< 2 > * > partners) const override
Coupling of ADlattice[0] with the other AD lattices (tpartners)
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_) override
Execute post-processing step on a sublattice.
ConcentrationAdvectionDiffusionCouplingPostProcessor2D(int x0_, int x1_, int y0_, int y1_, const std::vector< T > &stochiometricCoeff_, const std::vector< T > latticeReactionCoeff_, const std::vector< T > &react_order_, std::vector< BlockStructureD< 2 > * > partners_)
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
void computeSources(T sources[], const T concentrations[])
int extent(int whichDirection) const override
Extent of application area along a direction (0 or 1)
int extent() const override
Extent of application area (0 for purely local operations)
Interface of 2D post-processing steps.
std::string & getName()
read and write access to name
Descriptor for all types of 2D and 3D lattices.
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
bool intersect(int x0, int x1, int y0, int y1, int x0_, int x1_, int y0_, int y1_, int &newX0, int &newX1, int &newY0, int &newY1)
Top level namespace for all of OpenLB.
Interface for post-processing steps – header file.
Set of functions commonly used in LB computations – header file.