VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
BoundaryConditions.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
32//=======================================================================================
33#ifndef LBM_ADVECTION_DIFFUSION_BOUNDARY_CONDITIONS_H
34#define LBM_ADVECTION_DIFFUSION_BOUNDARY_CONDITIONS_H
35#include <basics/DataTypes.h>
38#include <lbm/constants/D3Q27.h>
39
41{
42
43template <size_t direction>
44constexpr real computeInterpolatedPopulation(const real* populations, const real concentration, const real velocityX,
45 const real velocityY, const real velocityZ, const real subgridDistance,
46 const real relaxationFrequency)
47{
48 using namespace vf::basics::constant;
49 using namespace vf::lbm::dir;
50
52 const real population = populations[direction];
54 const real equilibrium = computeEquilibrium<direction>(concentration, velocityX, velocityY, velocityZ);
55 return ((c1o1 - subgridDistance) * ((population - equilibrium * relaxationFrequency) / (c1o1 - relaxationFrequency)) +
57 (subgridDistance + c1o1);
58}
59
60template <size_t direction>
61constexpr real computePopulationSimpleBounceBackWithFlux(const real* populations, const real fluxX, const real fluxY,
62 const real fluxZ)
63{
64 using namespace vf::basics::constant;
65 using namespace vf::lbm::dir;
66
67 return populations[direction] - c6o1 * getWeight<direction>() * getVelocity<direction>(fluxX, fluxY, fluxZ);
68}
69
70template <size_t direction>
72 const real vx1, const real vx2, const real vx3,
73 const real relaxationFrequency, const real concentration,
74 const real fluxX, const real fluxY, const real fluxZ)
75{
76 using namespace vf::basics::constant;
77 using namespace vf::lbm::dir;
78
80 const real interpolated = computeInterpolatedPopulation<direction>(populations, concentration, vx1, vx2, vx3,
81 subgridDistance, relaxationFrequency);
82 return interpolated - c6o1 * getWeight<direction>() * flux / (subgridDistance + c1o1);
83}
84
85template <size_t direction>
88 const real velocityWallZ)
89{
90 using namespace vf::basics::constant;
91
92 const real equilibriumWall =
94
95 return -populations[direction] + c2o1 * equilibriumWall;
96}
97
98template <size_t direction>
101 const real vx1, real vx2, const real vx3,
103 const real velocityWallZ, const real relaxationFrequency)
104{
105 using namespace vf::basics::constant;
106
107 const real equilibriumWall =
110 subgridDistance, relaxationFrequency);
111 return -interpolated + c2o1 * equilibriumWall / (subgridDistance + c1o1);
112}
113
114} // namespace vf::lbm::advection_diffusion
115
116#endif
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
constexpr real computePopulationSimpleBounceBackWithFlux(const real *populations, const real fluxX, const real fluxY, const real fluxZ)
constexpr real computePopulationSimpleAntiBounceBack(const real *populations, const real concentrationWall, const real velocityWallX, const real velocityWallY, const real velocityWallZ)
constexpr real computePopulationInterpolatedAntiBounceBack(const real subgridDistance, const real *populations, const real concentrationNode, const real concentrationWall, const real vx1, real vx2, const real vx3, const real velocityWallX, const real velocityWallY, const real velocityWallZ, const real relaxationFrequency)
constexpr real computeInterpolatedPopulation(const real *populations, const real concentration, const real velocityX, const real velocityY, const real velocityZ, const real subgridDistance, const real relaxationFrequency)
constexpr real equilibrium(real weight, real concentration, real velocity, real cu_sq)
Definition Equilibrium.h:42
constexpr real computePopulationInterpolatedBounceBackWithFlux(const real subgridDistance, const real *populations, const real vx1, const real vx2, const real vx3, const real relaxationFrequency, const real concentration, const real fluxX, const real fluxY, const real fluxZ)