VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
Interpolator.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//
33//=======================================================================================
34
35#ifndef CPU_INTERPOLATER_H
36#define CPU_INTERPOLATER_H
37
38#include <memory>
39
40#include "BCArray3D.h"
41#include "BoundaryConditions.h"
42#include "DistributionArray3D.h"
43#include "LBMSystem.h"
44
45struct D3Q27ICell {
46 real TSW[27];
47 real TNW[27];
48 real TNE[27];
49 real TSE[27];
50 real BSW[27];
51 real BNW[27];
52 real BNE[27];
53 real BSE[27];
54};
55
56class Interpolator;
57using InterpolationProcessorPtr = std::shared_ptr<Interpolator>;
58
59
61{
62public:
63 virtual ~Interpolator() = default;
65
66 virtual void setOmegas(real omegaC, real omegaF) = 0;
69 real zoff) = 0;
72 real zoff) = 0;
73
74 static void readICell(SPtr<DistributionArray3D> f, D3Q27ICell &icell, int x1, int x2, int x3);
75 static void writeICell(SPtr<DistributionArray3D> f, const D3Q27ICell &icell, int x1, int x2, int x3);
76 static void writeICellInv(SPtr<DistributionArray3D> f, const D3Q27ICell &icell, int x1, int x2, int x3);
77 static void writeINode(SPtr<DistributionArray3D> f, const real *const inode, int x1, int x2, int x3);
78 static void writeINodeInv(SPtr<DistributionArray3D> f, const real *const inode, int x1, int x2, int x3);
79 static bool iCellHasSolid(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3);
80 static int iCellHowManySolids(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3);
81
83 int maxX2, int maxX3, int x1, int x2, int x3, real &xoff, real &yoff, real &zoff);
84
85protected:
87 virtual void calcInterpolatedNodeFC(real *f, real omega) {}
91 virtual void setOffsets(real xoff, real yoff, real zoff) {}
92
93};
94
95#endif
96
virtual void interpolateCoarseToFine(D3Q27ICell &icellC, D3Q27ICell &icellF, real xoff, real yoff, real zoff)=0
virtual void interpolateFineToCoarse(D3Q27ICell &icellF, real *icellC)=0
virtual void interpolateFineToCoarse(D3Q27ICell &icellF, real *icellC, real xoff, real yoff, real zoff)=0
virtual void setOmegas(real omegaC, real omegaF)=0
virtual void calcInterpolatedShearStress(real x, real y, real z, real &tauxx, real &tauyy, real &tauzz, real &tauxy, real &tauxz, real &tauyz)
virtual void setOffsets(real xoff, real yoff, real zoff)
virtual void calcInterpolatedCoefficiets(const D3Q27ICell &icell, real omega, real eps_new)
virtual InterpolationProcessorPtr clone()=0
virtual void interpolateCoarseToFine(D3Q27ICell &icellC, D3Q27ICell &icellF)=0
virtual void calcInterpolatedNodeFC(real *f, real omega)
virtual ~Interpolator()=default
virtual void calcInterpolatedVelocity(real x, real y, real z, real &vx1, real &vx2, real &vx3)
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
static int iCellHowManySolids(const SPtr< BCArray3D > bcArray, int x1, int x2, int x3)
static void writeICell(SPtr< DistributionArray3D > f, const D3Q27ICell &icell, int x1, int x2, int x3)
static void writeICellInv(SPtr< DistributionArray3D > f, const D3Q27ICell &icell, int x1, int x2, int x3)
std::shared_ptr< Interpolator > InterpolationProcessorPtr
static void writeINode(SPtr< DistributionArray3D > f, const real *const inode, int x1, int x2, int x3)
static void writeINodeInv(SPtr< DistributionArray3D > f, const real *const inode, int x1, int x2, int x3)
static void readICell(SPtr< DistributionArray3D > f, D3Q27ICell &icell, int x1, int x2, int x3)
bool findNeighborICell(const SPtr< BCArray3D > bcArray, SPtr< DistributionArray3D > f, D3Q27ICell &icell, int maxX1, int maxX2, int maxX3, int x1, int x2, int x3, real &xoff, real &yoff, real &zoff)
static bool iCellHasSolid(const SPtr< BCArray3D > bcArray, int x1, int x2, int x3)
@ z
Definition Axis.h:44
@ x
Definition Axis.h:42
@ y
Definition Axis.h:43
real TSW[27]
real TNE[27]
real TNW[27]
real BSW[27]
real BNE[27]
real BSE[27]
real BNW[27]
real TSE[27]