OpenLB 1.7
Loading...
Searching...
No Matches
freeSurfaceHelpers.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2021 Claudius Holeksa
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#pragma once
25
27
28
29#include <cstdint>
30#include <array>
31
32namespace olb {
33
34namespace FreeSurface {
35
36struct Stage0 { };
37struct Stage1 { };
38struct Stage2 { };
39struct Stage3 { };
40struct Stage4 { };
41
42enum class Type : std::uint8_t {
43 Gas = 0,
44 Interface = 1,
45 Fluid = 2,
46 Solid = 4
47};
48
49enum class Flags : std::uint8_t {
50 ToGas = 1,
51 ToFluid = 2,
52 NewInterface = 4
53};
54
57 bool has_gas_neighbours = false;
59};
60
61struct CELL_TYPE : public descriptors::TYPED_FIELD_BASE<Type,1> { };
62struct CELL_FLAGS : public descriptors::TYPED_FIELD_BASE<Flags,1> { };
63struct MASS : public descriptors::FIELD_BASE<1> { };
64struct EPSILON : public descriptors::FIELD_BASE<1> { };
67
68// Variables for PostProcessor
70struct TRANSITION : public descriptors::FIELD_BASE<1> { };
76
77template<typename T, size_t S>
78static std::array<T,S> solvePivotedLU(std::array<std::array<T,S>,S>& matrix, const std::array<T,S>& b, size_t N = S) any_platform;
79
80template<typename T, typename DESCRIPTOR>
82
83template <typename CELL>
84static bool isCellType(CELL& cell, const FreeSurface::Type& type) any_platform;
85
86template <typename CELL>
87static bool hasCellFlags(CELL& cell, const FreeSurface::Flags& type) any_platform;
88
89template <typename CELL>
90static bool hasNeighbour(CELL& cell, const FreeSurface::Type& type) any_platform;
91
92template <typename CELL>
93static bool hasNeighbourFlags(CELL& cell, const FreeSurface::Flags& flags) any_platform;
94
95template <typename CELL, typename V=typename CELL::value_t>
97
98template <typename CELL, typename V=typename CELL::value_t>
100
101template <typename CELL, typename V=typename CELL::value_t>
102static V getClampedEpsilon(CELL& cell) any_platform;
103
104/*
105template <typename CELL, typename V=typename CELL::value_t>
106static V getClampedEpsilonCorrected(CELL& cell) any_platform;
107*/
108
109template<typename T, typename DESCRIPTOR>
110static T calculateCubeOffset(T volume, const Vector<T,DESCRIPTOR::d>& normal) any_platform;
111
112template<typename T, typename DESCRIPTOR>
113static T calculateCubeOffsetOpt(T volume, const Vector<T,DESCRIPTOR::d>& normal) any_platform;
114
115template <typename CELL, typename V=typename CELL::value_t>
117
118template <typename CELL, typename V=typename CELL::value_t>
120
121template <typename CELL, typename V=typename CELL::value_t>
123
124template<typename T, typename DESCRIPTOR>
125static T plicInverse(T d, const Vector<T,DESCRIPTOR::d>& normal) any_platform;
126
127template <typename CELL>
129
130template <typename CELL, typename V=typename CELL::value_t>
131static bool isHealthyInterface(CELL& cell) any_platform;
132
133template <typename CELL, typename V=typename CELL::value_t>
134static void setCellType(CELL& cell, const FreeSurface::Type& type) any_platform;
135
136template <typename CELL, typename V=typename CELL::value_t>
137static void setCellFlags(CELL& cell, const FreeSurface::Flags& flags) any_platform;
138
139} // namespace FreeSurface
140
142 return static_cast<FreeSurface::Flags>(static_cast<std::uint8_t>(lhs) & static_cast<std::uint8_t>(rhs));
143}
144
146 return static_cast<FreeSurface::Flags>(static_cast<std::uint8_t>(lhs) | static_cast<std::uint8_t>(rhs));
147}
148
149} // namespace olb
150
151#include "freeSurfaceHelpers.hh"
Super class maintaining block lattices for a cuboid decomposition.
Plain old scalar vector.
Definition vector.h:47
void setCellFlags(CELL &cell, const FreeSurface::Flags &flags)
V getClampedEpsilon(CELL &cell)
Vector< V, CELL::descriptor_t::d > computeInterfaceNormal(CELL &cell)
bool hasNeighbourFlags(CELL &cell, const FreeSurface::Flags &flags)
V calculateSurfaceTensionCurvature2D(CELL &cell)
void initialize(SuperLattice< T, DESCRIPTOR > &lattice)
bool hasNeighbour(CELL &cell, const FreeSurface::Type &type)
bool isCellType(CELL &cell, const FreeSurface::Type &type)
std::array< T, S > solvePivotedLU(std::array< std::array< T, S >, S > &matrix, const std::array< T, S > &b, size_t N)
void setCellType(CELL &cell, const FreeSurface::Type &type)
V calculateSurfaceTensionCurvature3D(CELL &cell)
Vector< V, CELL::descriptor_t::d > computeParkerYoungInterfaceNormal(CELL &cell)
V calculateSurfaceTensionCurvature(CELL &cell)
T calculateCubeOffsetOpt(T volume, const Vector< T, DESCRIPTOR::d > &normal)
bool isHealthyInterface(CELL &cell)
bool hasCellFlags(CELL &cell, const FreeSurface::Flags &flags)
T calculateCubeOffset(T volume, const Vector< T, DESCRIPTOR::d > &normal)
T plicInverse(T d_o, const Vector< T, DESCRIPTOR::d > &normal)
NeighbourInfo getNeighbourInfo(CELL &cell)
Top level namespace for all of OpenLB.
any_platform FreeSurface::Flags operator&(FreeSurface::Flags lhs, FreeSurface::Flags rhs)
any_platform FreeSurface::Flags operator|(FreeSurface::Flags lhs, FreeSurface::Flags rhs)
#define any_platform
Define preprocessor macros for device-side functions, constant storage.
Definition platform.h:78
Base of a field whose size is defined by [C,U_1,...,U_N]^T * [1,V_1,...V_N].
Base of a descriptor field of scalar TYPE with dimensions A*B + B*Q + C.