mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
Conflicts: tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/polyMesh/boundary tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/rho tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/polyMesh/boundary tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/topAir/RASProperties tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/topAir/thermophysicalProperties tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/topAir/turbulenceProperties tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/0/cp tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/0/rho tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/polyMesh/boundary tutorials/incompressible/simpleFoam/windTurbineTerrain/0/include/fixedInlet tutorials/incompressible/simpleFoam/windTurbineTerrain/0/include/sideAndTopPatches tutorials/incompressible/simpleFoam/windTurbineTerrain/0/nut tutorials/incompressible/simpleFoam/windTurbineTerrain/0/p tutorials/incompressible/simpleFoam/windTurbineTerrain/constant/RASProperties tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict
This commit is contained in:
@ -50,199 +50,17 @@ PDRkEpsilon::PDRkEpsilon
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const basicThermo& thermophysicalModel
|
||||
const basicThermo& thermophysicalModel,
|
||||
const word& turbulenceModelName,
|
||||
const word& modelName
|
||||
)
|
||||
:
|
||||
RASModel(typeName, rho, U, phi, thermophysicalModel),
|
||||
|
||||
Cmu_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"Cmu",
|
||||
coeffDict_,
|
||||
0.09
|
||||
)
|
||||
),
|
||||
C1_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"C1",
|
||||
coeffDict_,
|
||||
1.44
|
||||
)
|
||||
),
|
||||
C2_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"C2",
|
||||
coeffDict_,
|
||||
1.92
|
||||
)
|
||||
),
|
||||
sigmak_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"sigmak",
|
||||
coeffDict_,
|
||||
1.0
|
||||
)
|
||||
),
|
||||
sigmaEps_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"sigmaEps",
|
||||
coeffDict_,
|
||||
1.3
|
||||
)
|
||||
),
|
||||
Prt_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"Prt",
|
||||
coeffDict_,
|
||||
1.0
|
||||
)
|
||||
),
|
||||
|
||||
k_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"k",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
autoCreateK("k", mesh_)
|
||||
),
|
||||
epsilon_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"epsilon",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
autoCreateEpsilon("epsilon", mesh_)
|
||||
),
|
||||
mut_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"mut",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
autoCreateMut("mut", mesh_)
|
||||
),
|
||||
alphat_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alphat",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
autoCreateAlphat("alphat", mesh_)
|
||||
)
|
||||
{
|
||||
bound(epsilon_, epsilonMin_);
|
||||
|
||||
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
alphat_ = mut_/Prt_;
|
||||
alphat_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
}
|
||||
kEpsilon(rho, U, phi, thermophysicalModel, turbulenceModelName, modelName)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<volSymmTensorField> PDRkEpsilon::R() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"R",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
((2.0/3.0)*I)*k_ - (mut_/rho_)*dev(twoSymm(fvc::grad(U_))),
|
||||
k_.boundaryField().types()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
tmp<volSymmTensorField> PDRkEpsilon::devRhoReff() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"devRhoReff",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
-muEff()*dev(twoSymm(fvc::grad(U_)))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
tmp<fvVectorMatrix> PDRkEpsilon::divDevRhoReff(volVectorField& U) const
|
||||
{
|
||||
return
|
||||
(
|
||||
- fvm::laplacian(muEff(), U) - fvc::div(muEff()*dev2(fvc::grad(U)().T()))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool PDRkEpsilon::read()
|
||||
{
|
||||
if (RASModel::read())
|
||||
{
|
||||
Cmu_.readIfPresent(coeffDict_);
|
||||
C1_.readIfPresent(coeffDict_);
|
||||
C2_.readIfPresent(coeffDict_);
|
||||
sigmak_.readIfPresent(coeffDict());
|
||||
sigmaEps_.readIfPresent(coeffDict());
|
||||
Prt_.readIfPresent(coeffDict());
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PDRkEpsilon::correct()
|
||||
{
|
||||
if (!turbulence_)
|
||||
@ -271,7 +89,7 @@ void PDRkEpsilon::correct()
|
||||
volScalarField G("RASModel::G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
|
||||
tgradU.clear();
|
||||
|
||||
// Update espsilon and G at the wall
|
||||
// Update epsilon and G at the wall
|
||||
epsilon_.boundaryField().updateCoeffs();
|
||||
|
||||
// Add the blockage generation term so that it is included consistently
|
||||
@ -320,6 +138,7 @@ void PDRkEpsilon::correct()
|
||||
solve(kEqn);
|
||||
bound(k_, kMin_);
|
||||
|
||||
|
||||
// Re-calculate viscosity
|
||||
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,12 +25,13 @@ Class
|
||||
Foam::compressible::RASModels::PDRkEpsilon
|
||||
|
||||
Description
|
||||
Standard k-epsilon turbulence model with additional source terms
|
||||
Standard k-epsilon turbulence model for compressible flow
|
||||
with additional source terms
|
||||
corresponding to PDR basic drag model (\link basic.H \endlink)
|
||||
|
||||
The default model coefficients correspond to the following:
|
||||
@verbatim
|
||||
kEpsilonCoeffs
|
||||
PDRkEpsilonCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
@ -53,7 +54,6 @@ Description
|
||||
|
||||
SourceFiles
|
||||
PDRkEpsilon.C
|
||||
PDRkEpsilonCorrect.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -61,6 +61,7 @@ SourceFiles
|
||||
#define compressiblePDRkEpsilon_H
|
||||
|
||||
#include "RASModel.H"
|
||||
#include "kEpsilon.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -77,26 +78,8 @@ namespace RASModels
|
||||
|
||||
class PDRkEpsilon
|
||||
:
|
||||
public RASModel
|
||||
public kEpsilon
|
||||
{
|
||||
// Private data
|
||||
|
||||
// Model coefficients
|
||||
|
||||
dimensionedScalar Cmu_;
|
||||
dimensionedScalar C1_;
|
||||
dimensionedScalar C2_;
|
||||
dimensionedScalar sigmak_;
|
||||
dimensionedScalar sigmaEps_;
|
||||
dimensionedScalar Prt_;
|
||||
|
||||
// Fields
|
||||
|
||||
volScalarField k_;
|
||||
volScalarField epsilon_;
|
||||
volScalarField mut_;
|
||||
volScalarField alphat_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -112,7 +95,9 @@ public:
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const basicThermo& thermophysicalModel
|
||||
const basicThermo& thermophysicalModel,
|
||||
const word& turbulenceModelName = turbulenceModel::typeName,
|
||||
const word& modelName = typeName
|
||||
);
|
||||
|
||||
|
||||
@ -123,62 +108,9 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the effective diffusivity for k
|
||||
tmp<volScalarField> DkEff() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField("DkEff", mut_/sigmak_ + mu())
|
||||
);
|
||||
}
|
||||
|
||||
//- Return the effective diffusivity for epsilon
|
||||
tmp<volScalarField> DepsilonEff() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField("DepsilonEff", mut_/sigmaEps_ + mu())
|
||||
);
|
||||
}
|
||||
|
||||
//- Return the turbulence viscosity
|
||||
virtual tmp<volScalarField> mut() const
|
||||
{
|
||||
return mut_;
|
||||
}
|
||||
|
||||
//- Return the turbulence thermal diffusivity
|
||||
virtual tmp<volScalarField> alphat() const
|
||||
{
|
||||
return alphat_;
|
||||
}
|
||||
|
||||
//- Return the turbulence kinetic energy
|
||||
virtual tmp<volScalarField> k() const
|
||||
{
|
||||
return k_;
|
||||
}
|
||||
|
||||
//- Return the turbulence kinetic energy dissipation rate
|
||||
virtual tmp<volScalarField> epsilon() const
|
||||
{
|
||||
return epsilon_;
|
||||
}
|
||||
|
||||
//- Return the Reynolds stress tensor
|
||||
virtual tmp<volSymmTensorField> R() const;
|
||||
|
||||
//- Return the effective stress tensor including the laminar stress
|
||||
virtual tmp<volSymmTensorField> devRhoReff() const;
|
||||
|
||||
//- Return the source term for the momentum equation
|
||||
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
|
||||
|
||||
//- Solve the turbulence equations and correct the turbulence viscosity
|
||||
virtual void correct();
|
||||
|
||||
//- Read turbulenceProperties dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,10 +6,12 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel
|
||||
|
||||
EXE_LIBS = \
|
||||
-lbasicThermophysicalModels \
|
||||
-lbasicSolidThermo \
|
||||
-lspecie \
|
||||
-lcompressibleRASModels \
|
||||
-lcompressibleLESModels \
|
||||
|
||||
@ -37,6 +37,7 @@ Description
|
||||
#include "regionProperties.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "solidRegionDiffNo.H"
|
||||
#include "basicSolidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude
|
||||
@ -14,5 +15,6 @@ EXE_INC = \
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lbasicThermophysicalModels \
|
||||
-lbasicSolidThermo \
|
||||
-lspecie \
|
||||
-lcompressibleRASModels
|
||||
|
||||
@ -35,6 +35,7 @@ Description
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "regionProperties.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "basicSolidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
// Initialise solid field pointer lists
|
||||
PtrList<volScalarField> rhos(solidRegions.size());
|
||||
PtrList<volScalarField> cps(solidRegions.size());
|
||||
PtrList<volScalarField> Ks(solidRegions.size());
|
||||
PtrList<volScalarField> Ts(solidRegions.size());
|
||||
PtrList<basicSolidThermo> thermos(solidRegions.size());
|
||||
|
||||
// Populate solid field pointer lists
|
||||
forAll(solidRegions, i)
|
||||
@ -10,75 +7,10 @@
|
||||
Info<< "*** Reading solid mesh thermophysical properties for region "
|
||||
<< solidRegions[i].name() << nl << endl;
|
||||
|
||||
Info<< " Adding to rhos\n" << endl;
|
||||
rhos.set
|
||||
Info<< " Adding to thermos\n" << endl;
|
||||
thermos.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to cps\n" << endl;
|
||||
cps.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cp",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to Ks\n" << endl;
|
||||
Ks.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"K",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to Ts\n" << endl;
|
||||
Ts.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
basicSolidThermo::New(solidRegions[i])
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,6 +1,14 @@
|
||||
fvMesh& mesh = solidRegions[i];
|
||||
basicSolidThermo& thermo = thermos[i];
|
||||
|
||||
volScalarField& rho = rhos[i];
|
||||
volScalarField& cp = cps[i];
|
||||
volScalarField& K = Ks[i];
|
||||
volScalarField& T = Ts[i];
|
||||
tmp<volScalarField> trho = thermo.rho();
|
||||
const volScalarField& rho = trho();
|
||||
|
||||
tmp<volScalarField> tcp = thermo.cp();
|
||||
const volScalarField& cp = tcp();
|
||||
|
||||
tmp<volScalarField> tK = thermo.K();
|
||||
//tmp<volSymmTensorField> tK = thermo.directionalK();
|
||||
const volScalarField& K = tK();
|
||||
|
||||
volScalarField& T = thermo.T();
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
// Initialise solid field pointer lists
|
||||
PtrList<volScalarField> rhos(solidRegions.size());
|
||||
PtrList<volScalarField> cps(solidRegions.size());
|
||||
PtrList<volScalarField> Ks(solidRegions.size());
|
||||
PtrList<volScalarField> Ts(solidRegions.size());
|
||||
PtrList<basicSolidThermo> thermos(solidRegions.size());
|
||||
|
||||
// Populate solid field pointer lists
|
||||
forAll(solidRegions, i)
|
||||
@ -10,75 +7,10 @@
|
||||
Info<< "*** Reading solid mesh thermophysical properties for region "
|
||||
<< solidRegions[i].name() << nl << endl;
|
||||
|
||||
Info<< " Adding to rhos\n" << endl;
|
||||
rhos.set
|
||||
Info<< " Adding to thermos\n" << endl;
|
||||
thermos.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to cps\n" << endl;
|
||||
cps.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cp",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to Ks\n" << endl;
|
||||
Ks.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"K",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to Ts\n" << endl;
|
||||
Ts.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
basicSolidThermo::New(solidRegions[i])
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,6 +1,14 @@
|
||||
fvMesh& mesh = solidRegions[i];
|
||||
basicSolidThermo& thermo = thermos[i];
|
||||
|
||||
volScalarField& rho = rhos[i];
|
||||
volScalarField& cp = cps[i];
|
||||
volScalarField& K = Ks[i];
|
||||
volScalarField& T = Ts[i];
|
||||
tmp<volScalarField> trho = thermo.rho();
|
||||
const volScalarField& rho = trho();
|
||||
|
||||
tmp<volScalarField> tcp = thermo.cp();
|
||||
const volScalarField& cp = tcp();
|
||||
|
||||
tmp<volScalarField> tK = thermo.K();
|
||||
//tmp<volSymmTensorField> tK = thermo.directionalK();
|
||||
const volScalarField& K = tK();
|
||||
|
||||
volScalarField& T = thermo.T();
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
scalar DiNum = -GREAT;
|
||||
|
||||
forAll(solidRegions, regionI)
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
# include "setRegionSolidFields.H"
|
||||
|
||||
DiNum = max
|
||||
(
|
||||
solidRegionDiffNo
|
||||
(
|
||||
solidRegions[regionI],
|
||||
solidRegions[i],
|
||||
runTime,
|
||||
rhos[regionI]*cps[regionI],
|
||||
Ks[regionI]
|
||||
rho*cp,
|
||||
K
|
||||
),
|
||||
DiNum
|
||||
);
|
||||
|
||||
@ -31,6 +31,41 @@ Description
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
template<class T>
|
||||
void printInfo
|
||||
(
|
||||
const word& tag,
|
||||
const UList<T>& lst,
|
||||
const bool showSize = false
|
||||
)
|
||||
{
|
||||
Info<< "<" << tag;
|
||||
if (showSize)
|
||||
{
|
||||
Info<< " size=\"" << lst.size() << "\"";
|
||||
}
|
||||
Info<< ">" << lst << "</" << tag << ">" << endl;
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
void printInfo
|
||||
(
|
||||
const word& tag,
|
||||
const DynamicList<T, SizeInc, SizeMult, SizeDiv>& lst,
|
||||
const bool showSize = false
|
||||
)
|
||||
{
|
||||
Info<< "<" << tag;
|
||||
if (showSize)
|
||||
{
|
||||
Info<< " size=\"" << lst.size()
|
||||
<< "\" capacity=\"" << lst.capacity() << "\"";
|
||||
}
|
||||
Info<< ">" << lst << "</" << tag << ">" << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
@ -104,10 +139,8 @@ int main(int argc, char *argv[])
|
||||
List<label> lstA;
|
||||
lstA.transfer(dlB);
|
||||
Info<< "Transferred to normal list" << endl;
|
||||
Info<< "<lstA>" << lstA << "</lstA>" << nl << "sizes: "
|
||||
<< " " << lstA.size() << endl;
|
||||
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
|
||||
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
|
||||
printInfo("lstA", lstA, true);
|
||||
printInfo("dlB", dlB, true);
|
||||
|
||||
// Copy back and append a few time
|
||||
for (label i=0; i < 3; i++)
|
||||
@ -116,15 +149,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
Info<< "appended list a few times" << endl;
|
||||
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
|
||||
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
|
||||
printInfo("dlB", dlB, true);
|
||||
|
||||
// assign the list (should maintain allocated space)
|
||||
dlB = lstA;
|
||||
Info<< "assigned list" << endl;
|
||||
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
|
||||
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
|
||||
|
||||
printInfo("dlB", dlB, true);
|
||||
|
||||
// Copy back and append a few time
|
||||
for (label i=0; i < 3; i++)
|
||||
@ -136,38 +166,30 @@ int main(int argc, char *argv[])
|
||||
// check allocation granularity
|
||||
DynamicList<label, 6, 0> dlC;
|
||||
|
||||
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
|
||||
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
|
||||
printInfo("dlC", dlC, true);
|
||||
|
||||
dlC.reserve(dlB.size());
|
||||
dlC = dlB;
|
||||
|
||||
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
|
||||
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
|
||||
printInfo("dlC", dlC, true);
|
||||
|
||||
List<label> lstB(dlC.xfer());
|
||||
|
||||
Info<< "Transferred to normal list via the xfer() method" << endl;
|
||||
Info<< "<lstB>" << lstB << "</lstB>" << nl << "sizes: "
|
||||
<< " " << lstB.size() << endl;
|
||||
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
|
||||
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
|
||||
printInfo("lstB", lstB, true);
|
||||
printInfo("dlC", dlC, true);
|
||||
|
||||
DynamicList<label> dlD(lstB.xfer());
|
||||
|
||||
Info<< "Transfer construct from normal list" << endl;
|
||||
Info<< "<lstB>" << lstB << "</lstB>" << nl << "sizes: "
|
||||
<< " " << lstB.size() << endl;
|
||||
Info<< "<dlD>" << dlD << "</dlD>" << nl << "sizes: "
|
||||
<< " " << dlD.size() << "/" << dlD.capacity() << endl;
|
||||
printInfo("lstB", lstB, true);
|
||||
printInfo("dlD", dlD, true);
|
||||
|
||||
DynamicList<label,10> dlE1(10);
|
||||
DynamicList<label> dlE2(dlE1); // construct dissimilar
|
||||
|
||||
Info<< "<dlE1>" << dlE1 << "</dlE1>" << nl << "sizes: "
|
||||
<< " " << dlE1.size() << "/" << dlE1.capacity() << endl;
|
||||
Info<< "<dlE2>" << dlE2 << "</dlE2>" << nl << "sizes: "
|
||||
<< " " << dlE2.size() << "/" << dlE2.capacity() << endl;
|
||||
printInfo("dlE1", dlE1, true);
|
||||
printInfo("dlE2", dlE2, true);
|
||||
|
||||
for (label elemI=0; elemI < 5; ++elemI)
|
||||
{
|
||||
@ -175,19 +197,42 @@ int main(int argc, char *argv[])
|
||||
dlE2.append(elemI);
|
||||
}
|
||||
|
||||
Info<< "<dlE2>" << dlE2 << "</dlE2>" << endl;
|
||||
printInfo("dlE2", dlE2, true);
|
||||
|
||||
DynamicList<label> dlE3(dlE2); // construct identical
|
||||
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
|
||||
printInfo("dlE3", dlE3, true);
|
||||
|
||||
dlE3 = dlE1; // assign dissimilar
|
||||
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
|
||||
printInfo("dlE3", dlE3, true);
|
||||
|
||||
dlE3 = dlE2; // assign identical
|
||||
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
|
||||
printInfo("dlE3", dlE3, true);
|
||||
|
||||
DynamicList<label> dlE4(reorder(identity(dlE3.size()), dlE3));
|
||||
Info<< "<dlE4>" << dlE4 << "</dlE4>" << endl;
|
||||
printInfo("dlE4", dlE4, true);
|
||||
|
||||
printInfo("dlE3", dlE3, true);
|
||||
|
||||
|
||||
{
|
||||
DynamicList<label> addr(10);
|
||||
addr.append(3);
|
||||
addr.append(1);
|
||||
addr.append(2);
|
||||
|
||||
forAll(dlE2, i)
|
||||
{
|
||||
dlE2[i] *= 10;
|
||||
}
|
||||
|
||||
UIndirectList<label> uil
|
||||
(
|
||||
dlE2, addr
|
||||
);
|
||||
Info<< "use UIndirectList " << uil << " remapped from " << dlE2 << endl;
|
||||
dlE4 = uil;
|
||||
printInfo("dlE4", dlE4, true);
|
||||
}
|
||||
|
||||
|
||||
Info<< "\nEnd\n";
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,15 +27,49 @@ Description
|
||||
|
||||
#include "IOstreams.H"
|
||||
#include "pTraits.H"
|
||||
#include "vector.H"
|
||||
#include "tensor.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
template<class T>
|
||||
void printTraits()
|
||||
{
|
||||
Info<< pTraits<T>::typeName
|
||||
<< ": zero=" << pTraits<T>::zero
|
||||
<< " one=" << pTraits<T>::one << endl;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void printTraits(const pTraits<T>& p)
|
||||
{
|
||||
Info<< p.typeName << " == " << p << endl;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
Info<< pTraits<scalar>::typeName << endl;
|
||||
printTraits<bool>();
|
||||
printTraits<label>();
|
||||
printTraits<scalar>();
|
||||
printTraits<vector>();
|
||||
printTraits<tensor>();
|
||||
|
||||
{
|
||||
pTraits<bool> b(true);
|
||||
printTraits(b);
|
||||
}
|
||||
|
||||
{
|
||||
pTraits<label> l(100);
|
||||
printTraits(l);
|
||||
}
|
||||
|
||||
printTraits(pTraits<scalar>(3.14159));
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
|
||||
@ -233,6 +233,44 @@ void storeCellInZone
|
||||
}
|
||||
|
||||
|
||||
// Reads mesh format
|
||||
scalar readMeshFormat(IFstream& inFile)
|
||||
{
|
||||
Info<< "Starting to read mesh format at line " << inFile.lineNumber() << endl;
|
||||
|
||||
string line;
|
||||
inFile.getLine(line);
|
||||
IStringStream lineStr(line);
|
||||
|
||||
scalar version;
|
||||
label asciiFlag, nBytes;
|
||||
lineStr >> version >> asciiFlag >> nBytes;
|
||||
|
||||
Info<< "Read format version " << version << " ascii " << asciiFlag << endl;
|
||||
|
||||
if (asciiFlag != 0)
|
||||
{
|
||||
FatalIOErrorIn("readMeshFormat(IFstream&)", inFile)
|
||||
<< "Can only read ascii msh files."
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
inFile.getLine(line);
|
||||
IStringStream tagStr(line);
|
||||
word tag(tagStr);
|
||||
|
||||
if (tag != "$EndMeshFormat")
|
||||
{
|
||||
FatalIOErrorIn("readMeshFormat(IFstream&)", inFile)
|
||||
<< "Did not find $ENDNOD tag on line "
|
||||
<< inFile.lineNumber() << exit(FatalIOError);
|
||||
}
|
||||
Info<< endl;
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
// Reads points and map
|
||||
void readPoints(IFstream& inFile, pointField& points, Map<label>& mshToFoam)
|
||||
{
|
||||
@ -278,9 +316,9 @@ void readPoints(IFstream& inFile, pointField& points, Map<label>& mshToFoam)
|
||||
|
||||
if (tag != "$ENDNOD" && tag != "$EndNodes")
|
||||
{
|
||||
FatalErrorIn("readPoints(..)")
|
||||
FatalIOErrorIn("readPoints(..)", inFile)
|
||||
<< "Did not find $ENDNOD tag on line "
|
||||
<< inFile.lineNumber() << exit(FatalError);
|
||||
<< inFile.lineNumber() << exit(FatalIOError);
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
@ -351,9 +389,9 @@ void readPhysNames(IFstream& inFile, Map<word>& physicalNames)
|
||||
|
||||
if (tag != "$EndPhysicalNames")
|
||||
{
|
||||
FatalErrorIn("readPhysicalNames(..)")
|
||||
FatalIOErrorIn("readPhysicalNames(..)", inFile)
|
||||
<< "Did not find $EndPhysicalNames tag on line "
|
||||
<< inFile.lineNumber() << exit(FatalError);
|
||||
<< inFile.lineNumber() << exit(FatalIOError);
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
@ -362,7 +400,7 @@ void readPhysNames(IFstream& inFile, Map<word>& physicalNames)
|
||||
// Reads cells and patch faces
|
||||
void readCells
|
||||
(
|
||||
const bool version2Format,
|
||||
const scalar versionFormat,
|
||||
const bool keepOrientation,
|
||||
const pointField& points,
|
||||
const Map<label>& mshToFoam,
|
||||
@ -426,23 +464,18 @@ void readCells
|
||||
|
||||
label elmNumber, elmType, regPhys;
|
||||
|
||||
if (version2Format)
|
||||
if (versionFormat >= 2)
|
||||
{
|
||||
lineStr >> elmNumber >> elmType;
|
||||
|
||||
label nTags;
|
||||
lineStr>> nTags;
|
||||
|
||||
label regElem, partition;
|
||||
|
||||
if (nTags == 3)
|
||||
if (nTags > 0)
|
||||
{
|
||||
lineStr >> regPhys >> regElem >> partition;
|
||||
}
|
||||
else
|
||||
{
|
||||
regPhys = 0;
|
||||
for (label i = 0; i < nTags; i++)
|
||||
// Assume the first tag is the physical surface
|
||||
lineStr >> regPhys;
|
||||
for (label i = 1; i < nTags; i++)
|
||||
{
|
||||
label dummy;
|
||||
lineStr>> dummy;
|
||||
@ -659,9 +692,9 @@ void readCells
|
||||
|
||||
if (tag != "$ENDELM" && tag != "$EndElements")
|
||||
{
|
||||
FatalErrorIn("readCells(..)")
|
||||
FatalIOErrorIn("readCells(..)", inFile)
|
||||
<< "Did not find $ENDELM tag on line "
|
||||
<< inFile.lineNumber() << exit(FatalError);
|
||||
<< inFile.lineNumber() << exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
@ -683,13 +716,13 @@ void readCells
|
||||
|
||||
if (cells.size() == 0)
|
||||
{
|
||||
FatalErrorIn("readCells(..)")
|
||||
FatalIOErrorIn("readCells(..)", inFile)
|
||||
<< "No cells read from file " << inFile.name() << nl
|
||||
<< "Does your file specify any 3D elements (hex=" << MSHHEX
|
||||
<< ", prism=" << MSHPRISM << ", pyramid=" << MSHPYR
|
||||
<< ", tet=" << MSHTET << ")?" << nl
|
||||
<< "Perhaps you have not exported the 3D elements?"
|
||||
<< exit(FatalError);
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
Info<< "CellZones:" << nl
|
||||
@ -749,7 +782,8 @@ int main(int argc, char *argv[])
|
||||
Map<word> physicalNames;
|
||||
|
||||
// Version 1 or 2 format
|
||||
bool version2Format = false;
|
||||
scalar versionFormat = 1;
|
||||
|
||||
|
||||
while (inFile.good())
|
||||
{
|
||||
@ -761,14 +795,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (tag == "$MeshFormat")
|
||||
{
|
||||
Info<< "Found $MeshFormat tag; assuming version 2 file format."
|
||||
<< endl;
|
||||
version2Format = true;
|
||||
|
||||
if (!skipSection(inFile))
|
||||
{
|
||||
break;
|
||||
}
|
||||
versionFormat = readMeshFormat(inFile);
|
||||
}
|
||||
else if (tag == "$PhysicalNames")
|
||||
{
|
||||
@ -782,7 +809,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
readCells
|
||||
(
|
||||
version2Format,
|
||||
versionFormat,
|
||||
keepOrientation,
|
||||
points,
|
||||
mshToFoam,
|
||||
|
||||
@ -1,15 +1,20 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
if [ -f /usr/include/readline/readline.h ]
|
||||
unset COMP_FLAGS LINK_FLAGS
|
||||
|
||||
#
|
||||
# use readline if available
|
||||
# unless otherwise specified (with NO_READLINE)
|
||||
#
|
||||
# eg, ./Allwmake NO_READLINE
|
||||
#
|
||||
|
||||
if [ -f /usr/include/readline/readline.h -a "${1%NO_READLINE}" = "$1" ]
|
||||
then
|
||||
echo "Found readline/readline.h -- enabling readline support."
|
||||
export READLINE=1
|
||||
export READLINELINK="-lreadline -lncurses"
|
||||
else
|
||||
# no readline/readline.h -- disabling readline support
|
||||
export READLINE=0
|
||||
unset READLINELINK
|
||||
echo "Found <readline/readline.h> -- enabling readline support."
|
||||
export COMP_FLAGS="-DHAS_READLINE"
|
||||
export LINK_FLAGS="-lreadline -lncurses"
|
||||
fi
|
||||
|
||||
wmake
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
/* NB: trailing zero after define improves robustness */
|
||||
|
||||
EXE_INC = \
|
||||
-DREADLINE=$(READLINE)0 \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
$(COMP_FLAGS)
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
$(READLINELINK)
|
||||
$(LINK_FLAGS)
|
||||
|
||||
@ -49,7 +49,7 @@ Description
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#if READLINE != 0
|
||||
#ifdef HAS_READLINE
|
||||
# include <readline/readline.h>
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
@ -59,29 +59,10 @@ using namespace Foam;
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
#if READLINE != 0
|
||||
#ifdef HAS_READLINE
|
||||
static const char* historyFile = ".setSet";
|
||||
#endif
|
||||
|
||||
Istream& selectStream(Istream* is0Ptr, Istream* is1Ptr)
|
||||
{
|
||||
if (is0Ptr)
|
||||
{
|
||||
return *is0Ptr;
|
||||
}
|
||||
else if (is1Ptr)
|
||||
{
|
||||
return *is1Ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("selectStream(Istream*, Istream*)")
|
||||
<< "No valid stream opened" << abort(FatalError);
|
||||
|
||||
return *is0Ptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Write set to VTK readable files
|
||||
void writeVTK
|
||||
@ -867,7 +848,7 @@ int main(int argc, char *argv[])
|
||||
printAllSets(mesh, Info);
|
||||
|
||||
// Read history if interactive
|
||||
# if READLINE != 0
|
||||
# ifdef HAS_READLINE
|
||||
if (!batch && !read_history(historyFile))
|
||||
{
|
||||
Info<< "Successfully read history from " << historyFile << endl;
|
||||
@ -949,7 +930,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
# if READLINE != 0
|
||||
# ifdef HAS_READLINE
|
||||
{
|
||||
char* linePtr = readline("readline>");
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
autoPtr<hCombustionThermo> thermo
|
||||
autoPtr<basicPsiThermo> thermo
|
||||
(
|
||||
hCombustionThermo::New(mesh)
|
||||
basicPsiThermo::New(mesh)
|
||||
);
|
||||
|
||||
const volScalarField& h = thermo->h();
|
||||
|
||||
@ -52,6 +52,10 @@ USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
# We want to do nice exit when running paraview to give paraview opportunity
|
||||
# to clean up
|
||||
unset FOAM_ABORT
|
||||
|
||||
unset regionName touchOpt
|
||||
|
||||
# reader extension
|
||||
|
||||
@ -1,17 +1,20 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
unset COMP_FLAGS LINK_FLAGS
|
||||
|
||||
#
|
||||
# use <sys/inotify.h> if available (Linux)
|
||||
# unless otherwise specified (with FOAM_USE_STAT)
|
||||
# unless otherwise specified (with USE_STAT)
|
||||
#
|
||||
# eg, ./Allwmake FOAM_USE_STAT
|
||||
# eg, ./Allwmake USE_STAT
|
||||
#
|
||||
if [ -f /usr/include/sys/inotify.h -a "${1%USE_STAT}" = "$1" ]
|
||||
then
|
||||
unset FOAM_FILE_MONITOR
|
||||
echo "Found <sys/inotify.h> -- using inotify for file monitoring."
|
||||
unset COMP_FLAGS
|
||||
else
|
||||
export FOAM_FILE_MONITOR="-DFOAM_USE_STAT"
|
||||
export COMP_FLAGS="-DFOAM_USE_STAT"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
EXE_INC = $(FOAM_FILE_MONITOR)
|
||||
EXE_INC = $(COMP_FLAGS)
|
||||
|
||||
@ -207,6 +207,10 @@ public:
|
||||
//- Assignment from UList
|
||||
inline void operator=(const UList<T>&);
|
||||
|
||||
//- Assignment from UIndirectList
|
||||
inline void operator=(const UIndirectList<T>&);
|
||||
|
||||
|
||||
|
||||
// IOstream operators
|
||||
|
||||
|
||||
@ -406,29 +406,6 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
(
|
||||
const UList<T>& lst
|
||||
)
|
||||
{
|
||||
if (capacity_ >= lst.size())
|
||||
{
|
||||
// can copy w/o reallocating, match initial size to avoid reallocation
|
||||
List<T>::size(lst.size());
|
||||
List<T>::operator=(lst);
|
||||
}
|
||||
else
|
||||
{
|
||||
// make everything available for the copy operation
|
||||
List<T>::size(capacity_);
|
||||
|
||||
List<T>::operator=(lst);
|
||||
capacity_ = List<T>::size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
(
|
||||
@ -461,4 +438,49 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
(
|
||||
const UList<T>& lst
|
||||
)
|
||||
{
|
||||
if (capacity_ >= lst.size())
|
||||
{
|
||||
// can copy w/o reallocating, match initial size to avoid reallocation
|
||||
List<T>::size(lst.size());
|
||||
List<T>::operator=(lst);
|
||||
}
|
||||
else
|
||||
{
|
||||
// make everything available for the copy operation
|
||||
List<T>::size(capacity_);
|
||||
|
||||
List<T>::operator=(lst);
|
||||
capacity_ = List<T>::size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
(
|
||||
const UIndirectList<T>& lst
|
||||
)
|
||||
{
|
||||
if (capacity_ >= lst.size())
|
||||
{
|
||||
// can copy w/o reallocating, match initial size to avoid reallocation
|
||||
List<T>::size(lst.size());
|
||||
List<T>::operator=(lst);
|
||||
}
|
||||
else
|
||||
{
|
||||
// make everything available for the copy operation
|
||||
List<T>::size(capacity_);
|
||||
|
||||
List<T>::operator=(lst);
|
||||
capacity_ = List<T>::size();
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -91,8 +91,10 @@ public:
|
||||
//- Return the last element of the list.
|
||||
inline const T& last() const;
|
||||
|
||||
|
||||
//- Return the complete list
|
||||
inline const UList<T>& completeList() const;
|
||||
|
||||
//- Return the list addressing
|
||||
inline const List<label>& addressing() const;
|
||||
|
||||
|
||||
|
||||
@ -36,7 +36,8 @@ Foam::IOField<Type>::IOField(const IOobject& io)
|
||||
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
|
||||
{
|
||||
WarningIn("IOField::IOField(const IOobject&)")
|
||||
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
<< "IOField " << name()
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOField does not support automatic rereading."
|
||||
<< endl;
|
||||
}
|
||||
@ -65,7 +66,8 @@ Foam::IOField<Type>::IOField(const IOobject& io, const label size)
|
||||
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
|
||||
{
|
||||
WarningIn("IOField::IOField(const IOobject&, const label)")
|
||||
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
<< "IOField " << name()
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOField does not support automatic rereading."
|
||||
<< endl;
|
||||
}
|
||||
@ -98,7 +100,8 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Field<Type>& f)
|
||||
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
|
||||
{
|
||||
WarningIn("IOField::IOField(const IOobject&, const Field<Type>&)")
|
||||
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
<< "IOField " << name()
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOField does not support automatic rereading."
|
||||
<< endl;
|
||||
}
|
||||
@ -133,7 +136,8 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Xfer<Field<Type> >& f)
|
||||
WarningIn
|
||||
(
|
||||
"IOField::IOField(const IOobject&, const Xfer<Field<Type> >&)"
|
||||
) << "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
) << "IOField " << name()
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOField does not support automatic rereading."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -36,8 +36,9 @@ Foam::IOList<T>::IOList(const IOobject& io)
|
||||
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
|
||||
{
|
||||
WarningIn("IOList::IOList(const IOobject&)")
|
||||
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOField does not support automatic rereading."
|
||||
<< "IOList " << name()
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOList does not support automatic rereading."
|
||||
<< endl;
|
||||
}
|
||||
if
|
||||
@ -64,8 +65,9 @@ Foam::IOList<T>::IOList(const IOobject& io, const label size)
|
||||
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
|
||||
{
|
||||
WarningIn("IOList::IOList(const IOobject&, const label)")
|
||||
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOField does not support automatic rereading."
|
||||
<< "IOList " << name()
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOList does not support automatic rereading."
|
||||
<< endl;
|
||||
}
|
||||
if
|
||||
@ -96,8 +98,9 @@ Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list)
|
||||
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
|
||||
{
|
||||
WarningIn("IOList::IOList(const IOobject&, const List<T>&)")
|
||||
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOField does not support automatic rereading."
|
||||
<< "IOList " << name()
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOList does not support automatic rereading."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -131,8 +134,9 @@ Foam::IOList<T>::IOList(const IOobject& io, const Xfer<List<T> >& list)
|
||||
WarningIn
|
||||
(
|
||||
"IOList::IOList(const IOobject&, const Xfer<List<T> >&)"
|
||||
) << "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOField does not support automatic rereading."
|
||||
) << "IOList " << name()
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but IOList does not support automatic rereading."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,8 @@ Foam::IOdictionary::IOdictionary(const IOobject& io)
|
||||
{
|
||||
WarningIn("IOdictionary::IOdictionary(const IOobject&)")
|
||||
//FatalErrorIn("IOdictionary::IOdictionary(const IOobject&)")
|
||||
<< "Dictionary constructed with IOobject::MUST_READ"
|
||||
<< "Dictionary " << name()
|
||||
<< " constructed with IOobject::MUST_READ"
|
||||
" instead of IOobject::MUST_READ_IF_MODIFIED." << nl
|
||||
<< "Use MUST_READ_IF_MODIFIED if you need automatic rereading."
|
||||
<< endl;
|
||||
@ -82,7 +83,8 @@ Foam::IOdictionary::IOdictionary(const IOobject& io, const dictionary& dict)
|
||||
WarningIn
|
||||
(
|
||||
"IOdictionary::IOdictionary(const IOobject& const dictionary&)"
|
||||
) << "Dictionary constructed with IOobject::MUST_READ"
|
||||
) << "Dictionary " << name()
|
||||
<< " constructed with IOobject::MUST_READ"
|
||||
" instead of IOobject::MUST_READ_IF_MODIFIED." << nl
|
||||
<< "Use MUST_READ_IF_MODIFIED if you need automatic rereading."
|
||||
<< endl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,7 +23,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -239,7 +238,9 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable()
|
||||
template<class Type>
|
||||
Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
|
||||
(
|
||||
const fileName& fn, const word& instance, const fvMesh& mesh
|
||||
const fileName& fn,
|
||||
const word& instance,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
List<scalarField>(),
|
||||
@ -357,11 +358,11 @@ void Foam::interpolationLookUpTable<Type>::write
|
||||
|
||||
control.writeHeader(os);
|
||||
|
||||
os.writeKeyword("fields");
|
||||
os << entries_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("fields")
|
||||
<< entries_ << token::END_STATEMENT << nl;
|
||||
|
||||
os.writeKeyword("output");
|
||||
os << output_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("output")
|
||||
<< output_ << token::END_STATEMENT << nl;
|
||||
|
||||
if (this->size() == 0)
|
||||
{
|
||||
@ -370,8 +371,8 @@ void Foam::interpolationLookUpTable<Type>::write
|
||||
"Foam::interpolationTable<Type>::write()"
|
||||
) << "table is empty" << nl << exit(FatalError);
|
||||
}
|
||||
os.writeKeyword("values");
|
||||
os << *this << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("values")
|
||||
<< *this << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
@ -381,8 +382,7 @@ template<class Type>
|
||||
Foam::scalarField&
|
||||
Foam::interpolationLookUpTable<Type>::operator[](const label i)
|
||||
{
|
||||
label ii = i;
|
||||
label n = this->size();
|
||||
const label n = this->size();
|
||||
|
||||
if (n <= 1)
|
||||
{
|
||||
@ -391,22 +391,22 @@ Foam::interpolationLookUpTable<Type>::operator[](const label i)
|
||||
"Foam::interpolationLookUpTable<Type>::operator[](const label)"
|
||||
) << "table has (" << n << ") columns" << nl << exit(FatalError);
|
||||
}
|
||||
else if (ii < 0)
|
||||
else if (i < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::interpolationLookUpTable<Type>::operator[](const label)"
|
||||
) << "index (" << ii << ") underflow" << nl << exit(FatalError);
|
||||
) << "index (" << i << ") underflow" << nl << exit(FatalError);
|
||||
}
|
||||
else if (ii > n)
|
||||
else if (i >= n)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::interpolationLookUpTable<Type>::operator[](const label)"
|
||||
) << "index (" << ii << ") overflow" << nl << exit(FatalError);
|
||||
) << "index (" << i << ") overflow" << nl << exit(FatalError);
|
||||
}
|
||||
|
||||
return List<scalarField>::operator[](ii);
|
||||
return List<scalarField>::operator[](i);
|
||||
}
|
||||
|
||||
|
||||
@ -414,8 +414,7 @@ template<class Type>
|
||||
const Foam::scalarField&
|
||||
Foam::interpolationLookUpTable<Type>::operator[](const label i) const
|
||||
{
|
||||
label ii = i;
|
||||
label n = this->size();
|
||||
const label n = this->size();
|
||||
|
||||
if (n <= 1)
|
||||
{
|
||||
@ -425,26 +424,25 @@ Foam::interpolationLookUpTable<Type>::operator[](const label i) const
|
||||
"(const label) const"
|
||||
) << "table has (" << n << ") columns" << nl << exit(FatalError);
|
||||
}
|
||||
else if (ii < 0)
|
||||
else if (i < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::interpolationLookUpTable<Type>::operator[]"
|
||||
"(const label) const"
|
||||
) << "index (" << ii << ") underflow" << nl << exit(FatalError);
|
||||
) << "index (" << i << ") underflow" << nl << exit(FatalError);
|
||||
}
|
||||
|
||||
else if (ii > n)
|
||||
else if (i >= n)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::interpolationLookUpTable<Type>::operator[]"
|
||||
"(const label) const"
|
||||
) << "index (" << ii << ") overflow" << nl
|
||||
) << "index (" << i << ") overflow" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return List<scalarField>::operator[](ii);
|
||||
return List<scalarField>::operator[](i);
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ class interpolationLookUpTable
|
||||
{
|
||||
private:
|
||||
|
||||
// Privsate data
|
||||
// Private data
|
||||
|
||||
//- File name
|
||||
fileName fileName_;
|
||||
@ -88,10 +88,10 @@ private:
|
||||
//- Output dictionaries
|
||||
List<dictionary> output_;
|
||||
|
||||
//- Input indices from the look up table
|
||||
//- Input indices from the lookup table
|
||||
List<label> entryIndices_;
|
||||
|
||||
//- Output Indeces from the Look Up Table
|
||||
//- Output indices from the lookup Table
|
||||
List<label> outputIndices_;
|
||||
|
||||
//- Field names and indices
|
||||
@ -118,7 +118,7 @@ private:
|
||||
//- Check range of lookup value
|
||||
bool checkRange(const scalar, const label) const;
|
||||
|
||||
//- Interpolate function return an scalar
|
||||
//- Interpolate function returning a scalar
|
||||
scalar interpolate
|
||||
(
|
||||
const label lo,
|
||||
@ -159,13 +159,13 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return true if the filed exists in the table
|
||||
//- Return true if the field exists in the table
|
||||
bool found(const word& fieldName) const;
|
||||
|
||||
//- Return the output list given a single input scalar
|
||||
const List<scalar>& lookUp(const scalar);
|
||||
|
||||
//- Write Look Up Table to filename.
|
||||
//- Write lookup table to filename.
|
||||
void write
|
||||
(
|
||||
Ostream&,
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -65,8 +65,8 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
|
||||
dict.lookup("data") >> *this;
|
||||
dict.lookup("x0") >> x0_;
|
||||
dict.lookup("dx") >> dx_;
|
||||
dict.lookup("log10") >> log10_;
|
||||
dict.lookup("bound") >> bound_;
|
||||
dict.readIfPresent("log10", log10_);
|
||||
dict.readIfPresent("bound", bound_);
|
||||
}
|
||||
|
||||
checkTable();
|
||||
@ -94,13 +94,13 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
|
||||
List<scalar>(2, 0.0),
|
||||
x0_(readScalar(dict.lookup("x0"))),
|
||||
dx_(readScalar(dict.lookup("dx"))),
|
||||
log10_(dict.lookup("log10")),
|
||||
bound_(dict.lookup("bound"))
|
||||
log10_(dict.lookupOrDefault<Switch>("log10", false)),
|
||||
bound_(dict.lookupOrDefault<Switch>("bound", false))
|
||||
{
|
||||
if (initialiseOnly)
|
||||
{
|
||||
scalar xMax = readScalar(dict.lookup("xMax"));
|
||||
label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1;
|
||||
const scalar xMax = readScalar(dict.lookup("xMax"));
|
||||
const label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1;
|
||||
this->setSize(nIntervals);
|
||||
}
|
||||
else
|
||||
@ -168,9 +168,9 @@ Type Foam::uniformInterpolationTable<Type>::interpolate(scalar x) const
|
||||
}
|
||||
}
|
||||
|
||||
label i = static_cast<label>((x - x0_)/dx_);
|
||||
const label i = static_cast<label>((x - x0_)/dx_);
|
||||
|
||||
scalar xLo = x0_ + i*dx_;
|
||||
const scalar xLo = x0_ + i*dx_;
|
||||
|
||||
Type fx = (x - xLo)/dx_*(operator[](i+1) - operator[](i)) + operator[](i);
|
||||
|
||||
@ -225,8 +225,14 @@ void Foam::uniformInterpolationTable<Type>::write() const
|
||||
dict.add("data", static_cast<const List<scalar>&>(*this));
|
||||
dict.add("x0", x0_);
|
||||
dict.add("dx", dx_);
|
||||
if (log10_)
|
||||
{
|
||||
dict.add("log10", log10_);
|
||||
}
|
||||
if (bound_)
|
||||
{
|
||||
dict.add("bound", bound_);
|
||||
}
|
||||
|
||||
dict.regIOobject::write();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,8 +28,9 @@ Description
|
||||
Table with uniform interval in independant variable, with linear
|
||||
interpolation
|
||||
|
||||
Example usage (scalar): values specified in a dictionary:
|
||||
Example usage (scalar): values specified within a dictionary:
|
||||
|
||||
@verbatim
|
||||
{
|
||||
x0 0; // lower limit
|
||||
dx 0.2; // fixed interval
|
||||
@ -42,6 +43,7 @@ Description
|
||||
7870 // value at x0 + n*dx
|
||||
);
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
SourceFiles
|
||||
uniformInterpolationTable.C
|
||||
@ -73,7 +75,7 @@ class uniformInterpolationTable
|
||||
{
|
||||
// Private data
|
||||
|
||||
// Control parameetrs
|
||||
// Control parameters
|
||||
|
||||
//- Lower limit
|
||||
scalar x0_;
|
||||
@ -81,7 +83,7 @@ class uniformInterpolationTable
|
||||
//- Fixed interval
|
||||
scalar dx_;
|
||||
|
||||
//- Flag to indicate that x data is given in log10(x) form
|
||||
//- Flag to indicate that x data are given in log10(x) form
|
||||
Switch log10_;
|
||||
|
||||
//- Bound x values
|
||||
@ -101,9 +103,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject and readFields flag. Creates a null object
|
||||
// if readFields = false
|
||||
uniformInterpolationTable(const IOobject& io, const bool readFields);
|
||||
//- Construct from IOobject and readFields flag.
|
||||
// Creates a null object if readFields = false
|
||||
uniformInterpolationTable(const IOobject&, const bool readFields);
|
||||
|
||||
//- Construct from name, objectRegistry and dictionary.
|
||||
// If initialiseOnly flag is set, control parameters are read from
|
||||
@ -111,13 +113,13 @@ public:
|
||||
uniformInterpolationTable
|
||||
(
|
||||
const word& tableName,
|
||||
const objectRegistry& db,
|
||||
const dictionary& dict,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool initialiseOnly = false
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
uniformInterpolationTable(const uniformInterpolationTable& uit);
|
||||
uniformInterpolationTable(const uniformInterpolationTable&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -174,22 +176,10 @@ public:
|
||||
// Override ancestor size() function and [] operator
|
||||
|
||||
//- Return the size of the table
|
||||
label size() const
|
||||
{
|
||||
return List<Type>::size();
|
||||
}
|
||||
using List<Type>::size;
|
||||
|
||||
//- Use List[] operator for read access
|
||||
Type operator[](label x) const
|
||||
{
|
||||
return List<Type>::operator[](x);
|
||||
}
|
||||
|
||||
//- Use List[] operator for write access
|
||||
Type& operator[](label x)
|
||||
{
|
||||
return List<Type>::operator[](x);
|
||||
}
|
||||
//- Use List[] operator for read/write access
|
||||
using List<Type>::operator[];
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,6 +38,12 @@ const Scalar pTraits<Scalar>::max = ScalarVGREAT;
|
||||
|
||||
const char* pTraits<Scalar>::componentNames[] = { "x" };
|
||||
|
||||
pTraits<Scalar>::pTraits(const Scalar& p)
|
||||
:
|
||||
p_(p)
|
||||
{}
|
||||
|
||||
|
||||
pTraits<Scalar>::pTraits(Istream& is)
|
||||
{
|
||||
is >> p_;
|
||||
|
||||
@ -65,6 +65,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from primitive
|
||||
explicit pTraits(const Scalar&);
|
||||
|
||||
//- Construct from Istream
|
||||
pTraits(Istream&);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,11 +28,17 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::pTraits<bool>::typeName = "bool";
|
||||
const bool Foam::pTraits<bool>::zero(false);
|
||||
const bool Foam::pTraits<bool>::one(true);
|
||||
const bool Foam::pTraits<bool>::zero = false;
|
||||
const bool Foam::pTraits<bool>::one = true;
|
||||
|
||||
const char* Foam::pTraits<bool>::componentNames[] = { "x" };
|
||||
|
||||
Foam::pTraits<bool>::pTraits(const bool& p)
|
||||
:
|
||||
p_(p)
|
||||
{}
|
||||
|
||||
|
||||
Foam::pTraits<bool>::pTraits(Istream& is)
|
||||
{
|
||||
is >> p_;
|
||||
|
||||
@ -91,6 +91,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from primitive
|
||||
explicit pTraits(const bool&);
|
||||
|
||||
//- Construct from Istream
|
||||
pTraits(Istream&);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,6 +41,12 @@ const label pTraits<label>::max = labelMax;
|
||||
|
||||
const char* pTraits<label>::componentNames[] = { "x" };
|
||||
|
||||
pTraits<label>::pTraits(const label& p)
|
||||
:
|
||||
p_(p)
|
||||
{}
|
||||
|
||||
|
||||
pTraits<label>::pTraits(Istream& is)
|
||||
{
|
||||
is >> p_;
|
||||
|
||||
@ -165,6 +165,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from primitive
|
||||
explicit pTraits(const label&);
|
||||
|
||||
//- Construct from Istream
|
||||
pTraits(Istream&);
|
||||
|
||||
|
||||
@ -41,6 +41,12 @@ const uLabel pTraits<uLabel>::max = uLabelMax;
|
||||
|
||||
const char* pTraits<uLabel>::componentNames[] = { "x" };
|
||||
|
||||
pTraits<uLabel>::pTraits(const uLabel& p)
|
||||
:
|
||||
p_(p)
|
||||
{}
|
||||
|
||||
|
||||
pTraits<uLabel>::pTraits(Istream& is)
|
||||
{
|
||||
is >> p_;
|
||||
|
||||
@ -149,6 +149,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from primitive
|
||||
explicit pTraits(const uLabel&);
|
||||
|
||||
//- Construct from Istream
|
||||
pTraits(Istream&);
|
||||
|
||||
|
||||
@ -55,11 +55,13 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from primitive
|
||||
pTraits(const PrimitiveType& p)
|
||||
:
|
||||
PrimitiveType(p)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
pTraits(Istream& is)
|
||||
:
|
||||
PrimitiveType(is)
|
||||
@ -68,11 +70,13 @@ public:
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Access to the primitive
|
||||
operator PrimitiveType() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Access to the primitive
|
||||
operator PrimitiveType&()
|
||||
{
|
||||
return *this;
|
||||
|
||||
@ -157,6 +157,8 @@ $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
|
||||
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
|
||||
|
||||
|
||||
fvsPatchFields = fields/fvsPatchFields
|
||||
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
||||
@ -354,4 +356,13 @@ fieldSources = $(general)/fieldSources
|
||||
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
|
||||
$(fieldSources)/timeActivatedExplicitSource/timeActivatedExplicitSource.C
|
||||
|
||||
basicSource = $(general)/fieldSources/basicSource
|
||||
$(basicSource)/basicSource/basicSource.C
|
||||
$(basicSource)/basicSource/basicSourceIO.C
|
||||
$(basicSource)/basicSource/basicSourceList.C
|
||||
$(basicSource)/basicSource/IObasicSourceList.C
|
||||
$(basicSource)/actuationDiskSource/actuationDiskSource.C
|
||||
$(basicSource)/explicitSource/explicitSource.C
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfiniteVolume
|
||||
|
||||
@ -3,5 +3,6 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lOpenFOAM \
|
||||
-ltriSurface \
|
||||
-lmeshTools
|
||||
|
||||
@ -0,0 +1,193 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "actuationDiskSource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "geometricOneField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(actuationDiskSource, 0);
|
||||
addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::actuationDiskSource::checkData()
|
||||
{
|
||||
if (magSqr(diskArea_) <= VSMALL)
|
||||
{
|
||||
FatalErrorIn("Foam::actuationDiskSource::checkData()")
|
||||
<< "diskArea is approximately zero"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
if (Cp_ <= VSMALL || Ct_ <= VSMALL)
|
||||
{
|
||||
FatalErrorIn("Foam::actuationDiskSource::checkData()")
|
||||
<< "Cp and Ct must be greater than zero"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
if (mag(diskDir_) < VSMALL)
|
||||
{
|
||||
FatalErrorIn("Foam::actuationDiskSource::checkData()")
|
||||
<< "disk direction vector is approximately zero"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::actuationDiskSource::actuationDiskSource
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
basicSource(name, dict, mesh),
|
||||
cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())),
|
||||
dict_(dict.subDict(typeName + "Coeffs")),
|
||||
diskDir_(dict_.lookup("diskDir")),
|
||||
Cp_(readScalar(dict_.lookup("Cp"))),
|
||||
Ct_(readScalar(dict_.lookup("Ct"))),
|
||||
diskArea_(readScalar(dict_.lookup("diskArea")))
|
||||
{
|
||||
Info<< " - creating actuation disk zone: "
|
||||
<< this->name() << endl;
|
||||
|
||||
bool foundZone = (cellZoneID_ != -1);
|
||||
|
||||
reduce(foundZone, orOp<bool>());
|
||||
|
||||
if (!foundZone && Pstream::master())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::actuationDiskSource::actuationDiskSource"
|
||||
"(const word&, const dictionary&, const fvMesh&)"
|
||||
) << "cannot find porous cellZone " << this->name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
checkData();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
||||
{
|
||||
if (cellZoneID_ == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool compressible = false;
|
||||
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
|
||||
{
|
||||
compressible = true;
|
||||
}
|
||||
|
||||
const labelList& cells = mesh_.cellZones()[cellZoneID_];
|
||||
const scalarField& V = this->mesh().V();
|
||||
vectorField& Usource = UEqn.source();
|
||||
const vectorField& U = UEqn.psi();
|
||||
|
||||
if (compressible)
|
||||
{
|
||||
addActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells,
|
||||
V,
|
||||
this->mesh().lookupObject<volScalarField>("rho"),
|
||||
U
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
addActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells,
|
||||
V,
|
||||
geometricOneField(),
|
||||
U
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::actuationDiskSource::writeData(Ostream& os) const
|
||||
{
|
||||
|
||||
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;
|
||||
|
||||
if (dict_.found("note"))
|
||||
{
|
||||
os.writeKeyword("note") << string(dict_.lookup("note"))
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
os << indent << "actuationDisk";
|
||||
|
||||
dict_.write(os);
|
||||
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::actuationDiskSource::read(const dictionary& dict)
|
||||
{
|
||||
if (basicSource::read(dict))
|
||||
{
|
||||
const dictionary& sourceDict = dict.subDict(name());
|
||||
const dictionary& subDictCoeffs =
|
||||
sourceDict.subDict(typeName + "Coeffs");
|
||||
subDictCoeffs.readIfPresent("diskDir", diskDir_);
|
||||
subDictCoeffs.readIfPresent("Cp", Cp_);
|
||||
subDictCoeffs.readIfPresent("Ct", Ct_);
|
||||
subDictCoeffs.readIfPresent("diskArea", diskArea_);
|
||||
|
||||
checkData();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,215 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::actuationDiskSource
|
||||
|
||||
Description
|
||||
Actuation disk zone definition.
|
||||
Constant values for momentum source for actuation disk
|
||||
|
||||
T = 2*rho*A*sqr(Uo)*a*(1-a)
|
||||
U1 = (1 -a)Uo
|
||||
where:
|
||||
A: disk area
|
||||
Uo: upstream velocity
|
||||
a: 1 - Cp/Ct
|
||||
U1: velocity at the disk
|
||||
|
||||
SourceFiles
|
||||
actuationDiskSource.C
|
||||
actuationDiskSourceTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef actuationDiskSource_H
|
||||
#define actuationDiskSource_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "coordinateSystem.H"
|
||||
#include "coordinateSystems.H"
|
||||
#include "wordList.H"
|
||||
#include "labelList.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
#include "basicSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class actuationDiskSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class actuationDiskSource
|
||||
:
|
||||
public basicSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Cell zone ID
|
||||
label cellZoneID_;
|
||||
|
||||
//- Sub dictionary with actuationDisk information
|
||||
const dictionary& dict_;
|
||||
|
||||
//- Disk area normal
|
||||
vector diskDir_;
|
||||
|
||||
//- Power coefficient
|
||||
scalar Cp_;
|
||||
|
||||
//- Thrust coefficient
|
||||
scalar Ct_;
|
||||
|
||||
//- Disk area
|
||||
scalar diskArea_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Check data
|
||||
void checkData();
|
||||
|
||||
//- Add resistance to the UEqn
|
||||
template<class RhoFieldType>
|
||||
void addActuationDiskAxialInertialResistance
|
||||
(
|
||||
vectorField& Usource,
|
||||
const labelList& cells,
|
||||
const scalarField& V,
|
||||
const RhoFieldType& rho,
|
||||
const vectorField& U
|
||||
) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
actuationDiskSource(const actuationDiskSource&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const actuationDiskSource&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("actuationDiskSource");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
actuationDiskSource
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~actuationDiskSource()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- cellZone number
|
||||
label zoneId() const
|
||||
{
|
||||
return cellZoneID_;
|
||||
}
|
||||
|
||||
//- Return Cp
|
||||
scalar Cp() const
|
||||
{
|
||||
return Cp_;
|
||||
}
|
||||
|
||||
//- Return Ct
|
||||
scalar Ct() const
|
||||
{
|
||||
return Ct_;
|
||||
}
|
||||
|
||||
//- Normal disk direction
|
||||
const vector& diskDir() const
|
||||
{
|
||||
return diskDir_;
|
||||
}
|
||||
|
||||
//- Disk area
|
||||
scalar diskArea() const
|
||||
{
|
||||
return diskArea_;
|
||||
}
|
||||
|
||||
|
||||
// Public Functions
|
||||
|
||||
//-Source term to fvMatrix<vector>
|
||||
virtual void addSu(fvMatrix<vector>& UEqn);
|
||||
|
||||
//-Source term to fvMatrix<scalar>
|
||||
virtual void addSu(fvMatrix<scalar>& UEqn){}
|
||||
|
||||
//- Add all explicit source
|
||||
virtual void addExplicitSources(){}
|
||||
|
||||
//- Add source to scalar field
|
||||
virtual void addSu(DimensionedField<scalar, volMesh>& field){}
|
||||
|
||||
//- Add source to vector field
|
||||
virtual void addSu(DimensionedField<vector, volMesh>& field){}
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "actuationDiskSourceTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "actuationDiskSource.H"
|
||||
#include "volFields.H"
|
||||
#include "fvMatrix.H"
|
||||
#include "fvm.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class RhoFieldType>
|
||||
void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
|
||||
(
|
||||
vectorField& Usource,
|
||||
const labelList& cells,
|
||||
const scalarField& V,
|
||||
const RhoFieldType& rho,
|
||||
const vectorField& U
|
||||
) const
|
||||
{
|
||||
scalar a = 1.0 - Cp_/Ct_;
|
||||
scalar totVol = 0.0;
|
||||
scalarField T(cells.size());
|
||||
vector uniDiskDir = diskDir_/mag(diskDir_);
|
||||
tensor E(tensor::zero);
|
||||
E.xx() = uniDiskDir.x();
|
||||
E.yy() = uniDiskDir.y();
|
||||
E.zz() = uniDiskDir.z();
|
||||
vectorField U1 = (1.0 - a)*U;
|
||||
forAll(cells, i)
|
||||
{
|
||||
totVol += V[cells[i]];
|
||||
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a);
|
||||
}
|
||||
forAll(cells, i)
|
||||
{
|
||||
Usource[cells[i]] += ((V[cells[i]]/totVol)*T[i]*E) & U1[cells[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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 "IObasicSourceList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::IObasicSourceList::IObasicSourceList
|
||||
(
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sourcesProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
basicSourceList(mesh, *this)
|
||||
{}
|
||||
|
||||
|
||||
bool Foam::IObasicSourceList::read()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
{
|
||||
basicSourceList::read(*this);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -21,55 +21,73 @@ License
|
||||
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::IObasicSourceList
|
||||
|
||||
Description
|
||||
IObasicSourceList
|
||||
|
||||
SourceFiles
|
||||
IObasicSourceList.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
#ifndef IObasicSourceList_H
|
||||
#define IObasicSourceList_H
|
||||
|
||||
#include "dispersionModel.H"
|
||||
#include "noDispersion.H"
|
||||
#include "basicSourceList.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IObasicSourceList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
autoPtr<dispersionModel> dispersionModel::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm
|
||||
)
|
||||
class IObasicSourceList
|
||||
:
|
||||
public IOdictionary,
|
||||
public basicSourceList
|
||||
{
|
||||
word dispersionModelType
|
||||
(
|
||||
dict.lookup("dispersionModel")
|
||||
);
|
||||
private:
|
||||
|
||||
Info<< "Selecting dispersionModel "
|
||||
<< dispersionModelType << endl;
|
||||
// Private Member Functions
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(dispersionModelType);
|
||||
//- Disallow default bitwise copy construct
|
||||
IObasicSourceList(const IObasicSourceList&);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalError
|
||||
<< "dispersionModel::New(const dictionary&, const spray&) : "
|
||||
<< endl
|
||||
<< " unknown dispersionModelType type "
|
||||
<< dispersionModelType
|
||||
<< ", constructor not in hash table" << endl << endl
|
||||
<< " Valid dispersionModel types are :" << endl;
|
||||
Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError);
|
||||
}
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const IObasicSourceList&);
|
||||
|
||||
return autoPtr<dispersionModel>(cstrIter()(dict, sm));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components with list of field names
|
||||
IObasicSourceList(const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~IObasicSourceList()
|
||||
{}
|
||||
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,283 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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 "basicSource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(basicSource, 0);
|
||||
defineRunTimeSelectionTable(basicSource, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::wordList Foam::basicSource::selectionModeTypeNames_
|
||||
(
|
||||
IStringStream("(points cellSet cellZone all)")()
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::basicSource::selectionModeType Foam::basicSource::wordToSelectionModeType
|
||||
(
|
||||
const word& smtName
|
||||
) const
|
||||
{
|
||||
forAll(selectionModeTypeNames_, i)
|
||||
{
|
||||
if (smtName == selectionModeTypeNames_[i])
|
||||
{
|
||||
return selectionModeType(i);
|
||||
}
|
||||
}
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
"basicSource::selectionModeType"
|
||||
"basicSource::wordToSelectionModeType"
|
||||
"("
|
||||
"const word&"
|
||||
")"
|
||||
) << "Unknown selectionMode type " << smtName
|
||||
<< ". Valid selectionMode types are:" << nl << selectionModeTypeNames_
|
||||
<< exit(FatalError);
|
||||
|
||||
return selectionModeType(0);
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::basicSource::selectionModeTypeToWord
|
||||
(
|
||||
const selectionModeType& smtType
|
||||
) const
|
||||
{
|
||||
if (smtType > selectionModeTypeNames_.size())
|
||||
{
|
||||
return "UNKNOWN";
|
||||
}
|
||||
else
|
||||
{
|
||||
return selectionModeTypeNames_[smtType];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::setSelection(const dictionary& dict)
|
||||
{
|
||||
switch (selectionMode_)
|
||||
{
|
||||
case smPoints:
|
||||
{
|
||||
// Do nothing. It should be sorted out by derived class
|
||||
break;
|
||||
}
|
||||
case smCellSet:
|
||||
{
|
||||
dict.lookup("cellSet") >> cellSetName_;
|
||||
break;
|
||||
}
|
||||
case smCellZone:
|
||||
{
|
||||
dict.lookup("cellZone") >> cellSetName_;
|
||||
break;
|
||||
}
|
||||
case smAll:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"basicSource::setSelection(const dictionary&)"
|
||||
) << "Unknown selectionMode "
|
||||
<< selectionModeTypeNames_[selectionMode_]
|
||||
<< ". Valid selectionMode types are" << selectionModeTypeNames_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::setCellSet()
|
||||
{
|
||||
Info<< incrIndent << indent << "Source: " << name_ << endl;
|
||||
switch (selectionMode_)
|
||||
{
|
||||
case smPoints:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case smCellSet:
|
||||
{
|
||||
Info<< indent << "- selecting cells using cellSet "
|
||||
<< cellSetName_ << endl;
|
||||
|
||||
cellSet selectedCells(mesh_, cellSetName_);
|
||||
cells_ = selectedCells.toc();
|
||||
|
||||
break;
|
||||
}
|
||||
case smCellZone:
|
||||
{
|
||||
Info<< indent << "- selecting cells using cellZone "
|
||||
<< cellSetName_ << endl;
|
||||
label zoneID = mesh_.cellZones().findZoneID(cellSetName_);
|
||||
if (zoneID == -1)
|
||||
{
|
||||
FatalErrorIn("basicSource<Type>::setCellIds()")
|
||||
<< "Cannot find cellZone " << cellSetName_ << endl
|
||||
<< "Valid cellZones are " << mesh_.cellZones().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
cells_ = mesh_.cellZones()[zoneID];
|
||||
|
||||
break;
|
||||
}
|
||||
case smAll:
|
||||
{
|
||||
Info<< indent << "- selecting all cells" << endl;
|
||||
cells_ = identity(mesh_.nCells());
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("basicSource<Type>::setCellIds()")
|
||||
<< "Unknown selectionMode "
|
||||
<< selectionModeTypeNames_[selectionMode_]
|
||||
<< ". Valid selectionMode types are" << selectionModeTypeNames_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// Set volume information
|
||||
if (selectionMode_ != smPoints)
|
||||
{
|
||||
V_ = 0.0;
|
||||
forAll(cells_, i)
|
||||
{
|
||||
V_ += mesh_.V()[cells_[i]];
|
||||
}
|
||||
reduce(V_, sumOp<scalar>());
|
||||
|
||||
Info<< indent << "- selected "
|
||||
<< returnReduce(cells_.size(), sumOp<label>())
|
||||
<< " cell(s) with volume " << V_ << nl << decrIndent << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::basicSource::basicSource
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
mesh_(mesh),
|
||||
dict_(dict),
|
||||
active_(readBool(dict_.lookup("active"))),
|
||||
timeStart_(readScalar(dict_.lookup("timeStart"))),
|
||||
duration_(readScalar(dict_.lookup("duration"))),
|
||||
selectionMode_(wordToSelectionModeType(dict_.lookup("selectionMode"))),
|
||||
cellSetName_("none"),
|
||||
V_(1.0)
|
||||
{
|
||||
setSelection(dict_);
|
||||
|
||||
setCellSet();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
word typeModel(dict.lookup("typeModel"));
|
||||
|
||||
Info<< "Selecting model type " << typeModel << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(typeModel);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"basicSource::New(const volVectorField&, "
|
||||
"const surfaceScalarField&, transportModel&)"
|
||||
) << "Unknown Model type " << typeModel
|
||||
<< nl << nl
|
||||
<< "Valid model types are :" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<basicSource>(cstrIter()(name, dict, mesh));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::basicSource::isActive()
|
||||
{
|
||||
if
|
||||
(
|
||||
active_
|
||||
&& (mesh_.time().value() >= timeStart_)
|
||||
&& (mesh_.time().value() <= timeEnd())
|
||||
)
|
||||
{
|
||||
// Update the cell set if the mesh is changing
|
||||
if (mesh_.changing())
|
||||
{
|
||||
setCellSet();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,384 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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::basicSource
|
||||
|
||||
Description
|
||||
Basic source abtract class
|
||||
|
||||
Sources described by:
|
||||
|
||||
source1
|
||||
{
|
||||
typeModel actuationDiskSource; // explicitSource
|
||||
active on; // on/off switch
|
||||
timeStart 0.0; // start time
|
||||
duration 1000.0; // duration
|
||||
selectionMode cellSet; // cellSet // points //cellZone
|
||||
cellSet c0; // cellSet name
|
||||
|
||||
actuationDiskSourceCoeffs
|
||||
{
|
||||
diskDir (-1 0 0); // orientation of the disk
|
||||
Cp 0.53; // Cp
|
||||
Ct 0.58; // Ct
|
||||
diskArea 40; // disk area
|
||||
}
|
||||
}
|
||||
|
||||
source2
|
||||
{
|
||||
typeModel explicitSource;
|
||||
active on;
|
||||
timeStart 0.0;
|
||||
duration 1000.0;
|
||||
selectionMode points;
|
||||
cellSet c0;
|
||||
|
||||
explicitSourceCoeffs
|
||||
{
|
||||
points // list of points when selectionMode = points
|
||||
(
|
||||
(-0.088 0.007 -0.02)
|
||||
(-0.028 0.007 -0.02)
|
||||
);
|
||||
volumeMode specific; //absolute
|
||||
fieldData //field data
|
||||
{
|
||||
k 30.7;
|
||||
epsilon 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SourceFiles
|
||||
basicSource.C
|
||||
basicSourceIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef basicSource_H
|
||||
#define basicSource_H
|
||||
|
||||
#include "fvMatrices.H"
|
||||
#include "cellSet.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class basicSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class basicSource
|
||||
{
|
||||
public:
|
||||
|
||||
// Public data
|
||||
|
||||
//- Enumeration for selection mode types
|
||||
enum selectionModeType
|
||||
{
|
||||
smPoints,
|
||||
smCellSet,
|
||||
smCellZone,
|
||||
smAll
|
||||
};
|
||||
|
||||
//- Word list of selection mode type names
|
||||
static const wordList selectionModeTypeNames_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Source name
|
||||
word name_;
|
||||
|
||||
//- Reference to the mesh database
|
||||
const fvMesh& mesh_;
|
||||
|
||||
//- Dictionary containing the data of the source
|
||||
const dictionary& dict_;
|
||||
|
||||
//- Source active flag
|
||||
bool active_;
|
||||
|
||||
//- Time start
|
||||
scalar timeStart_;
|
||||
|
||||
//- Duration
|
||||
scalar duration_;
|
||||
|
||||
//- Cell selection mode
|
||||
selectionModeType selectionMode_;
|
||||
|
||||
//- Name of cell set for "cellSet" and "cellZone" selectionMode
|
||||
word cellSetName_;
|
||||
|
||||
//- Set of cells to apply source to
|
||||
labelList cells_;
|
||||
|
||||
//- Sum of cell volumes
|
||||
scalar V_;
|
||||
|
||||
|
||||
// Protected functions
|
||||
|
||||
//- Helper function to convert from a word to a selectionModeType
|
||||
selectionModeType wordToSelectionModeType(const word& smtName) const;
|
||||
|
||||
//- Helper function to convert from a selectionModeType to a word
|
||||
word selectionModeTypeToWord(const selectionModeType& smtType) const;
|
||||
|
||||
//- Set the cellSet or points selection
|
||||
void setSelection(const dictionary& dict);
|
||||
|
||||
//- Set the cell set based on the user input selection mode
|
||||
void setCellSet();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("basicSource");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
basicSource,
|
||||
dictionary,
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(name, dict, mesh)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
basicSource
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
//- Return clone
|
||||
autoPtr<basicSource> clone() const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"autoPtr<basicSource> clone() const"
|
||||
);
|
||||
return autoPtr<basicSource>(NULL);
|
||||
}
|
||||
|
||||
//- Return pointer to new basicSource object created
|
||||
// on the freestore from an Istream
|
||||
class iNew
|
||||
{
|
||||
//- Reference to the mesh database
|
||||
const fvMesh& mesh_;
|
||||
const word& name_;
|
||||
|
||||
public:
|
||||
|
||||
iNew
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& name
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
name_(name)
|
||||
{}
|
||||
|
||||
autoPtr<basicSource> operator()(Istream& is) const
|
||||
{
|
||||
//const word name(is);
|
||||
const dictionary dict(is);
|
||||
|
||||
return autoPtr<basicSource>
|
||||
(
|
||||
basicSource::New
|
||||
(
|
||||
name_,
|
||||
dict,
|
||||
mesh_
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected basicSource model
|
||||
static autoPtr<basicSource> New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~basicSource()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return const access to the source name
|
||||
inline const word& name() const;
|
||||
|
||||
//- Return const access to the mesh database
|
||||
inline const fvMesh& mesh() const;
|
||||
|
||||
//- Return dictionay
|
||||
inline const dictionary& dictCoeffs() const;
|
||||
|
||||
//- Return const access to the source active flag
|
||||
inline bool active() const;
|
||||
|
||||
//- Return const access to the time start
|
||||
inline scalar timeStart() const;
|
||||
|
||||
//- Return const access to the duration
|
||||
inline scalar duration() const;
|
||||
|
||||
//- Return const access to the time end
|
||||
inline scalar timeEnd() const;
|
||||
|
||||
//- Return const access to the cell selection mode
|
||||
inline const selectionModeType& selectionMode() const;
|
||||
|
||||
//- Return const access to the name of cell set for "cellSet"
|
||||
// selectionMode
|
||||
inline const word& cellSetName() const;
|
||||
|
||||
//- Return const access to the total cell volume
|
||||
inline scalar V() const;
|
||||
|
||||
//- Return const access to the cell set
|
||||
inline const labelList& cells() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Return access to the source name
|
||||
inline word& name();
|
||||
|
||||
//- Return access to the source active flag
|
||||
inline bool& active();
|
||||
|
||||
//- Return access to the time start
|
||||
inline scalar& timeStart();
|
||||
|
||||
//- Return access to the duration
|
||||
inline scalar& duration();
|
||||
|
||||
//- Return access to the cell selection mode
|
||||
inline selectionModeType& selectionMode();
|
||||
|
||||
//- Return access to the list of points for "points" selectionMode
|
||||
inline List<point>& points();
|
||||
|
||||
//- Return access to the name of cell set for "cellSet"
|
||||
// selectionMode
|
||||
inline word& cellSetName();
|
||||
|
||||
//- Return access to the total cell volume
|
||||
inline scalar& V();
|
||||
|
||||
//- Return access to the cell set
|
||||
inline labelList& cells();
|
||||
|
||||
|
||||
// Checks
|
||||
|
||||
//- Is the source active?
|
||||
bool isActive();
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Add all explicit sources
|
||||
virtual void addExplicitSources() = 0;
|
||||
|
||||
//- Add source to scalar field
|
||||
virtual void addSu(DimensionedField<scalar, volMesh>& field) = 0;
|
||||
|
||||
//- Add source to vector field
|
||||
virtual void addSu(DimensionedField<vector, volMesh>& field) = 0;
|
||||
|
||||
//- Add source term to vector fvMatrix
|
||||
virtual void addSu(fvMatrix<vector>& Eqn) = 0;
|
||||
|
||||
//- Add source term to scalar fvMatrix
|
||||
virtual void addSu(fvMatrix<scalar>& Eqn) = 0;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write the source properties
|
||||
virtual void writeData(Ostream&) const = 0;
|
||||
|
||||
//- Read source dictionary
|
||||
virtual bool read(const dictionary& dict) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "basicSourceI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,144 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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 "basicSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::word& Foam::basicSource::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fvMesh& Foam::basicSource::mesh() const
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
inline const Foam::dictionary& Foam::basicSource::dictCoeffs() const
|
||||
{
|
||||
return dict_;
|
||||
}
|
||||
|
||||
inline bool Foam::basicSource::active() const
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::basicSource::timeStart() const
|
||||
{
|
||||
return timeStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::basicSource::duration() const
|
||||
{
|
||||
return duration_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::basicSource::timeEnd() const
|
||||
{
|
||||
return timeStart_ + duration_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::basicSource::selectionModeType&
|
||||
Foam::basicSource::selectionMode() const
|
||||
{
|
||||
return selectionMode_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::word& Foam::basicSource::cellSetName() const
|
||||
{
|
||||
return cellSetName_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::basicSource::V() const
|
||||
{
|
||||
return V_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList& Foam::basicSource::cells() const
|
||||
{
|
||||
return cells_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::word& Foam::basicSource::name()
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
inline bool& Foam::basicSource::active()
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::basicSource::timeStart()
|
||||
{
|
||||
return timeStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::basicSource::duration()
|
||||
{
|
||||
return duration_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::word& Foam::basicSource::cellSetName()
|
||||
{
|
||||
return cellSetName_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::basicSource::selectionModeType&
|
||||
Foam::basicSource::selectionMode()
|
||||
{
|
||||
return selectionMode_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::basicSource::V()
|
||||
{
|
||||
return V_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::labelList& Foam::basicSource::cells()
|
||||
{
|
||||
return cells_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,82 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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 "basicSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::basicSource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << nl
|
||||
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
|
||||
os.writeKeyword("active") << active_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("selectionMode")
|
||||
<< selectionModeTypeToWord(selectionMode_) << nl;
|
||||
|
||||
switch (selectionMode_)
|
||||
{
|
||||
case smPoints:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case smCellSet:
|
||||
{
|
||||
os.writeKeyword("cellSet") << cellSetName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"basicSource::writeData"
|
||||
"("
|
||||
"Ostream&, "
|
||||
"bool"
|
||||
") const"
|
||||
) << "Unknown selectionMode "
|
||||
<< selectionModeTypeToWord(selectionMode_)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::basicSource::read(const dictionary& dict)
|
||||
{
|
||||
const dictionary& sourceDict = dict.subDict(name_);
|
||||
active_ = readBool(sourceDict.lookup("active"));
|
||||
timeStart_ = readScalar(sourceDict.lookup("timeStart"));
|
||||
duration_ = readScalar(sourceDict.lookup("duration"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,182 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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 "basicSourceList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::basicSourceList::basicSourceList
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
PtrList<basicSource>(),
|
||||
mesh_(mesh)
|
||||
{
|
||||
label count = 0;
|
||||
forAllConstIter(dictionary, dict, iter)
|
||||
{
|
||||
// safety:
|
||||
if (iter().isDict())
|
||||
{
|
||||
count ++;
|
||||
}
|
||||
}
|
||||
|
||||
this->setSize(count);
|
||||
label i = 0;
|
||||
forAllConstIter(dictionary, dict, iter)
|
||||
{
|
||||
const word& name = iter().keyword();
|
||||
const dictionary& dict = iter().dict();
|
||||
|
||||
this->set
|
||||
(
|
||||
i++,
|
||||
basicSource::New(name, dict, mesh)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
void Foam::basicSourceList::addSu(fvMatrix<scalar>& Eqn)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
if (this->operator[](i).isActive())
|
||||
{
|
||||
this->operator[](i).addSu(Eqn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSourceList::addSu(fvMatrix<vector>& Eqn)
|
||||
{
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
if (this->operator[](i).isActive())
|
||||
{
|
||||
this->operator[](i).addSu(Eqn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSourceList::addExplicitSources()
|
||||
{
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
if (this->operator[](i).isActive())
|
||||
{
|
||||
this->operator[](i).addExplicitSources();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSourceList::addSu
|
||||
(
|
||||
DimensionedField<scalar, volMesh>& field
|
||||
)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
if (this->operator[](i).isActive())
|
||||
{
|
||||
this->operator[](i).addSu(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSourceList::addSu
|
||||
(
|
||||
DimensionedField<vector, volMesh>& field
|
||||
)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
if (this->operator[](i).isActive())
|
||||
{
|
||||
this->operator[](i).addSu(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::basicSourceList::read(const dictionary& dict)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).read(dict);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::basicSourceList::writeData(Ostream& os) const
|
||||
{
|
||||
// Write size of list
|
||||
os << nl << this->size();
|
||||
|
||||
// Write beginning of contents
|
||||
os << nl << token::BEGIN_LIST;
|
||||
|
||||
// Write list contents
|
||||
forAll(*this, i)
|
||||
{
|
||||
os << nl;
|
||||
this->operator[](i).writeData(os);
|
||||
}
|
||||
|
||||
// Write end of contents
|
||||
os << token::END_LIST << token::END_STATEMENT << nl;
|
||||
|
||||
// Check state of IOstream
|
||||
return os.good();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const basicSourceList& sources
|
||||
)
|
||||
{
|
||||
sources.writeData(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,130 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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::basicsourceList
|
||||
|
||||
Description
|
||||
List of explict sources
|
||||
|
||||
SourceFile
|
||||
basicSourceList.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef basicSourceList_H
|
||||
#define basicSourceList_H
|
||||
|
||||
#include "PtrList.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "basicSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class basicSourceList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class basicSourceList
|
||||
:
|
||||
public PtrList<basicSource>
|
||||
{
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to the mesh database
|
||||
const fvMesh& mesh_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
basicSourceList(const basicSourceList&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const basicSourceList&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components with list of field names
|
||||
basicSourceList(const fvMesh& mesh, const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~basicSourceList()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Add all explicit sources
|
||||
void addExplicitSources();
|
||||
|
||||
//- Add source to scalar field
|
||||
void addSu(DimensionedField<scalar, volMesh>& field);
|
||||
|
||||
//- Add source to vector field
|
||||
void addSu(DimensionedField<vector, volMesh>& field);
|
||||
|
||||
//- Add source terms to scalar fvMatrix
|
||||
void addSu(fvMatrix<scalar>& Eq);
|
||||
|
||||
//- Add source terms to vector fvMatrix
|
||||
void addSu(fvMatrix<vector>& Eq);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Write data to Istream
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
|
||||
//- Ostream operator
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const basicSourceList& sources
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,253 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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 "explicitSource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "HashSet.H"
|
||||
|
||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(explicitSource, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
basicSource,
|
||||
explicitSource,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
const Foam::wordList Foam::explicitSource::volumeModeTypeNames_
|
||||
(
|
||||
IStringStream("(absolute specific)")()
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::explicitSource::setSelectedCellsFromPoints()
|
||||
{
|
||||
labelHashSet selectedCells;
|
||||
|
||||
forAll(points_, i)
|
||||
{
|
||||
label cellI = this->mesh().findCell(points_[i]);
|
||||
if (cellI >= 0)
|
||||
{
|
||||
selectedCells.insert(cellI);
|
||||
}
|
||||
|
||||
label globalCellI = returnReduce(cellI, maxOp<label>());
|
||||
|
||||
if (globalCellI < 0)
|
||||
{
|
||||
WarningIn("explicitSource::setSelectedCellsFromPoints()")
|
||||
<< "Unable to find owner cell for point " << points_[i]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
this->cells() = selectedCells.toc();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::explicitSource::volumeModeType
|
||||
Foam::explicitSource::wordToVolumeModeType
|
||||
(
|
||||
const word& vmtName
|
||||
) const
|
||||
{
|
||||
forAll(volumeModeTypeNames_, i)
|
||||
{
|
||||
if (vmtName == volumeModeTypeNames_[i])
|
||||
{
|
||||
return volumeModeType(i);
|
||||
}
|
||||
}
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
"explicitSource<Type>::volumeModeType"
|
||||
"explicitSource<Type>::wordToVolumeModeType(const word&)"
|
||||
) << "Unknown volumeMode type " << vmtName
|
||||
<< ". Valid volumeMode types are:" << nl << volumeModeTypeNames_
|
||||
<< exit(FatalError);
|
||||
|
||||
return volumeModeType(0);
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::explicitSource::volumeModeTypeToWord
|
||||
(
|
||||
const volumeModeType& vmtType
|
||||
) const
|
||||
{
|
||||
if (vmtType > volumeModeTypeNames_.size())
|
||||
{
|
||||
return "UNKNOWN";
|
||||
}
|
||||
else
|
||||
{
|
||||
return volumeModeTypeNames_[vmtType];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::explicitSource::setFieldData(const dictionary& dict)
|
||||
{
|
||||
scalarFields_.clear();
|
||||
vectorFields_.clear();
|
||||
|
||||
wordList fieldTypes(dict.toc().size());
|
||||
wordList fieldNames(dict.toc().size());
|
||||
|
||||
forAll(dict.toc(), i)
|
||||
{
|
||||
const word& fieldName = dict.toc()[i];
|
||||
IOobject io
|
||||
(
|
||||
fieldName,
|
||||
this->mesh().time().timeName(0),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
if (io.headerOk())
|
||||
{
|
||||
fieldTypes[i] = io.headerClassName();
|
||||
fieldNames[i] = dict.toc()[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"explicitSource::setFieldData"
|
||||
) << "header not OK " << io.name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
addField(scalarFields_, fieldTypes, fieldNames, dict);
|
||||
addField(vectorFields_, fieldTypes, fieldNames, dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::explicitSource::explicitSource
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
basicSource(name, dict, mesh),
|
||||
scalarFields_(0, *this),
|
||||
vectorFields_(0, *this),
|
||||
dict_(dict.subDict(typeName + "Coeffs")),
|
||||
volumeMode_(wordToVolumeModeType(dict_.lookup("volumeMode"))),
|
||||
points_(),
|
||||
volSource_(this->cells().size(), 1.0)
|
||||
{
|
||||
setFieldData(dict_.subDict("fieldData"));
|
||||
|
||||
// Set points if selectionMode is smPoints
|
||||
if (this->selectionMode() == smPoints)
|
||||
{
|
||||
dict_.lookup("points") >> points_;
|
||||
setSelectedCellsFromPoints();
|
||||
volSource_.setSize(points_.size(), 1.0);
|
||||
}
|
||||
|
||||
const labelList& cellList = this->cells();
|
||||
scalar V = 0.0;
|
||||
if (volumeMode_ == vmAbsolute)
|
||||
{
|
||||
forAll(cellList, cellI)
|
||||
{
|
||||
volSource_[cellI] = mesh.V()[cellList[cellI]];
|
||||
V += volSource_[cellI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(cellList, cellI)
|
||||
{
|
||||
V += mesh.V()[cellList[cellI]];
|
||||
}
|
||||
}
|
||||
|
||||
reduce(V, sumOp<scalar>());
|
||||
|
||||
Info<< "- selected " << returnReduce(cellList.size(), sumOp<label>())
|
||||
<< " cell(s) with Volume: " << V << " in time activated sources "
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::explicitSource::addSu(fvMatrix<scalar>& Eqn)
|
||||
{
|
||||
Field<scalar>& source = Eqn.source();
|
||||
scalar data = scalarFields_[Eqn.psi().name()];
|
||||
addSources<scalar>(source, data);
|
||||
}
|
||||
|
||||
|
||||
void Foam::explicitSource::addSu(fvMatrix<vector>& Eqn)
|
||||
{
|
||||
Field<vector>& source = Eqn.source();
|
||||
vector data = vectorFields_[Eqn.psi().name()];
|
||||
addSources<vector>(source, data);
|
||||
}
|
||||
|
||||
|
||||
void Foam::explicitSource::addSu(DimensionedField<scalar, volMesh>& field)
|
||||
{
|
||||
scalar data = scalarFields_[field.name()];
|
||||
addSources<scalar>(field, data);
|
||||
}
|
||||
|
||||
|
||||
void Foam::explicitSource::addSu(DimensionedField<vector, volMesh>& field)
|
||||
{
|
||||
vector data = vectorFields_[field.name()];
|
||||
addSources<vector>(field, data);
|
||||
}
|
||||
|
||||
|
||||
void Foam::explicitSource::addExplicitSources()
|
||||
{
|
||||
scalarFields_.applySources();
|
||||
vectorFields_.applySources();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,295 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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::explicitSource
|
||||
|
||||
Description
|
||||
Explicit source.
|
||||
|
||||
Sources described by:
|
||||
|
||||
explicitSourceCoeffs
|
||||
{
|
||||
points // list of points when selectionMode = points
|
||||
(
|
||||
(-0.088 0.007 -0.02)
|
||||
(-0.028 0.007 -0.02)
|
||||
);
|
||||
volumeMode specific; //absolute
|
||||
fieldData // field data - usage for multiple fields
|
||||
{
|
||||
k 30.7;
|
||||
epsilon 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
SourceFiles
|
||||
explicitSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef explicitSource_H
|
||||
#define explicitSource_H
|
||||
|
||||
#include "cellSet.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "basicSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class explicitSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class explicitSource
|
||||
:
|
||||
public basicSource
|
||||
{
|
||||
// Private classes
|
||||
|
||||
template<class Type>
|
||||
class fieldList
|
||||
:
|
||||
public HashTable<Type>
|
||||
{
|
||||
|
||||
explicitSource& OwnerPtr_;
|
||||
|
||||
public:
|
||||
|
||||
//- null Constructor
|
||||
fieldList()
|
||||
:
|
||||
HashTable<Type>(0),
|
||||
OwnerPtr_()
|
||||
{}
|
||||
|
||||
|
||||
//- Constructor
|
||||
fieldList(label size, explicitSource& ownerPtr)
|
||||
:
|
||||
HashTable<Type>(size),
|
||||
OwnerPtr_(ownerPtr)
|
||||
{}
|
||||
|
||||
|
||||
void applySources()
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh>
|
||||
geometricField;
|
||||
|
||||
forAll(this->toc(), i)
|
||||
{
|
||||
geometricField& field = const_cast<geometricField&>
|
||||
(
|
||||
OwnerPtr_.mesh().lookupObject<geometricField>
|
||||
(this->toc()[i])
|
||||
);
|
||||
|
||||
Type data = this->operator[](field.name());
|
||||
OwnerPtr_.addSources<Type>(field.internalField(), data);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// Private cdata
|
||||
|
||||
//- List of field types
|
||||
fieldList<scalar> scalarFields_;
|
||||
fieldList<vector> vectorFields_;
|
||||
|
||||
//- Add field names and values to field table for types.
|
||||
template<class Type>
|
||||
void addField
|
||||
(
|
||||
HashTable<Type>& fields,
|
||||
const wordList& fieldTypes,
|
||||
const wordList& fieldNames,
|
||||
const dictionary& dict_
|
||||
);
|
||||
|
||||
|
||||
//- Add data to field source
|
||||
template<class Type>
|
||||
void addSources
|
||||
(
|
||||
Field<Type>& fieldSource,
|
||||
Type& data
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// Public data
|
||||
|
||||
//- Enumeration for volume types
|
||||
enum volumeModeType
|
||||
{
|
||||
vmAbsolute,
|
||||
vmSpecific
|
||||
};
|
||||
|
||||
//- Word list of volume mode type names
|
||||
static const wordList volumeModeTypeNames_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Sub dictionary for time activated explicit sources
|
||||
const dictionary& dict_;
|
||||
|
||||
//- Volume mode
|
||||
volumeModeType volumeMode_;
|
||||
|
||||
//- List of points for "points" selectionMode
|
||||
List<point> points_;
|
||||
|
||||
//- Volume of the explicit source
|
||||
scalarList volSource_;
|
||||
|
||||
|
||||
// Protected functions
|
||||
|
||||
//- Helper function to convert from a word to a volumeModeType
|
||||
volumeModeType wordToVolumeModeType(const word& vtName) const;
|
||||
|
||||
//- Helper function to convert from a volumeModeType to a word
|
||||
word volumeModeTypeToWord(const volumeModeType& vtType) const;
|
||||
|
||||
//- Set the local field data
|
||||
void setFieldData(const dictionary& dict);
|
||||
|
||||
//- Set selected cells when smPoint is used
|
||||
void setSelectedCellsFromPoints();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("explicitSource");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
explicitSource
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
//- Return clone
|
||||
autoPtr<explicitSource> clone() const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"autoPtr<explicitSource> clone() const"
|
||||
);
|
||||
return autoPtr<explicitSource>(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return const access to the volume mode
|
||||
inline const volumeModeType& volumeMode() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Return access to the volume mode
|
||||
inline volumeModeType& volumeMode();
|
||||
|
||||
//- Return points
|
||||
inline const List<point>& points() const;
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
//-Source term to fvMatrix<vector>
|
||||
virtual void addSu(fvMatrix<vector>& UEqn);
|
||||
|
||||
//-Source term to fvMatrix<scalar>
|
||||
virtual void addSu(fvMatrix<scalar>& UEqn);
|
||||
|
||||
//- Add all explicit source
|
||||
virtual void addExplicitSources();
|
||||
|
||||
//- Add source to scalar field
|
||||
virtual void addSu(DimensionedField<vector, volMesh>& field);
|
||||
|
||||
//- Add source to vector field
|
||||
virtual void addSu(DimensionedField<scalar, volMesh>& field);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write the source properties
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
//- Read fieldData in sub-dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Ostream operator
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const explicitSource& source
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "explicitSourceIO.C"
|
||||
#include "explicitSourceI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "explicitSourceTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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 "explicitSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::explicitSource::volumeModeType&
|
||||
Foam::explicitSource::volumeMode() const
|
||||
{
|
||||
return volumeMode_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::explicitSource::volumeModeType&
|
||||
Foam::explicitSource::volumeMode()
|
||||
{
|
||||
return volumeMode_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::List<Foam::point>&
|
||||
Foam::explicitSource::points() const
|
||||
{
|
||||
return points_;
|
||||
}
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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 "explicitSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::explicitSource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << nl
|
||||
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
|
||||
os.writeKeyword("volumeMode") << volumeModeTypeToWord(volumeMode_)
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
if (scalarFields_.size() > 0)
|
||||
{
|
||||
os.writeKeyword("scalarFields") << scalarFields_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
if (vectorFields_.size() > 0)
|
||||
{
|
||||
os.writeKeyword("vectorFields") << vectorFields_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::explicitSource::read(const dictionary& dict)
|
||||
{
|
||||
if (basicSource::read(dict))
|
||||
{
|
||||
const dictionary& sourceDict = dict.subDict(name());
|
||||
const dictionary& subDictCoeffs = sourceDict.subDict(typeName + "Coeffs");
|
||||
setFieldData(subDictCoeffs.subDict("fieldData"));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const explicitSource& source)
|
||||
{
|
||||
source.writeData(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
void Foam::explicitSource::addSources
|
||||
(
|
||||
Field<Type>& fieldSource,
|
||||
Type& data
|
||||
) const
|
||||
{
|
||||
forAll(this->cells(), i)
|
||||
{
|
||||
fieldSource[this->cells()[i]] = data/volSource_[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
void Foam::explicitSource::addField
|
||||
(
|
||||
HashTable<Type>& fields,
|
||||
const wordList& fieldTypes,
|
||||
const wordList& fieldNames,
|
||||
const dictionary& fieldDataDict
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> geometricField;
|
||||
|
||||
forAll (fieldTypes, fieldI)
|
||||
{
|
||||
word fieldName = fieldNames[fieldI];
|
||||
word fieldType = fieldTypes[fieldI];
|
||||
|
||||
if
|
||||
(
|
||||
(
|
||||
fieldType
|
||||
== GeometricField<Type, fvPatchField, volMesh>::typeName
|
||||
) &&
|
||||
(
|
||||
this->mesh().foundObject<geometricField>(fieldName)
|
||||
)
|
||||
)
|
||||
{
|
||||
Type fieldValue = fieldDataDict.lookupOrDefault<Type>
|
||||
(
|
||||
fieldName,
|
||||
pTraits<Type>::zero
|
||||
);
|
||||
|
||||
fields.insert(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -73,6 +73,8 @@ Foam::porousZone::porousZone
|
||||
cellZoneID_(mesh_.cellZones().findZoneID(name)),
|
||||
coordSys_(dict, mesh),
|
||||
porosity_(1),
|
||||
intensity_(0),
|
||||
mixingLength_(0),
|
||||
C0_(0),
|
||||
C1_(0),
|
||||
D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero),
|
||||
@ -95,9 +97,11 @@ Foam::porousZone::porousZone
|
||||
|
||||
|
||||
// porosity
|
||||
if (dict_.readIfPresent("porosity", porosity_))
|
||||
{
|
||||
if (porosity_ <= 0.0 || porosity_ > 1.0)
|
||||
if
|
||||
(
|
||||
dict_.readIfPresent("porosity", porosity_)
|
||||
&& (porosity_ <= 0.0 || porosity_ > 1.0)
|
||||
)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
@ -108,8 +112,42 @@ Foam::porousZone::porousZone
|
||||
<< "out-of-range porosity value " << porosity_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// turbulent intensity
|
||||
if
|
||||
(
|
||||
dict_.readIfPresent("intensity", intensity_)
|
||||
&& (intensity_ <= 0.0 || intensity_ > 1.0)
|
||||
)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"Foam::porousZone::porousZone"
|
||||
"(const fvMesh&, const word&, const dictionary&)",
|
||||
dict_
|
||||
)
|
||||
<< "out-of-range turbulent intensity value " << intensity_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// turbulent length scale
|
||||
if
|
||||
(
|
||||
dict_.readIfPresent("mixingLength", mixingLength_)
|
||||
&& (mixingLength_ <= 0.0)
|
||||
)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"Foam::porousZone::porousZone"
|
||||
"(const fvMesh&, const word&, const dictionary&)",
|
||||
dict_
|
||||
)
|
||||
<< "out-of-range turbulent length scale " << mixingLength_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
// powerLaw coefficients
|
||||
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
|
||||
{
|
||||
@ -171,9 +209,6 @@ Foam::porousZone::porousZone
|
||||
}
|
||||
}
|
||||
|
||||
// provide some feedback for the user
|
||||
// writeDict(Info, false);
|
||||
|
||||
// it is an error not to define anything
|
||||
if
|
||||
(
|
||||
@ -191,6 +226,12 @@ Foam::porousZone::porousZone
|
||||
"nor Darcy-Forchheimer law (d/f) specified"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// feedback for the user
|
||||
if (dict.lookupOrDefault("printCoeffs", false))
|
||||
{
|
||||
writeDict(Info, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -365,7 +406,8 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
|
||||
if (subDict)
|
||||
{
|
||||
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
os.writeKeyword("name") << zoneName() << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("name")
|
||||
<< zoneName() << token::END_STATEMENT << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -375,15 +417,28 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
|
||||
|
||||
if (dict_.found("note"))
|
||||
{
|
||||
os.writeKeyword("note") << string(dict_.lookup("note"))
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("note")
|
||||
<< string(dict_.lookup("note")) << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
coordSys_.writeDict(os, true);
|
||||
|
||||
if (dict_.found("porosity"))
|
||||
{
|
||||
os.writeKeyword("porosity") << porosity() << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("porosity")
|
||||
<< porosity() << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
if (dict_.found("intensity"))
|
||||
{
|
||||
os.writeKeyword("intensity")
|
||||
<< intensity() << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
if (dict_.found("mixingLength"))
|
||||
{
|
||||
os.writeKeyword("mixingLength")
|
||||
<< mixingLength() << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
// powerLaw coefficients
|
||||
@ -406,9 +461,9 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const porousZone& pZone)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const porousZone& pz)
|
||||
{
|
||||
pZone.writeDict(os);
|
||||
pz.writeDict(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +51,25 @@ Description
|
||||
The porousZones method porousZones::ddt() mirrors the normal fvm::ddt()
|
||||
method, but accounts for the effective volume of the cells.
|
||||
|
||||
An example dictionary entry:
|
||||
@verbatim
|
||||
cat1
|
||||
{
|
||||
note "some catalyst";
|
||||
coordinateSystem system_10;
|
||||
porosity 0.809;
|
||||
intensity 0.001; // optional
|
||||
mixingLength 0.0001; // optional
|
||||
printCoeffs yes; // optional: feedback for the user
|
||||
|
||||
Darcy
|
||||
{
|
||||
d d [0 -2 0 0 0] (-1000 -1000 5.3756e+07);
|
||||
f f [0 -1 0 0 0] (-1000 -1000 15.83);
|
||||
}
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
See Also
|
||||
porousZones and coordinateSystems
|
||||
|
||||
@ -111,6 +130,12 @@ class porousZone
|
||||
// Currently unused.
|
||||
scalar porosity_;
|
||||
|
||||
//- Turbulent intensity as fraction of the velocity
|
||||
scalar intensity_;
|
||||
|
||||
//- Turbulent length scale
|
||||
scalar mixingLength_;
|
||||
|
||||
//- powerLaw coefficient C0
|
||||
scalar C0_;
|
||||
|
||||
@ -283,6 +308,30 @@ public:
|
||||
return porosity_;
|
||||
}
|
||||
|
||||
//- Return turbulent intensity
|
||||
scalar intensity() const
|
||||
{
|
||||
return intensity_;
|
||||
}
|
||||
|
||||
//- Edit access to turbulent intensity
|
||||
scalar& intensity()
|
||||
{
|
||||
return intensity_;
|
||||
}
|
||||
|
||||
//- Return turbulent length scale
|
||||
scalar mixingLength() const
|
||||
{
|
||||
return mixingLength_;
|
||||
}
|
||||
|
||||
//- Edit access to turbulent length scale
|
||||
scalar& mixingLength()
|
||||
{
|
||||
return mixingLength_;
|
||||
}
|
||||
|
||||
|
||||
//- Modify time derivative elements according to porosity
|
||||
template<class Type>
|
||||
|
||||
@ -0,0 +1,173 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cylindricalInletVelocityFvPatchVectorField.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
cylindricalInletVelocityFvPatchVectorField::
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
axialVelocity_(0),
|
||||
centre_(pTraits<vector>::zero),
|
||||
axis_(pTraits<vector>::zero),
|
||||
rpm_(0),
|
||||
radialVelocity_(0)
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
cylindricalInletVelocityFvPatchVectorField::
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const cylindricalInletVelocityFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||
axialVelocity_(ptf.axialVelocity_),
|
||||
centre_(ptf.centre_),
|
||||
axis_(ptf.axis_),
|
||||
rpm_(ptf.rpm_),
|
||||
radialVelocity_(ptf.radialVelocity_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
cylindricalInletVelocityFvPatchVectorField::
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||
axialVelocity_(readScalar(dict.lookup("axialVelocity"))),
|
||||
centre_(dict.lookup("centre")),
|
||||
axis_(dict.lookup("axis")),
|
||||
rpm_(readScalar(dict.lookup("rpm"))),
|
||||
radialVelocity_(readScalar(dict.lookup("radialVelocity")))
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
cylindricalInletVelocityFvPatchVectorField::
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const cylindricalInletVelocityFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf),
|
||||
axialVelocity_(ptf.axialVelocity_),
|
||||
centre_(ptf.centre_),
|
||||
axis_(ptf.axis_),
|
||||
rpm_(ptf.rpm_),
|
||||
radialVelocity_(ptf.radialVelocity_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
cylindricalInletVelocityFvPatchVectorField::
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const cylindricalInletVelocityFvPatchVectorField& ptf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, iF),
|
||||
axialVelocity_(ptf.axialVelocity_),
|
||||
centre_(ptf.centre_),
|
||||
axis_(ptf.axis_),
|
||||
rpm_(ptf.rpm_),
|
||||
radialVelocity_(ptf.radialVelocity_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
vector hatAxis = axis_/mag(axis_);
|
||||
|
||||
vectorField r = (patch().Cf() - centre_);
|
||||
|
||||
vectorField d = r - (hatAxis & r)*hatAxis;
|
||||
|
||||
vectorField tangVelo =
|
||||
(rpm_*constant::mathematical::pi/30.0)*(hatAxis)^d;
|
||||
|
||||
operator==(tangVelo + axis_*axialVelocity_ + radialVelocity_*d);
|
||||
|
||||
fixedValueFvPatchField<vector>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::cylindricalInletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<vector>::write(os);
|
||||
os.writeKeyword("axialVelocity") << axialVelocity_ <<
|
||||
token::END_STATEMENT << nl;
|
||||
os.writeKeyword("centre") << centre_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("radialVelocity") << radialVelocity_ <<
|
||||
token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,175 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::cylindricalInletVelocityFvPatchVectorField
|
||||
|
||||
Description
|
||||
Describes an inlet vector boundary condition in cylindrical coordinates
|
||||
given a central axis, central point, rpm, axial and radial velocity.
|
||||
|
||||
Example of the boundary condition specification:
|
||||
@verbatim
|
||||
inlet
|
||||
{
|
||||
type cylindricalInletVelocity;
|
||||
axis (0 0 1);
|
||||
centre (0 0 0);
|
||||
axialVelocity 30;
|
||||
rpm 100;
|
||||
radialVelocity -10;
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
|
||||
SourceFiles
|
||||
cylindricalInletVelocityFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cylindricalInletVelocityFvPatchVectorField_H
|
||||
#define cylindricalInletVelocityFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cylindricalInletVelocityFvPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cylindricalInletVelocityFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Axial velocity
|
||||
const scalar axialVelocity_;
|
||||
|
||||
//- Central point
|
||||
const vector centre_;
|
||||
|
||||
//- Axis
|
||||
const vector axis_;
|
||||
|
||||
//- RPM
|
||||
const scalar rpm_;
|
||||
|
||||
//- Radial velocity
|
||||
const scalar radialVelocity_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cylindricalInletVelocity");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// flowRateInletVelocityFvPatchVectorField
|
||||
// onto a new patch
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const cylindricalInletVelocityFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const cylindricalInletVelocityFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new cylindricalInletVelocityFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const cylindricalInletVelocityFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new cylindricalInletVelocityFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -8,10 +8,10 @@
|
||||
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 free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
@ -19,14 +19,15 @@ 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/>.
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::swirlFlowRateInletVelocityFvPatchVectorField
|
||||
|
||||
Description
|
||||
Describes a volumetric/mass flow normal vector boundary condition by its
|
||||
magnitude as an integral over its area, with a swirl component determined
|
||||
magnitude as an integral over its area with a swirl component determined
|
||||
by the RPM
|
||||
|
||||
The basis of the patch (volumetric or mass) is determined by the
|
||||
@ -41,19 +42,11 @@ Description
|
||||
type swirlFlowRateInletVelocity;
|
||||
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
|
||||
rpm 100;
|
||||
value uniform (0 0 0); // placeholder
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
Note
|
||||
- The value is positive inwards
|
||||
- May not work correctly for transonic inlets
|
||||
- Swirl is defined in RPM about the patch centre-axis according
|
||||
to a right-hand rule (inwards axis).
|
||||
- Primarily useful for planar patches.
|
||||
|
||||
See Also
|
||||
Foam::flowRateInletVelocityFvPatchVectorField
|
||||
|
||||
SourceFiles
|
||||
swirlFlowRateInletVelocityFvPatchVectorField.C
|
||||
@ -88,7 +81,7 @@ class swirlFlowRateInletVelocityFvPatchVectorField
|
||||
//- Name of the density field used to normalize the mass flux
|
||||
word rhoName_;
|
||||
|
||||
//- Swirl rate [rpm]
|
||||
//- RPM
|
||||
scalar rpm_;
|
||||
|
||||
|
||||
@ -177,18 +170,6 @@ public:
|
||||
return flowRate_;
|
||||
}
|
||||
|
||||
//- Return the swirl rpm
|
||||
scalar rpm() const
|
||||
{
|
||||
return rpm_;
|
||||
}
|
||||
|
||||
//- Return reference to the swirl rpm to allow adjustment
|
||||
scalar& rpm()
|
||||
{
|
||||
return rpm_;
|
||||
}
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "calculatedFvPatchFields.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "coupledFvPatchFields.H"
|
||||
#include "UIndirectList.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -177,6 +178,95 @@ void Foam::fvMatrix<Type>::addBoundarySource
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<template<class> class ListType>
|
||||
void Foam::fvMatrix<Type>::setValuesFromList
|
||||
(
|
||||
const unallocLabelList& cellLabels,
|
||||
const ListType<Type>& values
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh = psi_.mesh();
|
||||
|
||||
const cellList& cells = mesh.cells();
|
||||
const unallocLabelList& own = mesh.owner();
|
||||
const unallocLabelList& nei = mesh.neighbour();
|
||||
|
||||
scalarField& Diag = diag();
|
||||
Field<Type>& psi =
|
||||
const_cast
|
||||
<
|
||||
GeometricField<Type, fvPatchField, volMesh>&
|
||||
>(psi_).internalField();
|
||||
|
||||
forAll(cellLabels, i)
|
||||
{
|
||||
const label celli = cellLabels[i];
|
||||
const Type& value = values[i];
|
||||
|
||||
psi[celli] = value;
|
||||
source_[celli] = value*Diag[celli];
|
||||
|
||||
if (symmetric() || asymmetric())
|
||||
{
|
||||
const cell& c = cells[celli];
|
||||
|
||||
forAll(c, j)
|
||||
{
|
||||
const label facei = c[j];
|
||||
|
||||
if (mesh.isInternalFace(facei))
|
||||
{
|
||||
if (symmetric())
|
||||
{
|
||||
if (celli == own[facei])
|
||||
{
|
||||
source_[nei[facei]] -= upper()[facei]*value;
|
||||
}
|
||||
else
|
||||
{
|
||||
source_[own[facei]] -= upper()[facei]*value;
|
||||
}
|
||||
|
||||
upper()[facei] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (celli == own[facei])
|
||||
{
|
||||
source_[nei[facei]] -= lower()[facei]*value;
|
||||
}
|
||||
else
|
||||
{
|
||||
source_[own[facei]] -= upper()[facei]*value;
|
||||
}
|
||||
|
||||
upper()[facei] = 0.0;
|
||||
lower()[facei] = 0.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label patchi = mesh.boundaryMesh().whichPatch(facei);
|
||||
|
||||
if (internalCoeffs_[patchi].size())
|
||||
{
|
||||
label patchFacei =
|
||||
mesh.boundaryMesh()[patchi].whichFace(facei);
|
||||
|
||||
internalCoeffs_[patchi][patchFacei] =
|
||||
pTraits<Type>::zero;
|
||||
|
||||
boundaryCoeffs_[patchi][patchFacei] =
|
||||
pTraits<Type>::zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -393,92 +483,25 @@ Foam::fvMatrix<Type>::~fvMatrix()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Set solution in given cells and eliminate corresponding
|
||||
// equations from the matrix
|
||||
template<class Type>
|
||||
void Foam::fvMatrix<Type>::setValues
|
||||
(
|
||||
const labelList& cellLabels,
|
||||
const Field<Type>& values
|
||||
const unallocLabelList& cellLabels,
|
||||
const UList<Type>& values
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh = psi_.mesh();
|
||||
this->setValuesFromList(cellLabels, values);
|
||||
}
|
||||
|
||||
const cellList& cells = mesh.cells();
|
||||
const unallocLabelList& own = mesh.owner();
|
||||
const unallocLabelList& nei = mesh.neighbour();
|
||||
|
||||
scalarField& Diag = diag();
|
||||
Field<Type>& psi =
|
||||
const_cast
|
||||
<
|
||||
GeometricField<Type, fvPatchField, volMesh>&
|
||||
>(psi_).internalField();
|
||||
|
||||
forAll(cellLabels, i)
|
||||
{
|
||||
label celli = cellLabels[i];
|
||||
|
||||
psi[celli] = values[i];
|
||||
source_[celli] = values[i]*Diag[celli];
|
||||
|
||||
if (symmetric() || asymmetric())
|
||||
{
|
||||
const cell& c = cells[celli];
|
||||
|
||||
forAll(c, j)
|
||||
{
|
||||
label facei = c[j];
|
||||
|
||||
if (mesh.isInternalFace(facei))
|
||||
{
|
||||
if (symmetric())
|
||||
{
|
||||
if (celli == own[facei])
|
||||
{
|
||||
source_[nei[facei]] -= upper()[facei]*values[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
source_[own[facei]] -= upper()[facei]*values[i];
|
||||
}
|
||||
|
||||
upper()[facei] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (celli == own[facei])
|
||||
{
|
||||
source_[nei[facei]] -= lower()[facei]*values[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
source_[own[facei]] -= upper()[facei]*values[i];
|
||||
}
|
||||
|
||||
upper()[facei] = 0.0;
|
||||
lower()[facei] = 0.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label patchi = mesh.boundaryMesh().whichPatch(facei);
|
||||
|
||||
if (internalCoeffs_[patchi].size())
|
||||
{
|
||||
label patchFacei =
|
||||
mesh.boundaryMesh()[patchi].whichFace(facei);
|
||||
|
||||
internalCoeffs_[patchi][patchFacei] =
|
||||
pTraits<Type>::zero;
|
||||
|
||||
boundaryCoeffs_[patchi][patchFacei] =
|
||||
pTraits<Type>::zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
template<class Type>
|
||||
void Foam::fvMatrix<Type>::setValues
|
||||
(
|
||||
const unallocLabelList& cellLabels,
|
||||
const UIndirectList<Type>& values
|
||||
)
|
||||
{
|
||||
this->setValuesFromList(cellLabels, values);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -101,6 +101,8 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > operator&
|
||||
template<class Type>
|
||||
Ostream& operator<<(Ostream&, const fvMatrix<Type>&);
|
||||
|
||||
template<class T> class UIndirectList;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fvMatrix Declaration
|
||||
@ -112,8 +114,6 @@ class fvMatrix
|
||||
public refCount,
|
||||
public lduMatrix
|
||||
{
|
||||
public:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Const reference to GeometricField<Type, fvPatchField, volMesh>
|
||||
@ -139,8 +139,12 @@ public:
|
||||
mutable GeometricField<Type, fvsPatchField, surfaceMesh>
|
||||
*faceFluxCorrectionPtr_;
|
||||
|
||||
protected:
|
||||
|
||||
// Private Member Functions
|
||||
//- Declare friendship with the fvSolver class
|
||||
friend class fvSolver;
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Add patch contribution to internal field
|
||||
template<class Type2>
|
||||
@ -193,12 +197,22 @@ public:
|
||||
const bool couples=true
|
||||
) const;
|
||||
|
||||
// Matrix manipulation functionality
|
||||
|
||||
//- Set solution in given cells to the specified values
|
||||
template<template<class> class ListType>
|
||||
void setValuesFromList
|
||||
(
|
||||
const unallocLabelList& cells,
|
||||
const ListType<Type>& values
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Solver class returned by the solver function
|
||||
// used for systems in which it is useful to cache the solver for reuse
|
||||
// e.g. if the solver is potentialy expensive to construct (AMG) and can
|
||||
// e.g. if the solver is potentially expensive to construct (AMG) and can
|
||||
// be used several times (PISO)
|
||||
class fvSolver
|
||||
{
|
||||
@ -309,12 +323,20 @@ public:
|
||||
|
||||
// Operations
|
||||
|
||||
//- Set solution in given cells and eliminate corresponding
|
||||
// equations from the matrix
|
||||
//- Set solution in given cells to the specified values
|
||||
// and eliminate the corresponding equations from the matrix.
|
||||
void setValues
|
||||
(
|
||||
const labelList& cells,
|
||||
const Field<Type>& values
|
||||
const unallocLabelList& cells,
|
||||
const UList<Type>& values
|
||||
);
|
||||
|
||||
//- Set solution in given cells to the specified values
|
||||
// and eliminate the corresponding equations from the matrix.
|
||||
void setValues
|
||||
(
|
||||
const unallocLabelList& cells,
|
||||
const UIndirectList<Type>& values
|
||||
);
|
||||
|
||||
//- Set reference level for solution
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "WallInteractionModel.H"
|
||||
#include "InflowBoundaryModel.H"
|
||||
#include "constants.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
@ -459,6 +460,8 @@ void Foam::DsmcCloud<ParcelType>::collisions()
|
||||
|
||||
reduce(collisionCandidates, sumOp<label>());
|
||||
|
||||
sigmaTcRMax_.correctBoundaryConditions();
|
||||
|
||||
if (collisionCandidates)
|
||||
{
|
||||
Info<< " Collisions = "
|
||||
@ -550,6 +553,8 @@ void Foam::DsmcCloud<ParcelType>::calculateFields()
|
||||
rhoM *= nParticle_/mesh().cellVolumes();
|
||||
rhoM_.correctBoundaryConditions();
|
||||
|
||||
dsmcRhoN_.correctBoundaryConditions();
|
||||
|
||||
linearKE *= nParticle_/mesh().cellVolumes();
|
||||
linearKE_.correctBoundaryConditions();
|
||||
|
||||
@ -851,7 +856,8 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimensionSet(0, 3, -1, 0, 0), 0.0)
|
||||
dimensionedScalar("zero", dimensionSet(0, 3, -1, 0, 0), 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
),
|
||||
collisionSelectionRemainder_(),
|
||||
q_
|
||||
|
||||
@ -83,10 +83,10 @@ class DsmcCloud
|
||||
//- Dictionary of particle properties
|
||||
IOdictionary particleProperties_;
|
||||
|
||||
//- A list of unique instances of molecule types in the simulation.
|
||||
// The position of an entry in the list maps to the label identifying
|
||||
// the typeId, i.e. where typeIdList_ = (N2 O2 CO2)
|
||||
// N2 has typeId label = 0, O2 = 1, CO2 = 2.
|
||||
//- A list of unique instances of molecule types in the
|
||||
// simulation. The position of an entry in the list maps to
|
||||
// the label identifying the typeId, i.e. where typeIdList_ =
|
||||
// (N2 O2 CO2) N2 has typeId label = 0, O2 = 1, CO2 = 2.
|
||||
List<word> typeIdList_;
|
||||
|
||||
//- Number of real atoms/molecules represented by a parcel
|
||||
@ -95,9 +95,9 @@ class DsmcCloud
|
||||
//- A data structure holding which particles are in which cell
|
||||
List<DynamicList<ParcelType*> > cellOccupancy_;
|
||||
|
||||
//- An IOField holding the value of (sigmaT * cR)max for each cell (see
|
||||
// Bird p220). Initialised with the parcels, updated as required, and
|
||||
// read in on start/restart.
|
||||
//- A field holding the value of (sigmaT * cR)max for each
|
||||
// cell (see Bird p220). Initialised with the parcels,
|
||||
// updated as required, and read in on start/restart.
|
||||
volScalarField sigmaTcRMax_;
|
||||
|
||||
//- A field holding the remainder from the previous collision selections
|
||||
|
||||
@ -317,18 +317,15 @@ bool Foam::KinematicParcel<ParcelType>::move(TrackData& td)
|
||||
|
||||
case TrackData::tpRotationalTrack:
|
||||
{
|
||||
Info<< "No rotational tracking implementation" << endl;
|
||||
notImplemented("TrackData::tpRotationalTrack");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"KinematicParcel<ParcelType>::move(TrackData& td)"
|
||||
) << td.part()
|
||||
<< " is an invalid part of the tracking method."
|
||||
FatalErrorIn("KinematicParcel<ParcelType>::move(TrackData& td)")
|
||||
<< td.part() << " is an invalid part of the tracking method."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,6 +62,7 @@ class polyLine
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const polyLine&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
@ -75,17 +76,18 @@ protected:
|
||||
//- The rational (0-1) cumulative parameter value for each point
|
||||
scalarList param_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Precalculate the rational cumulative parameter value
|
||||
// and the line-length
|
||||
void calcParam();
|
||||
|
||||
|
||||
//- Return the line segment and the local parameter [0..1]
|
||||
// corresponding to the global lambda [0..1]
|
||||
label localParameter(scalar& lambda) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -103,7 +103,7 @@ void Foam::writeRegisteredObject::write()
|
||||
(
|
||||
"Foam::writeRegisteredObject::read(const dictionary&)"
|
||||
) << "Object " << objectNames_[i] << " not found in "
|
||||
<< "database. Available objects are:" << nl << obr_.toc()
|
||||
<< "database. Available objects:" << nl << obr_.sortedToc()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.6 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application XXX;
|
||||
|
||||
startFrom latestTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 0.1;
|
||||
|
||||
deltaT 1e-05;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 10;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
functions
|
||||
{
|
||||
minMax
|
||||
{
|
||||
// Type of functionObject
|
||||
type fieldMinMax;
|
||||
|
||||
// Where to load it from (if not already in solver)
|
||||
functionObjectLibs ("libfieldAverage.so");
|
||||
|
||||
// Function object enabled flag
|
||||
enabled true;
|
||||
|
||||
// Log to output (default: false)
|
||||
log false;
|
||||
|
||||
// Write information to file (default: true)
|
||||
write true;
|
||||
|
||||
// Fields to be monitored - runTime modifiable
|
||||
fields
|
||||
(
|
||||
U
|
||||
p
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -59,6 +59,7 @@ Foam::fieldMinMax::fieldMinMax
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
write_(true),
|
||||
log_(false),
|
||||
mode_(mdMag),
|
||||
fieldSet_(),
|
||||
@ -92,9 +93,10 @@ void Foam::fieldMinMax::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
write_ = dict.lookupOrDefault<Switch>("write", true);
|
||||
log_ = dict.lookupOrDefault<Switch>("log", false);
|
||||
|
||||
mode_ = modeTypeNames_[dict.lookup("mode")];
|
||||
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
}
|
||||
@ -171,7 +173,10 @@ void Foam::fieldMinMax::write()
|
||||
if (active_)
|
||||
{
|
||||
// Create the fieldMinMax file if not already created
|
||||
if (write_)
|
||||
{
|
||||
makeFile();
|
||||
}
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
@ -195,13 +200,17 @@ void Foam::fieldMinMax::calcMinMaxFields<Foam::scalar>
|
||||
{
|
||||
const volScalarField& field =
|
||||
obr_.lookupObject<volScalarField>(fieldName);
|
||||
scalar minValue = min(field).value();
|
||||
scalar maxValue = max(field).value();
|
||||
const scalar minValue = min(field).value();
|
||||
const scalar maxValue = max(field).value();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
fieldMinMaxFilePtr_() << obr_.time().value() << tab
|
||||
if (write_)
|
||||
{
|
||||
fieldMinMaxFilePtr_()
|
||||
<< obr_.time().value() << tab
|
||||
<< fieldName << tab << minValue << tab << maxValue << endl;
|
||||
}
|
||||
|
||||
if (log_)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -74,11 +74,13 @@ public:
|
||||
mdCmpt
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Mode type names
|
||||
static const NamedEnum<modeType, 2> modeTypeNames_;
|
||||
|
||||
//- Name of this set of field min/max.
|
||||
// Also used as the name of the output directory.
|
||||
word name_;
|
||||
@ -88,11 +90,11 @@ protected:
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
//- Switch to enable/disable writing to file
|
||||
Switch write_;
|
||||
|
||||
//- Mode type names
|
||||
static const NamedEnum<modeType, 2> modeTypeNames_;
|
||||
//- Switch to send output to Info as well
|
||||
Switch log_;
|
||||
|
||||
//- Mode for min/max - only applicable for ranks > 0
|
||||
modeType mode_;
|
||||
@ -100,7 +102,6 @@ protected:
|
||||
//- Fields to assess min/max
|
||||
wordList fieldSet_;
|
||||
|
||||
|
||||
//- Min/max file ptr
|
||||
autoPtr<OFstream> fieldMinMaxFilePtr_;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,14 +42,18 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName)
|
||||
{
|
||||
case mdMag:
|
||||
{
|
||||
scalar minValue = min(mag(field)).value();
|
||||
scalar maxValue = max(mag(field)).value();
|
||||
const scalar minValue = min(mag(field)).value();
|
||||
const scalar maxValue = max(mag(field)).value();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
fieldMinMaxFilePtr_() << obr_.time().value() << tab
|
||||
if (write_)
|
||||
{
|
||||
fieldMinMaxFilePtr_()
|
||||
<< obr_.time().value() << tab
|
||||
<< fieldName << tab << minValue << tab << maxValue
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (log_)
|
||||
{
|
||||
@ -65,14 +69,18 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName)
|
||||
}
|
||||
case mdCmpt:
|
||||
{
|
||||
Type minValue = min(field).value();
|
||||
Type maxValue = max(field).value();
|
||||
const Type minValue = min(field).value();
|
||||
const Type maxValue = max(field).value();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
fieldMinMaxFilePtr_() << obr_.time().value() << tab
|
||||
if (write_)
|
||||
{
|
||||
fieldMinMaxFilePtr_()
|
||||
<< obr_.time().value() << tab
|
||||
<< fieldName << tab << minValue << tab << maxValue
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (log_)
|
||||
{
|
||||
|
||||
@ -27,6 +27,8 @@ Class
|
||||
Description
|
||||
A sampledSurface defined by a cuttingPlane. Always triangulated.
|
||||
|
||||
Note: does not actually cut until update() called.
|
||||
|
||||
SourceFiles
|
||||
sampledPlane.C
|
||||
|
||||
|
||||
@ -18,4 +18,8 @@ wmake libso radiation
|
||||
wmake libso barotropicCompressibilityModel
|
||||
wmake libso thermalPorousZone
|
||||
|
||||
# Should be combined with solids&solidMixture
|
||||
wmake libso basicSolidThermo
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
7
src/thermophysicalModels/basicSolidThermo/Make/files
Normal file
7
src/thermophysicalModels/basicSolidThermo/Make/files
Normal file
@ -0,0 +1,7 @@
|
||||
constSolidThermo/constSolidThermo.C
|
||||
directionalSolidThermo/directionalSolidThermo.C
|
||||
basicSolidThermo/basicSolidThermo.C
|
||||
basicSolidThermo/newBasicSolidThermo.C
|
||||
interpolatedSolidThermo/interpolatedSolidThermo.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libbasicSolidThermo
|
||||
7
src/thermophysicalModels/basicSolidThermo/Make/options
Normal file
7
src/thermophysicalModels/basicSolidThermo/Make/options
Normal file
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume
|
||||
@ -0,0 +1,91 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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 "basicSolidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(basicSolidThermo, 0);
|
||||
defineRunTimeSelectionTable(basicSolidThermo, mesh);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"solidThermophysicalProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
mesh_(mesh),
|
||||
T_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::basicSolidThermo::~basicSolidThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::basicSolidThermo::writeData(Ostream& os) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const basicSolidThermo& s)
|
||||
{
|
||||
s.writeData(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,196 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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::basicSolidThermo
|
||||
|
||||
Description
|
||||
The thermophysical properties of a basicSolidThermo
|
||||
|
||||
SourceFiles
|
||||
basicSolidThermo.C
|
||||
newBasicSolidThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef basicSolidThermo_H
|
||||
#define basicSolidThermo_H
|
||||
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "volFields.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class basicSolidThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class basicSolidThermo
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
const fvMesh& mesh_;
|
||||
|
||||
//- Temperature [K]
|
||||
volScalarField T_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("basicSolidThermo");
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
basicSolidThermo,
|
||||
mesh,
|
||||
(const fvMesh& mesh),
|
||||
(mesh)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
basicSolidThermo(const fvMesh&);
|
||||
|
||||
//- Return a pointer to a new basicSolidThermo created from
|
||||
// the solidThermophysicalProperties dictionary
|
||||
static autoPtr<basicSolidThermo> New(const fvMesh&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~basicSolidThermo();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update properties
|
||||
virtual void correct() = 0;
|
||||
|
||||
|
||||
// Physical constants which define the basicSolidThermo
|
||||
|
||||
//- Temperature [K]
|
||||
inline const volScalarField& T() const;
|
||||
|
||||
//- Temperature [K]
|
||||
inline volScalarField& T();
|
||||
|
||||
//- Density [kg/m3]
|
||||
virtual tmp<volScalarField> rho() const = 0;
|
||||
|
||||
//- Specific heat capacity [J/(kg.K)]
|
||||
virtual tmp<volScalarField> cp() const = 0;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<volScalarField> K() const = 0;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<volSymmTensorField> directionalK() const = 0;
|
||||
|
||||
//- Heat of formation [J/kg]
|
||||
virtual tmp<volScalarField> Hf() const = 0;
|
||||
|
||||
//- Emissivity []
|
||||
virtual tmp<volScalarField> emissivity() const = 0;
|
||||
|
||||
|
||||
// Per patch calculation
|
||||
|
||||
//- Density [kg/m3]
|
||||
virtual tmp<scalarField> rho(const label patchI) const = 0;
|
||||
|
||||
//- Specific heat capacity [J/(kg.K)]
|
||||
virtual tmp<scalarField> cp(const label patchI) const = 0;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<scalarField> K(const label patchI) const = 0;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<symmTensorField> directionalK(const label) const =0;
|
||||
|
||||
//- Heat of formation [J/kg]
|
||||
virtual tmp<scalarField> Hf(const label patchI) const = 0;
|
||||
|
||||
//- Emissivity []
|
||||
virtual tmp<scalarField> emissivity(const label) const = 0;
|
||||
|
||||
// // Point wise properties
|
||||
//
|
||||
// //- Density [kg/m3]
|
||||
// virtual scalar rho(const scalar T) const = 0;
|
||||
//
|
||||
// //- Specific heat capacity [J/(kg.K)]
|
||||
// virtual scalar cp(const scalar T) const = 0;
|
||||
//
|
||||
// //- Thermal conductivity [W/(m.K)]
|
||||
// virtual scalar K(const scalar T) const = 0;
|
||||
//
|
||||
// //- Heat of formation [J/kg]
|
||||
// virtual scalar Hf(const scalar T) const = 0;
|
||||
//
|
||||
// //- Emissivity []
|
||||
// virtual scalar emissivity(const scalar T) const = 0;
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write the basicSolidThermo properties
|
||||
virtual bool writeData(Ostream& os) const = 0;
|
||||
|
||||
//- Read solidThermophysicalProperties dictionary
|
||||
virtual bool read() = 0;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const basicSolidThermo& s);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "basicSolidThermoI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,42 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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 "basicSolidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::volScalarField& Foam::basicSolidThermo::T() const
|
||||
{
|
||||
return T_;
|
||||
}
|
||||
|
||||
|
||||
Foam::volScalarField& Foam::basicSolidThermo::T()
|
||||
{
|
||||
return T_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,77 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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 "basicSolidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::basicSolidThermo> Foam::basicSolidThermo::New
|
||||
(
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "basicSolidThermo::New(const fvMesh&): "
|
||||
<< "constructing basicSolidThermo"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
const word thermoType
|
||||
(
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"solidThermophysicalProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("thermoType")
|
||||
);
|
||||
|
||||
meshConstructorTable::iterator cstrIter =
|
||||
meshConstructorTablePtr_->find(thermoType);
|
||||
|
||||
if (cstrIter == meshConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"basicSolidThermo::New(const fvMesh&, const word&)"
|
||||
) << "Unknown solidThermo type " << thermoType
|
||||
<< endl << endl
|
||||
<< "Valid solidThermo types are :" << endl
|
||||
<< meshConstructorTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<basicSolidThermo>(cstrIter()(mesh));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -0,0 +1,232 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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 "interpolateSolidThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "interpolateXY.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(interpolateSolidThermo, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
basicSolidThermo,
|
||||
interpolateSolidThermo,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::interpolateSolidThermo::interpolateSolidThermo
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
basicSolidThermo(mesh, dict, typeName),
|
||||
TValues_(dict_.lookup("TValues")),
|
||||
rhoValues_(dict_.lookup("rhoValues")),
|
||||
cpValues_(dict_.lookup("cpValues")),
|
||||
KValues_(dict_.lookup("KValues")),
|
||||
HfValues_(dict_.lookup("HfValues")),
|
||||
emissivityValues_(dict_.lookup("emissivityValues"))
|
||||
{
|
||||
if
|
||||
(
|
||||
(TValues_.size() != rhoValues_.size())
|
||||
&& (TValues_.size() != cpValues_.size())
|
||||
&& (TValues_.size() != rhoValues_.size())
|
||||
&& (TValues_.size() != KValues_.size())
|
||||
&& (TValues_.size() != HfValues_.size())
|
||||
&& (TValues_.size() != emissivityValues_.size())
|
||||
)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"interpolateSolidThermo::interpolateSolidThermo\n"
|
||||
"(\n"
|
||||
" const fvMesh& mesh,\n"
|
||||
" const dictionary& dict\n"
|
||||
")\n",
|
||||
dict_
|
||||
) << "Size of property tables should be equal to size of Temperature"
|
||||
<< " values " << TValues_.size()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
for (label i = 1; i < TValues_.size(); i++)
|
||||
{
|
||||
if (TValues_[i] <= TValues_[i-1])
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"interpolateSolidThermo::interpolateSolidThermo\n"
|
||||
"(\n"
|
||||
" const fvMesh& mesh,\n"
|
||||
" const dictionary& dict\n"
|
||||
")\n",
|
||||
dict_
|
||||
) << "Temperature values are not in increasing order "
|
||||
<< TValues_ << exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::interpolateSolidThermo::~interpolateSolidThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::interpolateSolidThermo::correct()
|
||||
{
|
||||
// rho
|
||||
rho_.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
rhoValues_
|
||||
);
|
||||
|
||||
forAll(rho_.boundaryField(), patchI)
|
||||
{
|
||||
rho_.boundaryField()[patchI] == interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
rhoValues_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// cp
|
||||
cp_.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
cpValues_
|
||||
);
|
||||
|
||||
forAll(cp_.boundaryField(), patchI)
|
||||
{
|
||||
cp_.boundaryField()[patchI] == interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
cpValues_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// K
|
||||
K_.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
KValues_
|
||||
);
|
||||
|
||||
forAll(K_.boundaryField(), patchI)
|
||||
{
|
||||
K_.boundaryField()[patchI] == interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
KValues_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Hf
|
||||
Hf_.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
HfValues_
|
||||
);
|
||||
|
||||
forAll(Hf_.boundaryField(), patchI)
|
||||
{
|
||||
Hf_.boundaryField()[patchI] == interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
HfValues_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// emissivity
|
||||
emissivity_.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
emissivityValues_
|
||||
);
|
||||
|
||||
forAll(emissivity_.boundaryField(), patchI)
|
||||
{
|
||||
emissivity_.boundaryField()[patchI] == interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
emissivityValues_
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::interpolateSolidThermo::write(Ostream& os) const
|
||||
{
|
||||
basicSolidThermo::write(os);
|
||||
os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("emissivityValues") << emissivityValues_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const interpolateSolidThermo& s)
|
||||
{
|
||||
s.write(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,124 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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::interpolateSolidThermo
|
||||
|
||||
Description
|
||||
The thermophysical properties of a interpolateSolidThermo
|
||||
|
||||
SourceFiles
|
||||
interpolateSolidThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef interpolateSolidThermo_H
|
||||
#define interpolateSolidThermo_H
|
||||
|
||||
#include "basicSolidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class basicSolidThermo;
|
||||
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const basicSolidThermo&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class interpolateSolidThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class interpolateSolidThermo
|
||||
:
|
||||
public basicSolidThermo
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Temperature points for which there are values
|
||||
const Field<scalar> TValues_;
|
||||
|
||||
//- Density at given temperatures
|
||||
const Field<scalar> rhoValues_;
|
||||
|
||||
const Field<scalar> cpValues_;
|
||||
|
||||
const Field<symmTensor> KValues_;
|
||||
|
||||
const Field<scalar> HfValues_;
|
||||
|
||||
const Field<scalar> emissivityValues_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("interpolateSolidThermo");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
interpolateSolidThermo(const fvMesh& mesh, const dictionary& dict);
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~interpolateSolidThermo();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update properties
|
||||
virtual void correct();
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write the interpolateSolidThermo properties
|
||||
virtual void write(Ostream& os) const;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const interpolateSolidThermo& s
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,410 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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 "constSolidThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(constSolidThermo, 0);
|
||||
addToRunTimeSelectionTable(basicSolidThermo, constSolidThermo, mesh);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::constSolidThermo::constSolidThermo(const fvMesh& mesh)
|
||||
:
|
||||
basicSolidThermo(mesh),
|
||||
constRho_("zero", dimDensity, 0.0),
|
||||
constCp_("zero", dimEnergy/(dimMass*dimTemperature), 0.0),
|
||||
constK_("zero", dimEnergy/dimTime/(dimLength*dimTemperature), 0.0),
|
||||
constHf_("zero", dimEnergy/dimMass, 0.0),
|
||||
constEmissivity_("zero", dimless, 0.0)
|
||||
{
|
||||
read();
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::constSolidThermo::~constSolidThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::constSolidThermo::correct()
|
||||
{}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::rho() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
constRho_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::cp() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cp",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
constCp_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::K() const
|
||||
//{
|
||||
// vector v(eigenValues(constK_.value()));
|
||||
//
|
||||
// if (mag(v.x() - v.z()) > SMALL)
|
||||
// {
|
||||
// FatalErrorIn("directionalSolidThermo::K() const")
|
||||
// << "Supplied K " << constK_
|
||||
// << " are not isotropic. Eigenvalues are "
|
||||
// << v << exit(FatalError);
|
||||
// }
|
||||
//
|
||||
// return tmp<volScalarField>
|
||||
// (
|
||||
// new volScalarField
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "K",
|
||||
// mesh_.time().timeName(),
|
||||
// mesh_,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::NO_WRITE
|
||||
// ),
|
||||
// mesh_,
|
||||
// v.x()
|
||||
// )
|
||||
// );
|
||||
//}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::K() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"K",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
constK_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//Foam::tmp<Foam::volSymmTensorField> Foam::constSolidThermo::directionalK()
|
||||
//const
|
||||
//{
|
||||
// return tmp<volSymmTensorField>
|
||||
// (
|
||||
// new volSymmTensorField
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "K",
|
||||
// mesh_.time().timeName(),
|
||||
// mesh_,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::NO_WRITE
|
||||
// ),
|
||||
// mesh_,
|
||||
// constK_
|
||||
// )
|
||||
// );
|
||||
//}
|
||||
Foam::tmp<Foam::volSymmTensorField> Foam::constSolidThermo::directionalK() const
|
||||
{
|
||||
dimensionedSymmTensor t
|
||||
(
|
||||
constK_.name(),
|
||||
constK_.dimensions(),
|
||||
symmTensor
|
||||
(
|
||||
constK_.value(),
|
||||
0.0,
|
||||
0.0,
|
||||
constK_.value(),
|
||||
0.0,
|
||||
constK_.value()
|
||||
)
|
||||
);
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"K",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
t
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Hf() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Hf",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
constHf_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::emissivity() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"emissivity",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
constEmissivity_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::rho
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
T_.boundaryField()[patchI].size(),
|
||||
constRho_.value()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::cp
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
T_.boundaryField()[patchI].size(),
|
||||
constCp_.value()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::K
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
T_.boundaryField()[patchI].size(),
|
||||
constK_.value()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::symmTensorField> Foam::constSolidThermo::directionalK
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
symmTensor t
|
||||
(
|
||||
constK_.value(),
|
||||
0.0,
|
||||
0.0,
|
||||
constK_.value(),
|
||||
0.0,
|
||||
constK_.value()
|
||||
);
|
||||
return tmp<symmTensorField>
|
||||
(
|
||||
new symmTensorField
|
||||
(
|
||||
T_.boundaryField()[patchI].size(),
|
||||
t
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Hf
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
T_.boundaryField()[patchI].size(),
|
||||
constHf_.value()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::emissivity
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
T_.boundaryField()[patchI].size(),
|
||||
constEmissivity_.value()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::constSolidThermo::read()
|
||||
{
|
||||
return read(subDict(typeName + "Coeffs"));
|
||||
}
|
||||
|
||||
|
||||
bool Foam::constSolidThermo::read(const dictionary& dict)
|
||||
{
|
||||
constRho_ = dimensionedScalar(dict.lookup("rho"));
|
||||
constCp_ = dimensionedScalar(dict.lookup("cp"));
|
||||
constK_ = dimensionedScalar(dict.lookup("K"));
|
||||
constHf_ = dimensionedScalar(dict.lookup("Hf"));
|
||||
constEmissivity_ = dimensionedScalar(dict.lookup("emissivity"));
|
||||
|
||||
Info<< "Constructed constSolidThermo with" << nl
|
||||
<< " rho : " << constRho_ << nl
|
||||
<< " cp : " << constCp_ << nl
|
||||
<< " K : " << constK_ << nl
|
||||
<< " Hf : " << constHf_ << nl
|
||||
<< " emissivity : " << constEmissivity_ << nl
|
||||
<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::constSolidThermo::writeData(Ostream& os) const
|
||||
{
|
||||
bool ok = basicSolidThermo::writeData(os);
|
||||
os.writeKeyword("rho") << constRho_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("cp") << constCp_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("K") << constK_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("Hf") << constHf_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("emissivity") << constEmissivity_ << token::END_STATEMENT
|
||||
<< nl;
|
||||
return ok && os.good();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const constSolidThermo& s)
|
||||
{
|
||||
s.writeData(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,158 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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::constSolidThermo
|
||||
|
||||
Description
|
||||
The thermophysical properties of a constSolidThermo
|
||||
|
||||
SourceFiles
|
||||
constSolidThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef constSolidThermo_H
|
||||
#define constSolidThermo_H
|
||||
|
||||
#include "basicSolidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class constSolidThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class constSolidThermo
|
||||
:
|
||||
public basicSolidThermo
|
||||
{
|
||||
//- Density [kg/m3]
|
||||
dimensionedScalar constRho_;
|
||||
|
||||
//- Specific heat capacity [J/(kg.K)]
|
||||
dimensionedScalar constCp_;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
//dimensionedSymmTensor constK_;
|
||||
dimensionedScalar constK_;
|
||||
|
||||
//- Heat of formation [J/kg]
|
||||
dimensionedScalar constHf_;
|
||||
|
||||
//- Emissivity
|
||||
dimensionedScalar constEmissivity_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("constSolidThermo");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
constSolidThermo(const fvMesh& mesh);
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~constSolidThermo();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update properties
|
||||
virtual void correct();
|
||||
|
||||
//- Density [kg/m3]
|
||||
virtual tmp<volScalarField> rho() const;
|
||||
|
||||
//- Specific heat capacity [J/(kg.K)]
|
||||
virtual tmp<volScalarField> cp() const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
// Note: needs supplied K to be isotropic
|
||||
virtual tmp<volScalarField> K() const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<volSymmTensorField> directionalK() const;
|
||||
|
||||
//- Heat of formation [J/kg]
|
||||
virtual tmp<volScalarField> Hf() const;
|
||||
|
||||
//- Emissivity []
|
||||
virtual tmp<volScalarField> emissivity() const;
|
||||
|
||||
|
||||
// Per patch calculation
|
||||
|
||||
//- Density [kg/m3]
|
||||
virtual tmp<scalarField> rho(const label patchI) const;
|
||||
|
||||
//- Specific heat capacity [J/(kg.K)]
|
||||
virtual tmp<scalarField> cp(const label patchI) const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<scalarField> K(const label patchI) const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<symmTensorField> directionalK(const label patchI) const;
|
||||
|
||||
//- Heat of formation [J/kg]
|
||||
virtual tmp<scalarField> Hf(const label patchI) const;
|
||||
|
||||
//- Emissivity []
|
||||
virtual tmp<scalarField> emissivity(const label) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write the constSolidThermo properties
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
|
||||
//- Read solidThermophysicalProperties dictionary
|
||||
virtual bool read();
|
||||
|
||||
//- Read solidThermophysicalProperties dictionary
|
||||
bool read(const dictionary&);
|
||||
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const constSolidThermo& s);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,765 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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 "directionalSolidThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "interpolateXY.H"
|
||||
#include "transform.H"
|
||||
#include "transformField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(directionalSolidThermo, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
basicSolidThermo,
|
||||
directionalSolidThermo,
|
||||
mesh
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::directionalSolidThermo::directionalSolidThermo(const fvMesh& mesh)
|
||||
:
|
||||
basicSolidThermo(mesh),
|
||||
ccTransforms_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"ccTransforms",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimLength
|
||||
)
|
||||
{
|
||||
read();
|
||||
|
||||
// Determine transforms for cell centres
|
||||
forAll(mesh.C(), cellI)
|
||||
{
|
||||
vector dir = mesh.C()[cellI] - coordSys_.origin();
|
||||
dir /= mag(dir);
|
||||
|
||||
// Define local coordinate system with
|
||||
// - e1 : axis from cc to centre
|
||||
// - e3 : rotation axis
|
||||
coordinateSystem cs
|
||||
(
|
||||
"cc",
|
||||
coordSys_.origin(),
|
||||
coordSys_.e3(), //z',e3
|
||||
dir //x',e1
|
||||
);
|
||||
|
||||
ccTransforms_[cellI] = cs.R();
|
||||
}
|
||||
|
||||
forAll(mesh.C().boundaryField(), patchI)
|
||||
{
|
||||
const fvPatchVectorField& patchC = mesh.C().boundaryField()[patchI];
|
||||
fvPatchTensorField& patchT = ccTransforms_.boundaryField()[patchI];
|
||||
|
||||
tensorField tc(patchT.size());
|
||||
forAll(tc, i)
|
||||
{
|
||||
vector dir = patchC[i] - coordSys_.origin();
|
||||
dir /= mag(dir);
|
||||
|
||||
coordinateSystem cs
|
||||
(
|
||||
"cc",
|
||||
coordSys_.origin(),
|
||||
coordSys_.e3(), //z',e3
|
||||
dir //x',e1
|
||||
);
|
||||
|
||||
tc[i] = cs.R();
|
||||
}
|
||||
patchT = tc;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "directionalSolidThermo : dumping converted Kxx, Kyy, Kzz"
|
||||
<< endl;
|
||||
{
|
||||
volVectorField Kxx
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Kxx",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh,
|
||||
dimless
|
||||
);
|
||||
Kxx.internalField() = transform
|
||||
(
|
||||
ccTransforms_.internalField(),
|
||||
vectorField
|
||||
(
|
||||
ccTransforms_.internalField().size(),
|
||||
point(1, 0, 0)
|
||||
)
|
||||
);
|
||||
forAll(Kxx.boundaryField(), patchI)
|
||||
{
|
||||
Kxx.boundaryField()[patchI] = transform
|
||||
(
|
||||
ccTransforms_.boundaryField()[patchI],
|
||||
vectorField
|
||||
(
|
||||
ccTransforms_.boundaryField()[patchI].size(),
|
||||
point(1, 0, 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
Kxx.write();
|
||||
}
|
||||
{
|
||||
volVectorField Kyy
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Kyy",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh,
|
||||
dimless
|
||||
);
|
||||
Kyy.internalField() = transform
|
||||
(
|
||||
ccTransforms_.internalField(),
|
||||
vectorField
|
||||
(
|
||||
ccTransforms_.internalField().size(),
|
||||
point(0, 1, 0)
|
||||
)
|
||||
);
|
||||
forAll(Kyy.boundaryField(), patchI)
|
||||
{
|
||||
Kyy.boundaryField()[patchI] = transform
|
||||
(
|
||||
ccTransforms_.boundaryField()[patchI],
|
||||
vectorField
|
||||
(
|
||||
ccTransforms_.boundaryField()[patchI].size(),
|
||||
point(0, 1, 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
Kyy.write();
|
||||
}
|
||||
{
|
||||
volVectorField Kzz
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Kzz",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh,
|
||||
dimless
|
||||
);
|
||||
Kzz.internalField() = transform
|
||||
(
|
||||
ccTransforms_.internalField(),
|
||||
vectorField
|
||||
(
|
||||
ccTransforms_.internalField().size(),
|
||||
point(0, 0, 1)
|
||||
)
|
||||
);
|
||||
forAll(Kzz.boundaryField(), patchI)
|
||||
{
|
||||
Kzz.boundaryField()[patchI] = transform
|
||||
(
|
||||
ccTransforms_.boundaryField()[patchI],
|
||||
vectorField
|
||||
(
|
||||
ccTransforms_.boundaryField()[patchI].size(),
|
||||
point(0, 0, 1)
|
||||
)
|
||||
);
|
||||
}
|
||||
Kzz.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::directionalSolidThermo::~directionalSolidThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::symmTensor Foam::directionalSolidThermo::transformPrincipal
|
||||
(
|
||||
const tensor& tt,
|
||||
const vector& st
|
||||
) const
|
||||
{
|
||||
return symmTensor
|
||||
(
|
||||
tt.xx()*st.x()*tt.xx()
|
||||
+ tt.xy()*st.y()*tt.xy()
|
||||
+ tt.xz()*st.z()*tt.xz(),
|
||||
|
||||
tt.xx()*st.x()*tt.yx()
|
||||
+ tt.xy()*st.y()*tt.yy()
|
||||
+ tt.xz()*st.z()*tt.yz(),
|
||||
|
||||
tt.xx()*st.x()*tt.zx()
|
||||
+ tt.xy()*st.y()*tt.zy()
|
||||
+ tt.xz()*st.z()*tt.zz(),
|
||||
|
||||
tt.yx()*st.x()*tt.yx()
|
||||
+ tt.yy()*st.y()*tt.yy()
|
||||
+ tt.yz()*st.z()*tt.yz(),
|
||||
|
||||
tt.yx()*st.x()*tt.zx()
|
||||
+ tt.yy()*st.y()*tt.zy()
|
||||
+ tt.yz()*st.z()*tt.zz(),
|
||||
|
||||
tt.zx()*st.x()*tt.zx()
|
||||
+ tt.zy()*st.y()*tt.zy()
|
||||
+ tt.zz()*st.z()*tt.zz()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::directionalSolidThermo::transformField
|
||||
(
|
||||
symmTensorField& fld,
|
||||
const tensorField& tt,
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
fld.setSize(tt.size());
|
||||
forAll(fld, i)
|
||||
{
|
||||
fld[i] = transformPrincipal(tt[i], st[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::directionalSolidThermo::correct()
|
||||
{}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::rho() const
|
||||
{
|
||||
tmp<volScalarField> trho
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimDensity
|
||||
)
|
||||
);
|
||||
volScalarField& rho = trho();
|
||||
|
||||
rho.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
rhoValues_
|
||||
);
|
||||
|
||||
forAll(rho.boundaryField(), patchI)
|
||||
{
|
||||
rho.boundaryField()[patchI] == this->rho(patchI)();
|
||||
}
|
||||
|
||||
return trho;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::cp() const
|
||||
{
|
||||
tmp<volScalarField> tcp
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cp",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimEnergy/(dimMass*dimTemperature)
|
||||
)
|
||||
);
|
||||
volScalarField& cp = tcp();
|
||||
|
||||
cp.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
cpValues_
|
||||
);
|
||||
|
||||
forAll(cp.boundaryField(), patchI)
|
||||
{
|
||||
cp.boundaryField()[patchI] == this->cp(patchI)();
|
||||
}
|
||||
|
||||
return tcp;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volSymmTensorField> Foam::directionalSolidThermo::directionalK()
|
||||
const
|
||||
{
|
||||
tmp<volSymmTensorField> tK
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"K",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimEnergy/dimTime/(dimLength*dimTemperature)
|
||||
)
|
||||
);
|
||||
volSymmTensorField& K = tK();
|
||||
|
||||
// Get temperature interpolated properties (principal directions)
|
||||
Field<vector> localK
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
KValues_
|
||||
)
|
||||
);
|
||||
|
||||
// Transform into global coordinate system
|
||||
transformField(K.internalField(), ccTransforms_.internalField(), localK);
|
||||
|
||||
forAll(K.boundaryField(), patchI)
|
||||
{
|
||||
K.boundaryField()[patchI] == this->directionalK(patchI)();
|
||||
}
|
||||
|
||||
return tK;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::K() const
|
||||
{
|
||||
forAll(KValues_, i)
|
||||
{
|
||||
const vector& v = KValues_[i];
|
||||
if
|
||||
(
|
||||
v.x() != v.y()
|
||||
|| v.x() != v.z()
|
||||
|| v.y() != v.z()
|
||||
)
|
||||
{
|
||||
FatalErrorIn("directionalSolidThermo::K() const")
|
||||
<< "Supplied K values " << KValues_
|
||||
<< " are not isotropic." << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// Get temperature interpolated properties (principal directions)
|
||||
Field<vector> localK
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
KValues_
|
||||
)
|
||||
);
|
||||
|
||||
tmp<volScalarField> tK
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"K",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimEnergy/dimTime/(dimLength*dimTemperature)
|
||||
)
|
||||
);
|
||||
volScalarField& K = tK();
|
||||
|
||||
K.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
KValues_.component(0)()
|
||||
);
|
||||
|
||||
forAll(K.boundaryField(), patchI)
|
||||
{
|
||||
K.boundaryField()[patchI] == this->K(patchI)();
|
||||
}
|
||||
|
||||
return tK;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::Hf() const
|
||||
{
|
||||
tmp<volScalarField> tHf
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Hf",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimEnergy/dimMass
|
||||
)
|
||||
);
|
||||
volScalarField& Hf = tHf();
|
||||
|
||||
Hf.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
HfValues_
|
||||
);
|
||||
|
||||
forAll(Hf.boundaryField(), patchI)
|
||||
{
|
||||
Hf.boundaryField()[patchI] == this->Hf(patchI)();
|
||||
}
|
||||
|
||||
return tHf;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::emissivity() const
|
||||
{
|
||||
tmp<volScalarField> temissivity
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"emissivity",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimless
|
||||
)
|
||||
);
|
||||
volScalarField& emissivity = temissivity();
|
||||
|
||||
emissivity.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
emissivityValues_
|
||||
);
|
||||
|
||||
forAll(emissivity.boundaryField(), patchI)
|
||||
{
|
||||
emissivity.boundaryField()[patchI] == this->emissivity(patchI)();
|
||||
}
|
||||
|
||||
return temissivity;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::rho
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
rhoValues_
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::cp
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
cpValues_
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::K
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
forAll(KValues_, i)
|
||||
{
|
||||
const vector& v = KValues_[i];
|
||||
if
|
||||
(
|
||||
v.x() != v.y()
|
||||
|| v.x() != v.z()
|
||||
|| v.y() != v.z()
|
||||
)
|
||||
{
|
||||
FatalErrorIn("directionalSolidThermo::K() const")
|
||||
<< "Supplied K values " << KValues_
|
||||
<< " are not isotropic." << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
KValues_.component(0)()
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::symmTensorField> Foam::directionalSolidThermo::directionalK
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
const fvPatchScalarField& patchT = T_.boundaryField()[patchI];
|
||||
|
||||
Field<vector> localK(interpolateXY(patchT, TValues_, KValues_));
|
||||
|
||||
tmp<symmTensorField> tglobalK(new symmTensorField(localK.size()));
|
||||
transformField(tglobalK(), ccTransforms_.boundaryField()[patchI], localK);
|
||||
|
||||
return tglobalK;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::Hf
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
HfValues_
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::emissivity
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
emissivityValues_
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::directionalSolidThermo::read()
|
||||
{
|
||||
return read(subDict(typeName + "Coeffs"));
|
||||
}
|
||||
|
||||
|
||||
bool Foam::directionalSolidThermo::read(const dictionary& dict)
|
||||
{
|
||||
TValues_ = Field<scalar>(dict.lookup("TValues"));
|
||||
rhoValues_ = Field<scalar>(dict.lookup("rhoValues"));
|
||||
cpValues_ = Field<scalar>(dict.lookup("cpValues"));
|
||||
KValues_ = Field<vector>(dict.lookup("KValues"));
|
||||
HfValues_ = Field<scalar>(dict.lookup("HfValues"));
|
||||
emissivityValues_ = Field<scalar>(dict.lookup("emissivityValues"));
|
||||
coordSys_ = coordinateSystem(dict, mesh_);
|
||||
|
||||
Info<< "Constructed directionalSolidThermo with samples" << nl
|
||||
<< " T : " << TValues_ << nl
|
||||
<< " rho : " << rhoValues_ << nl
|
||||
<< " cp : " << cpValues_ << nl
|
||||
<< " K : " << KValues_ << nl
|
||||
<< " in coordinates system" << nl
|
||||
<< " type : " << coordSys_.type() << nl
|
||||
<< " e3 : " << coordSys_.e3() << nl
|
||||
<< " e1 : " << coordSys_.e1() << nl
|
||||
<< " Hf : " << HfValues_ << nl
|
||||
<< " emissivity : " << emissivityValues_ << nl
|
||||
<< endl;
|
||||
|
||||
|
||||
if
|
||||
(
|
||||
(TValues_.size() != rhoValues_.size())
|
||||
&& (TValues_.size() != cpValues_.size())
|
||||
&& (TValues_.size() != rhoValues_.size())
|
||||
&& (TValues_.size() != KValues_.size())
|
||||
&& (TValues_.size() != HfValues_.size())
|
||||
&& (TValues_.size() != emissivityValues_.size())
|
||||
)
|
||||
{
|
||||
FatalIOErrorIn("directionalSolidThermo::read()", dict)
|
||||
<< "Size of property tables should be equal to size of Temperature"
|
||||
<< " values " << TValues_.size()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
for (label i = 1; i < TValues_.size(); i++)
|
||||
{
|
||||
if (TValues_[i] <= TValues_[i-1])
|
||||
{
|
||||
FatalIOErrorIn("directionalSolidThermo::read()", dict)
|
||||
<< "Temperature values are not in increasing order "
|
||||
<< TValues_ << exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::directionalSolidThermo::writeData(Ostream& os) const
|
||||
{
|
||||
bool ok = basicSolidThermo::writeData(os);
|
||||
os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("emissivityValues") << emissivityValues_
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
return ok && os.good();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const directionalSolidThermo& s)
|
||||
{
|
||||
s.writeData(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,183 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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::directionalSolidThermo
|
||||
|
||||
Description
|
||||
Directional conductivity + table interpolation.
|
||||
|
||||
SourceFiles
|
||||
directionalSolidThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef directionalSolidThermo_H
|
||||
#define directionalSolidThermo_H
|
||||
|
||||
#include "basicSolidThermo.H"
|
||||
#include "coordinateSystem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class directionalSolidThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class directionalSolidThermo
|
||||
:
|
||||
public basicSolidThermo
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Temperature samples
|
||||
Field<scalar> TValues_;
|
||||
|
||||
//- Density at given temperatures
|
||||
Field<scalar> rhoValues_;
|
||||
|
||||
Field<scalar> cpValues_;
|
||||
|
||||
Field<vector> KValues_;
|
||||
|
||||
Field<scalar> HfValues_;
|
||||
|
||||
Field<scalar> emissivityValues_;
|
||||
|
||||
//- Coordinate system used for the directional properties
|
||||
coordinateSystem coordSys_;
|
||||
|
||||
//- Transformation for cell centres
|
||||
volTensorField ccTransforms_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Transform principal values of symmTensor
|
||||
symmTensor transformPrincipal(const tensor& tt, const vector& st) const;
|
||||
|
||||
//- Transform principal values of symmTensor
|
||||
void transformField
|
||||
(
|
||||
symmTensorField& fld,
|
||||
const tensorField& tt,
|
||||
const vectorField& st
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("directionalSolidThermo");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
directionalSolidThermo(const fvMesh& mesh);
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~directionalSolidThermo();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update properties
|
||||
virtual void correct();
|
||||
|
||||
//- Density [kg/m3]
|
||||
virtual tmp<volScalarField> rho() const;
|
||||
|
||||
//- Specific heat capacity [J/(kg.K)]
|
||||
virtual tmp<volScalarField> cp() const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<volScalarField> K() const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<volSymmTensorField> directionalK() const;
|
||||
|
||||
//- Heat of formation [J/kg]
|
||||
virtual tmp<volScalarField> Hf() const;
|
||||
|
||||
//- Emissivity []
|
||||
virtual tmp<volScalarField> emissivity() const;
|
||||
|
||||
|
||||
// Per patch calculation
|
||||
|
||||
//- Density [kg/m3]
|
||||
virtual tmp<scalarField> rho(const label patchI) const;
|
||||
|
||||
//- Specific heat capacity [J/(kg.K)]
|
||||
virtual tmp<scalarField> cp(const label patchI) const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
// Note: needs Kvalues to be isotropic
|
||||
virtual tmp<scalarField> K(const label patchI) const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<symmTensorField> directionalK(const label patchI) const;
|
||||
|
||||
//- Heat of formation [J/kg]
|
||||
virtual tmp<scalarField> Hf(const label patchI) const;
|
||||
|
||||
//- Emissivity []
|
||||
virtual tmp<scalarField> emissivity(const label) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write the directionalSolidThermo properties
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
|
||||
//- Read the directionalSolidThermo properties
|
||||
virtual bool read();
|
||||
|
||||
//- Read the directionalSolidThermo properties
|
||||
bool read(const dictionary& dict);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const directionalSolidThermo& s
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,501 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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 "interpolatedSolidThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "interpolateXY.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(interpolatedSolidThermo, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
basicSolidThermo,
|
||||
interpolatedSolidThermo,
|
||||
mesh
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::interpolatedSolidThermo::interpolatedSolidThermo(const fvMesh& mesh)
|
||||
:
|
||||
basicSolidThermo(mesh)
|
||||
{
|
||||
read();
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::interpolatedSolidThermo::~interpolatedSolidThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::interpolatedSolidThermo::correct()
|
||||
{}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::rho() const
|
||||
{
|
||||
tmp<volScalarField> trho
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimDensity
|
||||
)
|
||||
);
|
||||
volScalarField& rho = trho();
|
||||
|
||||
rho.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
rhoValues_
|
||||
);
|
||||
|
||||
forAll(rho.boundaryField(), patchI)
|
||||
{
|
||||
rho.boundaryField()[patchI] == this->rho(patchI)();
|
||||
}
|
||||
|
||||
return trho;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::cp() const
|
||||
{
|
||||
tmp<volScalarField> tcp
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cp",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimEnergy/(dimMass*dimTemperature)
|
||||
)
|
||||
);
|
||||
volScalarField& cp = tcp();
|
||||
|
||||
cp.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
cpValues_
|
||||
);
|
||||
|
||||
forAll(cp.boundaryField(), patchI)
|
||||
{
|
||||
cp.boundaryField()[patchI] == this->cp(patchI)();
|
||||
}
|
||||
|
||||
return tcp;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::K() const
|
||||
{
|
||||
tmp<volScalarField> tK
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"K",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimEnergy/dimTime/(dimLength*dimTemperature)
|
||||
)
|
||||
);
|
||||
volScalarField& K = tK();
|
||||
|
||||
K.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
KValues_
|
||||
);
|
||||
|
||||
forAll(K.boundaryField(), patchI)
|
||||
{
|
||||
K.boundaryField()[patchI] == this->K(patchI)();
|
||||
}
|
||||
|
||||
return tK;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::interpolatedSolidThermo::directionalK()
|
||||
const
|
||||
{
|
||||
tmp<volSymmTensorField> tK
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"K",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedSymmTensor
|
||||
(
|
||||
"zero",
|
||||
dimEnergy/dimTime/(dimLength*dimTemperature),
|
||||
symmTensor::zero
|
||||
)
|
||||
)
|
||||
);
|
||||
volSymmTensorField& K = tK();
|
||||
|
||||
Field<scalar> scalarK
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
KValues_
|
||||
)
|
||||
);
|
||||
|
||||
K.internalField().replace(symmTensor::XX, scalarK);
|
||||
K.internalField().replace(symmTensor::YY, scalarK);
|
||||
K.internalField().replace(symmTensor::ZZ, scalarK);
|
||||
|
||||
forAll(K.boundaryField(), patchI)
|
||||
{
|
||||
K.boundaryField()[patchI] == this->directionalK(patchI)();
|
||||
}
|
||||
|
||||
return tK;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::Hf() const
|
||||
{
|
||||
tmp<volScalarField> tHf
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Hf",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimEnergy/dimMass
|
||||
)
|
||||
);
|
||||
volScalarField& Hf = tHf();
|
||||
|
||||
Hf.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
HfValues_
|
||||
);
|
||||
|
||||
forAll(Hf.boundaryField(), patchI)
|
||||
{
|
||||
Hf.boundaryField()[patchI] == this->Hf(patchI)();
|
||||
}
|
||||
|
||||
return tHf;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::emissivity() const
|
||||
{
|
||||
tmp<volScalarField> temissivity
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"emissivity",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimless
|
||||
)
|
||||
);
|
||||
volScalarField& emissivity = temissivity();
|
||||
|
||||
emissivity.internalField() = interpolateXY
|
||||
(
|
||||
T_.internalField(),
|
||||
TValues_,
|
||||
emissivityValues_
|
||||
);
|
||||
|
||||
forAll(emissivity.boundaryField(), patchI)
|
||||
{
|
||||
emissivity.boundaryField()[patchI] == this->emissivity(patchI)();
|
||||
}
|
||||
|
||||
return temissivity;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::rho
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
rhoValues_
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::cp
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
cpValues_
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::K
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
KValues_
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::symmTensorField> Foam::interpolatedSolidThermo::directionalK
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
const fvPatchScalarField& patchT = T_.boundaryField()[patchI];
|
||||
|
||||
Field<scalar> scalarK(interpolateXY(patchT, TValues_, KValues_));
|
||||
|
||||
tmp<symmTensorField> tfld
|
||||
(
|
||||
new symmTensorField
|
||||
(
|
||||
scalarK.size(),
|
||||
symmTensor::zero
|
||||
)
|
||||
);
|
||||
symmTensorField& fld = tfld();
|
||||
|
||||
fld.replace(symmTensor::XX, scalarK);
|
||||
fld.replace(symmTensor::YY, scalarK);
|
||||
fld.replace(symmTensor::ZZ, scalarK);
|
||||
|
||||
return tfld;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::Hf
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
HfValues_
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::emissivity
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
T_.boundaryField()[patchI],
|
||||
TValues_,
|
||||
emissivityValues_
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::interpolatedSolidThermo::read()
|
||||
{
|
||||
return read(subDict(typeName + "Coeffs"));
|
||||
}
|
||||
|
||||
|
||||
bool Foam::interpolatedSolidThermo::read(const dictionary& dict)
|
||||
{
|
||||
TValues_ = Field<scalar>(dict.lookup("TValues"));
|
||||
rhoValues_ = Field<scalar>(dict.lookup("rhoValues"));
|
||||
cpValues_ = Field<scalar>(dict.lookup("cpValues"));
|
||||
KValues_ = Field<scalar>(dict.lookup("KValues"));
|
||||
HfValues_ = Field<scalar>(dict.lookup("HfValues"));
|
||||
emissivityValues_ = Field<scalar>(dict.lookup("emissivityValues"));
|
||||
|
||||
Info<< "Constructed interpolatedSolidThermo with samples" << nl
|
||||
<< " T : " << TValues_ << nl
|
||||
<< " rho : " << rhoValues_ << nl
|
||||
<< " cp : " << cpValues_ << nl
|
||||
<< " K : " << KValues_ << nl
|
||||
<< " Hf : " << HfValues_ << nl
|
||||
<< " emissivity : " << emissivityValues_ << nl
|
||||
<< endl;
|
||||
|
||||
if
|
||||
(
|
||||
(TValues_.size() != rhoValues_.size())
|
||||
&& (TValues_.size() != cpValues_.size())
|
||||
&& (TValues_.size() != rhoValues_.size())
|
||||
&& (TValues_.size() != KValues_.size())
|
||||
&& (TValues_.size() != HfValues_.size())
|
||||
&& (TValues_.size() != emissivityValues_.size())
|
||||
)
|
||||
{
|
||||
FatalIOErrorIn("interpolatedSolidThermo::read()", dict)
|
||||
<< "Size of property tables should be equal to size of Temperature"
|
||||
<< " values " << TValues_.size()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
for (label i = 1; i < TValues_.size(); i++)
|
||||
{
|
||||
if (TValues_[i] <= TValues_[i-1])
|
||||
{
|
||||
FatalIOErrorIn("interpolatedSolidThermo::read()", dict)
|
||||
<< "Temperature values are not in increasing order "
|
||||
<< TValues_ << exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::interpolatedSolidThermo::writeData(Ostream& os) const
|
||||
{
|
||||
bool ok = basicSolidThermo::writeData(os);
|
||||
os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("emissivityValues") << emissivityValues_
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
return ok && os.good();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const interpolatedSolidThermo& s)
|
||||
{
|
||||
s.writeData(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,161 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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::interpolatedSolidThermo
|
||||
|
||||
Description
|
||||
Table interpolated solid thermo.
|
||||
|
||||
SourceFiles
|
||||
interpolatedSolidThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef interpolatedSolidThermo_H
|
||||
#define interpolatedSolidThermo_H
|
||||
|
||||
#include "basicSolidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class interpolatedSolidThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class interpolatedSolidThermo
|
||||
:
|
||||
public basicSolidThermo
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Temperature samples
|
||||
Field<scalar> TValues_;
|
||||
|
||||
//- Density at given temperatures
|
||||
Field<scalar> rhoValues_;
|
||||
|
||||
Field<scalar> cpValues_;
|
||||
|
||||
Field<scalar> KValues_;
|
||||
|
||||
Field<scalar> HfValues_;
|
||||
|
||||
Field<scalar> emissivityValues_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("interpolatedSolidThermo");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
interpolatedSolidThermo(const fvMesh& mesh);
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~interpolatedSolidThermo();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update properties
|
||||
virtual void correct();
|
||||
|
||||
//- Density [kg/m3]
|
||||
virtual tmp<volScalarField> rho() const;
|
||||
|
||||
//- Specific heat capacity [J/(kg.K)]
|
||||
virtual tmp<volScalarField> cp() const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<volScalarField> K() const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<volSymmTensorField> directionalK() const;
|
||||
|
||||
//- Heat of formation [J/kg]
|
||||
virtual tmp<volScalarField> Hf() const;
|
||||
|
||||
//- Emissivity []
|
||||
virtual tmp<volScalarField> emissivity() const;
|
||||
|
||||
|
||||
// Per patch calculation
|
||||
|
||||
//- Density [kg/m3]
|
||||
virtual tmp<scalarField> rho(const label patchI) const;
|
||||
|
||||
//- Specific heat capacity [J/(kg.K)]
|
||||
virtual tmp<scalarField> cp(const label patchI) const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
// Note: needs Kvalues to be isotropic
|
||||
virtual tmp<scalarField> K(const label patchI) const;
|
||||
|
||||
//- Thermal conductivity [W/(m.K)]
|
||||
virtual tmp<symmTensorField> directionalK(const label patchI) const;
|
||||
|
||||
//- Heat of formation [J/kg]
|
||||
virtual tmp<scalarField> Hf(const label patchI) const;
|
||||
|
||||
//- Emissivity []
|
||||
virtual tmp<scalarField> emissivity(const label) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write the interpolatedSolidThermo properties
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
|
||||
//- Read the interpolatedSolidThermo properties
|
||||
virtual bool read();
|
||||
|
||||
//- Read the interpolatedSolidThermo properties
|
||||
bool read(const dictionary& dict);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const interpolatedSolidThermo& s
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -508,10 +508,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
|
||||
{
|
||||
const Reaction<ThermoType>& R = reactions_[i];
|
||||
|
||||
omega
|
||||
(
|
||||
R, c, Ti, pi, pf, cf, lRef, pr, cr, rRef
|
||||
);
|
||||
omega(R, c, Ti, pi, pf, cf, lRef, pr, cr, rRef);
|
||||
|
||||
forAll(R.rhs(), s)
|
||||
{
|
||||
|
||||
@ -91,7 +91,7 @@ protected:
|
||||
//- Chemistry solver
|
||||
autoPtr<chemistrySolver<CompType, ThermoType> > solver_;
|
||||
|
||||
//- Chemical source term [kg/m3/s]
|
||||
//- List of reaction rate per specie [kg/m3/s]
|
||||
PtrList<scalarField> RR_;
|
||||
|
||||
|
||||
|
||||
@ -60,10 +60,12 @@ DeardorffDiffStress::DeardorffDiffStress
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const basicThermo& thermoPhysicalModel
|
||||
const basicThermo& thermoPhysicalModel,
|
||||
const word& turbulenceModelName,
|
||||
const word& modelName
|
||||
)
|
||||
:
|
||||
LESModel(typeName, rho, U, phi, thermoPhysicalModel),
|
||||
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
|
||||
GenSGSStress(rho, U, phi, thermoPhysicalModel),
|
||||
|
||||
ck_
|
||||
|
||||
@ -101,7 +101,9 @@ public:
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const basicThermo& thermoPhysicalModel
|
||||
const basicThermo& thermoPhysicalModel,
|
||||
const word& turbulenceModelName = turbulenceModel::typeName,
|
||||
const word& modelName = typeName
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -34,6 +34,11 @@ namespace compressible
|
||||
namespace LESModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameWithName(GenEddyVisc, "GenEddyVisc");
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
GenEddyVisc::GenEddyVisc
|
||||
@ -41,13 +46,12 @@ GenEddyVisc::GenEddyVisc
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const basicThermo& thermoPhysicalModel
|
||||
const basicThermo& thermoPhysicalModel,
|
||||
const word& turbulenceModelName,
|
||||
const word& modelName
|
||||
)
|
||||
:
|
||||
LESModel
|
||||
(
|
||||
word("GenEddyVisc"), rho, U, phi, thermoPhysicalModel
|
||||
),
|
||||
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
|
||||
|
||||
ce_
|
||||
(
|
||||
|
||||
@ -82,6 +82,9 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
//- Partial Runtime type information
|
||||
static const word typeName;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
@ -90,7 +93,9 @@ public:
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const basicThermo& thermoPhysicalModel
|
||||
const basicThermo& thermoPhysicalModel,
|
||||
const word& turbulenceModelName = turbulenceModel::typeName,
|
||||
const word& modelName = typeName
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -34,6 +34,11 @@ namespace compressible
|
||||
namespace LESModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameWithName(GenSGSStress, "GenSGSStress");
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
GenSGSStress::GenSGSStress
|
||||
@ -41,17 +46,12 @@ GenSGSStress::GenSGSStress
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const basicThermo& thermoPhysicalModel
|
||||
const basicThermo& thermoPhysicalModel,
|
||||
const word& turbulenceModelName,
|
||||
const word& modelName
|
||||
)
|
||||
:
|
||||
LESModel
|
||||
(
|
||||
word("GenSGSStress"),
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermoPhysicalModel
|
||||
),
|
||||
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
|
||||
|
||||
ce_
|
||||
(
|
||||
|
||||
@ -82,6 +82,9 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
//- Partial Runtime type information
|
||||
static const word typeName;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Constructor from components
|
||||
@ -90,7 +93,9 @@ public:
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const basicThermo& thermoPhysicalModel
|
||||
const basicThermo& thermoPhysicalModel,
|
||||
const word& turbulenceModelName = turbulenceModel::typeName,
|
||||
const word& modelName = typeName
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -58,10 +58,11 @@ LESModel::LESModel
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const basicThermo& thermoPhysicalModel
|
||||
const basicThermo& thermoPhysicalModel,
|
||||
const word& turbulenceModelName
|
||||
)
|
||||
:
|
||||
turbulenceModel(rho, U, phi, thermoPhysicalModel),
|
||||
turbulenceModel(rho, U, phi, thermoPhysicalModel, turbulenceModelName),
|
||||
|
||||
IOdictionary
|
||||
(
|
||||
@ -97,7 +98,8 @@ autoPtr<LESModel> LESModel::New
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const basicThermo& thermoPhysicalModel
|
||||
const basicThermo& thermoPhysicalModel,
|
||||
const word& turbulenceModelName
|
||||
)
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
@ -129,9 +131,11 @@ autoPtr<LESModel> LESModel::New
|
||||
(
|
||||
"LESModel::New"
|
||||
"("
|
||||
"const volScalarField&, "
|
||||
"const volVectorField&, "
|
||||
"const surfaceScalarField&, "
|
||||
"const basicThermo&"
|
||||
"const basicThermo&, "
|
||||
"const word&"
|
||||
")"
|
||||
) << "Unknown LESModel type "
|
||||
<< modelType << nl << nl
|
||||
@ -140,7 +144,10 @@ autoPtr<LESModel> LESModel::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<LESModel>(cstrIter()(rho, U, phi, thermoPhysicalModel));
|
||||
return autoPtr<LESModel>
|
||||
(
|
||||
cstrIter()(rho, U, phi, thermoPhysicalModel, turbulenceModelName)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -160,7 +167,20 @@ void LESModel::correct()
|
||||
|
||||
bool LESModel::read()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
// Bit of trickery : we are both IOdictionary ('RASProperties') and
|
||||
// an regIOobject (from the turbulenceModel). Problem is to distinguish
|
||||
// between the two - we only want to reread the IOdictionary.
|
||||
|
||||
bool ok = IOdictionary::readData
|
||||
(
|
||||
IOdictionary::readStream
|
||||
(
|
||||
IOdictionary::type()
|
||||
)
|
||||
);
|
||||
IOdictionary::close();
|
||||
|
||||
if (ok)
|
||||
{
|
||||
if (const dictionary* dictPtr = subDictPtr(type() + "Coeffs"))
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user