OpenLB 1.7
Loading...
Searching...
No Matches
multiPhaseUnitConverter.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2017 Max Gaedtke, Albert Mink
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
28#ifndef MULTIPHASEUNITCONVERTER_H
29#define MULTIPHASEUNITCONVERTER_H
30
31
32#include <math.h>
33#include "io/ostreamManager.h"
34#include "core/util.h"
35#include "io/xmlReader.h"
36#include "core/unitConverter.h"
37
38// All OpenLB code is contained in this namespace.
39namespace olb {
40
41
42
55template <typename T, typename DESCRIPTOR>
56class MultiPhaseUnitConverter : public UnitConverter<T, DESCRIPTOR> {
57public:
62 size_t resolution,
63 T charPhysLength,
64 T charPhysVelocity,
65 T physViscosity,
66 T physEoSa,
67 T latticeEoSa,
68 T physEoSb,
69 T physMolarMass,
70 T physSurfaceTension,
71 T charPhysTemperature,
72 T charPhysPressure )
73 : UnitConverter<T, DESCRIPTOR>(
74 (charPhysLength/resolution),
75 (charPhysLength/resolution)*util::pow(physEoSa/latticeEoSa, -0.5)*util::pow(physEoSb*10.5/1., 0.5)*util::pow(physMolarMass*1, 0.5),
76 charPhysLength,
77 charPhysVelocity,
78 physViscosity,
79 physMolarMass*1/(physEoSb*10.5/1.),
80 charPhysPressure),
81 _conversionEoSa(physEoSa/latticeEoSa),
82 _conversionEoSb(physEoSb*10.5/1.),
83 _conversionMolarMass(physMolarMass*1),
86 _physEoSa(physEoSa),
87 _physEoSb(physEoSb),
88 _physMolarMass(physMolarMass),
89 _physSurfaceTension(physSurfaceTension),
90 _charPhysTemperature(charPhysTemperature),
92 clout(std::cout,"MultiPhaseUnitConv")
93 {
94 };
95
97 constexpr T getCharPhysTemperature( ) const
98 {
100 };
102 constexpr T getPhysEoSa( ) const
103 {
104 return _physEoSa;
105 };
107 constexpr T getPhysEoSb( ) const
108 {
109 return _physEoSb;
110 };
112 constexpr T getPhysMolarMass( ) const
113 {
114 return _physMolarMass;
115 };
117 constexpr T getPhysSurfaceTension( ) const
118 {
119 return _physSurfaceTension;
120 };
122 constexpr T getPhysTemperature( ) const
123 {
125 };
126
128 constexpr T getConversionFactorEoSa() const
129 {
130 return _conversionEoSa;
131 };
132
134 constexpr T getConversionFactorEoSb() const
135 {
136 return _conversionEoSb;
137 };
138
141 {
143 };
144
147 {
149 };
150
153 {
155 };
156
159 {
161 };
162
164 constexpr T getLatticeSurfaceTension( ) const
165 {
167 };
168
170 void print() const override;
171
172
173
174protected:
175 // conversion factors
176 const T _conversionEoSa; // kg m^5 / s^2 mol^2
177 const T _conversionEoSb; // m^3 / mol
178 const T _conversionMolarMass; // kg / mol
179 const T _conversionGasConstant = 8.314462618; // J / mol K = kg m^2 / s^2 mol K
180 const T _conversionSurfaceTension; // J / m^2 = kg / s^2
182
183 // physical units, e.g characteristic or reference values
184 const T _physEoSa; // kg m^5 / s^2 mol^2
185 const T _physEoSb; // m^3 / mol
186 const T _physMolarMass; // kg / mol
187 const T _physSurfaceTension; // J / m^2 = kg / s^2
189
190 // lattice units, discretization parameters
192
193private:
194 mutable OstreamManager clout;
195};
196
197} // namespace olb
198
199#endif
Conversion between physical and lattice units, as well as discretization for multiple component latti...
constexpr T getConversionFactorEoSa() const
access (read-only) to private member variable
constexpr T getConversionFactorTemperature() const
access (read-only) to private member variable
constexpr T getCharPhysTemperature() const
return characteristic temperature in physical units
constexpr T getPhysEoSb() const
return equation of state parameter b in physical units
constexpr T getPhysSurfaceTension() const
return surface tension in physical units
constexpr T getConversionFactorSurfaceTension() const
access (read-only) to private member variable
constexpr T getPhysMolarMass() const
return molar mass in physical units
constexpr T getPhysTemperature() const
return characteristic temperature in physical units
constexpr T getConversionFactorGasConstant() const
access (read-only) to private member variable
void print() const override
nice terminal output for conversion factors, characteristical and physical data
constexpr T getConversionFactorEoSb() const
access (read-only) to private member variable
constexpr T getPhysEoSa() const
return equation of state parameter a in physical units
constexpr MultiPhaseUnitConverter(size_t resolution, T charPhysLength, T charPhysVelocity, T physViscosity, T physEoSa, T latticeEoSa, T physEoSb, T physMolarMass, T physSurfaceTension, T charPhysTemperature, T charPhysPressure)
Documentation of constructor: TODO: Extend constructur documentation.
constexpr T getConversionFactorMolarMass() const
access (read-only) to private member variable
constexpr T getLatticeSurfaceTension() const
return lattice surface tension for parameter fitting
class for marking output with some text
Conversion between physical and lattice units, as well as discretization.
Top level namespace for all of OpenLB.
Unit conversion handling – header file.
Set of functions commonly used in LB computations – header file.
Input/Output in XML format – header file.