1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
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.
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
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
29//! \addtogroup gpu_BoundaryConditions BoundaryConditions
30//! \ingroup gpu_core core
32//! \author Martin Schoenherr, Anna Wellmann
33//======================================================================================
34#include <cuda_runtime.h>
35#include <helper_cuda.h>
37#include "Calculation/Calculation.h"
38#include <cuda_helper/CudaGrid.h>
40#include "PressureNonEquilibrium.cuh"
41#include "Parameter/Parameter.h"
43#include <lbm/MacroscopicQuantities.h>
47void PressureNonEquilibriumIncompressible(LBMSimulationParameter* parameterDevice, QforDirectionalBoundaryCondition* boundaryCondition)
49 dim3 grid = vf::cuda::getCudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
50 dim3 threads(parameterDevice->numberofthreads, 1, 1);
52 auto macroscopicQuantityFunctor = [] __device__(const real *const &f /*[27]*/, real &rho, real &vx1, real &vx2, real &vx3) {
53 vf::lbm::getIncompressibleMacroscopicValues(f, rho, vx1, vx2, vx3);
56 PressureNonEquilibrium_Device<decltype(macroscopicQuantityFunctor)><<< grid, threads >>> (
57 boundaryCondition->RhoBC,
58 parameterDevice->distributions.f[0],
60 boundaryCondition->kN,
61 boundaryCondition->numberOfBCnodes,
62 parameterDevice->neighborX,
63 parameterDevice->neighborY,
64 parameterDevice->neighborZ,
65 parameterDevice->numberOfNodes,
66 parameterDevice->isEvenTimestep,
67 static_cast<int>(boundaryCondition->direction),
68 macroscopicQuantityFunctor);
69 getLastCudaError("PressureNonEquilibriumIncompressible_Device execution failed");
71//////////////////////////////////////////////////////////////////////////
72void PressureNonEquilibriumCompressible(LBMSimulationParameter* parameterDevice, QforDirectionalBoundaryCondition* boundaryCondition)
74 dim3 grid = vf::cuda::getCudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
75 dim3 threads(parameterDevice->numberofthreads, 1, 1);
77 auto macroscopicQuantityFunctor = [] __device__(const real *const &f /*[27]*/, real &rho, real &vx1, real &vx2, real &vx3) {
78 vf::lbm::getCompressibleMacroscopicValues(f, rho, vx1, vx2, vx3);
81 PressureNonEquilibrium_Device<decltype(macroscopicQuantityFunctor)><<< grid, threads >>> (
82 boundaryCondition->RhoBC,
83 parameterDevice->distributions.f[0],
85 boundaryCondition->kN,
86 boundaryCondition->numberOfBCnodes,
87 parameterDevice->neighborX,
88 parameterDevice->neighborY,
89 parameterDevice->neighborZ,
90 parameterDevice->numberOfNodes,
91 parameterDevice->isEvenTimestep,
92 static_cast<int>(boundaryCondition->direction),
93 macroscopicQuantityFunctor);
94 getLastCudaError("PressureNonEquilibriumCompressible_Device execution failed");