OpenLB 1.7
Loading...
Searching...
No Matches
freeEnergyPostProcessor2D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2018 Robin Trunk, Sam Avis
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 FREE_ENERGY_POST_PROCESSOR_2D_H
25#define FREE_ENERGY_POST_PROCESSOR_2D_H
26
27#include "core/blockStructure.h"
28#include "core/postProcessing.h"
29
30/* \file
31 * PostProcessor classes organising the coupling between the lattices for the free energy
32 * model.
33 *
34 * The PostProcessor for the calculation of the chemical potential needs to be applied first,
35 * as the force relies on its results. This post processor should be assigned to the first
36 * lattice with the second (and third) lattices given as partner lattices.
37 * Then the force post processor should be assigned to the second lattice with the first (and
38 * third) given as partner lattices. Between the execution of these post processors the
39 * chemical potential should be communicated.
40 */
41
42namespace olb {
43
46template<typename T, typename DESCRIPTOR>
48public:
54 FreeEnergyChemicalPotentialCoupling2D(int x0_, int x1_, int y0_, int y1_, T alpha_,
55 T kappa1_, T kappa2_, T kappa3_,
56 std::vector<BlockStructureD<2>*> partners_);
62 FreeEnergyChemicalPotentialCoupling2D(T alpha_, T kappa1_, T kappa2_, T kappa3_,
63 std::vector<BlockStructureD<2>*> partners_);
64 int extent() const override
65 {
66 return 1;
67 }
68 int extent(int whichDirection) const override
69 {
70 return 1;
71 }
72 void process(BlockLattice<T,DESCRIPTOR>& blockLattice) override;
74 int x0_, int x1_, int y0_, int y1_) override;
75private:
76 using RHO_CACHE = descriptors::FIELD_BASE<3, 0, 0>;
77 int x0, x1, y0, y1;
78 T alpha, kappa1, kappa2, kappa3;
79 std::vector<BlockStructureD<2>*> partners;
80};
81
86template<typename T, typename DESCRIPTOR>
87class FreeEnergyForceCoupling2D : public LocalPostProcessor2D<T,DESCRIPTOR> {
88public:
90 FreeEnergyForceCoupling2D(int x0_, int x1_, int y0_, int y1_,
91 std::vector<BlockStructureD<2>*> partners_);
93 FreeEnergyForceCoupling2D(std::vector<BlockStructureD<2>*> partners_);
94 int extent() const override
95 {
96 return 1;
97 }
98 int extent(int whichDirection) const override
99 {
100 return 1;
101 }
102 void process(BlockLattice<T,DESCRIPTOR>& blockLattice) override;
104 int x0_, int x1_, int y0_, int y1_) override;
105private:
106 int x0, x1, y0, y1;
107 std::vector<BlockStructureD<2>*> partners;
108};
109
113template<typename T, typename DESCRIPTOR>
115public:
117 FreeEnergyInletOutletCoupling2D(int x0_, int x1_, int y0_, int y1_,
118 std::vector<BlockStructureD<2>*> partners_);
121 int extent() const override
122 {
123 return 0;
124 }
125 int extent(int whichDirection) const override
126 {
127 return 0;
128 }
129 void process(BlockLattice<T,DESCRIPTOR>& blockLattice) override;
131 int x0_, int x1_, int y0_, int y1_) override;
132private:
133 int x0, x1, y0, y1;
134 std::vector<BlockStructureD<2>*> partners;
135};
136
140template<typename T, typename DESCRIPTOR>
142public:
145 FreeEnergyDensityOutletCoupling2D(int x0_, int x1_, int y0_, int y1_, T rho_,
146 std::vector<BlockStructureD<2>*> partners_);
149 FreeEnergyDensityOutletCoupling2D(T rho_, std::vector<BlockStructureD<2>*> partners_);
150 int extent() const override
151 {
152 return 0;
153 }
154 int extent(int whichDirection) const override
155 {
156 return 0;
157 }
158 void process(BlockLattice<T,DESCRIPTOR>& blockLattice) override;
160 int x0_, int x1_, int y0_, int y1_) override;
161private:
162 int x0, x1, y0, y1;
163 T rho;
164 std::vector<BlockStructureD<2>*> partners;
165};
166
167
169template<typename T, typename DESCRIPTOR>
171public:
176 FreeEnergyChemicalPotentialGenerator2D(int x0_, int x1_, int y0_, int y1_, T alpha_,
177 T kappa1_, T kappa2_);
182 FreeEnergyChemicalPotentialGenerator2D(T alpha_, T kappa1_, T kappa2_);
188 FreeEnergyChemicalPotentialGenerator2D(int x0_, int x1_, int y0_, int y1_, T alpha_,
189 T kappa1_, T kappa2_, T kappa3_);
195 FreeEnergyChemicalPotentialGenerator2D(T alpha_, T kappa1_, T kappa2_, T kappa3_);
197 PostProcessor2D<T,DESCRIPTOR>* generate(std::vector<BlockStructureD<2>*> partners) const override;
199private:
200 T alpha, kappa1, kappa2, kappa3;
201};
202
204template<typename T, typename DESCRIPTOR>
206public:
207 FreeEnergyForceGenerator2D(int x0_, int x1_, int y0_, int y1_ );
210 PostProcessor2D<T,DESCRIPTOR>* generate(std::vector<BlockStructureD<2>*> partners) const override;
212};
213
215template<typename T, typename DESCRIPTOR>
217public:
218 FreeEnergyInletOutletGenerator2D(int x0_, int x1_, int y0_, int y1_);
221 PostProcessor2D<T,DESCRIPTOR>* generate(std::vector<BlockStructureD<2>*> partners) const override;
223};
224
226template<typename T, typename DESCRIPTOR>
228public:
230 FreeEnergyDensityOutletGenerator2D(int x0_, int x1_, int y0_, int y1_, T rho_);
234 PostProcessor2D<T,DESCRIPTOR>* generate(std::vector<BlockStructureD<2>*> partners) const override;
236private:
237 T rho;
238};
239
240}
241
242#endif
Platform-abstracted block lattice for external access and inter-block interaction.
Base of a regular block.
This class calculates the chemical potential and stores it in the external field of the respective la...
FreeEnergyChemicalPotentialCoupling2D(int x0_, int x1_, int y0_, int y1_, T alpha_, T kappa1_, T kappa2_, T kappa3_, std::vector< BlockStructureD< 2 > * > partners_)
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)
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
Generator class for the PostProcessors calculating the chemical potential.
FreeEnergyChemicalPotentialGenerator2D(int x0_, int x1_, int y0_, int y1_, T alpha_, T kappa1_, T kappa2_)
Two component free energy model.
LatticeCouplingGenerator2D< T, DESCRIPTOR > * clone() const override
PostProcessor2D< T, DESCRIPTOR > * generate(std::vector< BlockStructureD< 2 > * > partners) const override
PostProcessor for setting a constant density outlet.
FreeEnergyDensityOutletCoupling2D(int x0_, int x1_, int y0_, int y1_, T rho_, std::vector< BlockStructureD< 2 > * > partners_)
int extent(int whichDirection) const override
Extent of application area along a direction (0 or 1)
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_) override
Execute post-processing step on a sublattice.
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
int extent() const override
Extent of application area (0 for purely local operations)
Generator class for the PostProcessors assigning the density boundary condition at the outlet.
FreeEnergyDensityOutletGenerator2D(int x0_, int x1_, int y0_, int y1_, T rho_)
LatticeCouplingGenerator2D< T, DESCRIPTOR > * clone() const override
PostProcessor2D< T, DESCRIPTOR > * generate(std::vector< BlockStructureD< 2 > * > partners) const override
PostProcessor calculating the interfacial force in the free energy model.
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)
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
FreeEnergyForceCoupling2D(int x0_, int x1_, int y0_, int y1_, std::vector< BlockStructureD< 2 > * > partners_)
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_) override
Execute post-processing step on a sublattice.
Generator class for the PostProcessors calculating the interfacial force.
LatticeCouplingGenerator2D< T, DESCRIPTOR > * clone() const override
PostProcessor2D< T, DESCRIPTOR > * generate(std::vector< BlockStructureD< 2 > * > partners) const override
PostProcessor for assigning the velocity at inlet and outlets to lattice two and three.
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
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)
FreeEnergyInletOutletCoupling2D(int x0_, int x1_, int y0_, int y1_, std::vector< BlockStructureD< 2 > * > partners_)
int extent() const override
Extent of application area (0 for purely local operations)
Generator class for the PostProcessors assigning the velocity at the outlet to lattice two and three.
LatticeCouplingGenerator2D< T, DESCRIPTOR > * clone() const override
PostProcessor2D< T, DESCRIPTOR > * generate(std::vector< BlockStructureD< 2 > * > partners) const override
Interface of 2D post-processing steps.
Top level namespace for all of OpenLB.
Interface for post-processing steps – header file.
Base of a field whose size is defined by [C,U_1,...,U_N]^T * [1,V_1,...V_N].