version 3.8
components/base.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
7
17#ifndef DUMUX_COMPONENT_BASE_HH
18#define DUMUX_COMPONENT_BASE_HH
19
20#include <string>
21
22#include <dune/common/exceptions.hh>
23#include <dune/common/stdstreams.hh>
24#include <dune/common/exceptions.hh>
26
27namespace Dumux {
28namespace Components {
29
34template <class Component>
35struct IsAqueous : public std::false_type {};
36
45template <class ScalarType, class Component>
46class Base
47{
48public:
49
51 using Scalar = ScalarType;
52
54 static constexpr bool isTabulated = false;
55
68 static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp,
69 Scalar pressMin, Scalar pressMax, unsigned nPress)
70 { Dune::dwarn << "No init routine defined - make sure that this is not necessary!" << std::endl; }
71
76 template<class C = Component>
77 static std::string name()
78 {
79 static_assert(AlwaysFalse<C>::value, "Mandatory function not implemented: name()");
80 DUNE_THROW(Dune::NotImplemented, "name()");
81 }
82
86 template<class C = Component>
87 static constexpr Scalar molarMass()
88 {
89 static_assert(AlwaysFalse<C>::value, "Mandatory function not implemented: molarMass()");
90 return 0; // iso c++ requires a return statement for constexpr functions
91 }
92
96 template<class C = Component>
97 static constexpr Scalar criticalTemperature()
98 {
99 static_assert(AlwaysFalse<C>::value, "Mandatory function not implemented: criticalTemperature()");
100 return 0; // iso c++ requires a return statement for constexpr functions
101 }
102
106 template<class C = Component>
107 static constexpr Scalar criticalPressure()
108 {
109 static_assert(AlwaysFalse<C>::value, "Mandatory function not implemented: criticalPressure()");
110 return 0; // iso c++ requires a return statement for constexpr functions
111 }
112
116 template<class C = Component>
117 static constexpr Scalar tripleTemperature()
118 {
119 static_assert(AlwaysFalse<C>::value, "Mandatory function not implemented: tripleTemperature()");
120 return 0; // iso c++ requires a return statement for constexpr functions
121 }
122
126 template<class C = Component>
127 static constexpr Scalar triplePressure()
128 {
129 static_assert(AlwaysFalse<C>::value, "Mandatory function not implemented: triplePressure()");
130 return 0; // iso c++ requires a return statement for constexpr functions
131 }
132
139 template<class C = Component>
141 {
142 static_assert(AlwaysFalse<C>::value, "Mandatory function not implemented: vaporPressure(t)");
143 DUNE_THROW(Dune::NotImplemented, "vaporPressure(t)");
144 }
145
146};
147
148} // end namespace Components
149} // end namespace Dumux
150
151#endif
Base class for all components Components provide the thermodynamic relations for the liquid,...
Definition: components/base.hh:47
static constexpr Scalar molarMass()
The molar mass in of the component.
Definition: components/base.hh:87
static constexpr bool isTabulated
if the component relies on tabulated values
Definition: components/base.hh:54
static constexpr Scalar tripleTemperature()
Returns the temperature in at the component's triple point.
Definition: components/base.hh:117
static constexpr Scalar criticalPressure()
Returns the critical pressure in of the component.
Definition: components/base.hh:107
static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress)
A default routine for initialization, not needed for components and must not be called.
Definition: components/base.hh:68
static constexpr Scalar triplePressure()
Returns the pressure in at the component's triple point.
Definition: components/base.hh:127
static Scalar vaporPressure(Scalar t)
The vapor pressure in of the component at a given temperature in .
Definition: components/base.hh:140
static constexpr Scalar criticalTemperature()
Returns the critical temperature in of the component.
Definition: components/base.hh:97
static std::string name()
A human readable name for the component.
Definition: components/base.hh:77
ScalarType Scalar
export the scalar type used by the component
Definition: components/base.hh:51
Type traits.
Definition: adapt.hh:17
Template which always yields a false value.
Definition: common/typetraits/typetraits.hh:24
IsAqueous struct.
Definition: components/base.hh:35