From 94d3e79a8617f88dc0219cfdeedfa3147833719d Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 24 Jun 2019 14:43:36 +0200 Subject: Initialize at openlb-1-3 --- src/particles/twoWayCouplings/backCouplingModels.h | 124 +++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 src/particles/twoWayCouplings/backCouplingModels.h (limited to 'src/particles/twoWayCouplings/backCouplingModels.h') diff --git a/src/particles/twoWayCouplings/backCouplingModels.h b/src/particles/twoWayCouplings/backCouplingModels.h new file mode 100644 index 0000000..8f016d2 --- /dev/null +++ b/src/particles/twoWayCouplings/backCouplingModels.h @@ -0,0 +1,124 @@ +/* Lattice Boltzmann sample, written in C++, using the OpenLB + * library + * + * Copyright (C) 2019 Davide Dapelo + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +/* Models for Lagrangian back-coupling methods -- header file. + */ + +#ifndef LB_BACK_COUPLING_MODELS_H +#define LB_BACK_COUPLING_MODELS_H + +#include "twoWayHelperFunctionals.h" + +namespace olb { + +/** Abstact base class for BaseBackCouplingModel. + * Its raison d'etre consists of not being templetized in Lattice. + */ +template class Particle> +class BackCouplingModel { +public: + /// Class operator to apply the coupling, for overload. + virtual bool operator() (Particle* p, int globic, int material, int subCycles=1)=0; + /// Resets external field + virtual void resetExternalField(int material)=0; +}; + +/** Abstact class for all the back-coupling models, + * viz., momentum coupling from particle to fluid. + * Input parameters in attice units. + */ +template class Particle> +class BaseBackCouplingModel : public BackCouplingModel { +public: + /// Resets external field + virtual void resetExternalField(int material) override; +protected: + /// Constructor + BaseBackCouplingModel ( UnitConverter& converter, + SuperLattice3D& sLattice, + SuperGeometry3D& sGeometry ); + UnitConverter& _converter; // reference to a UnitConverter + SuperGeometry3D& _sGeometry; + SuperLattice3D& _sLattice; // reference to a lattice +private: + // Pointers to functions to reset fluid force + std::shared_ptr > _zeroAnalytical; + std::shared_ptr > _zeroField; +}; + +/** Back-coupling is performed on the cell containing the particle + * and its neighbours within a cube of one lattice spacing, as per in Maier et al. (2017). + * Input parameters in attice units. + */ +template class Particle> +class CubicDeltaBackCouplingModel : public BaseBackCouplingModel { +public: + /// Constructor + CubicDeltaBackCouplingModel ( UnitConverter& converter, + SuperLattice3D& sLattice, + SuperGeometry3D& sGeometry ); + /// Class operator to apply the coupling. + virtual bool operator() (Particle* p, int globic, int material, int subCycles=1) override; +protected: + int _range = 1; + T _delta[4][4][4] = { T() }; + std::shared_ptr > _cubicDeltaFunctional; +}; + +/** Back-coupling is performed only on the cell containing the particle. + * Input parameters in attice units. + */ +template class Particle> +class LocalBackCouplingModel : public BaseBackCouplingModel { +public: + /// Constructor + LocalBackCouplingModel ( UnitConverter& converter, + SuperLattice3D& sLattice, + SuperGeometry3D& sGeometry ); + /// Class operator to apply the coupling. + virtual bool operator() (Particle* p, int globic, int material, int subCycles=1) override; +}; + +/** Class for a generic non-local back-coupling model, + * viz., momentum coupling from particle to fluid. + * It reproduces the characteristics (viz., smoothing) of an input forward coupling model. + * Input parameters in attice units. + */ +template class Particle> +class NonLocalBaseBackCouplingModel : public BaseBackCouplingModel { +public: + /// Constructor + NonLocalBaseBackCouplingModel ( UnitConverter& converter, + SuperLattice3D& sLattice, + SuperGeometry3D& sGeometry, + SmoothingFunctional& smoothingFunctional ); + /// Class operator to apply the coupling. + virtual bool operator() (Particle* p, int globic, int material, int subCycles=1) override; +protected: + SmoothingFunctional& _smoothingFunctional; // Functional to treat non-local smoothing +}; + +} + +#endif -- cgit v1.2.3