VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
UpdateGrid27.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#ifndef UPDATEGRID27_H
35#define UPDATEGRID27_H
36
37#include <vector>
38
40
43#include "Parameter/Parameter.h"
45
46namespace vf::parallel
47{
48class Communicator;
49}
50
51namespace vf::gpu {
52
53class BoundaryConditionKernelManager;
54class GridScalingKernelManager;
55class Kernel;
56class BoundaryConditionFactory;
57class GridScalingFactory;
58class TurbulenceModelFactory;
59class TurbulenceModelManager;
60class UpdateGrid27;
61using CollisionStrategy = std::function<void (UpdateGrid27* updateGrid, Parameter* para, int level, unsigned int t)>;
62using RefinementStrategy = std::function<void (UpdateGrid27* updateGrid, Parameter* para, int level)>;
63
64
66{
67public:
68 UpdateGrid27(SPtr<Parameter> para, vf::parallel::Communicator& comm, SPtr<CudaMemoryManager> cudaMemoryManager, std::vector<SPtr<Kernel>>& kernels,
69 std::vector<SPtr<AdvectionDiffusionKernel>>& kernelsAD, const BoundaryConditionFactory* bcFactory,
70 SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory);
71 void updateGrid(int level, unsigned int t);
72 void exchangeData(int level);
73
74private:
75 void collisionAllNodes(int level, unsigned int t);
76 void collisionUsingIndices(int level, unsigned int t, uint *taggedFluidNodeIndices = nullptr, uint numberOfTaggedFluidNodes = 0, CollisionTemplate collisionTemplate = CollisionTemplate::Default, CudaStreamIndex streamIndex=CudaStreamIndex::Legacy);
77
78 void postCollisionBC(int level, unsigned int t);
79 void preCollisionBC(int level, unsigned int t);
80
81 void fineToCoarse(int level, InterpolationCells* fineToCoarse, ICellNeigh &neighborFineToCoarse, CudaStreamIndex streamIndex);
82 void coarseToFine(int level, InterpolationCells* coarseToFine, ICellNeigh &neighborCoarseToFine, CudaStreamIndex streamIndex);
83
84 void prepareExchangeMultiGPU(int level, CudaStreamIndex streamIndex);
85 void prepareExchangeMultiGPUAfterFtoC(int level, CudaStreamIndex streamIndex);
86
87 void exchangeMultiGPU(int level, CudaStreamIndex streamIndex);
88 void exchangeMultiGPUAfterFtoC(int level, CudaStreamIndex streamIndex);
89 void exchangeMultiGPU_noStreams_withPrepare(int level, bool useReducedComm);
90
91 void swapBetweenEvenAndOddTimestep(int level);
92
93 void calcMacroscopicQuantities(int level);
94 void calcTurbulentViscosity(int level);
95 void interact(int level, unsigned int t);
96 void sample(int level, unsigned int t);
97
98private:
99 CollisionStrategy collision;
104
105 RefinementStrategy refinement;
111 friend class NoRefinement;
112
113private:
114 SPtr<Parameter> para;
116 SPtr<CudaMemoryManager> cudaMemoryManager;
117 std::vector<SPtr<Kernel>> kernels;
118 std::vector<std::shared_ptr<AdvectionDiffusionKernel>> kernelsAD;
120 std::shared_ptr<BoundaryConditionKernelManager> bcKernelManager;
122 std::shared_ptr<GridScalingKernelManager> gridScalingKernelManager;
124 std::shared_ptr<TurbulenceModelManager> tmManager;
125};
126
127}
128
129#endif
130
Version of collision: for multi-gpu simulations, without communication hiding ("streams"),...
Version of collision: for multi-gpu simulations, without communication hiding ("streams"),...
Version of collision: for multi-gpu simulations, with communication hiding ("streams"),...
Version of refinement: for uniform simulations (no grid refinement)
Class for LBM-parameter management.
Definition Parameter.h:359
Version of refinement: for single-gpu simulations.
Version of refinement: for multi-gpu simulations, without communication hiding ("streams"),...
Version of refinement: for multi-gpu simulations, without communication hiding ("streams"),...
Version of refinement: for multi-gpu simulations, with communication hiding ("streams"),...
Version of refinement: for multi-gpu simulations, with communication hiding ("streams"),...
void updateGrid(int level, unsigned int t)
void exchangeData(int level)
friend class CollisionAndExchange_noStreams_withReadWriteFlags
An abstract class for communication between processes in parallel computation.
std::shared_ptr< T > SPtr
unsigned int uint
Definition DataTypes.h:47
CollisionTemplate
An enumeration for selecting a template of the collision kernel (CumulantK17)
Definition Calculation.h:57
std::function< void(UpdateGrid27 *updateGrid, Parameter *para, int level, unsigned int t)> CollisionStrategy
std::function< void(UpdateGrid27 *updateGrid, Parameter *para, int level)> RefinementStrategy
stores location of neighboring cell (necessary for refinement into the wall)
Definition Calculation.h:85