OpenLB 1.8.1
Loading...
Searching...
No Matches
availableDynamicList.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2024 Dennis Teutscher
4 *
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23*/
24#ifndef AVAILABLE_DYNAMICS_H
25#define AVAILABLE_DYNAMICS_H
26
28#include "superLattice.hh"
29//#include "core3D.h"
30
31namespace olb {
32namespace momenta{
33 template <typename T, typename DESCRIPTOR>
37
38 template<typename T, typename DESCRIPTOR>
40 // "default" with momenta::bulkTuple
48 //ChopardDynamics<T,DESCRIPTOR>,
49 // "default" with different momenta
51 //This Dynamic is not working in this setup. What is it even.
52 //P1Dynamics<T,DESCRIPTOR>,
58 // NguyenLaddCorrection collision
60 // Porous momenta, SmagorinskyEffectiveOmega collision
62 // With Forcing "default"
65 // Guo<> forcing
69 // Guo<> forcing, OmegaFromCellTauEff<> collision
71 // MCGuo<> forcing
72 //MultiComponentForcedBGKdynamics<T,DESCRIPTOR>
73 >;
74}
75 template<typename T, typename DESCRIPTOR>
158 opti::F,
161 >;
162
163 template <typename T, typename DESCRIPTOR>
165 OstreamManager clout("DynamicsFromXML");
166 bool dynamicFound = false;
168
170 if (name == DynamicsPromise<T, DESCRIPTOR>(dynamic).realize()->getName()) {
171 tmp = DynamicsPromise<T, DESCRIPTOR>(dynamic);
172 clout << DynamicsPromise<T, DESCRIPTOR>(dynamic).realize()->getName() << std::endl;
173 dynamicFound = true;
174 }
175 });
176
177 if (dynamicFound) {
178 clout << "Returned dynamic" << std::endl;
180 } else {
181 throw std::invalid_argument("Model " + name + " not available");
182 }
183 }
184
185 template <typename T, typename DESCRIPTOR>
186 void defineDynamicsAndSetParameterFromXml(std::string xmlFileName, SuperGeometry<T, 3>& sGeometry, SuperLattice<T, DESCRIPTOR>& sLattice) {
187 defineDynamicsFromXml(xmlFileName, sLattice,sGeometry);
188 setParameterFromXml(sLattice, xmlFileName);
189 }
190
191 template <typename T, typename DESCRIPTOR>
192 void defineDynamicsFromXml(std::string xmlFileName, SuperLattice<T, DESCRIPTOR>& sLattice, SuperGeometry<T, 3>& sGeometry) {
193 OstreamManager clout("DynamicsFromXML");
194 DynamicsTupleParser<T, DESCRIPTOR> parser(xmlFileName);
195 std::vector<int> indicators = parser.readIndicatorFromXML();
196 clout << "size " << indicators.size() << std::endl;
197
198 auto dynamicsStrings = parser.readTupleFromXML();
199 for (int i = 0; i < dynamicsStrings.size(); i++) {
200 clout << indicators[i] << std::endl;
201 sLattice.defineDynamics(sGeometry.getMaterialIndicator(indicators[i]),
202 mapStringToDynamics<T, DESCRIPTOR>(dynamicsStrings[i]));
203 }
204 }
205
206 template <typename T, typename DESCRIPTOR>
207 void defineDynamicsFromString(SuperLattice<T, DESCRIPTOR>& sLattice, std::unique_ptr<olb::SuperIndicatorF<T, 3U>> indicatorF, std::string modelName)
208 {
209
210 sLattice.defineDynamics(indicatorF,
212
213 }
214
215 template<typename T, typename DESCRIPTOR>
216 void setParameterFromXml(SuperLattice<T, DESCRIPTOR>& sLattice, std::string xmlFileName) {
217 OstreamManager clout("ParameterFromXML");
218
219 DynamicsTupleParser<T, DESCRIPTOR> parser(xmlFileName);
220 std::map<std::string, float> parameters = parser.readParameterFromXML();
221
223 auto it = parameters.find(fields::name<decltype(field.get())>()); // Find the name in the map
224 if (it != parameters.end()) {
225 clout << "Name: " << fields::name<decltype(field.get())>() << ", Value: " << it->second << std::endl;
226 sLattice.template setParameter<decltype(field.get())>( it->second );
227 }
228 });
229 }
230
231} // namespace olb
232
233#endif // AVAILABLE_DYNAMICS_H
Factory for instances of a specific Dynamics type.
std::vector< int > readIndicatorFromXML()
std::vector< std::string > readTupleFromXML()
Definition tupleParser.h:64
std::map< std::string, float > readParameterFromXML()
class for marking output with some text
Representation of a statistic for a parallel 2D geometry.
std::unique_ptr< SuperIndicatorF< T, D > > getMaterialIndicator(std::vector< int > &&materials)
Returns a material indicator using the given vector of materials.
Super class maintaining block lattices for a cuboid decomposition.
void defineDynamics()
Set dynamics of all cells to DYNAMICS.
std::string name()
Returns name of FIELD for human consumption.
Definition fields.h:49
Top level namespace for all of OpenLB.
void defineDynamicsFromString(SuperLattice< T, DESCRIPTOR > &sLattice, std::unique_ptr< olb::SuperIndicatorF< T, 3U > > indicatorF, std::string modelName)
DynamicsPromise< T, DESCRIPTOR > mapStringToDynamics(std::string name)
void setParameterFromXml(SuperLattice< T, DESCRIPTOR > &sLattice, std::string xmlFileName)
std::string getName(OperatorScope scope)
Returns human-readable name of scope.
DynamicsPromise(meta::id< DYNAMICS >) -> DynamicsPromise< typename DYNAMICS::value_t, typename DYNAMICS::descriptor_t >
std::conditional_t< D==2, SuperIndicatorF2D< T >, SuperIndicatorF3D< T > > SuperIndicatorF
Definition aliases.h:197
void defineDynamicsFromXml(std::string xmlFileName, SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 3 > &sGeometry)
void defineDynamicsAndSetParameterFromXml(std::string xmlFileName, SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice)
Compute dynamics parameter OMEGA locally using Smagorinsky LES model.
Dynamics constructed as a tuple of momenta, equilibrium and collision.
Definition interface.h:308
Identity type to pass non-constructible types as value.
Definition meta.h:79
Plain wrapper for list of types.
Definition meta.h:276
static constexpr void for_each(F f)
Calls f for each type of TYPES by-value (in reversed order!)
Definition meta.h:331
Objective functional derivative regarding optimization controls.
Definition fields.h:581
Derivative of Objective functional regarding populations.
Definition fields.h:552
Stores populations of the primal problems for adjoint simulations.
Definition fields.h:550