VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
DampingLayer.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 DAMPING_LAYER_H
36#define DAMPING_LAYER_H
37
38#include <functional>
39#include <utility>
40#include <vector>
41
42#include <basics/DataTypes.h>
43#include <logger/Logger.h>
44
45#include "Axis.h"
47
48namespace vf::gpu {
49
51{
52
53public:
54 struct DampingLayerData;
55
56 enum class DampingLayerType { Rayleigh };
57
58public:
60 Axis direction, std::function<real(real)> dampingFunction, real startPosition, real endPosition)
61 : dampingLayerType(dampingLayerType), direction(direction), dampingFunction(std::move(dampingFunction)),
62 startPosition(startPosition), endPosition(endPosition),
64 {
65 switch (dampingLayerType) {
67 VF_LOG_INFO("Using Rayleigh Damping");
68 break;
69 }
70 switch (direction) {
71 case Axis::x:
72 VF_LOG_INFO("Damping from {} to {} in X direction", startPosition, endPosition);
73 break;
74 case Axis::y:
75 VF_LOG_INFO("Damping from {} to {} in Y direction", startPosition, endPosition);
76 break;
77 case Axis::z:
78 VF_LOG_INFO("Damping from {} to {} in Z direction", startPosition, endPosition);
79 break;
80 }
81 };
82
83 ~DampingLayer() override;
84
85 void init() override;
86 void interact(int level, uint t) override;
89 {
90 return dampingLayerData[level];
91 }
92
93private:
94 void makeDampingLayerData(int level);
95
96 DampingLayerType dampingLayerType;
97 Axis direction;
98 real startPosition, endPosition;
99 std::function<real(real)> dampingFunction;
100 std::vector<DampingLayerData> dampingLayerData;
101};
102
110
111}
112
113#endif
#define VF_LOG_INFO(...)
Definition Logger.h:50
void init() override
DampingLayerData & getDampingLayerData(int level)
~DampingLayer() override
void interact(int level, uint t) override
void getTaggedFluidNodes(GridProvider *gridProvider) override
DampingLayer(SPtr< Parameter > parameter, SPtr< CudaMemoryManager > cudaMemoryManager, DampingLayerType dampingLayerType, Axis direction, std::function< real(real)> dampingFunction, real startPosition, real endPosition)
SPtr< CudaMemoryManager > cudaMemoryManager
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
unsigned int uint
Definition DataTypes.h:47
Axis
Definition Axis.h:41
@ z
Definition Axis.h:44
@ x
Definition Axis.h:42
@ y
Definition Axis.h:43