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/latticeDescriptors.h | 404 ++++++++++++++++++++++++++++++++++++++
1 file changed, 404 insertions(+)
create mode 100644 src/dynamics/latticeDescriptors.h
(limited to 'src/dynamics/latticeDescriptors.h')
diff --git a/src/dynamics/latticeDescriptors.h b/src/dynamics/latticeDescriptors.h
new file mode 100644
index 0000000..ce756cd
--- /dev/null
+++ b/src/dynamics/latticeDescriptors.h
@@ -0,0 +1,404 @@
+/* This file is part of the OpenLB library
+ *
+ * Copyright (C) 2019 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
+ * Descriptor for all types of 2D and 3D lattices. In principle, thanks
+ * to the fact that the OpenLB code is generic, it is sufficient to
+ * write a new descriptor when a new type of lattice is to be used.
+ * -- header file
+ */
+#ifndef LATTICE_DESCRIPTORS_H
+#define LATTICE_DESCRIPTORS_H
+
+#include "descriptorBase.h"
+#include "descriptorField.h"
+#include "descriptorFunction.h"
+
+namespace olb {
+
+/// Descriptors for the 2D and 3D lattices.
+/** \warning Attention: The lattice directions must always be ordered in
+ * such a way that c[i] = -c[i+(q-1)/2] for i=1..(q-1)/2, and c[0] = 0 must
+ * be the rest velocity. Furthermore, the velocities c[i] for i=1..(q-1)/2
+ * must verify
+ * - in 2D: (c[i][0]<0) || (c[i][0]==0 && c[i][1]<0)
+ * - in 3D: (c[i][0]<0) || (c[i][0]==0 && c[i][1]<0)
+ * || (c[i][0]==0 && c[i][1]==0 && c[i][2]<0)
+ * Otherwise some of the code will work erroneously, because the
+ * aformentioned relations are taken as given to enable a few
+ * optimizations.
+*/
+namespace descriptors {
+
+
+/// D2Q9 lattice
+template
+struct D2Q9 : public DESCRIPTOR_BASE<2,9,POPULATION,FIELDS...> {
+ typedef D2Q9 BaseDescriptor;
+ D2Q9() = delete;
+};
+
+namespace data {
+
+template <>
+constexpr int vicinity<2,9> = 1;
+
+template <>
+constexpr int c<2,9>[9][2] = {
+ { 0, 0},
+ {-1, 1}, {-1, 0}, {-1,-1}, { 0,-1},
+ { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}
+};
+
+template <>
+constexpr int opposite<2,9>[9] = {
+ 0, 5, 6, 7, 8, 1, 2, 3, 4
+};
+
+template <>
+constexpr Fraction t<2,9>[9] = {
+ {4, 9}, {1, 36}, {1, 9}, {1, 36}, {1, 9},
+ {1, 36}, {1, 9}, {1, 36}, {1, 9}
+};
+
+template <>
+constexpr Fraction cs2<2,9> = {1, 3};
+
+}
+
+using D2Q9Descriptor = D2Q9<>;
+using AdvectionDiffusionD2Q9Descriptor = D2Q9;
+using ForcedD2Q9Descriptor = D2Q9;
+using SmagorinskyForcedD2Q9Descriptor = D2Q9;
+using MixedScaleForcedD2Q9Descriptor = D2Q9;
+using FreeEnergyD2Q9Descriptor = D2Q9;
+using V6ForcedD2Q9Descriptor = D2Q9;
+
+
+/// D2Q5 lattice
+template
+struct D2Q5 : public DESCRIPTOR_BASE<2,5,POPULATION,FIELDS...> {
+ typedef D2Q5 BaseDescriptor;
+ D2Q5() = delete;
+};
+
+namespace data {
+
+template <>
+constexpr int vicinity<2,5> = 1;
+
+template <>
+constexpr int c<2,5>[5][2] = {
+ { 0, 0},
+ {-1, 0}, {0, -1}, {1,0}, { 0,1}
+};
+
+template <>
+constexpr int opposite<2,5>[5] = {
+ 0, 3, 4, 1, 2
+};
+
+template <>
+constexpr Fraction t<2,5>[5] = {
+ {1, 3},
+ {1, 6}, {1, 6},
+ {1, 6}, {1, 6}
+};
+
+template <>
+constexpr Fraction cs2<2,5> = {1, 3};
+
+}
+
+using D2Q5Descriptor = D2Q5<>;
+using AdvectionDiffusionD2Q5Descriptor = D2Q5;
+using SourcedAdvectionDiffusionD2Q5Descriptor = D2Q5