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/boundary/boundaryPostProcessors3D.h | 392 ++++++++++++++++++++++++++++++++ 1 file changed, 392 insertions(+) create mode 100644 src/boundary/boundaryPostProcessors3D.h (limited to 'src/boundary/boundaryPostProcessors3D.h') diff --git a/src/boundary/boundaryPostProcessors3D.h b/src/boundary/boundaryPostProcessors3D.h new file mode 100644 index 0000000..ce32b05 --- /dev/null +++ b/src/boundary/boundaryPostProcessors3D.h @@ -0,0 +1,392 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2006, 2007 Jonas Latt + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * + * + * Generic collision, which modifies the particle distribution + * functions, implemented by Orestis Malaspinas, 2007 + * + * 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. +*/ + +#ifndef BOUNDARY_POST_PROCESSORS_3D_H +#define BOUNDARY_POST_PROCESSORS_3D_H + +#include "core/postProcessing.h" +#include "momentaOnBoundaries.h" +#include "core/blockLattice3D.h" + +namespace olb { + +/** +* This class computes the skordos BC +* on a plane wall in 3D but with a limited number of terms added to the +* equilibrium distributions (i.e. only the Q_i : Pi term) +*/ +template +class PlaneFdBoundaryProcessor3D : public LocalPostProcessor3D { +public: + PlaneFdBoundaryProcessor3D (int x0_, int x1_, int y0_, int y1_, int z0_, int z1_); + int extent() const override + { + return 1; + } + int extent(int whichDirection) const override + { + return 1; + } + void process(BlockLattice3D& blockLattice) override; + void processSubDomain(BlockLattice3D& blockLattice, + int x0_, int x1_, int y0_, int y1_, int z0_, int z1_ ) override; +private: + template + void interpolateGradients ( + BlockLattice3D const& blockLattice, + T velDeriv[DESCRIPTOR::d], int iX, int iY, int iZ ) const; +private: + int x0, x1, y0, y1, z0, z1; +}; + +template +class PlaneFdBoundaryProcessorGenerator3D : public PostProcessorGenerator3D { +public: + PlaneFdBoundaryProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_); + PostProcessor3D* generate() const override; + PostProcessorGenerator3D* clone() const override; +}; + + +/** +* This class computes a convection BC on a flat wall in 2D +*/ +template +class StraightConvectionBoundaryProcessor3D : public LocalPostProcessor3D { +public: + StraightConvectionBoundaryProcessor3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, T* uAv_ = NULL); + ~StraightConvectionBoundaryProcessor3D() override; + int extent() const override + { + return 1; + } + int extent(int whichDirection) const override + { + return 1; + } + void process(BlockLattice3D& blockLattice) override; + void processSubDomain ( BlockLattice3D& blockLattice, + int x0_, int x1_, int y0_, int y1_ , int z0_, int z1_) override; +private: + int x0, x1, y0, y1, z0, z1; + T**** saveCell; + T* uAv; +}; + +template +class StraightConvectionBoundaryProcessorGenerator3D : public PostProcessorGenerator3D { +public: + StraightConvectionBoundaryProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, T* uAv_ = NULL); + PostProcessor3D* generate() const override; + PostProcessorGenerator3D* clone() const override; +private: + T* uAv; +}; + +/** +* This class computes the skordos BC +* on a convex edge wall in 3D but with a limited number of terms added to the +* equilibrium distributions (i.e. only the Q_i : Pi term) +*/ +template +class OuterVelocityEdgeProcessor3D : public LocalPostProcessor3D { +public: + enum { direction1 = (plane+1)%3, direction2 = (plane+2)%3 }; +public: + OuterVelocityEdgeProcessor3D ( + int x0_, int x1_, int y0_, int y1_, int z0_, int z1_ ); + int extent() const override + { + return 2; + } + int extent(int whichDirection) const override + { + return 2; + } + void process(BlockLattice3D& blockLattice) override; + void processSubDomain(BlockLattice3D& blockLattice, + int x0_, int x1_, int y0_, int y1_, + int z0_, int z1_ ) override; +private: + T getNeighborRho(int x, int y, int z, int step1, int step2, + BlockLattice3D const& blockLattice); + template + void interpolateGradients ( + BlockLattice3D const& blockLattice, + T velDeriv[DESCRIPTOR::d], int iX, int iY, int iZ ) const; +private: + int x0, x1, y0, y1, z0, z1; +}; + +template +class OuterVelocityEdgeProcessorGenerator3D + : public PostProcessorGenerator3D { +public: + OuterVelocityEdgeProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, + int z0_, int z1_); + PostProcessor3D* generate() const override; + PostProcessorGenerator3D* clone() const override; +}; + + +template +class OuterVelocityCornerProcessor3D : public LocalPostProcessor3D { +public: + OuterVelocityCornerProcessor3D(int x_, int y_, int z_); + int extent() const override + { + return 2; + } + int extent(int whichDirection) const override + { + return 2; + } + void process(BlockLattice3D& blockLattice) override; + void processSubDomain(BlockLattice3D& blockLattice, + int x0_, int x1_, int y0_, int y1_, + int z0_, int z1_ ) override; +private: + int x,y,z; +}; + +template +class OuterVelocityCornerProcessorGenerator3D + : public PostProcessorGenerator3D { +public: + OuterVelocityCornerProcessorGenerator3D(int x_, int y_, int z_); + PostProcessor3D* generate() const override; + PostProcessorGenerator3D* clone() const override; +}; + +/** +* This class computes a slip BC in 3D +*/ + +template +class SlipBoundaryProcessor3D : public LocalPostProcessor3D { +public: + SlipBoundaryProcessor3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_); + int extent() const override + { + return 0; + } + int extent(int whichDirection) const override + { + return 0; + } + void process(BlockLattice3D& blockLattice) override; + void processSubDomain ( BlockLattice3D& blockLattice, + int x0_, int x1_, int y0_, int y1_, int z0_, int z1_ ) override; +private: + int reflectionPop[DESCRIPTOR::q]; + int x0, x1, y0, y1, z0, z1; +}; + + +template +class SlipBoundaryProcessorGenerator3D : public PostProcessorGenerator3D { +public: + SlipBoundaryProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_); + PostProcessor3D* generate() const override; + PostProcessorGenerator3D* clone() const override; +private: + int discreteNormalX; + int discreteNormalY; + int discreteNormalZ; +}; + +/** +* This class computes a partial slip BC in 3D +*/ + +template +class PartialSlipBoundaryProcessor3D : public LocalPostProcessor3D { +public: + PartialSlipBoundaryProcessor3D(T tuner_, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_); + int extent() const override + { + return 0; + } + int extent(int whichDirection) const override + { + return 0; + } + void process(BlockLattice3D& blockLattice) override; + void processSubDomain ( BlockLattice3D& blockLattice, + int x0_, int x1_, int y0_, int y1_, int z0_, int z1_ ) override; +private: + int reflectionPop[DESCRIPTOR::q]; + int x0, x1, y0, y1, z0, z1; + T tuner; +}; + + +template +class PartialSlipBoundaryProcessorGenerator3D : public PostProcessorGenerator3D { +public: + PartialSlipBoundaryProcessorGenerator3D(T tuner_, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_); + PostProcessor3D* generate() const override; + PostProcessorGenerator3D* clone() const override; +private: + int discreteNormalX; + int discreteNormalY; + int discreteNormalZ; + T tuner; +}; + +/// PostProcessor for the wetting boundary condition in the free energy model. This is +/// required to set rho on the boundary (using the denisty of the neighbouring cell in +/// direction of inwards facing normal at the boundary), as the coupling between the +/// lattices requires the calculation of a density gradient. +template +class FreeEnergyWallProcessor3D : public LocalPostProcessor3D { +public: + FreeEnergyWallProcessor3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, + int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_, T addend_); + int extent() const override + { + return 2; + } + int extent(int whichDirection) const override + { + return 2; + } + void process(BlockLattice3D& blockLattice) override; + void processSubDomain(BlockLattice3D& blockLattice, + int x0_, int x1_, int y0_, int y1_, int z0_, int z1_ ) override; +private: + int x0, x1, y0, y1, z0, z1; + int discreteNormalX, discreteNormalY, discreteNormalZ; + T addend; +}; + +/// Generator class for the FreeEnergyWall PostProcessor handling the wetting boundary condition. +template +class FreeEnergyWallProcessorGenerator3D : public PostProcessorGenerator3D { +public: + FreeEnergyWallProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, + int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_, T addend_); + PostProcessor3D* generate() const override; + PostProcessorGenerator3D* clone() const override; +private: + int discreteNormalX; + int discreteNormalY; + int discreteNormalZ; + T addend; +}; + + +/// PostProcessor for the chemical potential boundary condition in the free energy model. +/// The chemical potentials on the boundary are set equal to the chemical potential on the +/// fluid cell normal to the boundary. This is necessary because the coupling between the +/// lattices requires the calculation of the gradient of the chemical potential. +/// +/// It would be preferable if this were implemented as a lattice coupling that ran +/// between the chemical potential and force lattice couplings. However there is no +/// access to the discrete normals in lattice couplings. +template +class FreeEnergyChemPotBoundaryProcessor3D : public LocalPostProcessor3D { +public: + FreeEnergyChemPotBoundaryProcessor3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, + int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_, int latticeNumber_); + int extent() const override + { + return 2; + } + int extent(int whichDirection) const override + { + return 2; + } + void process(BlockLattice3D& blockLattice) override; + void processSubDomain(BlockLattice3D& blockLattice, + int x0_, int x1_, int y0_, int y1_, int z0_, int z1_ ) override; +private: + int x0, x1, y0, y1, z0, z1; + int discreteNormalX, discreteNormalY, discreteNormalZ; + int latticeNumber; +}; + +/// Generator class for the FreeEnergyChemPotBoundary PostProcessor. +template +class FreeEnergyChemPotBoundaryProcessorGenerator3D : public PostProcessorGenerator3D { +public: + FreeEnergyChemPotBoundaryProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, + int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_, int latticeNumber_); + PostProcessor3D* generate() const override; + PostProcessorGenerator3D* clone() const override; +private: + int discreteNormalX; + int discreteNormalY; + int discreteNormalZ; + int latticeNumber; +}; + + +/// PostProcessor for the density / velocity outflow boundaries in the free energy model. +/// The density / order parameters are prescribed to the outflow nodes such that they obey +/// the local-velocity convective boundary condition given in Lou, Gou, Shi (2013). +template +class FreeEnergyConvectiveProcessor3D : public LocalPostProcessor3D { +public: + FreeEnergyConvectiveProcessor3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, + int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_); + int extent() const override + { + return 2; + } + int extent(int whichDirection) const override + { + return 2; + } + void process(BlockLattice3D& blockLattice) override; + void processSubDomain(BlockLattice3D& blockLattice, + int x0_, int x1_, int y0_, int y1_, int z0_, int z1_ ) override; +private: + int x0, x1, y0, y1, z0, z1; + int discreteNormalX, discreteNormalY, discreteNormalZ; +}; + +/// Generator class for the FreeEnergyConvective post processor. +template +class FreeEnergyConvectiveProcessorGenerator3D : public PostProcessorGenerator3D { +public: + FreeEnergyConvectiveProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, + int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_); + PostProcessor3D* generate() const override; + PostProcessorGenerator3D* clone() const override; +private: + int discreteNormalX; + int discreteNormalY; + int discreteNormalZ; +}; + +} + +#endif -- cgit v1.2.3