/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-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 "multiphaseSystem.H"
#include "fixedValueFvsPatchFields.H"
#include "Time.H"
#include "subCycle.H"
#include "fvcMeshPhi.H"
#include "surfaceInterpolate.H"
#include "fvcGrad.H"
#include "fvcSnGrad.H"
#include "fvcDiv.H"
#include "fvcDdt.H"
#include "fvcFlux.H"
#include "fvmDdt.H"
#include "fvcAverage.H"
#include "fvMatrix.H"
#include "fvmSup.H"
#include "CMULES.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(multiphaseSystem, 0);
defineRunTimeSelectionTable(multiphaseSystem, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::multiphaseSystem::multiphaseSystem
(
const fvMesh& mesh
)
:
phaseSystem(mesh),
cAlphas_(),
ddtAlphaMax_(0.0),
limitedPhiAlphas_(phaseModels_.size()),
Su_(phaseModels_.size()),
Sp_(phaseModels_.size())
{
label phasei = 0;
phases_.setSize(phaseModels_.size());
forAllIters(phaseModels_, iter)
{
phaseModel& pm = iter()();
phases_.set(phasei++, &pm);
}
mesh.solverDict("alpha").readEntry("cAlphas", cAlphas_);
// Initiate Su and Sp
forAllConstIters(phaseModels_, iter)
{
const phaseModel& pm = iter()();
Su_.insert
(
pm.name(),
volScalarField::Internal
(
IOobject
(
"Su" + pm.name(),
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless/dimTime, Zero)
)
);
Sp_.insert
(
pm.name(),
volScalarField::Internal
(
IOobject
(
"Sp" + pm.name(),
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless/dimTime, Zero)
)
);
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::multiphaseSystem::calculateSuSp()
{
this->alphaTransfer(Su_, Sp_);
}
void Foam::multiphaseSystem::solve()
{
const dictionary& alphaControls = mesh_.solverDict("alpha");
label nAlphaSubCycles(alphaControls.get