From 94d3e79a8617f88dc0219cfdeedfa3147833719d Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 24 Jun 2019 14:43:36 +0200 Subject: Initialize at openlb-1-3 --- src/dynamics/rtlbmDescriptors.h | 104 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 src/dynamics/rtlbmDescriptors.h (limited to 'src/dynamics/rtlbmDescriptors.h') diff --git a/src/dynamics/rtlbmDescriptors.h b/src/dynamics/rtlbmDescriptors.h new file mode 100644 index 0000000..3d435b8 --- /dev/null +++ b/src/dynamics/rtlbmDescriptors.h @@ -0,0 +1,104 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2017-2019 Albert Mink, Adrian Kummerlaender + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +/** \file + * -- header file + */ +#ifndef RTLBM_DESCRIPTORS_H +#define RTLBM_DESCRIPTORS_H + +#include "latticeDescriptors.h" + +namespace olb { + +namespace descriptors { + +namespace tag { + +struct RTLBM : public CATEGORY, public DESCRIPTOR_TAG { }; + +} + +using D3Q7DescriptorRTLBM = D3Q7<>; +using D3Q19DescriptorRTLBM = D3Q19<>; +using D3Q27DescriptorRTLBM = D3Q27; + +namespace rtlbm_data { + +using utilities::Fraction; + +template +constexpr Fraction t[Q] = {}; + +template <> +constexpr Fraction t<3,27>[27] = { + 0, + + {1, 21}, {1, 21}, {1, 21}, + {4, 105}, {4, 105}, {4, 105}, + {4, 105}, {4, 105}, {4, 105}, + {9, 280}, {9, 280}, {9, 280}, {9, 280}, + + {1, 21}, {1, 21}, {1, 21}, + {4, 105}, {4, 105}, {4, 105}, + {4, 105}, {4, 105}, {4, 105}, + {9, 280}, {9, 280}, {9, 280}, {9, 280} +}; + +template +constexpr T norm_c_3_27[27] = { + 0.0, + 1.0, 1.0, 1.0, + 1.41421356237, 1.41421356237, 1.41421356237, + 1.41421356237, 1.41421356237, 1.41421356237, + 1.73205080757, 1.73205080757, 1.73205080757, 1.73205080757, + 1.0, 1.0, 1.0, + 1.41421356237, 1.41421356237, 1.41421356237, + 1.41421356237, 1.41421356237, 1.41421356237, + 1.73205080757, 1.73205080757, 1.73205080757, 1.73205080757 +}; + +} + +template +constexpr T t(unsigned iPop, tag::RTLBM) +{ + return rtlbm_data::t[iPop].template as(); +} + +template +constexpr T norm_c(unsigned iPop) +{ + // Hacky but should hold until we implemented a solution for abstracting T in this setting + static_assert( + DESCRIPTOR::d == 3 && DESCRIPTOR::q == 27 && DESCRIPTOR::template provides(), + "DESCRIPTOR is D3Q27 RTLBM" + ); + return rtlbm_data::norm_c_3_27[iPop]; +} + +} // namespace descriptors + +} // namespace olb + +#endif -- cgit v1.2.3