OpenLB 1.7
Loading...
Searching...
No Matches
latticeStokesDragForce.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2021 Nicolas Hafen, Mathias J. Krause
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
24#ifndef LATTICE_STOKES_DRAG_FORCE_H
25#define LATTICE_STOKES_DRAG_FORCE_H
26
27#include <unordered_set>
28
29namespace olb {
30
31
32//Forward declaration
33namespace particles{
34template<typename T, typename PARTICLETYPE> class ParticleSystem;
35template<typename T, typename PARTICLETYPE> class Particle;
36}
37
38template <typename T, typename DESCRIPTOR, typename PARTICLETYPE, bool serialize=true>
39class BlockLatticeStokesDragForce final : public BlockLatticePhysF<T,DESCRIPTOR> {
41
42private:
43 const BlockGeometry<T,DESCRIPTOR::d>& _blockGeometry;
44 BlockLattice<T,DESCRIPTOR>& _blockLattice;
49 std::size_t _iP0;
50 const std::unordered_set<int> _ignoredMaterials;
51 const F _f;
52 //Precalculated constants
53 T _delTinv;
54 T _C1;
55public:
57 const BlockGeometry<T,DESCRIPTOR::d>& blockGeometry,
59 const UnitConverter<T,DESCRIPTOR>& converter,
63 std::size_t iP0=0,
64 const std::unordered_set<int>& ignoredMaterials = std::unordered_set<int>{},
65 const F f = [](auto&, const auto&, const auto&, const auto&){}
66 );
67 void evaluate(T output[], particles::Particle<T,PARTICLETYPE>& particle, int iP);
68 bool operator() (T output[], const int input[]) override;
69 static constexpr bool serializeForce = serialize; //Return serialized force values via output[]
70};
71
72
73
74}
75#endif
Representation of a block geometry.
bool operator()(T output[], const int input[]) override
void evaluate(T output[], particles::Particle< T, PARTICLETYPE > &particle, int iP)
BlockLatticeStokesDragForce(BlockLattice< T, DESCRIPTOR > &blockLattice, const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, particles::ParticleSystem< T, PARTICLETYPE > &particleSystem, const UnitConverter< T, DESCRIPTOR > &converter, PhysR< T, DESCRIPTOR::d > cellMin=PhysR< T, DESCRIPTOR::d >(0.), PhysR< T, DESCRIPTOR::d > cellMax=PhysR< T, DESCRIPTOR::d >(0.), Vector< bool, DESCRIPTOR::d > periodic=Vector< bool, DESCRIPTOR::d >(false), std::size_t iP0=0, const std::unordered_set< int > &ignoredMaterials=std::unordered_set< int >{}, const F f=[](auto &, const auto &, const auto &, const auto &){})
Platform-abstracted block lattice for external access and inter-block interaction.
Conversion between physical and lattice units, as well as discretization.
Plain old scalar vector.
Definition vector.h:47
Top level namespace for all of OpenLB.
std::conditional_t< DESCRIPTOR::d==2, BlockLatticePhysF2D< T, DESCRIPTOR >, BlockLatticePhysF3D< T, DESCRIPTOR > > BlockLatticePhysF
Definition aliases.h:339
Converts dimensions by deriving from given cartesian dimension D.