mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-Arrhenius-viscocity-energyFO' into 'develop'
ENH: Arrhenius viscocity model for incompressible viscocity See merge request Development/OpenFOAM-plus!155
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
scalarTransport/scalarTransport.C
|
scalarTransport/scalarTransport.C
|
||||||
|
energyTransport/energyTransport.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libsolverFunctionObjects
|
LIB = $(FOAM_LIBBIN)/libsolverFunctionObjects
|
||||||
|
|||||||
487
src/functionObjects/solvers/energyTransport/energyTransport.C
Normal file
487
src/functionObjects/solvers/energyTransport/energyTransport.C
Normal file
@ -0,0 +1,487 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "energyTransport.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "fvmDdt.H"
|
||||||
|
#include "fvmDiv.H"
|
||||||
|
#include "fvmLaplacian.H"
|
||||||
|
#include "fvmSup.H"
|
||||||
|
#include "turbulentTransportModel.H"
|
||||||
|
#include "turbulentFluidThermoModel.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(energyTransport, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
energyTransport,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::volScalarField& Foam::functionObjects::energyTransport::transportedField()
|
||||||
|
{
|
||||||
|
if (!foundObject<volScalarField>(fieldName_))
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tfldPtr
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
fieldName_,
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
store(fieldName_, tfldPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lookupObjectRef<volScalarField>(fieldName_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::functionObjects::energyTransport::kappaEff() const
|
||||||
|
{
|
||||||
|
// Incompressible
|
||||||
|
{
|
||||||
|
typedef incompressible::turbulenceModel turbType;
|
||||||
|
|
||||||
|
const turbType* turbPtr = lookupObjectPtr<turbType>
|
||||||
|
(
|
||||||
|
turbulenceModel::propertiesName
|
||||||
|
);
|
||||||
|
|
||||||
|
if (turbPtr)
|
||||||
|
{
|
||||||
|
return tmp<volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
kappa() + Cp()*turbPtr->nut()*rho()/Prt_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Turbulence model not found" << exit(FatalError);
|
||||||
|
return tmp<volScalarField>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::functionObjects::energyTransport::rho() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> trho
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"trho",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
rho_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (phases_.size())
|
||||||
|
{
|
||||||
|
trho.ref() = lookupObject<volScalarField>(rhoName_);
|
||||||
|
}
|
||||||
|
return trho;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::functionObjects::energyTransport::Cp() const
|
||||||
|
{
|
||||||
|
if (phases_.size())
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tCp(phases_[0]*Cps_[0]);
|
||||||
|
|
||||||
|
for (label i = 1; i < phases_.size(); i++)
|
||||||
|
{
|
||||||
|
tCp.ref() += phases_[i]*Cps_[i];
|
||||||
|
}
|
||||||
|
return tCp;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp<volScalarField> tCp
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"tCp",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
Cp_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return tCp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::functionObjects::energyTransport::kappa() const
|
||||||
|
{
|
||||||
|
if (phases_.size())
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tkappa(phases_[0]*kappas_[0]);
|
||||||
|
|
||||||
|
for (label i = 1; i < phases_.size(); i++)
|
||||||
|
{
|
||||||
|
tkappa.ref() += phases_[i]*kappas_[i];
|
||||||
|
}
|
||||||
|
return tkappa;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp<volScalarField> tkappa
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"tkappa",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
kappa_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return tkappa;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::energyTransport::energyTransport
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time& runTime,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
|
fieldName_(dict.lookupOrDefault<word>("field", "T")),
|
||||||
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
|
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||||
|
nCorr_(0),
|
||||||
|
schemesField_("unknown-schemesField"),
|
||||||
|
fvOptions_(mesh_),
|
||||||
|
multiphaseThermo_(dict.subOrEmptyDict("phaseThermos")),
|
||||||
|
Cp_
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault
|
||||||
|
(
|
||||||
|
"Cp",
|
||||||
|
dimensionedScalar("Cp", dimEnergy/dimMass/dimTemperature, 0)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
kappa_
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault
|
||||||
|
(
|
||||||
|
"kappa",
|
||||||
|
dimensionedScalar
|
||||||
|
(
|
||||||
|
"kappa",
|
||||||
|
dimEnergy/dimTime/dimLength/dimTemperature,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
rho_
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("rhoInf", dimensionedScalar("rho", dimDensity, 0))
|
||||||
|
),
|
||||||
|
Prt_(dict.lookupOrDefault("Prt", dimensionedScalar("Prt", dimless, 1))),
|
||||||
|
rhoCp_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhoCp",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("rhoCp", dimEnergy/dimTemperature/dimVolume, 0.0)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
|
||||||
|
// If the flow is multiphase
|
||||||
|
if (!multiphaseThermo_.empty())
|
||||||
|
{
|
||||||
|
Cps_.setSize(multiphaseThermo_.size());
|
||||||
|
kappas_.setSize(Cps_.size());
|
||||||
|
phaseNames_.setSize(Cps_.size());
|
||||||
|
|
||||||
|
label phasei = 0;
|
||||||
|
forAllConstIters(multiphaseThermo_, iter)
|
||||||
|
{
|
||||||
|
const word& key = iter().keyword();
|
||||||
|
|
||||||
|
if (!multiphaseThermo_.isDict(key))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Found non-dictionary entry " << iter()
|
||||||
|
<< " in top-level dictionary " << multiphaseThermo_
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const dictionary& dict = multiphaseThermo_.subDict(key);
|
||||||
|
|
||||||
|
phaseNames_[phasei] = key;
|
||||||
|
|
||||||
|
Cps_.set
|
||||||
|
(
|
||||||
|
phasei,
|
||||||
|
new dimensionedScalar
|
||||||
|
(
|
||||||
|
"Cp",
|
||||||
|
dimEnergy/dimMass/dimTemperature,
|
||||||
|
dict.lookup("Cp")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
kappas_.set
|
||||||
|
(
|
||||||
|
phasei,
|
||||||
|
new dimensionedScalar //[J/m/s/K]
|
||||||
|
(
|
||||||
|
"kappa",
|
||||||
|
dimEnergy/dimTime/dimLength/dimTemperature,
|
||||||
|
dict.lookup("kappa")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
++phasei;
|
||||||
|
}
|
||||||
|
|
||||||
|
phases_.setSize(phaseNames_.size());
|
||||||
|
forAll(phaseNames_, i)
|
||||||
|
{
|
||||||
|
phases_.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
mesh_.lookupObjectRefPtr<volScalarField>(phaseNames_[i])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
rhoCp_ = rho()*Cp();
|
||||||
|
rhoCp_.oldTime();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Cp_.value() == 0.0 || kappa_.value() == 0.0)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< " Multiphase thermo dictionary not found and Cp/kappa "
|
||||||
|
<< " for single phase are zero. Please entry either"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force creation of transported field so any BCs using it can
|
||||||
|
// look it up
|
||||||
|
volScalarField& s = transportedField();
|
||||||
|
s.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::energyTransport::~energyTransport()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::functionObjects::energyTransport::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
|
dict.readIfPresent("phi", phiName_);
|
||||||
|
dict.readIfPresent("rho", rhoName_);
|
||||||
|
|
||||||
|
schemesField_ = dict.lookupOrDefault("schemesField", fieldName_);
|
||||||
|
|
||||||
|
dict.readIfPresent("nCorr", nCorr_);
|
||||||
|
|
||||||
|
if (dict.found("fvOptions"))
|
||||||
|
{
|
||||||
|
fvOptions_.reset(dict.subDict("fvOptions"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::energyTransport::execute()
|
||||||
|
{
|
||||||
|
volScalarField& s = transportedField();
|
||||||
|
|
||||||
|
Log << type() << " execute: " << s.name() << endl;
|
||||||
|
|
||||||
|
const surfaceScalarField& phi =
|
||||||
|
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
|
// Calculate the diffusivity
|
||||||
|
const volScalarField kappaEff("kappaEff", this->kappaEff());
|
||||||
|
|
||||||
|
word divScheme("div(phi," + schemesField_ + ")");
|
||||||
|
word laplacianScheme
|
||||||
|
(
|
||||||
|
"laplacian(kappaEff," + schemesField_ + ")"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Set under-relaxation coeff
|
||||||
|
scalar relaxCoeff = 0.0;
|
||||||
|
if (mesh_.relaxEquation(schemesField_))
|
||||||
|
{
|
||||||
|
relaxCoeff = mesh_.equationRelaxationFactor(schemesField_);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (phi.dimensions() == dimMass/dimTime)
|
||||||
|
{
|
||||||
|
rhoCp_ = rho()*Cp();
|
||||||
|
const surfaceScalarField rhoCpPhi(fvc::interpolate(Cp())*phi);
|
||||||
|
|
||||||
|
for (label i = 0; i <= nCorr_; i++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix sEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rhoCp_, s)
|
||||||
|
+ fvm::div(rhoCpPhi, s, divScheme)
|
||||||
|
- fvm::Sp(fvc::ddt(rhoCp_) + fvc::div(rhoCpPhi), s)
|
||||||
|
- fvm::laplacian(kappaEff, s, laplacianScheme)
|
||||||
|
==
|
||||||
|
fvOptions_(rhoCp_, s)
|
||||||
|
);
|
||||||
|
|
||||||
|
sEqn.relax(relaxCoeff);
|
||||||
|
|
||||||
|
fvOptions_.constrain(sEqn);
|
||||||
|
|
||||||
|
sEqn.solve(mesh_.solverDict(schemesField_));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (phi.dimensions() == dimVolume/dimTime)
|
||||||
|
{
|
||||||
|
dimensionedScalar rhoCp(rho_*Cp_);
|
||||||
|
|
||||||
|
const surfaceScalarField CpPhi(rhoCp*phi);
|
||||||
|
|
||||||
|
tmp<volScalarField> trhoCp
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"trhoCp",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
rhoCp
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
for (label i = 0; i <= nCorr_; i++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix sEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rhoCp, s)
|
||||||
|
+ fvm::div(CpPhi, s, divScheme)
|
||||||
|
- fvm::laplacian(kappaEff, s, laplacianScheme)
|
||||||
|
==
|
||||||
|
fvOptions_(trhoCp.ref(), s)
|
||||||
|
);
|
||||||
|
|
||||||
|
sEqn.relax(relaxCoeff);
|
||||||
|
|
||||||
|
fvOptions_.constrain(sEqn);
|
||||||
|
|
||||||
|
sEqn.solve(mesh_.solverDict(schemesField_));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Incompatible dimensions for phi: " << phi.dimensions() << nl
|
||||||
|
<< "Dimensions should be " << dimMass/dimTime << " or "
|
||||||
|
<< dimVolume/dimTime << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log << endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::energyTransport::write()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
323
src/functionObjects/solvers/energyTransport/energyTransport.H
Normal file
323
src/functionObjects/solvers/energyTransport/energyTransport.H
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::functionObjects::energyTransport
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpSolversFunctionObjects
|
||||||
|
|
||||||
|
Description
|
||||||
|
Evolves a simplified energy transport equation for incompressible flows.
|
||||||
|
It takes into account the inertia, conduction and convection terms plus
|
||||||
|
a source.
|
||||||
|
|
||||||
|
- The field name must be temperature and its BC's specified in the time
|
||||||
|
directory.
|
||||||
|
- The turbulence model should be incompressible
|
||||||
|
- In order to use in a incompressible multi phase a list of thermal
|
||||||
|
properties are needed. See bellow
|
||||||
|
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of function object specification to solve a energy transport
|
||||||
|
equation for a single phase flow plus a source term
|
||||||
|
\verbatim
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
energy
|
||||||
|
{
|
||||||
|
type energyTransport;
|
||||||
|
libs ("libenergyTransportFunctionObjects.so");
|
||||||
|
|
||||||
|
enabled true;
|
||||||
|
writeControl outputTime;
|
||||||
|
writeInterval 1;
|
||||||
|
|
||||||
|
field T;
|
||||||
|
|
||||||
|
// volumetric Flux
|
||||||
|
phi phi;
|
||||||
|
|
||||||
|
// Thermal properties
|
||||||
|
Cp Cp [J/kg/K] 1e3;
|
||||||
|
kappa kappa [W/m/K] 0.0257;
|
||||||
|
rhoInf rho [kg/m^3] 1.2;
|
||||||
|
|
||||||
|
write true;
|
||||||
|
|
||||||
|
fvOptions
|
||||||
|
{
|
||||||
|
viscousDissipation
|
||||||
|
{
|
||||||
|
type viscousDissipation;
|
||||||
|
enabled true;
|
||||||
|
|
||||||
|
viscousDissipationCoeffs
|
||||||
|
{
|
||||||
|
fields (T);
|
||||||
|
rhoInf $....rhoInf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Example of function object specification to solve a energy transport
|
||||||
|
equation for a multiphase phase flow plus a source term
|
||||||
|
|
||||||
|
equation:
|
||||||
|
\verbatim
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
energy
|
||||||
|
{
|
||||||
|
type energyTransport;
|
||||||
|
libs ("libenergyTransportFunctionObjects.so");
|
||||||
|
|
||||||
|
enabled true;
|
||||||
|
writeControl outputTime;
|
||||||
|
writeInterval 1;
|
||||||
|
|
||||||
|
field T;
|
||||||
|
|
||||||
|
// rho field name
|
||||||
|
rho rho;
|
||||||
|
// mass flux for multiphase
|
||||||
|
phi rhoPhi;
|
||||||
|
|
||||||
|
write true;
|
||||||
|
|
||||||
|
// Thermal properties of the phases
|
||||||
|
phaseThermos
|
||||||
|
{
|
||||||
|
alpha.air
|
||||||
|
{
|
||||||
|
Cp 1e3;
|
||||||
|
kappa 0.0243;
|
||||||
|
}
|
||||||
|
alpha.mercury
|
||||||
|
{
|
||||||
|
Cp 140;
|
||||||
|
kappa 8.2;
|
||||||
|
}
|
||||||
|
alpha.oil
|
||||||
|
{
|
||||||
|
Cp 2e3;
|
||||||
|
kappa 0.2;
|
||||||
|
}
|
||||||
|
alpha.water
|
||||||
|
{
|
||||||
|
Cp 4e3;
|
||||||
|
kappa 0.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fvOptions
|
||||||
|
{
|
||||||
|
viscousDissipation
|
||||||
|
{
|
||||||
|
type viscousDissipation;
|
||||||
|
enabled true;
|
||||||
|
|
||||||
|
viscousDissipationCoeffs
|
||||||
|
{
|
||||||
|
fields (T);
|
||||||
|
rho rho; //rho Field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Where the entries comprise:
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default value
|
||||||
|
type | Type name: energyTransport | yes |
|
||||||
|
field | Name of the scalar field | no | T
|
||||||
|
phi | Name of flux field | no | phi
|
||||||
|
rho | Name of density field | no | rho
|
||||||
|
nCorr | Number of correctors | no | 0
|
||||||
|
schemesField | Name of field to specify schemes | no | field name
|
||||||
|
fvOptions | List of scalar sources | no |
|
||||||
|
Cp | Heat capacity for single phase | no | 0
|
||||||
|
rhoInf | Density for single phase | no | 0
|
||||||
|
kappa | Thermal conductivity for single phase | no | 0
|
||||||
|
Prt | Turbulent Prandt number | no | 1.0
|
||||||
|
phaseThermos | Dictionary for multi-phase thermo |no | null
|
||||||
|
fvOptions | Opotional extra sources | no | null
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
energyTransport.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef functionObjects_energyTransport_H
|
||||||
|
#define functionObjects_energyTransport_H
|
||||||
|
|
||||||
|
#include "fvMeshFunctionObject.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "fvOptionList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class energyTransport Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class energyTransport
|
||||||
|
:
|
||||||
|
public fvMeshFunctionObject
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of the transport field.
|
||||||
|
word fieldName_;
|
||||||
|
|
||||||
|
//- Name of flux field
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
//- Name of density field
|
||||||
|
word rhoName_;
|
||||||
|
|
||||||
|
//- Number of corrector iterations (optional)
|
||||||
|
label nCorr_;
|
||||||
|
|
||||||
|
//- Name of field whose schemes are used (optional)
|
||||||
|
word schemesField_;
|
||||||
|
|
||||||
|
//- Run-time selectable finite volume options, e.g. sources, constraints
|
||||||
|
fv::optionList fvOptions_;
|
||||||
|
|
||||||
|
//- Dictionary for multiphase thermos
|
||||||
|
dictionary multiphaseThermo_;
|
||||||
|
|
||||||
|
//- List of phase names
|
||||||
|
wordList phaseNames_;
|
||||||
|
|
||||||
|
//- List of phase heat capacities
|
||||||
|
PtrList<dimensionedScalar> Cps_;
|
||||||
|
|
||||||
|
//- List of phase thermal diffusivity for temperature [J/m/s/K]
|
||||||
|
PtrList<dimensionedScalar> kappas_;
|
||||||
|
|
||||||
|
//- Unallocated phase list
|
||||||
|
UPtrList<volScalarField> phases_;
|
||||||
|
|
||||||
|
//- Heat capacity for single phase flows
|
||||||
|
dimensionedScalar Cp_;
|
||||||
|
|
||||||
|
//- Thermal diffusivity for temperature for single phase flows
|
||||||
|
dimensionedScalar kappa_;
|
||||||
|
|
||||||
|
//- Density for single phase flows
|
||||||
|
dimensionedScalar rho_;
|
||||||
|
|
||||||
|
//- Turbulent Prandt number
|
||||||
|
dimensionedScalar Prt_;
|
||||||
|
|
||||||
|
//- rhoCp
|
||||||
|
volScalarField rhoCp_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Return reference to registered transported field
|
||||||
|
volScalarField& transportedField();
|
||||||
|
|
||||||
|
//- Return the diffusivity field
|
||||||
|
tmp<volScalarField> kappaEff() const;
|
||||||
|
|
||||||
|
//- Return rho field
|
||||||
|
tmp<volScalarField> rho() const;
|
||||||
|
|
||||||
|
//- Return Cp
|
||||||
|
tmp<volScalarField> Cp() const;
|
||||||
|
|
||||||
|
//- Return kappa
|
||||||
|
tmp<volScalarField> kappa() const;
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
energyTransport(const energyTransport&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const energyTransport&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("energyTransport");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from Time and dictionary
|
||||||
|
energyTransport
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time& runTime,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~energyTransport();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read the energyTransport data
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
|
//- Calculate the energyTransport
|
||||||
|
virtual bool execute();
|
||||||
|
|
||||||
|
//- Do nothing.
|
||||||
|
// The volScalarField is registered and written automatically
|
||||||
|
virtual bool write();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace functionObjects
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -42,6 +42,7 @@ $(derivedSources)/solidificationMeltingSource/solidificationMeltingSource.C
|
|||||||
$(derivedSources)/solidificationMeltingSource/solidificationMeltingSourceIO.C
|
$(derivedSources)/solidificationMeltingSource/solidificationMeltingSourceIO.C
|
||||||
$(derivedSources)/tabulatedAccelerationSource/tabulatedAccelerationSource.C
|
$(derivedSources)/tabulatedAccelerationSource/tabulatedAccelerationSource.C
|
||||||
$(derivedSources)/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C
|
$(derivedSources)/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C
|
||||||
|
$(derivedSources)/viscousDissipation/viscousDissipation.C
|
||||||
|
|
||||||
interRegion = sources/interRegion
|
interRegion = sources/interRegion
|
||||||
$(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C
|
$(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C
|
||||||
|
|||||||
@ -0,0 +1,222 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "viscousDissipation.H"
|
||||||
|
#include "fvMatrices.H"
|
||||||
|
#include "turbulentTransportModel.H"
|
||||||
|
#include "turbulentFluidThermoModel.H"
|
||||||
|
#include "basicThermo.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fv
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(viscousDissipation, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
option,
|
||||||
|
viscousDissipation,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::fv::viscousDissipation::rho() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> trho
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"trho",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
rho_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (rho_.value() > 0)
|
||||||
|
{
|
||||||
|
return trho;
|
||||||
|
}
|
||||||
|
else if (rhoName_ != "none")
|
||||||
|
{
|
||||||
|
trho.ref() = mesh_.lookupObject<volScalarField>(rhoName_);
|
||||||
|
return trho;
|
||||||
|
}
|
||||||
|
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Neither rhoName nor rho are specified."
|
||||||
|
<< exit(FatalError);
|
||||||
|
|
||||||
|
return tmp<volScalarField>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fv::viscousDissipation::viscousDissipation
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvMesh& mesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
option(sourceName, modelType, dict, mesh),
|
||||||
|
UName_(coeffs_.lookupOrDefault<word>("U", "U")),
|
||||||
|
rhoName_(coeffs_.lookupOrDefault<word>("rho", "none")),
|
||||||
|
rho_
|
||||||
|
(
|
||||||
|
coeffs_.lookupOrDefault
|
||||||
|
(
|
||||||
|
"rhoInf",
|
||||||
|
dimensionedScalar("rho", dimDensity, 0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const basicThermo* thermoPtr =
|
||||||
|
mesh_.lookupObjectPtr<basicThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
|
if (thermoPtr)
|
||||||
|
{
|
||||||
|
fieldNames_.setSize(1, thermoPtr->he().name());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fieldNames_.empty())
|
||||||
|
{
|
||||||
|
coeffs_.lookup("fields") >> fieldNames_;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fieldNames_.size() != 1)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "settings are:" << fieldNames_ << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
applied_.setSize(fieldNames_.size(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volSymmTensorField> Foam::fv::viscousDissipation::
|
||||||
|
devRhoReff() const
|
||||||
|
{
|
||||||
|
// Incompressible
|
||||||
|
{
|
||||||
|
typedef incompressible::turbulenceModel turbType;
|
||||||
|
|
||||||
|
const turbType* turbPtr =
|
||||||
|
mesh_.lookupObjectPtr<turbType>(turbulenceModel::propertiesName);
|
||||||
|
|
||||||
|
if (turbPtr)
|
||||||
|
{
|
||||||
|
return tmp<volSymmTensorField>(rho()*turbPtr->devRhoReff());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compressible
|
||||||
|
{
|
||||||
|
typedef compressible::turbulenceModel turbType;
|
||||||
|
|
||||||
|
const turbType* turbPtr =
|
||||||
|
mesh_.lookupObjectPtr<turbType>(turbulenceModel::propertiesName);
|
||||||
|
|
||||||
|
if (turbPtr)
|
||||||
|
{
|
||||||
|
return tmp<volSymmTensorField>(turbPtr->devRhoReff());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< " The turbulence model is not found in the database."
|
||||||
|
<< exit(FatalError);
|
||||||
|
|
||||||
|
return tmp<volSymmTensorField>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fv::viscousDissipation::addSup
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
fvMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
typedef typename outerProduct<vector, vector>::type GradType;
|
||||||
|
typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
|
||||||
|
|
||||||
|
word gradUName("grad(" + UName_ + ')');
|
||||||
|
|
||||||
|
tmp<GradFieldType> tgradU
|
||||||
|
(
|
||||||
|
new GradFieldType
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"gradU",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_.time(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedTensor("zero", inv(dimTime) , tensor::zero)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Cached?
|
||||||
|
const GradFieldType* gradUPtr =
|
||||||
|
mesh_.lookupObjectPtr<GradFieldType>(gradUName);
|
||||||
|
|
||||||
|
if (gradUPtr)
|
||||||
|
{
|
||||||
|
tgradU.ref() = *gradUPtr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
|
||||||
|
tgradU.ref() = fvc::grad(U);
|
||||||
|
}
|
||||||
|
|
||||||
|
const volScalarField D("D", devRhoReff() && tgradU.ref());
|
||||||
|
|
||||||
|
eqn -= D;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,149 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fv::viscousDissipation
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpFvOptionsSources
|
||||||
|
|
||||||
|
Description
|
||||||
|
Calculates and applies the viscous dissipation energy source to the energy
|
||||||
|
equation.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example usage:
|
||||||
|
\verbatim
|
||||||
|
fields (h); // Name of energy field
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
viscousDissipation.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef viscousDissipation_H
|
||||||
|
#define viscousDissipation_H
|
||||||
|
|
||||||
|
#include "fvOption.H"
|
||||||
|
#include "uniformDimensionedFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fv
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class viscousDissipation Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class viscousDissipation
|
||||||
|
:
|
||||||
|
public option
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of velocity field; default = U
|
||||||
|
word UName_;
|
||||||
|
|
||||||
|
//- Name of the rho field for incompressible solvers
|
||||||
|
word rhoName_;
|
||||||
|
|
||||||
|
//- Density for single phase flows
|
||||||
|
dimensionedScalar rho_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Return the viscosity field
|
||||||
|
tmp<volSymmTensorField> devRhoReff() const;
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
viscousDissipation(const viscousDissipation&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const viscousDissipation&) = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
|
||||||
|
//- Return rho field
|
||||||
|
tmp<volScalarField> rho() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("viscousDissipation");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from explicit source name and mesh
|
||||||
|
viscousDissipation
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvMesh& mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Evaluate
|
||||||
|
|
||||||
|
//- Add explicit contribution to compressible energy equation
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
fvMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Read source dictionary
|
||||||
|
virtual bool read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fv
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -7,6 +7,7 @@ viscosityModels/BirdCarreau/BirdCarreau.C
|
|||||||
viscosityModels/HerschelBulkley/HerschelBulkley.C
|
viscosityModels/HerschelBulkley/HerschelBulkley.C
|
||||||
viscosityModels/Casson/Casson.C
|
viscosityModels/Casson/Casson.C
|
||||||
viscosityModels/strainRateFunction/strainRateFunction.C
|
viscosityModels/strainRateFunction/strainRateFunction.C
|
||||||
|
viscosityModels/Arrhenius/Arrheniuss.C
|
||||||
|
|
||||||
transportModel/transportModel.C
|
transportModel/transportModel.C
|
||||||
singlePhaseTransportModel/singlePhaseTransportModel.C
|
singlePhaseTransportModel/singlePhaseTransportModel.C
|
||||||
|
|||||||
@ -0,0 +1,93 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "Arrhenius.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class ViscousModel>
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::viscosityModels::Arrhenius<ViscousModel>::calcNu
|
||||||
|
(
|
||||||
|
const volScalarField& field
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return exp(-alpha_*(field - Talpha_));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class ViscousModel>
|
||||||
|
Foam::viscosityModels::Arrhenius<ViscousModel>::Arrhenius
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& viscosityProperties,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ViscousModel(name, viscosityProperties, U, phi),
|
||||||
|
ArrheniusCoeffs_
|
||||||
|
(
|
||||||
|
viscosityProperties.optionalSubDict(typeName + "Coeffs")
|
||||||
|
),
|
||||||
|
alpha_("alpha", inv(dimTemperature), ArrheniusCoeffs_),
|
||||||
|
Talpha_("Talpha", dimTemperature, ArrheniusCoeffs_),
|
||||||
|
fieldName_(ArrheniusCoeffs_.lookupOrDefault<word>("field","T")),
|
||||||
|
mesh_(U.mesh())
|
||||||
|
{
|
||||||
|
const volScalarField* fieldPtr =
|
||||||
|
mesh_.lookupObjectPtr<volScalarField>(fieldName_);
|
||||||
|
|
||||||
|
if (fieldPtr)
|
||||||
|
{
|
||||||
|
this->nu_ *= calcNu(*fieldPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class ViscousModel>
|
||||||
|
bool Foam::viscosityModels::Arrhenius<ViscousModel>::read
|
||||||
|
(
|
||||||
|
const dictionary& viscosityProperties
|
||||||
|
)
|
||||||
|
{
|
||||||
|
viscosityModel::read(viscosityProperties);
|
||||||
|
|
||||||
|
ArrheniusCoeffs_ =
|
||||||
|
viscosityProperties.optionalSubDict(typeName + "Coeffs");
|
||||||
|
|
||||||
|
ArrheniusCoeffs_.lookup("alpha") >> alpha_;
|
||||||
|
ArrheniusCoeffs_.lookup("Talpha") >> Talpha_;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,145 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::viscosityModels::Arrhenius
|
||||||
|
|
||||||
|
Description
|
||||||
|
Arrhenius type of dependency on a given scalar field name. Most likely
|
||||||
|
temperature. The expression is as follow:
|
||||||
|
\verbatim
|
||||||
|
mu = exp(-alpha_*(T - Talpha_))
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
Arrhenius.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef Arrhenius_H
|
||||||
|
#define Arrhenius_H
|
||||||
|
|
||||||
|
#include "viscosityModel.H"
|
||||||
|
#include "dimensionedScalar.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace viscosityModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class Arrhenius Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class ViscousModel>
|
||||||
|
class Arrhenius
|
||||||
|
:
|
||||||
|
public ViscousModel
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
dictionary ArrheniusCoeffs_;
|
||||||
|
|
||||||
|
// Model coefficients
|
||||||
|
dimensionedScalar alpha_;
|
||||||
|
dimensionedScalar Talpha_;
|
||||||
|
|
||||||
|
//- Field used for as temperature
|
||||||
|
word fieldName_;
|
||||||
|
|
||||||
|
//- Auto pointer for scalar field
|
||||||
|
autoPtr<volScalarField> field_;
|
||||||
|
|
||||||
|
//- Refernce to mesh
|
||||||
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Calculate and return the laminar viscosity
|
||||||
|
tmp<volScalarField> calcNu(const volScalarField&) const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// //- Runtime type information
|
||||||
|
TypeName("Arrhenius");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
Arrhenius
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& viscosityProperties,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~Arrhenius()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Correct the laminar viscosity
|
||||||
|
virtual void correct()
|
||||||
|
{
|
||||||
|
ViscousModel::correct();
|
||||||
|
|
||||||
|
const volScalarField* fieldPtr =
|
||||||
|
mesh_.lookupObjectPtr<volScalarField>(fieldName_);
|
||||||
|
|
||||||
|
if (fieldPtr)
|
||||||
|
{
|
||||||
|
this->nu_ *= calcNu(*fieldPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read transportProperties dictionary
|
||||||
|
virtual bool read(const dictionary& viscosityProperties);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace viscosityModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "Arrhenius.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "makeArrheniusTypes.H"
|
||||||
|
|
||||||
|
#include "Arrhenius.H"
|
||||||
|
#include "BirdCarreau.H"
|
||||||
|
#include "Casson.H"
|
||||||
|
#include "CrossPowerLaw.H"
|
||||||
|
#include "HerschelBulkley.H"
|
||||||
|
#include "Newtonian.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeArrheniusTypes(Arrhenius, BirdCarreau);
|
||||||
|
makeArrheniusTypes(Arrhenius, Casson);
|
||||||
|
makeArrheniusTypes(Arrhenius, CrossPowerLaw);
|
||||||
|
makeArrheniusTypes(Arrhenius, HerschelBulkley);
|
||||||
|
makeArrheniusTypes(Arrhenius, Newtonian);
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef makeArrheniusTypes_H
|
||||||
|
#define makeArrheniusTypes_H
|
||||||
|
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#define makeArrheniusTypes(ArrheniusType, visType) \
|
||||||
|
\
|
||||||
|
namespace Foam \
|
||||||
|
{ \
|
||||||
|
namespace viscosityModels \
|
||||||
|
{ \
|
||||||
|
typedef ArrheniusType<visType> ArrheniusType##visType; \
|
||||||
|
\
|
||||||
|
addNamedToRunTimeSelectionTable \
|
||||||
|
( \
|
||||||
|
viscosityModel, \
|
||||||
|
ArrheniusType##visType, \
|
||||||
|
dictionary, \
|
||||||
|
ArrheniusType##visType \
|
||||||
|
); \
|
||||||
|
\
|
||||||
|
defineTemplateTypeNameAndDebugWithName \
|
||||||
|
( \
|
||||||
|
ArrheniusType##visType, \
|
||||||
|
#ArrheniusType"<"#visType">", \
|
||||||
|
0 \
|
||||||
|
); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -44,7 +44,7 @@ namespace viscosityModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::viscosityModels::BirdCarreau::calcNu() const
|
Foam::viscosityModels::BirdCarreau::calcNu() const
|
||||||
@ -52,7 +52,7 @@ Foam::viscosityModels::BirdCarreau::calcNu() const
|
|||||||
return
|
return
|
||||||
nuInf_
|
nuInf_
|
||||||
+ (nu0_ - nuInf_)
|
+ (nu0_ - nuInf_)
|
||||||
*pow(scalar(1) + pow(k_*strainRate(), a_), (n_ - 1.0)/a_);
|
* pow(scalar(1) + pow(k_*strainRate(), a_), (n_ - 1.0)/a_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -67,10 +67,14 @@ class BirdCarreau
|
|||||||
dimensionedScalar n_;
|
dimensionedScalar n_;
|
||||||
dimensionedScalar a_;
|
dimensionedScalar a_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
volScalarField nu_;
|
volScalarField nu_;
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Calculate and return the laminar viscosity
|
//- Calculate and return the laminar viscosity
|
||||||
tmp<volScalarField> calcNu() const;
|
tmp<volScalarField> calcNu() const;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -44,7 +44,7 @@ namespace viscosityModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::viscosityModels::Casson::calcNu() const
|
Foam::viscosityModels::Casson::calcNu() const
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -90,10 +90,16 @@ class Casson
|
|||||||
dimensionedScalar nuMin_;
|
dimensionedScalar nuMin_;
|
||||||
dimensionedScalar nuMax_;
|
dimensionedScalar nuMax_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
volScalarField nu_;
|
volScalarField nu_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Calculate and return the laminar viscosity
|
//- Calculate and return the laminar viscosity
|
||||||
tmp<volScalarField> calcNu() const;
|
tmp<volScalarField> calcNu() const;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -45,7 +45,7 @@ namespace viscosityModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::viscosityModels::CrossPowerLaw::calcNu() const
|
Foam::viscosityModels::CrossPowerLaw::calcNu() const
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -63,9 +63,15 @@ class CrossPowerLaw
|
|||||||
dimensionedScalar m_;
|
dimensionedScalar m_;
|
||||||
dimensionedScalar n_;
|
dimensionedScalar n_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
volScalarField nu_;
|
volScalarField nu_;
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Calculate and return the laminar viscosity
|
//- Calculate and return the laminar viscosity
|
||||||
tmp<volScalarField> calcNu() const;
|
tmp<volScalarField> calcNu() const;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -45,7 +45,7 @@ namespace viscosityModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::viscosityModels::HerschelBulkley::calcNu() const
|
Foam::viscosityModels::HerschelBulkley::calcNu() const
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -63,10 +63,15 @@ class HerschelBulkley
|
|||||||
dimensionedScalar tau0_;
|
dimensionedScalar tau0_;
|
||||||
dimensionedScalar nu0_;
|
dimensionedScalar nu0_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
volScalarField nu_;
|
volScalarField nu_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Calculate and return the laminar viscosity
|
//- Calculate and return the laminar viscosity
|
||||||
tmp<volScalarField> calcNu() const;
|
tmp<volScalarField> calcNu() const;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -58,11 +58,14 @@ class Newtonian
|
|||||||
|
|
||||||
dimensionedScalar nu0_;
|
dimensionedScalar nu0_;
|
||||||
|
|
||||||
volScalarField nu_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
volScalarField nu_;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("Newtonian");
|
TypeName("Newtonian");
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -45,7 +45,7 @@ namespace viscosityModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::viscosityModels::powerLaw::calcNu() const
|
Foam::viscosityModels::powerLaw::calcNu() const
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -63,10 +63,15 @@ class powerLaw
|
|||||||
dimensionedScalar nuMin_;
|
dimensionedScalar nuMin_;
|
||||||
dimensionedScalar nuMax_;
|
dimensionedScalar nuMax_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
volScalarField nu_;
|
volScalarField nu_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Calculate and return the laminar viscosity
|
//- Calculate and return the laminar viscosity
|
||||||
tmp<volScalarField> calcNu() const;
|
tmp<volScalarField> calcNu() const;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -76,7 +76,11 @@ class strainRateFunction
|
|||||||
//- Strain-rate function
|
//- Strain-rate function
|
||||||
autoPtr<Function1<scalar>> strainRateFunction_;
|
autoPtr<Function1<scalar>> strainRateFunction_;
|
||||||
|
|
||||||
//- Current viscosity field
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
volScalarField nu_;
|
volScalarField nu_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,35 +9,14 @@ FoamFile
|
|||||||
{
|
{
|
||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class volVectorField;
|
class dictionary;
|
||||||
location "0";
|
location "constant";
|
||||||
object U;
|
object fvOptions;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
viscousDissipation
|
||||||
dimensions [0 1 -1 0 0 0 0];
|
|
||||||
|
|
||||||
internalField uniform (0 0 0);
|
|
||||||
|
|
||||||
boundaryField
|
|
||||||
{
|
{
|
||||||
rotor
|
type viscousDissipation;
|
||||||
{
|
enabled true;
|
||||||
type noSlip;
|
|
||||||
}
|
|
||||||
stator
|
|
||||||
{
|
|
||||||
type noSlip;
|
|
||||||
}
|
|
||||||
front
|
|
||||||
{
|
|
||||||
type empty;
|
|
||||||
}
|
|
||||||
back
|
|
||||||
{
|
|
||||||
type empty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -10,19 +10,20 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class volScalarField;
|
class volScalarField;
|
||||||
object p_rgh;
|
object T;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
dimensions [1 -1 -2 0 0 0 0];
|
dimensions [0 0 0 1 0 0 0];
|
||||||
|
|
||||||
internalField uniform 0;
|
internalField uniform 300;
|
||||||
|
|
||||||
boundaryField
|
boundaryField
|
||||||
{
|
{
|
||||||
rotor
|
rotor
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type fixedValue;
|
||||||
|
value uniform 305;
|
||||||
}
|
}
|
||||||
|
|
||||||
stator
|
stator
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,6 @@
|
|||||||
cd ${0%/*} || exit 1 # Run from this directory
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
|
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
|
||||||
|
|
||||||
cleanCase
|
cleanCase0
|
||||||
rm 0/alphas > /dev/null 2>&1
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -3,6 +3,10 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||||
|
|
||||||
runApplication ./makeMesh
|
runApplication ./makeMesh
|
||||||
|
restore0Dir
|
||||||
|
topoSet
|
||||||
|
setFields
|
||||||
|
setsToZones -noFlipMap
|
||||||
runApplication $(getApplication)
|
runApplication $(getApplication)
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -5,4 +5,3 @@ blockMesh
|
|||||||
topoSet
|
topoSet
|
||||||
setsToZones -noFlipMap
|
setsToZones -noFlipMap
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
|
|||||||
@ -52,5 +52,62 @@ maxAlphaCo 0.5;
|
|||||||
|
|
||||||
maxDeltaT 1;
|
maxDeltaT 1;
|
||||||
|
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
sTransport
|
||||||
|
{
|
||||||
|
type energyTransport;
|
||||||
|
libs ("libsolverFunctionObjects.so");
|
||||||
|
|
||||||
|
enabled true;
|
||||||
|
writeControl outputTime;
|
||||||
|
writeInterval 1;
|
||||||
|
|
||||||
|
field T;
|
||||||
|
|
||||||
|
rho rho;
|
||||||
|
phi rhoPhi;
|
||||||
|
|
||||||
|
write true;
|
||||||
|
|
||||||
|
phaseThermos
|
||||||
|
{
|
||||||
|
alpha.air
|
||||||
|
{
|
||||||
|
Cp 1e3;
|
||||||
|
kappa 0.0243;
|
||||||
|
}
|
||||||
|
alpha.mercury
|
||||||
|
{
|
||||||
|
Cp 140;
|
||||||
|
kappa 8.2;
|
||||||
|
}
|
||||||
|
alpha.oil
|
||||||
|
{
|
||||||
|
Cp 2e3;
|
||||||
|
kappa 0.2;
|
||||||
|
}
|
||||||
|
alpha.water
|
||||||
|
{
|
||||||
|
Cp 4e3;
|
||||||
|
kappa 0.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fvOptions
|
||||||
|
{
|
||||||
|
viscousDissipation
|
||||||
|
{
|
||||||
|
type viscousDissipation;
|
||||||
|
enabled true;
|
||||||
|
|
||||||
|
viscousDissipationCoeffs
|
||||||
|
{
|
||||||
|
fields (T);
|
||||||
|
rho rho; //rho Field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -31,6 +31,7 @@ divSchemes
|
|||||||
div(phi,alpha) Gauss vanLeer;
|
div(phi,alpha) Gauss vanLeer;
|
||||||
div(phirb,alpha) Gauss linear;
|
div(phirb,alpha) Gauss linear;
|
||||||
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
|
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
|
||||||
|
div(phi,T) Gauss limitedLinear 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
laplacianSchemes
|
laplacianSchemes
|
||||||
|
|||||||
@ -48,7 +48,7 @@ solvers
|
|||||||
relTol 0;
|
relTol 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
U
|
"(U|T)"
|
||||||
{
|
{
|
||||||
solver smoothSolver;
|
solver smoothSolver;
|
||||||
smoother symGaussSeidel;
|
smoother symGaussSeidel;
|
||||||
@ -71,7 +71,7 @@ relaxationFactors
|
|||||||
{
|
{
|
||||||
equations
|
equations
|
||||||
{
|
{
|
||||||
"U.*" 1;
|
".*" 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user