OpenLB 1.7
Loading...
Searching...
No Matches
latticeTauFromBoundaryDistance3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2012 Lukas Baron, Tim Dornieden, Mathias J. Krause,
4 * Albert Mink
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
25#ifndef LATTICE_TAU_FROM_BOUNDARY_DISTANCE_3D_HH
26#define LATTICE_TAU_FROM_BOUNDARY_DISTANCE_3D_HH
27
28#include<vector> // for generic i/o
29#include<cmath> // for lpnorm
30#include<math.h>
31
32#ifndef M_PI
33#define M_PI (3.14159265358979323846)
34#endif
35
37#include "superBaseF3D.h"
40#include "dynamics/lbm.h" // for computation of lattice rho and velocity
42#include "blockBaseF3D.h"
45
46namespace olb {
47
48template<typename T,typename DESCRIPTOR, typename TDESCRIPTOR>
50 SuperLattice<T,DESCRIPTOR>& sLattice, SuperGeometry<T,3>& sGeometry, XMLreader const& xmlReader, const ThermalUnitConverter<T,DESCRIPTOR,TDESCRIPTOR>& converter, const T p, const T T_avg, const T c_p, const T beta, const T lambda_0, const T sigma, const T p_0, const T n_0)
51 : SuperLatticeThermalPhysF3D<T,DESCRIPTOR,TDESCRIPTOR>(sLattice, converter, 1)
52{
53 this->getName() = "physTauFromBoundaryDistance";
54 int maxC = this->_sLattice.getLoadBalancer().size();
55 this->_blockF.reserve(maxC);
56 for (int iC = 0; iC < maxC; iC++) {
57 this->_blockF.emplace_back(new BlockLatticePhysTauFromBoundaryDistance3D<T,DESCRIPTOR,TDESCRIPTOR>(this->_sLattice.getBlock(iC), sGeometry.getBlockGeometry(iC), xmlReader, this->_converter, p, T_avg, c_p, beta, lambda_0, sigma, p_0, n_0));
58 }
59}
60
61template <typename T, typename DESCRIPTOR, typename TDESCRIPTOR>
63 BlockLattice<T,DESCRIPTOR>& blockLattice, BlockGeometry<T,3>& blockGeometry, XMLreader const& xmlReader, ThermalUnitConverter<T,DESCRIPTOR,TDESCRIPTOR> const& converter, const T p, const T T_avg, const T c_p, const T beta, const T lambda_0, const T sigma, const T p_0, const T n_0)
64 : BlockLatticeThermalPhysF3D<T,DESCRIPTOR,TDESCRIPTOR>(blockLattice,converter,1), _blockGeometry(blockGeometry), _distanceFunctor(blockLattice, blockGeometry, xmlReader), _tmp1(lambda_0 * 287.058 * T_avg / p / c_p), _tmp2(2. * beta / (util::sqrt(2.) * M_PI * sigma * sigma * p * n_0 / p_0))
65{
66 this->getName() = "physTauFromBoundaryDistance";
67}
68
69
70template <typename T, typename DESCRIPTOR, typename TDESCRIPTOR>
72{
73 T L[1] = {0.};
74 _distanceFunctor(L, input);
75 if ( L[0] < this->_converter.getPhysDeltaX() ) {
76 L[0] = this->_converter.getPhysDeltaX();
77 }
78
79 const T alpha = _tmp1 / ( 1. + _tmp2 / L[0] );
80
81 output[0] = alpha / this->_converter.getConversionFactorViscosity() * descriptors::invCs2<T,TDESCRIPTOR>() + 0.5;
82
83 // std::cout << L[0] << " " << alpha << " " << output[0] << std::endl;
84
85 return true;
86}
87
88}
89#endif
#define M_PI
Representation of a block geometry.
functor returns pointwise pore radius for packings of spheres given by indicators returns NAN for non...
BlockLatticePhysTauFromBoundaryDistance3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockGeometry< T, 3 > &blockGeometry, XMLreader const &xmlReader, ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > const &converter, const T p, const T T_avg, const T c_p, const T beta, const T lambda_0, const T sigma, const T p_0, const T n_0)
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
represents all thermal functors that operate on a DESCRIPTOR with output in Phys, e....
Platform-abstracted block lattice for external access and inter-block interaction.
std::string & getName()
read and write access to name
Definition genericF.hh:51
std::vector< std::unique_ptr< BlockF3D< T > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
Representation of a statistic for a parallel 2D geometry.
BlockGeometry< T, D > & getBlockGeometry(int locIC)
Read and write access to a single block geometry.
SuperLattice< T, TDESCRIPTOR > & _sLattice
SuperLatticePhysTauFromBoundaryDistance3D(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 3 > &sGeometry, XMLreader const &xmlReader, ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > const &converter, const T p, const T T_avg, const T c_p, const T beta, const T lambda_0, const T sigma, const T p_0, const T n_0)
represents all thermal functors that operate on a DESCRIPTOR with output in Phys, e....
Super class maintaining block lattices for a cuboid decomposition.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Conversion between physical and lattice units, as well as discretization specialized for thermal appl...
Wrapper functions that simplify the use of MPI.
Top level namespace for all of OpenLB.
Representation of a parallel 2D geometry – header file.