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/momentaOnBoundaries2D.hh | 168 ++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 src/boundary/momentaOnBoundaries2D.hh (limited to 'src/boundary/momentaOnBoundaries2D.hh') diff --git a/src/boundary/momentaOnBoundaries2D.hh b/src/boundary/momentaOnBoundaries2D.hh new file mode 100644 index 0000000..5b373fe --- /dev/null +++ b/src/boundary/momentaOnBoundaries2D.hh @@ -0,0 +1,168 @@ +/* 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 + * + * + * 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. +*/ + +/** \file + * Implementation of boundary cell dynamics -- generic implementation. + */ +#ifndef MOMENTA_ON_BOUNDARIES_2D_HH +#define MOMENTA_ON_BOUNDARIES_2D_HH + +#include "momentaOnBoundaries2D.h" +#include "dynamics/lbHelpers.h" +#include "dynamics/firstOrderLbHelpers.h" + +namespace olb { + +////////////////////// Class InnerCornerVelBM2D /////////////// + +template +InnerCornerVelBM2D::InnerCornerVelBM2D() +{ + for (int iD=0; iD +InnerCornerVelBM2D::InnerCornerVelBM2D ( + const T u_[DESCRIPTOR::d]) +{ + for (int iD=0; iD +T InnerCornerVelBM2D::computeRho ( + Cell const& cell ) const +{ + T rhoX = velocityBMRho(cell, _u); + T rhoY = velocityBMRho(cell, _u); + return (rhoX + rhoY) / (T)2; +} + +template +void InnerCornerVelBM2D::computeU ( + Cell const& cell, + T u[DESCRIPTOR::d] ) const +{ + for (int iD=0; iD +void InnerCornerVelBM2D::computeJ ( + Cell const& cell, + T j[DESCRIPTOR::d] ) const +{ + computeU(cell, j); + T rho = computeRho(cell); + for (int iD=0; iD +void InnerCornerVelBM2D::computeU ( + T u[DESCRIPTOR::d] ) const +{ + for (int iD=0; iD +void InnerCornerVelBM2D::defineRho ( + Cell& cell, T rho ) +{ } + +template +void InnerCornerVelBM2D::defineU ( + Cell& cell, + const T u[DESCRIPTOR::d] ) +{ + for (int iD=0; iD +void InnerCornerVelBM2D::defineU ( + const T u[DESCRIPTOR::d] ) +{ + for (int iD=0; iD +void InnerCornerVelBM2D::defineAllMomenta ( + Cell& cell, + T rho, const T u[DESCRIPTOR::d], + const T pi[util::TensorVal::n] ) +{ + for (int iD=0; iD +void InnerCornerVelBM2D::computeStress ( + Cell const& cell, + T rho, const T u[DESCRIPTOR::d], + T pi[util::TensorVal::n] ) const +{ + typedef lbHelpers lbH; + Cell newCell(cell); + int v[DESCRIPTOR::d] = { -normalX, -normalY }; + int unknownF = util::findVelocity(v); + + if (unknownF != DESCRIPTOR::q) { + int oppositeF = util::opposite(unknownF); + + T uSqr = util::normSqr(u); + + newCell[unknownF] = newCell[oppositeF] + - lbH::equilibrium(oppositeF, rho, u, uSqr) + + lbH::equilibrium(unknownF, rho, u, uSqr); + } + + lbH::computeStress(newCell, rho, u, pi); +} + + +} // namespace olb + +#endif -- cgit v1.2.3