/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM 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. OpenFOAM 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 OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "LaheyKEpsilon.H" #include "fvOptions.H" #include "twoPhaseSystem.H" #include "dragModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { namespace RASModels { // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template LaheyKEpsilon::LaheyKEpsilon ( const alphaField& alpha, const rhoField& rho, const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, const transportModel& transport, const word& propertiesName, const word& type ) : kEpsilon ( alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName, type ), gasTurbulencePtr_(nullptr), alphaInversion_ ( dimensioned::getOrAddToDict ( "alphaInversion", this->coeffDict_, 0.3 ) ), Cp_ ( dimensioned::getOrAddToDict ( "Cp", this->coeffDict_, 0.25 ) ), C3_ ( dimensioned::getOrAddToDict ( "C3", this->coeffDict_, this->C2_.value() ) ), Cmub_ ( dimensioned::getOrAddToDict ( "Cmub", this->coeffDict_, 0.6 ) ) { if (type == typeName) { this->printCoeffs(type); } } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template bool LaheyKEpsilon::read() { if (kEpsilon::read()) { alphaInversion_.readIfPresent(this->coeffDict()); Cp_.readIfPresent(this->coeffDict()); C3_.readIfPresent(this->coeffDict()); Cmub_.readIfPresent(this->coeffDict()); return true; } return false; } template const PhaseCompressibleTurbulenceModel < typename BasicTurbulenceModel::transportModel >& LaheyKEpsilon::gasTurbulence() const { if (!gasTurbulencePtr_) { const volVectorField& U = this->U_; const transportModel& liquid = this->transport(); const twoPhaseSystem& fluid = refCast(liquid.fluid()); const transportModel& gas = fluid.otherPhase(liquid); gasTurbulencePtr_ = &U.db() .lookupObject> ( IOobject::groupName ( turbulenceModel::propertiesName, gas.name() ) ); } return *gasTurbulencePtr_; } template void LaheyKEpsilon::correctNut() { const PhaseCompressibleTurbulenceModel& gasTurbulence = this->gasTurbulence(); this->nut_ = this->Cmu_*sqr(this->k_)/this->epsilon_ + Cmub_*gasTurbulence.transport().d()*gasTurbulence.alpha() *(mag(this->U_ - gasTurbulence.U())); this->nut_.correctBoundaryConditions(); fv::options::New(this->mesh_).correct(this->nut_); BasicTurbulenceModel::correctNut(); } template tmp LaheyKEpsilon::bubbleG() const { const PhaseCompressibleTurbulenceModel& gasTurbulence = this->gasTurbulence(); const transportModel& liquid = this->transport(); const twoPhaseSystem& fluid = refCast(liquid.fluid()); const transportModel& gas = fluid.otherPhase(liquid); const dragModel& drag = fluid.lookupSubModel(gas, liquid); volScalarField magUr(mag(this->U_ - gasTurbulence.U())); tmp bubbleG ( Cp_ *( pow3(magUr) + pow(drag.CdRe()*liquid.nu()/gas.d(), 4.0/3.0) *pow(magUr, 5.0/3.0) ) *gas /gas.d() ); return bubbleG; } template tmp LaheyKEpsilon::phaseTransferCoeff() const { const volVectorField& U = this->U_; const alphaField& alpha = this->alpha_; const rhoField& rho = this->rho_; const turbulenceModel& gasTurbulence = this->gasTurbulence(); return ( max(alphaInversion_ - alpha, scalar(0)) *rho *min(gasTurbulence.epsilon()/gasTurbulence.k(), 1.0/U.time().deltaT()) ); } template tmp LaheyKEpsilon::kSource() const { const alphaField& alpha = this->alpha_; const rhoField& rho = this->rho_; const PhaseCompressibleTurbulenceModel& gasTurbulence = this->gasTurbulence(); const volScalarField phaseTransferCoeff(this->phaseTransferCoeff()); return alpha*rho*bubbleG() + phaseTransferCoeff*gasTurbulence.k() - fvm::Sp(phaseTransferCoeff, this->k_); } template tmp LaheyKEpsilon::epsilonSource() const { const alphaField& alpha = this->alpha_; const rhoField& rho = this->rho_; const PhaseCompressibleTurbulenceModel& gasTurbulence = this->gasTurbulence(); const volScalarField phaseTransferCoeff(this->phaseTransferCoeff()); return alpha*rho*this->C3_*this->epsilon_*bubbleG()/this->k_ + phaseTransferCoeff*gasTurbulence.epsilon() - fvm::Sp(phaseTransferCoeff, this->epsilon_); } template void LaheyKEpsilon::correct() { kEpsilon::correct(); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace RASModels } // End namespace Foam // ************************************************************************* //