OpenLB 1.7
Loading...
Searching...
No Matches
porousAdvectionDiffusionDynamics.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2008 Orestis Malaspinas, Andrea Parmigiani
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 POROUS_ADVECTION_DIFFUSION_DYNAMICS_HH
29#define POROUS_ADVECTION_DIFFUSION_DYNAMICS_HH
30
31#include <algorithm>
32#include <limits>
33
35#include "core/util.h"
36#include "lbm.h"
37
38namespace olb {
39
40
41//==================================================================//
42//========== BGK Model for porous Advection diffusion=======//
43//==================================================================//
44
45template<typename T, typename DESCRIPTOR, typename MOMENTA>
47 T omega, T tSolid )
48 : legacy::BasicDynamics<T, DESCRIPTOR, MOMENTA>( ),
49 _omega(omega), _tSolid(tSolid)
50{
51 this->getName() = "PorousAdvectionDiffusionBGKdynamics";
52}
53
54template<typename T, typename DESCRIPTOR, typename MOMENTA>
56 const UnitConverter<T,DESCRIPTOR>& converter, T tSolid )
57 : legacy::BasicDynamics<T, DESCRIPTOR, MOMENTA>( ),
58 _omega(converter.getLatticeRelaxationFrequency()), _tSolid(tSolid)
59{
60 this->getName() = "PorousAdvectionDiffusionBGKdynamics";
61}
62
63template<typename T, typename DESCRIPTOR, typename MOMENTA>
65 const T u[DESCRIPTOR::d] ) const
66{
67 // does temperature need to be considered here?
68 return equilibrium<DESCRIPTOR>::firstOrder( iPop, rho, u );
69}
70
71
72template<typename T, typename DESCRIPTOR, typename MOMENTA>
74{
75 T temperature = MomentaF().computeRho( cell );
76
77 // apply temperature scaling
78 auto porosity = cell.template getField<descriptors::POROSITY>();
79 temperature = scaleTemp(temperature, porosity);
80
81 auto u = cell.template getField<descriptors::VELOCITY>();
82
83 T uSqr = lbm<DESCRIPTOR>::bgkCollision(cell, temperature, u, _omega);
84
85 return {temperature, uSqr};
86}
87
88template<typename T, typename DESCRIPTOR, typename MOMENTA>
93
94template<typename T, typename DESCRIPTOR, typename MOMENTA>
99
100template<typename T, typename DESCRIPTOR, typename MOMENTA>
102{
103 T rho = porosity * temp + ( T(1) - porosity ) * _tSolid;
104 return rho;
105}
106
107
108} // namespace olb
109
110#endif
Highest-level interface to Cell data.
Definition cell.h:148
This approach contains a slight error in the diffusion term.
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override
Compute equilibrium distribution function.
T getOmega() const
Get local relaxation parameter of the dynamics.
PorousAdvectionDiffusionBGKdynamics(T omega, T tSolid)
Constructor.
void setOmega(T omega)
Set local relaxation parameter of the dynamics.
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell) override
Collision step.
Conversion between physical and lattice units, as well as discretization.
Top level namespace for all of OpenLB.
A collection of dynamics classes (e.g.
Return value of any collision.
Definition interface.h:43
virtual std::string getName() const
Return human-readable name.
Definition interface.h:63
static V firstOrder(int iPop, const RHO &rho, const U &u) any_platform
Computation of equilibrium distribution, first order in u.
Definition lbm.h:37
static V bgkCollision(CELL &cell, const RHO &rho, const VELOCITY &u, const OMEGA &omega) any_platform
BGK collision step.
Definition lbm.h:290
Set of functions commonly used in LB computations – header file.