OpenLB 1.7
Loading...
Searching...
No Matches
contactProperties.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2022 Jan E. Marquardt, Mathias J. Krause
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#ifndef CONTACT_PROPERTIES_H
25#define CONTACT_PROPERTIES_H
26
27namespace olb {
28namespace particles {
29namespace contact {
30
31template <typename T>
33 constexpr ContactProperty() = default;
34
35 constexpr ContactProperty(const T _effectiveYoungsModulus,
36 const T _coefficientOfRestitution,
37 const T _coefficientKineticFriction,
38 const T _coefficientStaticFriction,
39 const T _staticKineticTransitionVelocity)
40 : effectiveYoungsModulus(_effectiveYoungsModulus)
41 , coefficientOfRestitution(_coefficientOfRestitution)
42 , coefficientOfKineticFriction(_coefficientKineticFriction)
43 , coefficientOfStaticFriction(_coefficientStaticFriction)
44 , staticKineticTransitionVelocity(_staticKineticTransitionVelocity) {};
45
51};
52
59template <typename T, unsigned N, bool ENABLE_RANGE_CHECK = false>
61private:
62 std::array<ContactProperty<T>, N*(N + 1) / 2> data;
63
64 constexpr inline unsigned getIndex(unsigned materialA,
65 unsigned materialB) const;
66
67public:
69 constexpr ContactProperties() = default;
70
72 constexpr void set(const unsigned materialA, const unsigned materialB,
73 const T effectiveYoungsModulus,
74 const T coefficientOfRestitution,
75 const T coefficientKineticFriction,
76 const T coefficientStaticFriction,
77 const T staticKineticTransitionVelocity = T {0.01});
78
80 constexpr T getEffectiveYoungsModulus(const unsigned materialA,
81 const unsigned materialB) const;
83 constexpr T getCoefficientOfRestitution(const unsigned materialA,
84 const unsigned materialB) const;
86 constexpr T getKineticFrictionCoefficient(const unsigned materialA,
87 const unsigned materialB) const;
89 constexpr T getStaticFrictionCoefficient(const unsigned materialA,
90 const unsigned materialB) const;
92 constexpr T
93 getStaticKineticTransitionVelocity(const unsigned materialA,
94 const unsigned materialB) const;
95};
96
97template <typename T, unsigned N, typename F>
99{
100 ContactProperties<T, N> contactProperties {};
101 f(contactProperties);
102 return contactProperties;
103}
104
105} // namespace contact
106} // namespace particles
107} // namespace olb
108#endif
constexpr ContactProperties< T, N > createContactProperties(F f)
Top level namespace for all of OpenLB.
Object that stores properties which are necessary for the computation of contact forces N = number of...
constexpr ContactProperties()=default
Constructor.
constexpr T getKineticFrictionCoefficient(const unsigned materialA, const unsigned materialB) const
Get coefficient of kinetic friction.
constexpr T getStaticKineticTransitionVelocity(const unsigned materialA, const unsigned materialB) const
Get transition velocity (static to kinetic)
constexpr T getStaticFrictionCoefficient(const unsigned materialA, const unsigned materialB) const
Get coefficient of static friction.
constexpr void set(const unsigned materialA, const unsigned materialB, const T effectiveYoungsModulus, const T coefficientOfRestitution, const T coefficientKineticFriction, const T coefficientStaticFriction, const T staticKineticTransitionVelocity=T {0.01})
Set contact properties.
constexpr T getCoefficientOfRestitution(const unsigned materialA, const unsigned materialB) const
Get damping constant.
constexpr T getEffectiveYoungsModulus(const unsigned materialA, const unsigned materialB) const
Get effective modulus of elasticity.
constexpr ContactProperty(const T _effectiveYoungsModulus, const T _coefficientOfRestitution, const T _coefficientKineticFriction, const T _coefficientStaticFriction, const T _staticKineticTransitionVelocity)