Skip to content
Snippets Groups Projects
Commit 475656d0 authored by peters's avatar peters
Browse files

Add K15 unified.

parent a629e2f4
No related branches found
No related tags found
1 merge request!34Add new library, which contains the calculation of the macroscopic quantities and a general cumulant computation. (Closes #13)
...@@ -2,10 +2,44 @@ ...@@ -2,10 +2,44 @@
#include "LBM/D3Q27.h" #include "LBM/D3Q27.h"
#include <lbm/constants/NumericConstants.h> #include <lbm/constants/NumericConstants.h>
#include <lbm/CumulantChimeraK15.h>
#include "Kernel/Utilities/DistributionHelper.cuh"
using namespace vf::lbm::constant; using namespace vf::lbm::constant;
#include "math.h" #include "math.h"
extern "C" __global__ void LB_Kernel_CumulantK15Comp(real omega, extern "C" __global__ void LB_Kernel_CumulantK15Comp(real omega,
unsigned int* typeOfGridNode,
unsigned int* neighborX,
unsigned int* neighborY,
unsigned int* neighborZ,
real* distributions,
int size_Mat,
int level,
real* forces,
bool isEvenTimestep)
{
const uint k = vf::gpu::getNodeIndex();
const uint nodeType = typeOfGridNode[k];
if (!vf::gpu::isValidFluidNode(k, size_Mat, nodeType))
return;
vf::gpu::DistributionWrapper distributionWrapper {
distributions, size_Mat, isEvenTimestep, k, neighborX, neighborY, neighborZ
};
real level_forces[3];
vf::gpu::getLevelForce(forces[0], forces[1], forces[2], level, level_forces);
vf::lbm::cumulantChimeraK15(distributionWrapper.distribution, omega, level_forces);
distributionWrapper.write();
}
extern "C" __global__ void LB_Kernel_CumulantK15Comp_(real omega,
unsigned int* bcMatD, unsigned int* bcMatD,
unsigned int* neighborX, unsigned int* neighborX,
unsigned int* neighborY, unsigned int* neighborY,
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "LBM/D3Q27.h" #include "LBM/D3Q27.h"
#include <lbm/constants/NumericConstants.h>
#include <lbm/constants/D3Q27.h>
namespace vf namespace vf
{ {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "LBM/LB.h" #include "LBM/LB.h"
#include <lbm/CumulantChimeraK17.h> #include <lbm/Distribution27.h>
namespace vf namespace vf
{ {
......
This diff is collapsed.
#ifndef LBM_CUMULANT_CHIMERA_K15_H
#define LBM_CUMULANT_CHIMERA_K15_H
#ifndef __host__
#define __host__
#endif
#ifndef __device__
#define __device__
#endif
#include <basics/Core/DataTypes.h>
#include "Distribution27.h"
namespace vf
{
namespace lbm
{
//////////////////////////////////////////////////////////////////////////
//! Cumulant K17 Kernel is based on \ref
//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
//! and \ref
//! <a href="https://doi.org/10.1016/j.jcp.2017.07.004"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.07.004 ]</b></a>
//////////////////////////////////////////////////////////////////////////
__host__ __device__ void cumulantChimeraK15(Distribution27& distribution, real omega, real* forces);
}
}
#endif
#include "CumulantChimeraK17.h" #include "CumulantChimeraK15.h"
#include <cmath> #include <cmath>
......
#ifndef LBM_CUMULANT_CHIMERA_PRE_H #ifndef LBM_CUMULANT_CHIMERA_K17_H
#define LBM_CUMULANT_CHIMERA_PRE_H #define LBM_CUMULANT_CHIMERA_K17_H
#ifndef __host__ #ifndef __host__
#define __host__ #define __host__
...@@ -8,44 +8,15 @@ ...@@ -8,44 +8,15 @@
#define __device__ #define __device__
#endif #endif
#include <cmath>
#include <basics/Core/DataTypes.h> #include <basics/Core/DataTypes.h>
#include <basics/Core/RealConstants.h>
#include "Chimera.h" #include "Distribution27.h"
#include "MacroscopicQuantities.h"
namespace vf namespace vf
{ {
namespace lbm namespace lbm
{ {
struct Distribution27
{
real f[27];
inline __host__ __device__ real getDensity_() const
{
return getDensity(f);
}
};
inline __host__ __device__ real abs_internal(real value)
{
#ifdef __CUDA_ARCH__
return ::abs(value);
#else
return std::abs(value);
#endif
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
//! Cumulant K17 Kernel is based on \ref //! Cumulant K17 Kernel is based on \ref
//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
......
#include "Distribution27.h"
#include "MacroscopicQuantities.h"
namespace vf
{
namespace lbm
{
inline __host__ __device__ real Distribution27::getDensity_() const
{
return getDensity(f);
}
__host__ __device__ real abs_internal(real value)
{
#ifdef __CUDA_ARCH__
return ::abs(value);
#else
return std::abs(value);
#endif
}
}
}
#ifndef LBM_DISTRIBUTION_27_H
#define LBM_DISTRIBUTION_27_H
#ifndef __host__
#define __host__
#endif
#ifndef __device__
#define __device__
#endif
#include <basics/Core/DataTypes.h>
namespace vf
{
namespace lbm
{
struct Distribution27
{
real f[27];
__host__ __device__ real getDensity_() const;
};
__host__ __device__ real abs_internal(real value);
}
}
#endif
...@@ -6,6 +6,7 @@ vf_add_library(NAME lbmCuda BUILDTYPE static PUBLIC_LINK basics FOLDER ../../lbm ...@@ -6,6 +6,7 @@ vf_add_library(NAME lbmCuda BUILDTYPE static PUBLIC_LINK basics FOLDER ../../lbm
set_target_properties(lbmCuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON) set_target_properties(lbmCuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_source_files_properties(../Distribution27.cpp PROPERTIES LANGUAGE CUDA)
set_source_files_properties(../CumulantChimeraK15.cpp PROPERTIES LANGUAGE CUDA)
set_source_files_properties(../CumulantChimeraK17.cpp PROPERTIES LANGUAGE CUDA) set_source_files_properties(../CumulantChimeraK17.cpp PROPERTIES LANGUAGE CUDA)
#set_source_files_properties(../BackwardChimera.cpp PROPERTIES LANGUAGE CUDA) #set_source_files_properties(../BackwardChimera.cpp PROPERTIES LANGUAGE CUDA)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment