Skip to content
Snippets Groups Projects
Commit d89f898e authored by Kutscher's avatar Kutscher
Browse files

add pressure boundary condition for multiphase flow

parent 17b2c786
No related branches found
No related tags found
1 merge request!225Refactoring of CPU code
Showing with 2302 additions and 1924 deletions
PROJECT(Nozzle)
vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} LiggghtsCoupling MultiphaseFlow FILES nozzle.cpp )
vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} LiggghtsCoupling MultiphaseFlow NonNewtonianFluids FILES nozzle.cpp )
This diff is collapsed.
......@@ -149,8 +149,8 @@ void run(string configname)
// kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
// kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
//kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel());
kernel = make_shared<MultiphaseScaleDistributionLBMKernel>();
//kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>();
//kernel = make_shared<MultiphaseScaleDistributionLBMKernel>();
kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>();
mu::Parser fgr;
fgr.SetExpr("-rho*g_y");
fgr.DefineConst("g_y", g_y);
......
......@@ -25,11 +25,9 @@
SET(VFCPU_USE_METIS ON CACHE BOOL "include METIS library support")
SET(VFCPU_USE_VTK OFF CACHE BOOL "include VTK library support")
SET(VFCPU_USE_CATALYST OFF CACHE BOOL "include Paraview Catalyst support")
SET(VFCPU_USE_HLRN_LUSTRE OFF CACHE BOOL "include HLRN Lustre support")
SET(VFCPU_USE_DEM_COUPLING OFF CACHE BOOL "PE plugin")
SET(VFCPU_ENABLE_LiggghtsCoupling ON CACHE BOOL "enable coupling with LIGGGHTS library")
SET(VFCPU_ENABLE_LiggghtsCoupling OFF CACHE BOOL "enable coupling with LIGGGHTS library")
SET(VFCPU_ENABLE_NonNewtonianFluids ON CACHE BOOL "enable non-Newtonian fluids module")
SET(VFCPU_ENABLE_MultiphaseFlow ON CACHE BOOL "enable multiphase flow module")
......
//=======================================================================================
// ____ ____ __ ______ __________ __ __ __ __
// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
// \ \ | | | | | |_) | | | | | | | / \ | |
// \ \ | | | | | _ / | | | | | | / /\ \ | |
// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
// \ \ | | ________________________________________________________________
// \ \ | | | ______________________________________________________________|
// \ \| | | | __ __ __ __ ______ _______
// \ | | |_____ | | | | | | | | | _ \ / _____)
// \ | | _____| | | | | | | | | | | \ \ \_______
// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
// \ _____| |__| |________| \_______/ |__| |______/ (_______/
//
// This file is part of VirtualFluids. VirtualFluids 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 3 of
// the License, or (at your option) any later version.
//
// VirtualFluids 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 VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file MultiphasePressureBCStrategy.cpp
//! \ingroup BoundarConditions
//! \author Hesameddin Safari
//=======================================================================================
#include "MultiphasePressureBCStrategy.h"
#include "DistributionArray3D.h"
#include "BoundaryConditions.h"
MultiphasePressureBCStrategy::MultiphasePressureBCStrategy()
{
BCStrategy::type = BCStrategy::MultiphasePressureBCStrategy;
BCStrategy::preCollision = false;
}
//////////////////////////////////////////////////////////////////////////
MultiphasePressureBCStrategy::~MultiphasePressureBCStrategy()
{
}
//////////////////////////////////////////////////////////////////////////
SPtr<BCStrategy> MultiphasePressureBCStrategy::clone()
{
SPtr<BCStrategy> bc(new MultiphasePressureBCStrategy());
return bc;
}
//////////////////////////////////////////////////////////////////////////
void MultiphasePressureBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions)
{
this->distributions = distributions;
}
//////////////////////////////////////////////////////////////////////////
void MultiphasePressureBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributionsH)
{
this->distributionsH = distributionsH;
}
//////////////////////////////////////////////////////////////////////////
void MultiphasePressureBCStrategy::addDistributionsH2(SPtr<DistributionArray3D> distributionsH)
{
this->distributionsH2 = distributionsH;
}
//////////////////////////////////////////////////////////////////////////
void MultiphasePressureBCStrategy::applyBC()
{
using namespace vf::lbm::dir;
LBMReal f[D3Q27System::ENDF+1];
LBMReal h[D3Q27System::ENDF+1];
LBMReal h2[D3Q27System::ENDF + 1];
LBMReal feq[D3Q27System::ENDF+1];
//LBMReal heq[D3Q27System::ENDF+1];
LBMReal htemp[D3Q27System::ENDF+1];
distributions->getDistributionInv(f, x1, x2, x3);
distributionsH->getDistributionInv(h, x1, x2, x3);
if (distributionsH2)
distributionsH2->getDistributionInv(h2, x1, x2, x3);
LBMReal phi, vx1, vx2, vx3, p1, phiBC;
D3Q27System::calcDensity(h, phi);
calcMacrosFct(f, p1, vx1, vx2, vx3);
p1 = 0.0;
int nx1 = x1;
int nx2 = x2;
int nx3 = x3;
//flag points in direction of fluid
if (bcPtr->hasVelocityBoundaryFlag(DIR_P00)) { nx1 -= 1; }
else if (bcPtr->hasVelocityBoundaryFlag(DIR_M00)) { nx1 += 1; }
else if (bcPtr->hasVelocityBoundaryFlag(DIR_0P0)) { nx2 -= 1; }
else if (bcPtr->hasVelocityBoundaryFlag(DIR_0M0)) { nx2 += 1; }
else if (bcPtr->hasVelocityBoundaryFlag(DIR_00P)) { nx3 -= 1; }
else if (bcPtr->hasVelocityBoundaryFlag(DIR_00M)) { nx3 += 1; }
//else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary..."));
phiBC = bcPtr->getBoundaryPhaseField();
LBMReal rhoBC = bcPtr->getBoundaryDensity();
D3Q27System::calcIncompFeq(feq, rhoBC, vx1, vx2, vx3);
D3Q27System::calcMultiphaseHeq(htemp, phiBC, vx1, vx2, vx3);
for (int fdir = D3Q27System::STARTF; fdir <= D3Q27System::ENDF; fdir++) {
if (bcPtr->hasDensityBoundaryFlag(fdir)) {
LBMReal ftemp = -f[D3Q27System::INVDIR[fdir]] + feq[fdir] + feq[D3Q27System::INVDIR[fdir]];
distributions->setDistributionForDirection(ftemp, x1, x2, x3, D3Q27System::INVDIR[fdir]);
LBMReal hReturn = -h[D3Q27System::INVDIR[fdir]] + htemp[fdir] + htemp[D3Q27System::INVDIR[fdir]];
distributionsH->setDistributionForDirection(hReturn, x1, x2, x3, D3Q27System::INVDIR[fdir]);
}
}
}
//=======================================================================================
// ____ ____ __ ______ __________ __ __ __ __
// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
// \ \ | | | | | |_) | | | | | | | / \ | |
// \ \ | | | | | _ / | | | | | | / /\ \ | |
// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
// \ \ | | ________________________________________________________________
// \ \ | | | ______________________________________________________________|
// \ \| | | | __ __ __ __ ______ _______
// \ | | |_____ | | | | | | | | | _ \ / _____)
// \ | | _____| | | | | | | | | | | \ \ \_______
// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
// \ _____| |__| |________| \_______/ |__| |______/ (_______/
//
// This file is part of VirtualFluids. VirtualFluids 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 3 of
// the License, or (at your option) any later version.
//
// VirtualFluids 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 VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file MultiphasePressureBCStrategy.h
//! \ingroup BoundarConditions
//! \author Hesameddin Safari
//=======================================================================================
#ifndef MultiphasePressureBCStrategy_h__
#define MultiphasePressureBCStrategy_h__
#include "BCStrategy.h"
//! A class implements velocity boundary condition for multiphase simulations
class MultiphasePressureBCStrategy : public BCStrategy
{
public:
MultiphasePressureBCStrategy();
~MultiphasePressureBCStrategy();
SPtr<BCStrategy> clone() override;
void addDistributions(SPtr<DistributionArray3D> distributions) override;
void addDistributionsH(SPtr<DistributionArray3D> distributionsH) override;
void addDistributionsH2(SPtr<DistributionArray3D> distributionsH2) override;
void applyBC() override;
};
#endif // MultiphasePressureBCStrategy_h__
source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -54,7 +54,7 @@ public:
///refactor
//CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
//CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressure;
double getCalculationTime() override { return .0; }
......@@ -64,69 +64,69 @@ protected:
void initForcing();
void forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
void backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
LBMReal f1[D3Q27System::ENDF+1];
CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF;
CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF;
CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsF;
CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH1;
CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH1;
CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsH1;
CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH2;
CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH2;
CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsH2;
CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr p1Old;
CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField;
CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseFieldOld;
CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU;
CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr rhoNode;
CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr vxNode;
CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr vyNode;
CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr vzNode;
LBMReal h [D3Q27System::ENDF+1];
LBMReal h2[D3Q27System::ENDF + 1];
LBMReal g [D3Q27System::ENDF+1];
LBMReal phi[D3Q27System::ENDF+1];
LBMReal phi2[D3Q27System::ENDF + 1];
LBMReal pr1[D3Q27System::ENDF+1];
LBMReal phi_cutoff[D3Q27System::ENDF+1];
LBMReal gradX1_phi();
LBMReal gradX2_phi();
LBMReal gradX3_phi();
LBMReal gradX1_rhoInv(LBMReal rhoL, LBMReal rhoDIV);
LBMReal gradX2_rhoInv(LBMReal rhoL, LBMReal rhoDIV);
LBMReal gradX3_rhoInv(LBMReal rhoL, LBMReal rhoDIV);
LBMReal gradX1_phi2();
LBMReal gradX2_phi2();
LBMReal gradX3_phi2();
void forwardInverseChimeraWithKincompressible(real& mfa, real& mfb, real& mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho);
void backwardInverseChimeraWithKincompressible(real& mfa, real& mfb, real& mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho);
void forwardChimera(real& mfa, real& mfb, real& mfc, real vv, real v2);
void backwardChimera(real& mfa, real& mfb, real& mfc, real vv, real v2);
real f1[D3Q27System::ENDF+1];
CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF;
CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF;
CbArray3D<real,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsF;
CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH1;
CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH1;
CbArray3D<real,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsH1;
CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH2;
CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH2;
CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsH2;
CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressureOld;
CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr p1Old;
CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr phaseField;
CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr phaseFieldOld;
CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr divU;
CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr rhoNode;
CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vxNode;
CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vyNode;
CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vzNode;
real h [D3Q27System::ENDF+1];
real h2[D3Q27System::ENDF + 1];
real g [D3Q27System::ENDF+1];
real phi[D3Q27System::ENDF+1];
real phi2[D3Q27System::ENDF + 1];
real pr1[D3Q27System::ENDF+1];
real phi_cutoff[D3Q27System::ENDF+1];
real gradX1_phi();
real gradX2_phi();
real gradX3_phi();
real gradX1_rhoInv(real rhoL, real rhoDIV);
real gradX2_rhoInv(real rhoL, real rhoDIV);
real gradX3_rhoInv(real rhoL, real rhoDIV);
real gradX1_phi2();
real gradX2_phi2();
real gradX3_phi2();
void computePhasefield();
void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3);
void findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3);
void findNeighbors(CbArray3D<real,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3);
void findNeighbors2(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3);
LBMReal nabla2_phi();
real nabla2_phi();
LBMReal computeCurvature_phi();
real computeCurvature_phi();
mu::value_type muX1,muX2,muX3;
mu::value_type muDeltaT;
mu::value_type muNu;
mu::value_type muRho;
LBMReal forcingX1;
LBMReal forcingX2;
LBMReal forcingX3;
real forcingX1;
real forcingX2;
real forcingX3;
};
#endif
......@@ -72,6 +72,7 @@ public:
static const char MultiphaseVelocityBCStrategy = 21;
static const char NonReflectingInflowBCStrategy = 22;
static const char NonReflectingOutflowWithRelaxationBCStrategy = 23;
static const char MultiphasePressureBCStrategy = 24;
public:
BCStrategy() = default;
......
......@@ -16,18 +16,10 @@ IF(${VFCPU_USE_CATALYST})
list(APPEND VF_LIBRARIES optimized vtkParallelMPI debug vtkParallelMPI )
ENDIF()
IF(${VFCPU_USE_DEM_COUPLING})
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../DemCoupling/DemCoupling.cmake)
ENDIF()
if(BUILD_USE_OPENMP)
list(APPEND VF_LIBRARIES OpenMP::OpenMP_CXX)
endif()
IF(${VFCPU_USE_LIGGGHTS})
list(APPEND VF_LIBRARIES optimized ${LIGGGHTS_RELEASE_LIBRARY} debug ${LIGGGHTS_DEBUG_LIBRARY})
ENDIF()
vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser ${VF_LIBRARIES} PRIVATE_LINK lbm mpi logger)
vf_add_tests()
......@@ -45,7 +37,6 @@ target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Vi
target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/SimulationObservers)
target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Utilities)
IF(${VFCPU_USE_METIS} AND METIS_INCLUDEDIR)
target_include_directories(${library_name} PUBLIC ${METIS_INCLUDEDIR})
ENDIF()
......@@ -56,6 +47,3 @@ IF(${VFCPU_USE_VTK})
target_include_directories(${library_name} PRIVATE ${VTK_INCLUDE_DIRS})
ENDIF()
IF(${VFCPU_ENABLE_LiggghtsCoupling})
target_include_directories(${library_name} PUBLIC ${LIGGGHTS_SOURCE_DIR})
ENDIF()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment