Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2012-07-03 14:00:42 +01:00
178 changed files with 155025 additions and 5789 deletions

View File

@ -43,7 +43,7 @@ Description
#include "regionProperties.H" #include "regionProperties.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "solidRegionDiffNo.H" #include "solidRegionDiffNo.H"
#include "basicSolidThermo.H" #include "solidThermo.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "porousZones.H" #include "porousZones.H"
#include "IObasicSourceList.H" #include "IObasicSourceList.H"

View File

@ -34,7 +34,7 @@ Description
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "fixedGradientFvPatchFields.H" #include "fixedGradientFvPatchFields.H"
#include "regionProperties.H" #include "regionProperties.H"
#include "basicSolidThermo.H" #include "solidThermo.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "porousZones.H" #include "porousZones.H"
#include "IObasicSourceList.H" #include "IObasicSourceList.H"

View File

@ -1,5 +1,5 @@
// Initialise solid field pointer lists // Initialise solid field pointer lists
PtrList<basicSolidThermo> porousSolidThermos(porousSolidRegions.size()); PtrList<solidThermo> porousSolidThermos(porousSolidRegions.size());
PtrList<IObasicSourceList> solidHeatSources(porousSolidRegions.size()); PtrList<IObasicSourceList> solidHeatSources(porousSolidRegions.size());
PtrList<volScalarField> betavSolid(porousSolidRegions.size()); PtrList<volScalarField> betavSolid(porousSolidRegions.size());
@ -14,7 +14,7 @@
porousSolidThermos.set porousSolidThermos.set
( (
i, i,
basicSolidThermo::New(porousSolidRegions[i]) solidThermo::New(porousSolidRegions[i])
); );
Info<< " Adding sources\n" << endl; Info<< " Adding sources\n" << endl;
solidHeatSources.set solidHeatSources.set

View File

@ -1,6 +1,6 @@
const fvMesh& mesh = porousSolidRegions[i]; const fvMesh& mesh = porousSolidRegions[i];
basicSolidThermo& thermo = porousSolidThermos[i]; solidThermo& thermo = porousSolidThermos[i];
const volScalarField& betav = betavSolid[i]; const volScalarField& betav = betavSolid[i];
tmp<volScalarField> trho = thermo.rho(); tmp<volScalarField> trho = thermo.rho();
@ -15,9 +15,9 @@
const volScalarField& kappa = tkappa(); const volScalarField& kappa = tkappa();
//const volSymmTensorField& K = tK(); //const volSymmTensorField& K = tK();
tmp<volScalarField> trhoCp = cp*rho; tmp<volScalarField> talpha = thermo.alpha();
const volScalarField& rhoCp = trhoCp(); const volScalarField& alpha = talpha();
volScalarField& T = thermo.T(); volScalarField& h = thermo.he();
IObasicSourceList& sources = solidHeatSources[i]; IObasicSourceList& sources = solidHeatSources[i];

View File

@ -1,17 +1,17 @@
{ {
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
tmp<fvScalarMatrix> TEqn tmp<fvScalarMatrix> hEqn
( (
- fvm::laplacian(betav*kappa, T, "laplacian(K,T)") - fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)")
+ sources(rhoCp, T) + sources(rho, h)
); );
TEqn().relax(); hEqn().relax();
TEqn().solve(); hEqn().solve();
} }
Info<< "Min/max T:" << min(T).value() << ' ' << max(T).value() << endl;
} }
thermo.correct(); thermo.correct();
Info<< "Min/max T:" << min(thermo.T()) << ' ' << max(thermo.T()) << endl;

View File

@ -1,5 +1,5 @@
// Initialise solid field pointer lists // Initialise solid field pointer lists
PtrList<basicSolidThermo> thermos(solidRegions.size()); PtrList<solidThermo> thermos(solidRegions.size());
// Populate solid field pointer lists // Populate solid field pointer lists
forAll(solidRegions, i) forAll(solidRegions, i)
@ -11,6 +11,6 @@
thermos.set thermos.set
( (
i, i,
basicSolidThermo::New(solidRegions[i]) solidThermo::New(solidRegions[i])
); );
} }

View File

@ -1,5 +1,5 @@
fvMesh& mesh = solidRegions[i]; fvMesh& mesh = solidRegions[i];
basicSolidThermo& thermo = thermos[i]; solidThermo& thermo = thermos[i];
tmp<volScalarField> trho = thermo.rho(); tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho(); const volScalarField& rho = trho();
@ -11,4 +11,7 @@
//tmp<volSymmTensorField> tkappa = thermo.directionalkappa(); //tmp<volSymmTensorField> tkappa = thermo.directionalkappa();
const volScalarField& kappa = tkappa(); const volScalarField& kappa = tkappa();
volScalarField& T = thermo.T(); tmp<volScalarField> talpha = thermo.alpha();
const volScalarField& alpha = talpha();
volScalarField& h = thermo.he();

View File

@ -1,16 +1,15 @@
{ {
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix tEqn fvScalarMatrix hEqn
( (
-fvm::laplacian(kappa, T) -fvm::laplacian(alpha, h)
); );
tEqn.relax(); hEqn.relax();
tEqn.solve(); hEqn.solve();
} }
Info<< "Min/max T:" << min(T).value() << ' '
<< max(T).value() << endl;
} }
thermo.correct(); thermo.correct();
Info<< "Min/max T:" << min(thermo.T()) << ' ' << max(thermo.T()) << endl;

View File

@ -1,5 +1,5 @@
// Initialise solid field pointer lists // Initialise solid field pointer lists
PtrList<basicSolidThermo> porousSolidThermos(porousSolidRegions.size()); PtrList<solidThermo> porousSolidThermos(porousSolidRegions.size());
PtrList<IObasicSourceList> solidHeatSources(porousSolidRegions.size()); PtrList<IObasicSourceList> solidHeatSources(porousSolidRegions.size());
PtrList<volScalarField> betavSolid(porousSolidRegions.size()); PtrList<volScalarField> betavSolid(porousSolidRegions.size());
@ -14,7 +14,7 @@
porousSolidThermos.set porousSolidThermos.set
( (
i, i,
basicSolidThermo::New(porousSolidRegions[i]) solidThermo::New(porousSolidRegions[i])
); );
Info<< " Adding sources\n" << endl; Info<< " Adding sources\n" << endl;
solidHeatSources.set solidHeatSources.set

View File

@ -1,6 +1,6 @@
fvMesh& mesh = porousSolidRegions[i]; fvMesh& mesh = porousSolidRegions[i];
basicSolidThermo& thermo = porousSolidThermos[i]; solidThermo& thermo = porousSolidThermos[i];
const volScalarField& betav = betavSolid[i]; const volScalarField& betav = betavSolid[i];
tmp<volScalarField> trho = thermo.rho(); tmp<volScalarField> trho = thermo.rho();
@ -15,9 +15,12 @@
const volScalarField& kappa = tkappa(); const volScalarField& kappa = tkappa();
//const volSymmTensorField& K = tK(); //const volSymmTensorField& K = tK();
tmp<volScalarField> trhoCp = cp*rho; //tmp<volScalarField> trhoCp = cp*rho;
const volScalarField& rhoCp = trhoCp(); //const volScalarField& rhoCp = trhoCp();
volScalarField& T = thermo.T(); tmp<volScalarField> talpha = thermo.alpha();
const volScalarField& alpha = talpha();
volScalarField& h = thermo.he();
IObasicSourceList& sources = solidHeatSources[i]; IObasicSourceList& sources = solidHeatSources[i];

View File

@ -6,22 +6,22 @@ if (finalIter)
{ {
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
tmp<fvScalarMatrix> TEqn tmp<fvScalarMatrix> hEqn
( (
fvm::ddt(betav*rho*cp, T) fvm::ddt(betav*rho, h)
- fvm::laplacian(betav*kappa, T, "laplacian(K,T)") - fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)")
+ sources(rhoCp, T) + sources(rho, h)
); );
TEqn().relax(); hEqn().relax();
TEqn().solve(mesh.solver(T.select(finalIter))); hEqn().solve(mesh.solver(h.select(finalIter)));
} }
Info<< "Min/max T:" << min(T).value() << ' ' << max(T).value() << endl;
} }
thermo.correct(); thermo.correct();
Info<< "Min/max T:" << min(thermo.T()) << ' ' << max(thermo.T()) << endl;
if (finalIter) if (finalIter)
{ {
mesh.data::remove("finalIteration"); mesh.data::remove("finalIteration");

View File

@ -1,5 +1,5 @@
// Initialise solid field pointer lists // Initialise solid field pointer lists
PtrList<basicSolidThermo> thermos(solidRegions.size()); PtrList<solidThermo> thermos(solidRegions.size());
// Populate solid field pointer lists // Populate solid field pointer lists
forAll(solidRegions, i) forAll(solidRegions, i)
@ -8,5 +8,5 @@
<< solidRegions[i].name() << nl << endl; << solidRegions[i].name() << nl << endl;
Info<< " Adding to thermos\n" << endl; Info<< " Adding to thermos\n" << endl;
thermos.set(i, basicSolidThermo::New(solidRegions[i])); thermos.set(i, solidThermo::New(solidRegions[i]));
} }

View File

@ -1,5 +1,5 @@
fvMesh& mesh = solidRegions[i]; fvMesh& mesh = solidRegions[i];
basicSolidThermo& thermo = thermos[i]; solidThermo& thermo = thermos[i];
tmp<volScalarField> trho = thermo.rho(); tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho(); const volScalarField& rho = trho();
@ -7,9 +7,12 @@
tmp<volScalarField> tcp = thermo.Cp(); tmp<volScalarField> tcp = thermo.Cp();
const volScalarField& cp = tcp(); const volScalarField& cp = tcp();
tmp<volScalarField> talpha = thermo.alpha();
const volScalarField& alpha = talpha();
tmp<volScalarField> tkappa = thermo.kappa(); tmp<volScalarField> tkappa = thermo.kappa();
const volScalarField& kappa = tkappa(); const volScalarField& kappa = tkappa();
//tmp<volSymmTensorField> tkappa = thermo.directionalKappa(); //tmp<volSymmTensorField> tkappa = thermo.directionalKappa();
//const volSymmTensorField& kappa = tkappa(); //const volSymmTensorField& kappa = tkappa();
volScalarField& T = thermo.T(); volScalarField& h = thermo.he();

View File

@ -6,20 +6,20 @@ if (finalIter)
{ {
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
tmp<fvScalarMatrix> TEqn tmp<fvScalarMatrix> hEqn
( (
fvm::ddt(rho*cp, T) fvm::ddt(rho, h)
- fvm::laplacian(kappa, T) - fvm::laplacian(alpha, h)
); );
TEqn().relax(); hEqn().relax();
TEqn().solve(mesh.solver(T.select(finalIter))); hEqn().solve(mesh.solver(h.select(finalIter)));
} }
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
} }
thermo.correct(); thermo.correct();
Info<< "Min/max T:" << min(thermo.T()) << ' ' << max(thermo.T()) << endl;
if (finalIter) if (finalIter)
{ {
mesh.data::remove("finalIteration"); mesh.data::remove("finalIteration");

View File

@ -51,7 +51,7 @@ void noPyrolysis::constructThermoChemistry()
solidChemistryModel::New(regionMesh()).ptr() solidChemistryModel::New(regionMesh()).ptr()
); );
solidThermo_.reset(&solidChemistry_->solidThermo()); solidThermo_.reset(&solidChemistry_->solid());
} }
bool noPyrolysis::read() bool noPyrolysis::read()
@ -151,13 +151,13 @@ const tmp<volScalarField> noPyrolysis::Cp() const
} }
const volScalarField& noPyrolysis::kappaRad() const tmp<volScalarField> noPyrolysis::kappaRad() const
{ {
return (solidThermo_->kappaRad()); return (solidThermo_->kappaRad());
} }
const volScalarField& noPyrolysis::kappa() const tmp<volScalarField> noPyrolysis::kappa() const
{ {
return (solidThermo_->kappa()); return (solidThermo_->kappa());
} }

View File

@ -37,6 +37,7 @@ SourceFiles
#include "pyrolysisModel.H" #include "pyrolysisModel.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "solidChemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -83,7 +84,7 @@ protected:
autoPtr<solidChemistryModel> solidChemistry_; autoPtr<solidChemistryModel> solidChemistry_;
//- Reference to solid thermo //- Reference to solid thermo
autoPtr<basicSolidThermo> solidThermo_; autoPtr<solidReactionThermo> solidThermo_;
public: public:
@ -124,10 +125,10 @@ public:
virtual const tmp<volScalarField> Cp() const; virtual const tmp<volScalarField> Cp() const;
//- Return the region absorptivity [1/m] //- Return the region absorptivity [1/m]
virtual const volScalarField& kappaRad() const; virtual tmp<volScalarField> kappaRad() const;
//- Return the region thermal conductivity [W/m/k] //- Return the region thermal conductivity [W/m/k]
virtual const volScalarField& kappa() const; virtual tmp<volScalarField> kappa() const;
//- Return the total gas mass flux to primary region [kg/m2/s] //- Return the total gas mass flux to primary region [kg/m2/s]
virtual const surfaceScalarField& phiGas() const; virtual const surfaceScalarField& phiGas() const;

View File

@ -37,8 +37,6 @@ SourceFiles
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "solidChemistryModel.H"
#include "basicSolidThermo.H"
#include "regionModel1D.H" #include "regionModel1D.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -218,10 +216,10 @@ public:
virtual const tmp<volScalarField> Cp() const = 0; virtual const tmp<volScalarField> Cp() const = 0;
//- Return the region absorptivity [1/m] //- Return the region absorptivity [1/m]
virtual const volScalarField& kappaRad() const = 0; virtual tmp<volScalarField> kappaRad() const = 0;
//- Return the region thermal conductivity [W/m/k] //- Return the region thermal conductivity [W/m/k]
virtual const volScalarField& kappa() const = 0; virtual tmp<volScalarField> kappa() const = 0;
//- Return the total gas mass flux to primary region [kg/m2/s] //- Return the total gas mass flux to primary region [kg/m2/s]
virtual const surfaceScalarField& phiGas() const = 0; virtual const surfaceScalarField& phiGas() const = 0;

View File

@ -54,7 +54,7 @@ void reactingOneDim::readReactingOneDimControls()
{ {
const dictionary& solution = this->solution().subDict("SIMPLE"); const dictionary& solution = this->solution().subDict("SIMPLE");
solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; solution.lookup("nNonOrthCorr") >> nNonOrthCorr_;
time_.controlDict().lookup("maxDi") >> maxDiff_; time().controlDict().lookup("maxDi") >> maxDiff_;
coeffs().lookup("radFluxName") >> primaryRadFluxName_; coeffs().lookup("radFluxName") >> primaryRadFluxName_;
coeffs().lookup("minimumDelta") >> minimumDelta_; coeffs().lookup("minimumDelta") >> minimumDelta_;
@ -107,6 +107,8 @@ void reactingOneDim::updateQr()
Qrp = max(Qrp, scalar(0.0)); Qrp = max(Qrp, scalar(0.0));
} }
const volScalarField kappaRad_(kappaRad());
// Propagate Qr through 1-D regions // Propagate Qr through 1-D regions
forAll(intCoupledPatchIDs_, i) forAll(intCoupledPatchIDs_, i)
{ {
@ -147,18 +149,17 @@ void reactingOneDim::updatePhiGas()
forAll(gasTable, gasI) forAll(gasTable, gasI)
{ {
tmp<volScalarField> tHsiGas = tmp<volScalarField> tHsiGas =
solidChemistry_->gasHs(p, T_, gasI); solidChemistry_->gasHs(solidThermo_.p(), solidThermo_.T(), gasI);
tmp<volScalarField> tRRiGas = solidChemistry_->RRg(gasI); tmp<volScalarField> tRRiGas = solidChemistry_->RRg(gasI);
const volScalarField& HsiGas = tHsiGas(); const volScalarField& HsiGas = tHsiGas();
const volScalarField& RRiGas = tRRiGas(); const volScalarField& RRiGas = tRRiGas();
const surfaceScalarField HsiGasf(fvc::interpolate(HsiGas));
const surfaceScalarField RRiGasf(fvc::interpolate(RRiGas));
forAll(intCoupledPatchIDs_, i) forAll(intCoupledPatchIDs_, i)
{ {
const label patchI = intCoupledPatchIDs_[i]; const label patchI = intCoupledPatchIDs_[i];
const scalarField& phiGasp = phiHsGas_.boundaryField()[patchI]; const scalarField& phiGasp = phiHsGas_.boundaryField()[patchI];
forAll(phiGasp, faceI) forAll(phiGasp, faceI)
@ -286,16 +287,16 @@ void reactingOneDim::solveEnergy()
Info<< "reactingOneDim::solveEnergy()" << endl; Info<< "reactingOneDim::solveEnergy()" << endl;
} }
const volScalarField rhoCp(rho_*solidThermo_.Cp()); tmp<volScalarField> alpha(solidThermo_.alpha());
const surfaceScalarField phiQr(fvc::interpolate(Qr_)*nMagSf()); const surfaceScalarField phiQr(fvc::interpolate(Qr_)*nMagSf());
const surfaceScalarField phiGas(fvc::interpolate(phiHsGas_)); const surfaceScalarField phiGas(fvc::interpolate(phiHsGas_));
fvScalarMatrix TEqn fvScalarMatrix hEqn
( (
fvm::ddt(rhoCp, T_) fvm::ddt(rho_, h_)
- fvm::laplacian(kappa_, T_) - fvm::laplacian(alpha, h_)
== ==
chemistrySh_ chemistrySh_
+ fvc::div(phiQr) + fvc::div(phiQr)
@ -306,17 +307,17 @@ void reactingOneDim::solveEnergy()
{ {
surfaceScalarField phiMesh surfaceScalarField phiMesh
( (
fvc::interpolate(rhoCp*T_)*regionMesh().phi() fvc::interpolate(rho_*h_)*regionMesh().phi()
); );
TEqn -= fvc::div(phiMesh); hEqn -= fvc::div(phiMesh);
} }
TEqn.relax(); hEqn.relax();
TEqn.solve(); hEqn.solve();
Info<< "pyrolysis min/max(T) = " << min(T_).value() << ", " Info<< "pyrolysis min/max(T) = " << min(solidThermo_.T()) << ", "
<< max(T_).value() << endl; << max(solidThermo_.T()) << endl;
} }
@ -347,12 +348,10 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh)
: :
pyrolysisModel(modelType, mesh), pyrolysisModel(modelType, mesh),
solidChemistry_(solidChemistryModel::New(regionMesh())), solidChemistry_(solidChemistryModel::New(regionMesh())),
solidThermo_(solidChemistry_->solidThermo()), solidThermo_(solidChemistry_->solid()),
kappaRad_(solidThermo_.kappaRad()), rho_(solidThermo_.rhos()),
kappa_(solidThermo_.kappa()),
rho_(solidThermo_.rho()),
Ys_(solidThermo_.composition().Y()), Ys_(solidThermo_.composition().Y()),
T_(solidThermo_.T()), h_(solidThermo_.he()),
primaryRadFluxName_(coeffs().lookupOrDefault<word>("radFluxName", "Qr")), primaryRadFluxName_(coeffs().lookupOrDefault<word>("radFluxName", "Qr")),
nNonOrthCorr_(-1), nNonOrthCorr_(-1),
maxDiff_(10), maxDiff_(10),
@ -449,12 +448,10 @@ reactingOneDim::reactingOneDim
: :
pyrolysisModel(modelType, mesh, dict), pyrolysisModel(modelType, mesh, dict),
solidChemistry_(solidChemistryModel::New(regionMesh())), solidChemistry_(solidChemistryModel::New(regionMesh())),
solidThermo_(solidChemistry_->solidThermo()), solidThermo_(solidChemistry_->solid()),
kappaRad_(solidThermo_.kappaRad()), rho_(solidThermo_.rhos()),
kappa_(solidThermo_.kappa()),
rho_(solidThermo_.rho()),
Ys_(solidThermo_.composition().Y()), Ys_(solidThermo_.composition().Y()),
T_(solidThermo_.T()), h_(solidThermo_.he()),
primaryRadFluxName_(dict.lookupOrDefault<word>("radFluxName", "Qr")), primaryRadFluxName_(dict.lookupOrDefault<word>("radFluxName", "Qr")),
nNonOrthCorr_(-1), nNonOrthCorr_(-1),
maxDiff_(10), maxDiff_(10),
@ -585,11 +582,11 @@ scalar reactingOneDim::solidRegionDiffNo() const
surfaceScalarField KrhoCpbyDelta surfaceScalarField KrhoCpbyDelta
( (
regionMesh().surfaceInterpolation::deltaCoeffs() regionMesh().surfaceInterpolation::deltaCoeffs()
* fvc::interpolate(kappa_) * fvc::interpolate(kappa())
/ fvc::interpolate(Cp()*rho_) / fvc::interpolate(Cp()*rho_)
); );
DiNum = max(KrhoCpbyDelta.internalField())*time_.deltaTValue(); DiNum = max(KrhoCpbyDelta.internalField())*time().deltaTValue();
} }
return DiNum; return DiNum;
@ -610,7 +607,7 @@ const volScalarField& reactingOneDim::rho() const
const volScalarField& reactingOneDim::T() const const volScalarField& reactingOneDim::T() const
{ {
return T_; return solidThermo_.T();
} }
@ -620,15 +617,15 @@ const tmp<volScalarField> reactingOneDim::Cp() const
} }
const volScalarField& reactingOneDim::kappaRad() const tmp<volScalarField> reactingOneDim::kappaRad() const
{ {
return kappaRad_; return solidThermo_.kappaRad();
} }
const volScalarField& reactingOneDim::kappa() const tmp<volScalarField> reactingOneDim::kappa() const
{ {
return kappa_; return solidThermo_.kappa();
} }
@ -643,7 +640,7 @@ void reactingOneDim::preEvolveRegion()
pyrolysisModel::preEvolveRegion(); pyrolysisModel::preEvolveRegion();
// Initialise all cells as able to react // Initialise all cells as able to react
forAll(T_, cellI) forAll(h_, cellI)
{ {
solidChemistry_->setCellReacting(cellI, true); solidChemistry_->setCellReacting(cellI, true);
} }

View File

@ -36,6 +36,7 @@ SourceFiles
#define reactingOneDim_H #define reactingOneDim_H
#include "pyrolysisModel.H" #include "pyrolysisModel.H"
#include "solidChemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -78,16 +79,16 @@ protected:
autoPtr<solidChemistryModel> solidChemistry_; autoPtr<solidChemistryModel> solidChemistry_;
//- Reference to solid thermo //- Reference to solid thermo
basicSolidThermo& solidThermo_; solidReactionThermo& solidThermo_;
// Reference to solid thermo properties // Reference to solid thermo properties
//- Absorption coefficient [1/m] // //- Absorption coefficient [1/m]
const volScalarField& kappaRad_; // const volScalarField& kappaRad_;
//
//- Thermal conductivity [W/m/K] // //- Thermal conductivity [W/m/K]
const volScalarField& kappa_; // const volScalarField& kappa_;
//- Density [kg/m3] //- Density [kg/m3]
volScalarField& rho_; volScalarField& rho_;
@ -96,7 +97,7 @@ protected:
PtrList<volScalarField>& Ys_; PtrList<volScalarField>& Ys_;
// Non-const access to temperature // Non-const access to temperature
volScalarField& T_; volScalarField& h_;
//- Name of the radiative flux in the primary region //- Name of the radiative flux in the primary region
@ -230,10 +231,10 @@ public:
virtual const tmp<volScalarField> Cp() const; virtual const tmp<volScalarField> Cp() const;
//- Return the region absorptivity [1/m] //- Return the region absorptivity [1/m]
virtual const volScalarField& kappaRad() const; virtual tmp<volScalarField> kappaRad() const;
//- Return the region thermal conductivity [W/m/k] //- Return the region thermal conductivity [W/m/k]
virtual const volScalarField& kappa() const; virtual tmp<volScalarField> kappa() const;
//- Return the total gas mass flux to primary region [kg/m2/s] //- Return the total gas mass flux to primary region [kg/m2/s]
virtual const surfaceScalarField& phiGas() const; virtual const surfaceScalarField& phiGas() const;

View File

@ -222,9 +222,8 @@ void temperatureThermoBaffleFvPatchScalarField::write(Ostream& os) const
os.writeKeyword("thermoType") << solidThermoType_ os.writeKeyword("thermoType") << solidThermoType_
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
os.writeKeyword(word(solidThermoType_ + "Coeffs")); os.writeKeyword("mixture");
os << dict_.subDict("mixture") << nl;
os << dict_.subDict(solidThermoType_ + "Coeffs") << nl;
} }
} }

View File

@ -25,10 +25,13 @@ Class
Foam::temperatureThermoBaffleFvPatchScalarField Foam::temperatureThermoBaffleFvPatchScalarField
Description Description
Thermal bounday applied to both sides of the thermal baffle region and Thermal boundary applied to both sides:the baffle region and
in the primary region. in the primary region.
The primary region creates and evolves the thermal baffle heat transfer
equation. The solid thermo and baffle dictionaries are located on the The primary region creates it and evolves the thermal baffle heat transfer
equation.
The solid thermo and baffle dictionaries are located on the
primary region. primary region.
type compressible::temperatureThermoBaffle; type compressible::temperatureThermoBaffle;
@ -50,22 +53,44 @@ Description
// Solid thermo // Solid thermo
thermoType constSolidThermo; thermoType
heSolidThermo
<pureSolidMixture
<constIsoSolidTransport
<constSolidRad
<specieThermo
<constSolidThermo<constRho>,sensibleEnthalpy>
>
>
>
>;
constSolidThermoCoeffs mixture
{ {
//- thermo properties specie
rho rho [1 -3 0 0 0 0 0] 80; {
Cp Cp [0 2 -2 -1 0 0 0] 15; nMoles 1;
kappa kappa [1 1 -3 -1 0 0 0] 0.01; molWeight 20;
}
//- radiative properties transport
kappaRad kappaRad [0 -1 0 0 0 0 0] 0; {
sigmaS sigmaS [0 -1 0 0 0 0 0] 0; kappa 0.01;
emissivity emissivity [0 0 0 0 0 0 0] 1; }
radiation
//- chemical properties {
Hf Hf [0 2 -2 0 0 0 0] 0; sigmaS 0;
kappaRad 0;
emissivity 1;
}
thermodynamics
{
Hf 0;
Cp 15;
}
density
{
rho 80;
}
} }
value uniform 300; value uniform 300;

View File

@ -39,7 +39,9 @@ namespace thermoBaffleModels
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(noThermo, 0); defineTypeNameAndDebug(noThermo, 0);
addToRunTimeSelectionTable(thermoBaffleModel, noThermo, mesh); addToRunTimeSelectionTable(thermoBaffleModel, noThermo, mesh);
addToRunTimeSelectionTable(thermoBaffleModel, noThermo, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -56,6 +58,18 @@ noThermo::noThermo(const word& modelType, const fvMesh& mesh)
thermoBaffleModel(mesh) thermoBaffleModel(mesh)
{} {}
noThermo::noThermo
(
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
thermoBaffleModel(modelType, mesh, dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
noThermo::~noThermo() noThermo::~noThermo()
@ -127,11 +141,11 @@ const volScalarField& noThermo::T() const
} }
const basicSolidThermo& noThermo::thermo() const const solidThermo& noThermo::thermo() const
{ {
FatalErrorIn("const volScalarField& noThermo::T() const") FatalErrorIn("const volScalarField& noThermo::T() const")
<< "T field not available for " << type() << abort(FatalError); << "T field not available for " << type() << abort(FatalError);
return reinterpret_cast<const basicSolidThermo&>(null); return reinterpret_cast<const solidThermo&>(null);
} }

View File

@ -85,6 +85,15 @@ public:
//- Construct from type name and mesh //- Construct from type name and mesh
noThermo(const word& modelType, const fvMesh& mesh); noThermo(const word& modelType, const fvMesh& mesh);
//- Construct from components and dict
noThermo
(
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor //- Destructor
virtual ~noThermo(); virtual ~noThermo();
@ -96,7 +105,7 @@ public:
// Thermo properties // Thermo properties
//- Return const reference to the basicSolidThermo //- Return const reference to the basicSolidThermo
virtual const basicSolidThermo& thermo() const; virtual const solidThermo& thermo() const;
// Fields // Fields

View File

@ -95,8 +95,8 @@ void thermoBaffle2D::solveEnergy()
volScalarField& Q = tQ(); volScalarField& Q = tQ();
volScalarField rhoCp("rhoCp", thermo_->rho()*thermo_->Cp()()); volScalarField rho("rho", thermo_->rho());
volScalarField kappa("kappa", thermo_->kappa()); volScalarField alpha("alpha", thermo_->alpha());
//If region is one-dimension variable thickness //If region is one-dimension variable thickness
@ -117,9 +117,9 @@ void thermoBaffle2D::solveEnergy()
Qs_.boundaryField()[patchI][localFaceI] Qs_.boundaryField()[patchI][localFaceI]
/thickness_[localFaceI]; /thickness_[localFaceI];
rhoCp[cellId] *= delta_.value()/thickness_[localFaceI]; rho[cellId] *= delta_.value()/thickness_[localFaceI];
kappa[cellId] *= delta_.value()/thickness_[localFaceI]; alpha[cellId] *= delta_.value()/thickness_[localFaceI];
} }
} }
} }
@ -128,10 +128,10 @@ void thermoBaffle2D::solveEnergy()
Q = Q_; Q = Q_;
} }
fvScalarMatrix TEqn fvScalarMatrix hEqn
( (
fvm::ddt(rhoCp, T_) fvm::ddt(rho, h_)
- fvm::laplacian(kappa, T_) - fvm::laplacian(alpha, h_)
== ==
Q Q
); );
@ -140,19 +140,19 @@ void thermoBaffle2D::solveEnergy()
{ {
surfaceScalarField phiMesh surfaceScalarField phiMesh
( (
fvc::interpolate(rhoCp*T_)*regionMesh().phi() fvc::interpolate(rho*h_)*regionMesh().phi()
); );
TEqn -= fvc::div(phiMesh); hEqn -= fvc::div(phiMesh);
} }
TEqn.relax(); hEqn.relax();
TEqn.solve(); hEqn.solve();
Info<< "T gas min/max = " << min(T_).value() << ", "
<< max(T_).value() << endl;
thermo_->correct(); thermo_->correct();
Info<< "T min/max = " << min(thermo_->T()) << ", "
<< max(thermo_->T()) << endl;
} }
@ -168,8 +168,8 @@ thermoBaffle2D::thermoBaffle2D
: :
thermoBaffleModel(modelType, mesh, dict), thermoBaffleModel(modelType, mesh, dict),
nNonOrthCorr_(readLabel(solution().lookup("nNonOrthCorr"))), nNonOrthCorr_(readLabel(solution().lookup("nNonOrthCorr"))),
thermo_(basicSolidThermo::New(regionMesh(), dict)), thermo_(solidThermo::New(regionMesh(), dict)),
T_(thermo_->T()), h_(thermo_->he()),
Qs_ Qs_
( (
IOobject IOobject
@ -220,8 +220,8 @@ thermoBaffle2D::thermoBaffle2D
: :
thermoBaffleModel(modelType, mesh), thermoBaffleModel(modelType, mesh),
nNonOrthCorr_(readLabel(solution().lookup("nNonOrthCorr"))), nNonOrthCorr_(readLabel(solution().lookup("nNonOrthCorr"))),
thermo_(basicSolidThermo::New(regionMesh())), thermo_(solidThermo::New(regionMesh())),
T_(thermo_->T()), h_(thermo_->he()),
Qs_ Qs_
( (
IOobject IOobject
@ -336,11 +336,11 @@ const volScalarField& thermoBaffle2D::kappa() const
const volScalarField& thermoBaffle2D::T() const const volScalarField& thermoBaffle2D::T() const
{ {
return T_; return thermo_->T();
} }
const basicSolidThermo& thermoBaffle2D::thermo() const const solidThermo& thermoBaffle2D::thermo() const
{ {
return thermo_; return thermo_;
} }
@ -348,21 +348,18 @@ const basicSolidThermo& thermoBaffle2D::thermo() const
void thermoBaffle2D::info() const void thermoBaffle2D::info() const
{ {
Info<< indent << "min/max(T) = " << min(T_).value() << ", "
<< max(T_).value() << nl;
const labelList& coupledPatches = intCoupledPatchIDs(); const labelList& coupledPatches = intCoupledPatchIDs();
forAll (coupledPatches, i) forAll (coupledPatches, i)
{ {
const label patchI = coupledPatches[i]; const label patchI = coupledPatches[i];
const fvPatchScalarField& pT = T_.boundaryField()[patchI]; const fvPatchScalarField& ph = h_.boundaryField()[patchI];
const word patchName = regionMesh().boundary()[patchI].name(); const word patchName = regionMesh().boundary()[patchI].name();
Info << indent << "Q : " << patchName << indent << Info << indent << "Q : " << patchName << indent <<
gSum gSum
( (
mag(regionMesh().Sf().boundaryField()[patchI]) mag(regionMesh().Sf().boundaryField()[patchI])
* pT.snGrad() * ph.snGrad()
* thermo_->kappa(patchI) * thermo_->alpha(patchI)
) << endl; ) << endl;
} }
} }

View File

@ -85,10 +85,10 @@ protected:
// Thermo properties // Thermo properties
//- Solid thermo //- Solid thermo
autoPtr<basicSolidThermo> thermo_; autoPtr<solidThermo> thermo_;
//- Temperature / [K] //- Enthalpy/internal energy
volScalarField& T_; volScalarField& h_;
// Source term fields // Source term fields
@ -145,8 +145,8 @@ public:
// Thermo properties // Thermo properties
//- Return const reference to the basicSolidThermo //- Return const reference to the solidThermo
virtual const basicSolidThermo& thermo() const; virtual const solidThermo& thermo() const;
// Fields // Fields
@ -157,7 +157,7 @@ public:
//- Return solid absortivity [1/m] //- Return solid absortivity [1/m]
virtual const volScalarField& kappaRad() const; virtual const volScalarField& kappaRad() const;
//- Return the film mean temperature [K] //- Return temperature [K]
virtual const volScalarField& T() const; virtual const volScalarField& T() const;
//- Return density [Kg/m3] //- Return density [Kg/m3]
@ -169,26 +169,18 @@ public:
// Helper functions // Helper functions
//- Return sensible enthalpy as a function of temperature //- Return sensible enthalpy/internal energy
// as a function of temperature
// for a patch // for a patch
inline tmp<scalarField> hs inline tmp<scalarField> he
( (
const scalarField& p,
const scalarField& T, const scalarField& T,
const label patchI const label patchI
) const; ) const;
//- Return sensible enthalpy as a function of temperature //- Return sensible enthalpy/internal energy
inline tmp<volScalarField> hs inline tmp<volScalarField> he() const;
(
const volScalarField& T
) const;
//- Return temperature as a function of sensible enthalpy
inline tmp<volScalarField> T
(
const volScalarField& hs
) const;
// Evolution // Evolution

View File

@ -39,64 +39,20 @@ namespace thermoBaffleModels
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline tmp<scalarField> thermoBaffle2D::hs inline tmp<scalarField> thermoBaffle2D::he
( (
const scalarField& p,
const scalarField& T, const scalarField& T,
const label patchI const label patchI
) const ) const
{ {
const scalarField Cp(thermo_->Cp(patchI)); return thermo_->he(p, T, patchI);
return Cp*(T - 298.15);
} }
inline tmp<volScalarField> thermoBaffle2D::hs inline tmp<volScalarField> thermoBaffle2D::he() const
(
const volScalarField& T
) const
{ {
const volScalarField Cp = thermo_->Cp()(); return thermo_->he();
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"hs(" + T.name() + ")",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
Cp*(T - (dimensionedScalar("Tstd", dimTemperature, 298.15))),
zeroGradientFvPatchScalarField::typeName
)
);
}
inline tmp<volScalarField> thermoBaffle2D::T
(
const volScalarField& hs
) const
{
const volScalarField Cp = thermo_->Cp()();
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"T(" + hs.name() + ")",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
hs/Cp + dimensionedScalar("Tstd", dimTemperature, 298.15),
zeroGradientFvPatchScalarField::typeName
)
);
} }

View File

@ -38,7 +38,7 @@ SourceFiles
#include "scalarIOField.H" #include "scalarIOField.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "basicSolidThermo.H" #include "solidThermo.H"
#include "regionModel1D.H" #include "regionModel1D.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -172,7 +172,7 @@ public:
// Access // Access
//- Return solid thermo //- Return solid thermo
virtual const basicSolidThermo& thermo() const = 0; virtual const solidThermo& thermo() const = 0;
//- Return thickness //- Return thickness
const scalarField& thickness() const const scalarField& thickness() const

View File

@ -1,7 +1,7 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude
-I/home/tom3/sergio/development/chtMultiRegionCoupledFoam/lnInclude
LIB_LIBS = \ LIB_LIBS = \
-lfiniteVolume \ -lfiniteVolume \

View File

@ -40,7 +40,7 @@ namespace Foam
defineTypeNameAndDebug(basicThermo, 0); defineTypeNameAndDebug(basicThermo, 0);
defineRunTimeSelectionTable(basicThermo, fvMesh); defineRunTimeSelectionTable(basicThermo, fvMesh);
} }
/*
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::wordList Foam::basicThermo::heBoundaryTypes() Foam::wordList Foam::basicThermo::heBoundaryTypes()
@ -95,7 +95,7 @@ void Foam::basicThermo::heBoundaryCorrection(volScalarField& h)
} }
} }
} }
*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -183,6 +183,92 @@ Foam::basicThermo::basicThermo(const fvMesh& mesh)
{} {}
Foam::basicThermo::basicThermo(const fvMesh& mesh, const dictionary& dict)
:
IOdictionary
(
IOobject
(
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
dict
),
p_
(
IOobject
(
"p",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
),
psi_
(
IOobject
(
"psi",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionSet(0, -2, 2, 0, 0)
),
T_
(
IOobject
(
"T",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
),
mu_
(
IOobject
(
"mu",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionSet(1, -1, -1, 0, 0)
),
alpha_
(
IOobject
(
"alpha",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionSet(1, -1, -1, 0, 0)
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::basicThermo::~basicThermo() Foam::basicThermo::~basicThermo()

View File

@ -77,18 +77,6 @@ protected:
volScalarField alpha_; volScalarField alpha_;
// Protected Member Functions
// Enthalpy/Internal energy
//- Return the enthalpy/internal energy field boundary types
// by interrogating the temperature field boundary types
wordList heBoundaryTypes();
//- Correct the enthalpy/internal energy field boundaries
void heBoundaryCorrection(volScalarField& he);
//- Construct as copy (not implemented) //- Construct as copy (not implemented)
basicThermo(const basicThermo&); basicThermo(const basicThermo&);
@ -114,6 +102,9 @@ public:
//- Construct from mesh //- Construct from mesh
basicThermo(const fvMesh&); basicThermo(const fvMesh&);
//- Construct from mesh
basicThermo(const fvMesh&, const dictionary&);
//- Selector //- Selector
static autoPtr<basicThermo> New(const fvMesh&); static autoPtr<basicThermo> New(const fvMesh&);

View File

@ -23,11 +23,11 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fixedEnergyFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "volFields.H" #include "volFields.H"
#include "basicThermo.H" #include "basicThermo.H"
#include "addToRunTimeSelectionTable.H"
#include "fixedEnergyFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -102,6 +102,7 @@ void Foam::fixedEnergyFvPatchScalarField::updateCoeffs()
"thermophysicalProperties" "thermophysicalProperties"
); );
const label patchi = patch().index(); const label patchi = patch().index();
const scalarField& pw = thermo.p().boundaryField()[patchi]; const scalarField& pw = thermo.p().boundaryField()[patchi];

View File

@ -134,6 +134,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -24,29 +24,75 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "heThermo.H" #include "heThermo.H"
#include "zeroGradientFvPatchFields.H"
#include "fixedEnergyFvPatchScalarField.H"
#include "gradientEnergyFvPatchScalarField.H"
#include "mixedEnergyFvPatchScalarField.H"
#include "temperatureJumpFvPatchScalarField.H"
#include "energyJumpFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class BasicThermo, class MixtureType> template<class BasicThermo, class MixtureType>
Foam::heThermo<BasicThermo, MixtureType>::heThermo(const fvMesh& mesh) Foam::wordList Foam::heThermo<BasicThermo, MixtureType>::heBoundaryTypes()
: {
BasicThermo(mesh), const volScalarField::GeometricBoundaryField& tbf =
MixtureType(*this, mesh), this->T_.boundaryField();
he_ wordList hbt = tbf.types();
forAll(tbf, patchi)
{
if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
{
hbt[patchi] = fixedEnergyFvPatchScalarField::typeName;
}
else if
( (
IOobject isA<zeroGradientFvPatchScalarField>(tbf[patchi])
( || isA<fixedGradientFvPatchScalarField>(tbf[patchi])
MixtureType::thermoType::heName(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->heBoundaryTypes()
) )
{
hbt[patchi] = gradientEnergyFvPatchScalarField::typeName;
}
else if(isA<mixedFvPatchScalarField>(tbf[patchi]))
{
hbt[patchi] = mixedEnergyFvPatchScalarField::typeName;
}
else if (isA<temperatureJumpFvPatchScalarField>(tbf[patchi]))
{
hbt[patchi] = energyJumpFvPatchScalarField::typeName;
}
}
return hbt;
}
template<class BasicThermo, class MixtureType>
void Foam::heThermo<BasicThermo, MixtureType>::
heBoundaryCorrection(volScalarField& h)
{
volScalarField::GeometricBoundaryField& hbf = h.boundaryField();
forAll(hbf, patchi)
{
if (isA<gradientEnergyFvPatchScalarField>(hbf[patchi]))
{
refCast<gradientEnergyFvPatchScalarField>(hbf[patchi]).gradient()
= hbf[patchi].fvPatchField::snGrad();
}
else if (isA<mixedEnergyFvPatchScalarField>(hbf[patchi]))
{
refCast<mixedEnergyFvPatchScalarField>(hbf[patchi]).refGrad()
= hbf[patchi].fvPatchField::snGrad();
}
}
}
template<class BasicThermo, class MixtureType>
void Foam::heThermo<BasicThermo, MixtureType>::init()
{ {
scalarField& heCells = he_.internalField(); scalarField& heCells = he_.internalField();
const scalarField& pCells = this->p_.internalField(); const scalarField& pCells = this->p_.internalField();
@ -72,6 +118,63 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo(const fvMesh& mesh)
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicThermo, class MixtureType>
Foam::heThermo<BasicThermo, MixtureType>::heThermo(const fvMesh& mesh)
:
BasicThermo(mesh),
MixtureType(*this, mesh),
he_
(
IOobject
(
MixtureType::thermoType::heName(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->heBoundaryTypes()
)
{
init();
}
template<class BasicThermo, class MixtureType>
Foam::heThermo<BasicThermo, MixtureType>::heThermo
(
const fvMesh& mesh,
const dictionary& dict
)
:
BasicThermo(mesh, dict),
MixtureType(*this, mesh),
he_
(
IOobject
(
MixtureType::thermoType::heName(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->heBoundaryTypes()
)
{
init();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class BasicThermo, class MixtureType> template<class BasicThermo, class MixtureType>
@ -550,9 +653,9 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::THE
const label patchi const label patchi
) const ) const
{ {
tmp<scalarField> tT(new scalarField(h.size())); tmp<scalarField> tT(new scalarField(h.size()));
scalarField& T = tT(); scalarField& T = tT();
forAll(h, facei) forAll(h, facei)
{ {
T[facei] = this->patchFaceMixture T[facei] = this->patchFaceMixture
@ -658,6 +761,26 @@ Foam::heThermo<BasicThermo, MixtureType>::alphaEff
} }
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::heThermo<BasicThermo, MixtureType>::alpha
(
const label patchi
) const
{
return
this->CpByCpv
(
this->p_.boundaryField()[patchi],
this->T_.boundaryField()[patchi],
patchi
)
*(
this->alpha_.boundaryField()[patchi]
);
}
template<class BasicThermo, class MixtureType> template<class BasicThermo, class MixtureType>
bool Foam::heThermo<BasicThermo, MixtureType>::read() bool Foam::heThermo<BasicThermo, MixtureType>::read()
{ {

View File

@ -60,6 +60,18 @@ protected:
volScalarField he_; volScalarField he_;
// Protected Member Functions
// Enthalpy/Internal energy
//- Return the enthalpy/internal energy field boundary types
// by interrogating the temperature field boundary types
wordList heBoundaryTypes();
//- Correct the enthalpy/internal energy field boundaries
void heBoundaryCorrection(volScalarField& he);
private: private:
// Private Member Functions // Private Member Functions
@ -68,6 +80,10 @@ private:
heThermo(const heThermo<BasicThermo, MixtureType>&); heThermo(const heThermo<BasicThermo, MixtureType>&);
//- Initialize heThermo
void init();
public: public:
// Constructors // Constructors
@ -75,6 +91,9 @@ public:
//- Construct from mesh //- Construct from mesh
heThermo(const fvMesh&); heThermo(const fvMesh&);
//- Construct from mesh and dictionary
heThermo(const fvMesh&, const dictionary&);
//- Destructor //- Destructor
virtual ~heThermo(); virtual ~heThermo();
@ -214,6 +233,7 @@ public:
virtual tmp<volScalarField> kappa() const; virtual tmp<volScalarField> kappa() const;
//- Thermal diffusivity of mixture for patch [J/m/s/K] //- Thermal diffusivity of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappa virtual tmp<scalarField> kappa
( (
const label patchi const label patchi
@ -229,6 +249,7 @@ public:
const label patchi const label patchi
) const; ) const;
//- Effective thermal diffusivity of mixture [J/m/s/K] //- Effective thermal diffusivity of mixture [J/m/s/K]
virtual tmp<volScalarField> alphaEff virtual tmp<volScalarField> alphaEff
( (
@ -242,6 +263,12 @@ public:
const label patchi const label patchi
) const; ) const;
//- Thermal diffusivity for enthalpy of mixture [kg/m/s]
virtual tmp<scalarField> alpha
(
const label patchI
) const;
//- Read thermophysicalProperties dictionary //- Read thermophysicalProperties dictionary
virtual bool read(); virtual bool read();

View File

@ -1,13 +1,10 @@
basicSolidThermo/basicSolidThermo.C solidThermo/solidThermo.C
basicSolidThermo/basicSolidThermoNew.C solidThermo/solidThermoNew.C
constSolidThermo/constSolidThermo.C mixtures/basicSolidMixture/basicSolidMixture.C
directionalKSolidThermo/directionalKSolidThermo.C
interpolatedSolidThermo/interpolatedSolidThermo.C
interpolatedSolidThermo/interpolateSolid/interpolateSolid.C
isotropicKSolidThermo/isotropicKSolidThermo.C
solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C solidReactionThermo/solidReactionThermo.C
solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C solidReactionThermo/solidReactionThermoNew.C
heSolidThermo/heSolidThermos.C
LIB = $(FOAM_LIBBIN)/libbasicSolidThermo LIB = $(FOAM_LIBBIN)/libbasicSolidThermo

View File

@ -1,6 +1,7 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude -I$(LIB_SRC)/thermophysicalModels/solid/lnInclude
@ -8,4 +9,5 @@ LIB_LIBS = \
-lmeshTools \ -lmeshTools \
-lfiniteVolume \ -lfiniteVolume \
-lspecie \ -lspecie \
-lsolid -lsolid \
-lbasicThermophysicalModels

View File

@ -1,310 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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"
#include "fvMesh.H"
#include "HashTable.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
defineTypeNameAndDebug(basicSolidThermo, 0);
defineRunTimeSelectionTable(basicSolidThermo, mesh);
defineRunTimeSelectionTable(basicSolidThermo, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh)
:
IOdictionary
(
IOobject
(
"solidThermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
mesh_(mesh),
T_
(
IOobject
(
"T",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
),
rho_
(
IOobject
(
"rho",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimMass/dimVolume
),
kappaRad_
(
IOobject
(
"kappaRad",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless/dimLength
),
sigmaS_
(
IOobject
(
"sigmaS",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless/dimLength
),
emissivity_
(
IOobject
(
"emissivity",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless
)
{}
Foam::basicSolidThermo::basicSolidThermo
(
const fvMesh& mesh,
const dictionary& dict
)
:
IOdictionary
(
IOobject
(
"solidThermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
dict
),
mesh_(mesh),
T_
(
IOobject
(
"T",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
),
rho_
(
IOobject
(
"rho",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimMass/dimVolume
),
kappaRad_
(
IOobject
(
"kappaRad",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless/dimLength
),
sigmaS_
(
IOobject
(
"sigmaS",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless/dimLength
),
emissivity_
(
IOobject
(
"emissivity",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::basicSolidThermo::~basicSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::volScalarField& Foam::basicSolidThermo::T()
{
return T_;
}
const Foam::volScalarField& Foam::basicSolidThermo::T() const
{
return T_;
}
const Foam::volScalarField& Foam::basicSolidThermo::rho() const
{
return rho_;
}
Foam::volScalarField& Foam::basicSolidThermo::rho()
{
return rho_;
}
const Foam::volScalarField& Foam::basicSolidThermo::kappaRad() const
{
return kappaRad_;
}
const Foam::volScalarField& Foam::basicSolidThermo::sigmaS() const
{
return sigmaS_;
}
const Foam::volScalarField& Foam::basicSolidThermo::emissivity() const
{
return emissivity_;
}
Foam::basicSolidMixture& Foam::basicSolidThermo::composition()
{
notImplemented("basicSolidThermo::composition()");
return *reinterpret_cast<basicSolidMixture*>(0);
}
const Foam::basicSolidMixture& Foam::basicSolidThermo::composition() const
{
notImplemented("basicSolidThermo::composition() const");
return *reinterpret_cast<const basicSolidMixture*>(0);
}
Foam::tmp<Foam::volScalarField> Foam::basicSolidThermo::hs() const
{
notImplemented("basicSolidThermo::hs() const");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicSolidThermo::hs(const label patchI)
const
{
notImplemented("basicSolidThermo::hs(const label) const");
return scalarField::null();
}
bool Foam::basicSolidThermo::read()
{
return regIOobject::read();
}
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;
}
// ************************************************************************* //

View File

@ -1,339 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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);
addToRunTimeSelectionTable(basicSolidThermo, constSolidThermo, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::constSolidThermo::constSolidThermo
(
const fvMesh& mesh,
const dictionary& dict
)
:
basicSolidThermo(mesh, dict),
dict_(dict.subDict(typeName + "Coeffs")),
constKappa_(dimensionedScalar(dict_.lookup("kappa"))),
kappa_
(
IOobject
(
"kappa",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
constKappa_
),
constRho_(dimensionedScalar(dict_.lookup("rho"))),
constCp_(dimensionedScalar(dict_.lookup("Cp"))),
constHf_(dimensionedScalar(dict_.lookup("Hf"))),
constEmissivity_(dimensionedScalar(dict_.lookup("emissivity"))),
constKappaRad_(dimensionedScalar(dict_.lookup("kappaRad"))),
constSigmaS_(dimensionedScalar(dict_.lookup("sigmaS")))
{
read();
kappa_ = constKappa_;
rho_ = constRho_;
emissivity_ = constEmissivity_;
kappaRad_ = constKappaRad_;
sigmaS_ = constSigmaS_;
}
Foam::constSolidThermo::constSolidThermo(const fvMesh& mesh)
:
basicSolidThermo(mesh),
dict_(subDict(typeName + "Coeffs")),
constKappa_(dimensionedScalar(dict_.lookup("kappa"))),
kappa_
(
IOobject
(
"kappa",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
constKappa_
),
constRho_(dimensionedScalar(dict_.lookup("rho"))),
constCp_(dimensionedScalar(dict_.lookup("Cp"))),
constHf_(dimensionedScalar(dict_.lookup("Hf"))),
constEmissivity_(dimensionedScalar(dict_.lookup("emissivity"))),
constKappaRad_(dimensionedScalar(dict_.lookup("kappaRad"))),
constSigmaS_(dimensionedScalar(dict_.lookup("sigmaS")))
{
read();
kappa_ = constKappa_;
rho_ = constRho_;
emissivity_ = constEmissivity_;
kappaRad_ = constKappaRad_;
sigmaS_ = constSigmaS_;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::constSolidThermo::~constSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::constSolidThermo::correct()
{}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::kappa() const
{
return kappa_;
}
Foam::tmp<Foam::volSymmTensorField>
Foam::constSolidThermo::directionalKappa() const
{
dimensionedSymmTensor t
(
constKappa_.name(),
constKappa_.dimensions(),
symmTensor
(
constKappa_.value(),
0.0,
0.0,
constKappa_.value(),
0.0,
constKappa_.value()
)
);
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"kappa",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
t
)
);
}
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::Hf() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"Hf",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
constHf_
)
);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::kappa
(
const label patchI
) const
{
return (kappa_.boundaryField()[patchI]);
}
Foam::tmp<Foam::symmTensorField> Foam::constSolidThermo::directionalKappa
(
const label patchI
) const
{
symmTensor t
(
constKappa_.value(),
0.0,
0.0,
constKappa_.value(),
0.0,
constKappa_.value()
);
return tmp<symmTensorField>
(
new symmTensorField
(
T_.boundaryField()[patchI].size(),
t
)
);
}
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::Hf
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constHf_.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"));
constKappa_ = dimensionedScalar(dict.lookup("kappa"));
constHf_ = dimensionedScalar(dict.lookup("Hf"));
constEmissivity_ = dimensionedScalar(dict.lookup("emissivity"));
constKappaRad_ = dimensionedScalar(dict_.lookup("kappaRad"));
constSigmaS_ = dimensionedScalar(dict_.lookup("sigmaS"));
Info<< "Constructed constSolidThermo with" << nl
<< " rho : " << constRho_ << nl
<< " Cp : " << constCp_ << nl
<< " kappa : " << constKappa_ << nl
<< " Hf : " << constHf_ << nl
<< " emissivity : " << constEmissivity_ << nl
<< " kappaRad : " << constKappaRad_ << nl
<< " sigmaS : " << constSigmaS_ << 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("kappa") << constKappa_ << token::END_STATEMENT << nl;
os.writeKeyword("Hf") << constHf_ << token::END_STATEMENT << nl;
os.writeKeyword("kappaRad") << constKappaRad_ << token::END_STATEMENT << nl;
os.writeKeyword("sigmaS") << constSigmaS_ << 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;
}
// ************************************************************************* //

View File

@ -1,165 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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
{
private:
// Private data
//- Dictionary
dictionary dict_;
//- Constant thermal conductivity [W/(m.K)]
dimensionedScalar constKappa_;
//- Thermal conductivity field[W/(m.K)]
volScalarField kappa_;
//- Density [kg/m3]
dimensionedScalar constRho_;
//- Specific heat capacity [J/(kg.K)]
dimensionedScalar constCp_;
//- Heat of formation [J/kg]
dimensionedScalar constHf_;
//- Emissivity
dimensionedScalar constEmissivity_;
//- Absorptivity [1/m]
dimensionedScalar constKappaRad_;
//- Scatter [1/m]
dimensionedScalar constSigmaS_;
public:
//- Runtime type information
TypeName("constSolidThermo");
// Constructors
//- Construct from mesh
constSolidThermo(const fvMesh& mesh);
//- Construct from mesh and dict
constSolidThermo(const fvMesh& mesh, const dictionary& dict);
//- Destructor
virtual ~constSolidThermo();
// Member Functions
//- Update properties
virtual void correct();
// Derived thermal properties
//- Thermal conductivity [W/m/K]
virtual tmp<volScalarField> kappa() const;
//- Thermal conductivity [W/m/K]
virtual tmp<volSymmTensorField> directionalKappa() const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> Cp() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
// Per patch calculation
//- Thermal conductivity [W//m/K]
virtual tmp<scalarField> kappa(const label patchI) const;
//- Thermal conductivity [W//m/K]
virtual tmp<symmTensorField>directionalKappa(const label) const;
//- Specific heat capacity [J/kg/K)]
virtual tmp<scalarField> Cp(const label patchI) const;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) 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
// ************************************************************************* //

View File

@ -1,455 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "directionalKSolidThermo.H"
#include "addToRunTimeSelectionTable.H"
#include "transform.H"
#include "transformField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(directionalKSolidThermo, 0);
addToRunTimeSelectionTable
(
basicSolidThermo,
directionalKSolidThermo,
mesh
);
addToRunTimeSelectionTable
(
basicSolidThermo,
directionalKSolidThermo,
dictionary
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::directionalKSolidThermo::directionalKSolidThermo
(
const fvMesh& mesh,
const dictionary& dict
)
:
interpolatedSolidThermo(mesh, typeName + "Coeffs", dict),
directionalKappa_
(
IOobject
(
"kappa",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/dimTime/(dimLength*dimTemperature)
),
ccTransforms_
(
IOobject
(
"ccTransforms",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimLength
)
{
init();
}
Foam::directionalKSolidThermo::directionalKSolidThermo(const fvMesh& mesh)
:
interpolatedSolidThermo(mesh, typeName + "Coeffs"),
directionalKappa_
(
IOobject
(
"kappa",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/dimTime/(dimLength*dimTemperature)
),
ccTransforms_
(
IOobject
(
"ccTransforms",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimLength
)
{
init();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::directionalKSolidThermo::~directionalKSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::directionalKSolidThermo::init()
{
kappaValues_ =
Field<vector>(subDict(typeName + "Coeffs").lookup("kappaValues"));
Info<< " kappa : " << kappaValues_ << nl << endl;
// 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<< "directionalKSolidThermo : 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();
}
Foam::symmTensor Foam::directionalKSolidThermo::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::directionalKSolidThermo::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::directionalKSolidThermo::correct()
{
calculate();
interpolatedSolidThermo::calculate();
}
Foam::tmp<Foam::volSymmTensorField>
Foam::directionalKSolidThermo::directionalKappa() const
{
return directionalKappa_;
}
void Foam::directionalKSolidThermo::calculate()
{
// Correct directionalK
Field<vector> localKappa
(
interpolateXY
(
T_.internalField(),
TValues_,
kappaValues_
)
);
// Transform into global coordinate system
transformField
(
directionalKappa_.internalField(),
ccTransforms_.internalField(),
localKappa
);
forAll(directionalKappa_.boundaryField(), patchI)
{
directionalKappa_.boundaryField()[patchI] ==
this->directionalKappa(patchI)();
}
}
Foam::tmp<Foam::symmTensorField> Foam::directionalKSolidThermo::directionalKappa
(
const label patchI
) const
{
const fvPatchScalarField& patchT = T_.boundaryField()[patchI];
Field<vector> localKappa(interpolateXY(patchT, TValues_, kappaValues_));
tmp<symmTensorField> tglobalK(new symmTensorField(localKappa.size()));
transformField
(
tglobalK(), ccTransforms_.boundaryField()[patchI], localKappa
);
return tglobalK;
}
bool Foam::directionalKSolidThermo::read()
{
return read(subDict(typeName + "Coeffs"));
}
bool Foam::directionalKSolidThermo::read(const dictionary& dict)
{
coordSys_ = coordinateSystem(dict, mesh_);
kappaValues_ =
Field<vector>(subDict(typeName + "Coeffs").lookup("kappaValues"));
return true;
}
bool Foam::directionalKSolidThermo::writeData(Ostream& os) const
{
bool ok = interpolatedSolidThermo::writeData(os);
os.writeKeyword("kappaValues")
<< kappaValues_ << token::END_STATEMENT << nl;
return ok && os.good();
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const directionalKSolidThermo& s)
{
s.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -1,173 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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::directionalKSolidThermo
Description
Directional conductivity + table interpolation.
SourceFiles
directionalKSolidThermo.C
\*---------------------------------------------------------------------------*/
#ifndef directionalKSolidThermo_H
#define directionalKSolidThermo_H
#include "coordinateSystem.H"
#include "interpolatedSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directionalKSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class directionalKSolidThermo
:
public interpolatedSolidThermo
{
// Private data
//- Thermal conductivity [W/(m.K)]
volSymmTensorField directionalKappa_;
//- Thermal conductivity vector
Field<vector> kappaValues_;
//- 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;
//- Calculate properties
void calculate();
//- Initialize thermo
void init();
public:
//- Runtime type information
TypeName("directionalKSolidThermo");
// Constructors
//- Construct from mesh
directionalKSolidThermo(const fvMesh& mesh);
//- Construct from mesh and dictionary
directionalKSolidThermo(const fvMesh& mesh, const dictionary& dict);
//- Destructor
virtual ~directionalKSolidThermo();
// Member Functions
//- Update properties
virtual void correct();
//- Access functions
//- Thermal conductivity [W/m/K]
virtual tmp<volScalarField> kappa() const
{
notImplemented("directionalKSolidThermo::kappa() const");
return tmp<volScalarField>(NULL);
}
//- Thermal conductivity [W/m/K]
virtual tmp<volSymmTensorField> directionalKappa() const;
// Per patch calculation
//- Thermal conductivity [W//m/K]
virtual tmp<scalarField> kappa(const label patchI) const
{
notImplemented
(
"directionalKSolidThermo::kappa(const label) const"
);
return tmp<scalarField>(NULL);
}
//- Thermal conductivity [W//m/K]
virtual tmp<symmTensorField> directionalKappa(const label) const;
// I-O
//- Write the directionalKSolidThermo properties
virtual bool writeData(Ostream& os) const;
//- Read the directionalKSolidThermo properties
virtual bool read();
//- Read the directionalKSolidThermo properties
bool read(const dictionary& dict);
//- Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const directionalKSolidThermo& s
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,534 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "heSolidThermo.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType, class BasicSolidThermo>
void Foam::heSolidThermo<MixtureType, BasicSolidThermo>::calculate()
{
scalarField& TCells = this->T_.internalField();
const scalarField& hCells = this->he_.internalField();
const scalarField& pCells = this->p_.internalField();
scalarField& rhoCells = this->rho_.internalField();
scalarField& alphaCells = this->alpha_.internalField();
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);
const typename MixtureType::thermoType& volMixture_ =
this->cellVolMixture(pCells[celli], TCells[celli], celli);
TCells[celli] = mixture_.THE
(
hCells[celli],
pCells[celli],
TCells[celli]
);
rhoCells[celli] = volMixture_.rho(pCells[celli], TCells[celli]);
alphaCells[celli] =
volMixture_.kappa(TCells[celli])
/
mixture_.Cpv(pCells[celli], TCells[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& prho = this->rho_.boundaryField()[patchi];
fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];
fvPatchScalarField& ph = this->he_.boundaryField()[patchi];
if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
const typename MixtureType::thermoType& volMixture_ =
this->patchFaceVolMixture
(
pp[facei],
pT[facei],
patchi,
facei
);
ph[facei] = mixture_.HE(pp[facei], pT[facei]);
prho[facei] = volMixture_.rho(pp[facei], pT[facei]);
palpha[facei] =
volMixture_.kappa(pT[facei])
/ mixture_.Cpv(pp[facei], pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
const typename MixtureType::thermoType& volMixture_ =
this->patchFaceVolMixture
(
pp[facei],
pT[facei],
patchi,
facei
);
pT[facei] = mixture_.THE(ph[facei], pp[facei] ,pT[facei]);
prho[facei] = volMixture_.rho(pp[facei], pT[facei]);
palpha[facei] =
volMixture_.kappa(pT[facei])
/ mixture_.Cpv(pp[facei], pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType, class BasicSolidThermo>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::
heSolidThermo(const fvMesh& mesh)
:
heThermo<BasicSolidThermo, MixtureType>(mesh)
{
calculate();
}
template<class MixtureType, class BasicSolidThermo>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::
heSolidThermo(const fvMesh& mesh, const dictionary& dict)
:
heThermo<BasicSolidThermo, MixtureType>(mesh, dict)
{
calculate();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType, class BasicSolidThermo>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::~heSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType, class BasicSolidThermo>
void Foam::heSolidThermo<MixtureType, BasicSolidThermo>::correct()
{
if (debug)
{
Info<< "entering heSolidThermo<MixtureType>::correct()" << endl;
}
calculate();
if (debug)
{
Info<< "exiting heSolidThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType, class BasicSolidThermo>
Foam::tmp<Foam::volVectorField>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::Kappa() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volVectorField> tKappa
(
new volVectorField
(
IOobject
(
"Kappa",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimTime/dimLength/dimTemperature
)
);
volVectorField& Kappa = tKappa();
vectorField& KappaCells = Kappa.internalField();
const scalarField& TCells = this->T_.internalField();
const scalarField& pCells = this->p_.internalField();
forAll(KappaCells, celli)
{
Kappa[celli] =
this->cellVolMixture
(
pCells[celli],
TCells[celli],
celli
).Kappa(TCells[celli]);
}
forAll(Kappa.boundaryField(), patchi)
{
vectorField& Kappap = Kappa.boundaryField()[patchi];
const scalarField& pT = this->T_.boundaryField()[patchi];
const scalarField& pp = this->p_.boundaryField()[patchi];
forAll(Kappap, facei)
{
Kappap[facei] =
this->patchFaceVolMixture
(
pp[facei],
pT[facei],
patchi,
facei
).Kappa(pT[facei]);
}
}
return tKappa;
}
template<class MixtureType, class BasicSolidThermo>
Foam::tmp<Foam::volScalarField>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::kappaRad() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tkappaRad
(
new volScalarField
(
IOobject
(
"kappaRad",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
inv(dimLength)
)
);
volScalarField& kappaRad = tkappaRad();
scalarField& kappaRadCells = kappaRad.internalField();
const scalarField& TCells = this->T_.internalField();
const scalarField& pCells = this->p_.internalField();
forAll(kappaRadCells, celli)
{
kappaRadCells[celli] =
this->cellVolMixture
(
pCells[celli],
TCells[celli],
celli
).kappaRad(TCells[celli]);
}
forAll(kappaRad.boundaryField(), patchi)
{
scalarField& kappaRadp = kappaRad.boundaryField()[patchi];
const scalarField& pT = this->T_.boundaryField()[patchi];
const scalarField& pp = this->p_.boundaryField()[patchi];
forAll(kappaRadp, facei)
{
kappaRadp[facei] =
this->patchFaceVolMixture
(
pp[facei],
pT[facei],
patchi,
facei
).kappaRad(pT[facei]);
}
}
return tkappaRad;
}
template<class MixtureType, class BasicSolidThermo>
Foam::tmp<Foam::volScalarField>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::sigmaS() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tsigmaS
(
new volScalarField
(
IOobject
(
"sigmaS",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
inv(dimLength)
)
);
volScalarField& sigmaS = tsigmaS();
scalarField& sigmaSCells = sigmaS.internalField();
const scalarField& TCells = this->T_.internalField();
const scalarField& pCells = this->p_.internalField();
forAll(sigmaSCells, celli)
{
sigmaSCells[celli] =
this->cellVolMixture
(
pCells[celli],
TCells[celli],
celli
).sigmaS(TCells[celli]);
}
forAll(sigmaS.boundaryField(), patchi)
{
scalarField& sigmaSp = sigmaS.boundaryField()[patchi];
const scalarField& pT = this->T_.boundaryField()[patchi];
const scalarField& pp = this->p_.boundaryField()[patchi];
forAll(sigmaSp, facei)
{
sigmaSp[facei] =
this->patchFaceVolMixture
(
pp[facei],
pT[facei],
patchi,
facei
).sigmaS(pT[facei]);
}
}
return tsigmaS;
}
template<class MixtureType, class BasicSolidThermo>
Foam::tmp<Foam::volScalarField>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::emissivity() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> temissivity
(
new volScalarField
(
IOobject
(
"emissivity",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
inv(dimLength)
)
);
volScalarField& emissivity = temissivity();
scalarField& emissivityCells = emissivity.internalField();
const scalarField& TCells = this->T_.internalField();
const scalarField& pCells = this->p_.internalField();
forAll(emissivityCells, celli)
{
emissivityCells[celli] =
this->cellVolMixture
(
pCells[celli],
TCells[celli],
celli
).emissivity(TCells[celli]);
}
forAll(emissivity.boundaryField(), patchi)
{
scalarField& emissivityp = emissivity.boundaryField()[patchi];
const scalarField& pT = this->T_.boundaryField()[patchi];
const scalarField& pp = this->p_.boundaryField()[patchi];
forAll(emissivityp, facei)
{
emissivityp[facei] =
this->patchFaceVolMixture
(
pp[facei],
pT[facei],
patchi,
facei
).emissivity(pT[facei]);
}
}
return temissivity;
}
template<class MixtureType, class BasicSolidThermo>
Foam::tmp<Foam::vectorField>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::Kappa
(
const label patchi
) const
{
const scalarField& pp = this->p_.boundaryField()[patchi];
const scalarField& Tp = this->T_.boundaryField()[patchi];
tmp<vectorField> tKappa(new vectorField(pp.size()));
vectorField& Kappap = tKappa();
forAll(Tp, facei)
{
Kappap[facei] =
this->patchFaceVolMixture
(
pp[facei],
Tp[facei],
patchi,
facei
).Kappa(Tp[facei]);
}
return tKappa;
}
template<class MixtureType, class BasicSolidThermo>
Foam::tmp<Foam::scalarField>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::kappaRad
(
const label patchi
) const
{
const scalarField& Tp = this->T_.boundaryField()[patchi];
tmp<scalarField> tKappaRad(new scalarField(Tp.size()));
scalarField& KappapRadp = tKappaRad();
const scalarField& pp = this->p_.boundaryField()[patchi];
forAll(Tp, facei)
{
KappapRadp[facei] =
this->patchFaceVolMixture
(
pp[facei],
Tp[facei],
patchi,
facei
).kappaRad(Tp[facei]);
}
return tKappaRad;
}
template<class MixtureType, class BasicSolidThermo>
Foam::tmp<Foam::scalarField>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::sigmaS
(
const label patchi
) const
{
const scalarField& Tp = this->T_.boundaryField()[patchi];
tmp<scalarField> tsigmaS(new scalarField(Tp.size()));
scalarField& sigmaSp = tsigmaS();
const scalarField& pp = this->p_.boundaryField()[patchi];
forAll(Tp, facei)
{
sigmaSp[facei] =
this->patchFaceVolMixture
(
pp[facei],
Tp[facei],
patchi,
facei
).sigmaS(Tp[facei]);
}
return tsigmaS;
}
template<class MixtureType, class BasicSolidThermo>
Foam::tmp<Foam::scalarField>
Foam::heSolidThermo<MixtureType, BasicSolidThermo>::emissivity
(
const label patchi
) const
{
const scalarField& Tp = this->T_.boundaryField()[patchi];
tmp<scalarField> temissivity(new scalarField(Tp.size()));
scalarField& emissivity = temissivity();
const scalarField& pp = this->p_.boundaryField()[patchi];
forAll(Tp, facei)
{
emissivity[facei] =
this->patchFaceVolMixture
(
pp[facei],
Tp[facei],
patchi,
facei
).emissivity(Tp[facei]);
}
return temissivity;
}
// ************************************************************************* //

View File

@ -0,0 +1,151 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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::heSolidThermo
Description
Enthalpy, internal energy based for a solid mixture.
SourceFiles
heSolidThermo.C
\*---------------------------------------------------------------------------*/
#ifndef heSolidThermo_H
#define heSolidThermo_H
#include "heThermo.H"
#include "solidThermo.H"
#include "coordinateSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class heSolidThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType, class BasicSolidThermo>
class heSolidThermo
:
public heThermo<BasicSolidThermo, MixtureType>
{
// Private Member Functions
//- Calculate the thermo variables
void calculate();
//- Construct as copy (not implemented)
heSolidThermo(const heSolidThermo<MixtureType, BasicSolidThermo>&);
public:
//- Runtime type information
TypeName("heSolidThermo");
// Constructors
//- Construct from mesh
heSolidThermo(const fvMesh&);
//- Construct from mesh and dictionary
heSolidThermo(const fvMesh&, const dictionary&);
//- Destructor
virtual ~heSolidThermo();
// Member functions
//- Update properties
virtual void correct();
// Derived thermal properties
//- Isotropic thermal conductivity [W/m/K]
//virtual tmp<volScalarField> kappa() const;
//- Anisotropic thermal conductivity [W/m/K]
virtual tmp<volVectorField> Kappa() const;
//- Absorption coefficient [1/m]
virtual tmp<volScalarField> kappaRad() const;
//- Scatter coefficient
virtual tmp<volScalarField> sigmaS() const;
//- Emissivity coefficient [1/m]
virtual tmp<volScalarField> emissivity() const;
// Per patch calculation
//- Anisotropic thermal conductivity [W//m/K]
virtual tmp<vectorField> Kappa
(
const label patchI
) const;
//- Absorption coefficient [1/m]
virtual tmp<scalarField> kappaRad
(
const label patchI
) const;
//- Scatter coefficient
virtual tmp<scalarField> sigmaS
(
const label patchI
) const;
//- Emissivity coefficient [1/m]
virtual tmp<scalarField> emissivity
(
const label patchI
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "heSolidThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,74 +23,106 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "makeSolidMixtureThermo.H"
#include "makeSolidThermo.H"
#include "constRho.H" #include "constRho.H"
#include "constSolidThermo.H" #include "constSolidThermo.H"
#include "exponentialSolidThermo.H" #include "exponentialSolidThermo.H"
#include "constSolidTransport.H" #include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
#include "exponentialSolidTransport.H" #include "exponentialSolidTransport.H"
#include "constSolidRad.H" #include "constSolidRad.H"
#include "basicSolidThermo.H" #include "pureSolidMixture.H"
#include "multiComponentSolidMixture.H" #include "multiComponentSolidMixture.H"
#include "reactingSolidMixture.H" #include "reactingSolidMixture.H"
#include "sensibleEnthalpy.H"
#include "sensibleInternalEnergy.H"
#include "specieThermo.H"
#include "heThermo.H"
#include "solidThermo.H"
#include "solidReactionThermo.H"
#include "heSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * Enthalpy-based * * * * * * * * * * * * * */
makeSolidMixtureThermo makeSolidThermo
( (
basicSolidThermo, solidThermo,
solidMixtureThermo, heSolidThermo,
multiComponentSolidMixture, pureSolidMixture,
constSolidTransport, constIsoSolidTransport,
constSolidRad, constSolidRad,
sensibleEnthalpy,
constSolidThermo, constSolidThermo,
constRho constRho
); );
makeSolidMixtureThermo makeSolidThermo
( (
basicSolidThermo, solidThermo,
solidMixtureThermo, heSolidThermo,
multiComponentSolidMixture, pureSolidMixture,
exponentialSolidTransport, constAnIsoSolidTransport,
constSolidRad,
exponentialSolidThermo,
constRho
);
makeSolidMixtureThermo
(
basicSolidThermo,
solidMixtureThermo,
reactingSolidMixture,
exponentialSolidTransport,
constSolidRad,
exponentialSolidThermo,
constRho
);
makeSolidMixtureThermo
(
basicSolidThermo,
solidMixtureThermo,
reactingSolidMixture,
constSolidTransport,
constSolidRad, constSolidRad,
sensibleEnthalpy,
constSolidThermo, constSolidThermo,
constRho constRho
); );
makeSolidThermo
(
solidThermo,
heSolidThermo,
pureSolidMixture,
exponentialSolidTransport,
constSolidRad,
sensibleEnthalpy,
exponentialSolidThermo,
constRho
);
makeSolidThermo
(
solidThermo,
heSolidThermo,
multiComponentSolidMixture,
constIsoSolidTransport,
constSolidRad,
sensibleEnthalpy,
constSolidThermo,
constRho
);
// Reacting solid thermo
makeSolidThermo
(
solidReactionThermo,
heSolidThermo,
reactingSolidMixture,
constIsoSolidTransport,
constSolidRad,
sensibleEnthalpy,
constSolidThermo,
constRho
);
/* * * * * * * * * * * * * * Internal-energy-based * * * * * * * * * * * * * */
/*
*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,114 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 "interpolateSolid.H"
#include "interpolateXY.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::interpolateSolid::interpolateSolid(const dictionary& dict)
{
read(dict);
Info<< "Constructed solid thermo with samples" << nl
<< " T : " << TValues_ << nl
<< " rho : " << rhoValues_ << nl
<< " cp : " << cpValues_ << nl
<< " Hf : " << HfValues_ << nl
<< " emissivity : " << emissivityValues_ << nl
<< " kappaRad : " << kappaRadValues_ << nl
<< " sigmaS : " << sigmaSValues_ << nl;
if
(
(TValues_.size() != rhoValues_.size())
&& (TValues_.size() != cpValues_.size())
&& (TValues_.size() != rhoValues_.size())
&& (TValues_.size() != HfValues_.size())
&& (TValues_.size() != emissivityValues_.size())
)
{
FatalIOErrorIn("interpolateSolid::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("interpolateSolid::read()", dict)
<< "Temperature values are not in increasing order "
<< TValues_ << exit(FatalIOError);
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::interpolateSolid::~interpolateSolid()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::interpolateSolid::writeData(Ostream& os) const
{
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("HfValues") << HfValues_ << token::END_STATEMENT << nl;
os.writeKeyword("emissivityValues") << emissivityValues_ <<
token::END_STATEMENT << nl;
os.writeKeyword("kappaRadValues") << kappaRadValues_
<< token::END_STATEMENT << nl;
os.writeKeyword("sigmaSValues") << sigmaSValues_
<< token::END_STATEMENT << nl;
return os.good();
}
bool Foam::interpolateSolid::read(const dictionary& dict)
{
TValues_ = Field<scalar>(dict.lookup("TValues"));
rhoValues_ = Field<scalar>(dict.lookup("rhoValues"));
cpValues_ = Field<scalar>(dict.lookup("cpValues"));
kappaRadValues_ = Field<scalar>(dict.lookup("kappaRadValues"));
sigmaSValues_ = Field<scalar>(dict.lookup("sigmaSValues"));
HfValues_ = Field<scalar>(dict.lookup("HfValues"));
emissivityValues_ = Field<scalar>(dict.lookup("emissivityValues"));
sigmaSValues_ = Field<scalar>(dict.lookup("sigmaSValues"));
return true;
}
// ************************************************************************* //

View File

@ -1,352 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "interpolateXY.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
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::emissivity
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
emissivityValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::kappaRad
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
kappaRadValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::sigmaS
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
sigmaSValues_
)
)
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::interpolatedSolidThermo::interpolatedSolidThermo
(
const fvMesh& mesh,
const word dictName
)
:
basicSolidThermo(mesh),
interpolateSolid(subDict(dictName)),
dict_(subDict(dictName))
{
calculate();
}
Foam::interpolatedSolidThermo::interpolatedSolidThermo
(
const fvMesh& mesh,
const word dictName,
const dictionary& dict
)
:
basicSolidThermo(mesh, dict),
interpolateSolid(subDict(dictName)),
dict_(subDict(dictName))
{
calculate();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::interpolatedSolidThermo::~interpolatedSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::interpolatedSolidThermo::calculate()
{
// Correct rho
rho_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
rhoValues_
);
forAll(rho_.boundaryField(), patchI)
{
rho_.boundaryField()[patchI] == this->rho(patchI)();
}
// Correct emissivity
emissivity_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
emissivityValues_
);
forAll(emissivity_.boundaryField(), patchI)
{
emissivity_.boundaryField()[patchI] == this->emissivity(patchI)();
}
// Correct absorptivity
kappaRad_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
kappaRadValues_
);
forAll(kappaRad_.boundaryField(), patchI)
{
kappaRad_.boundaryField()[patchI] == this->kappaRad(patchI)();
}
// Correct scatter
sigmaS_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
sigmaSValues_
);
forAll(sigmaS_.boundaryField(), patchI)
{
sigmaS_.boundaryField()[patchI] == this->sigmaS(patchI)();
}
}
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::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::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::Hf
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
HfValues_
)
)
);
}
bool Foam::interpolatedSolidThermo::read()
{
return read(dict_);
}
bool Foam::interpolatedSolidThermo::read(const dictionary& dict)
{
bool ok = interpolateSolid::read(dict);
return ok;
}
bool Foam::interpolatedSolidThermo::writeData(Ostream& os) const
{
bool ok = basicSolidThermo::writeData(os);
ok = interpolateSolid::writeData(os);
return ok && os.good();
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const interpolatedSolidThermo& s)
{
s.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -1,151 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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"
#include "interpolateSolid.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class interpolatedSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class interpolatedSolidThermo
:
public basicSolidThermo,
public interpolateSolid
{
private:
// Private data
//- Dictionary
const dictionary dict_;
// Helper functions
//- Density [kg/m3]
tmp<scalarField> rho(const label patchI) const;
//- Scatter coefficient [1/m]
tmp<scalarField> sigmaS(const label) const;
//- Absorption coefficient [1/m]
tmp<scalarField> kappaRad(const label) const;
//- Emissivity []
tmp<scalarField> emissivity(const label) const;
public:
// Constructors
//- Construct from mesh
interpolatedSolidThermo(const fvMesh& mesh, const word);
//- Construct from mesh and dictionary
interpolatedSolidThermo
(
const fvMesh& mesh,
const word,
const dictionary& dict
);
//- Destructor
virtual ~interpolatedSolidThermo();
// Member Functions
//- Calculate properties
void calculate();
// Derived properties
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> Cp() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
// Per patch calculation
//- Specific heat capacity [J/kg/K)]
virtual tmp<scalarField> Cp(const label patchI) const;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) 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
// ************************************************************************* //

View File

@ -1,172 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "isotropicKSolidThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(isotropicKSolidThermo, 0);
addToRunTimeSelectionTable
(
basicSolidThermo,
isotropicKSolidThermo,
mesh
);
addToRunTimeSelectionTable
(
basicSolidThermo,
isotropicKSolidThermo,
dictionary
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::isotropicKSolidThermo::isotropicKSolidThermo
(
const fvMesh& mesh,
const dictionary& dict
)
:
interpolatedSolidThermo(mesh, typeName + "Coeffs", dict),
kappa_
(
IOobject
(
"kappa",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimTime/(dimLength*dimTemperature)
),
kappaValues_
(
Field<scalar>(subDict(typeName + "Coeffs").lookup("kappaValues"))
)
{
Info<< " kappa : " << kappaValues_ << nl << endl;
correct();
}
Foam::isotropicKSolidThermo::isotropicKSolidThermo(const fvMesh& mesh)
:
interpolatedSolidThermo(mesh, typeName + "Coeffs"),
kappa_
(
IOobject
(
"kappa",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimTime/(dimLength*dimTemperature)
),
kappaValues_
(
Field<scalar>(subDict(typeName + "Coeffs").lookup("kappaValues"))
)
{
Info<< " kappa : " << kappaValues_ << nl <<endl;
correct();
}
void Foam::isotropicKSolidThermo::correct()
{
// Correct K
kappa_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
kappaValues_
);
forAll(kappa_.boundaryField(), patchI)
{
kappa_.boundaryField()[patchI] == interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
kappaValues_
);
}
interpolatedSolidThermo::calculate();
}
Foam::tmp<Foam::volScalarField> Foam::isotropicKSolidThermo::kappa() const
{
return kappa_;
}
Foam::tmp<Foam::scalarField> Foam::isotropicKSolidThermo::kappa
(
const label patchI
) const
{
return kappa_.boundaryField()[patchI];
}
bool Foam::isotropicKSolidThermo::read()
{
kappaValues_ =
Field<scalar>(subDict(typeName + "Coeffs").lookup("kappaValues"));
return true;
}
bool Foam::isotropicKSolidThermo::writeData(Ostream& os) const
{
os.writeKeyword("kappaValues") << kappaValues_
<< token::END_STATEMENT << nl;
bool ok = interpolatedSolidThermo::writeData(os);
return ok && os.good();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::isotropicKSolidThermo::~isotropicKSolidThermo()
{}
// ************************************************************************* //

View File

@ -1,145 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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::isotropicKSolidThermo
Description
Directional conductivity + table interpolation.
SourceFiles
isotropicKSolidThermo.C
\*---------------------------------------------------------------------------*/
#ifndef directionalSolidThermo_H
#define directionalSolidThermo_H
#include "interpolatedSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class isotropicKSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class isotropicKSolidThermo
:
public interpolatedSolidThermo
{
// Private data
//- Thermal conductivity [W/(m.K)]
volScalarField kappa_;
//- Thermal conductivity vector
Field<scalar> kappaValues_;
public:
//- Runtime type information
TypeName("isotropicKSolidThermo");
// Constructors
//- Construct from mesh
isotropicKSolidThermo(const fvMesh& mesh);
//- Construct from mesh and dicionary
isotropicKSolidThermo(const fvMesh& mesh, const dictionary& dict);
//- Destructor
virtual ~isotropicKSolidThermo();
// Member functions
//- Update properties
virtual void correct();
// Access functions
//- Constant access to K
virtual tmp<volScalarField> kappa() const;
//- Thermal conductivity [W/m/K]
virtual tmp<volSymmTensorField> directionalKappa() const
{
notImplemented
(
"directionalKSolidThermo::directionalKappa() const"
);
return tmp<volSymmTensorField>(NULL);
}
// Per patch calculation
//- Thermal conductivity [W/m/K]
virtual tmp<scalarField> kappa(const label patchI) const;
//- Thermal conductivity [W/m/K]
virtual tmp<symmTensorField> directionalKappa(const label) const
{
notImplemented
(
"directionalKSolidThermo::directionalKappa(const label)"
"const"
);
return tmp<symmTensorField>(NULL);
}
// I-O
//- Read solidThermophysicalProperties dictionary
virtual bool read();
//- Write properties
virtual bool writeData(Ostream& os) const;
//- Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const isotropicKSolidThermo& s
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -35,6 +35,7 @@ Description
#include "volFields.H" #include "volFields.H"
#include "speciesTable.H" #include "speciesTable.H"
#include "PtrList.H" #include "PtrList.H"
#include "error.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -63,6 +64,10 @@ protected:
public: public:
//- The base class of the mixture
typedef basicSolidMixture basicMixtureType;
// Constructors // Constructors
//- Construct from word list and mesh //- Construct from word list and mesh
@ -108,34 +113,102 @@ public:
inline bool contains(const word& specieName) const; inline bool contains(const word& specieName) const;
// Derived cell based properties. // Per specie thermo properties
//- Heat capacity at constant pressure [J/(kg K)]
virtual scalar Cp
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- Heat capacity at constant volume [J/(kg K)]
virtual scalar Cv
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- Absolute enthalpy [J/kg]
virtual scalar Ha
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- Sensible enthalpy [J/kg]
virtual scalar Hs
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- Chemical enthalpy [J/kg]
virtual scalar Hc(const label specieI) const = 0;
//- Density [Kg/m3]
virtual scalar rho
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
// Per specie transport properties
//- Thermal conductivity [W/m/K]
virtual scalar kappa
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- An-isotropic thermal conductivity [W/m/K]
virtual vector Kappa
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- Thermal diffusivity of enthalpy/internal energy [kg/m/s]
virtual scalar alpha
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
// Cell based properties with on the run mixture calculation
//- Density //- Density
virtual scalar rho(scalar T, label celli) const = 0; virtual scalar rho(scalar p, scalar T, label celli) const = 0;
//- Absorption coefficient //- Absorption coefficient
virtual scalar kappaRad(scalar T, label celli) const = 0; virtual scalar kappaRad(scalar p, scalar T, label celli) const = 0;
//- Scatter coefficient //- Scatter coefficient
virtual scalar sigmaS(scalar T, label celli) const = 0; virtual scalar sigmaS(scalar p, scalar T, label celli) const = 0;
//- Thermal conductivity //- Thermal conductivity
virtual scalar kappa(scalar T, label celli) const = 0; virtual scalar kappa(scalar p, scalar T, label celli) const = 0;
//- Emissivity coefficient //- Emissivity coefficient
virtual scalar emissivity(scalar T, label celli) const = 0; virtual scalar emissivity
(
//- Formation enthalpy scalar p, scalar T, label celli
virtual scalar hf(scalar T, label celli) const = 0; ) const = 0;
//- Sensible enthalpy
virtual scalar hs(scalar T, label celli) const = 0;
//- Total enthalpy
virtual scalar h(scalar T, label celli) const = 0;
//- Specific heat capacity //- Specific heat capacity
virtual scalar Cp(scalar T, label celli) const = 0; virtual scalar Cp(scalar p, scalar T, label celli) const = 0;
}; };

View File

@ -0,0 +1,228 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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/>.
Description
Mixture instantiation
\*---------------------------------------------------------------------------*/
#include "basicMixture.H"
#include "makeBasicMixture.H"
#include "constRho.H"
#include "constSolidThermo.H"
#include "exponentialSolidThermo.H"
#include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
#include "exponentialSolidTransport.H"
#include "constSolidRad.H"
#include "sensibleInternalEnergy.H"
#include "sensibleEnthalpy.H"
#include "specieThermo.H"
#include "pureSolidMixture.H"
#include "multiComponentSolidMixture.H"
#include "reactingSolidMixture.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicMixture
(
pureSolidMixture,
constIsoSolidTransport,
sensibleEnthalpy,
constSolidThermo,
constRho
);
makeBasicMixture
(
pureSolidMixture,
constAnIsoSolidTransport,
sensibleEnthalpy,
constSolidThermo,
constRho
);
makeBasicMixture
(
pureSolidMixture,
exponentialSolidTransport,
sensibleEnthalpy,
exponentialSolidThermo,
constRho
);
makeBasicMixture
(
multiComponentSolidMixture,
constIsoSolidTransport,
sensibleEnthalpy,
constSolidThermo,
constRho
);
makeBasicMixture
(
reactingSolidMixture,
constIsoSolidTransport,
sensibleEnthalpy,
constSolidThermo,
constRho
);
/*
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
eConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
janafThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
hConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
janafThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
incompressible
);
makeBasicPolyMixture
(
pureMixture,
3,
sensibleEnthalpy
);
makeBasicPolyMixture
(
pureMixture,
8,
sensibleEnthalpy
);
makeBasicMixture
(
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
isobaricPerfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
hConstThermo,
isobaricPerfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
janafThermo,
isobaricPerfectGas
);
*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,408 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 "multiComponentSolidMixture.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ThermoType>
const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::
constructSolidData
(
const dictionary& thermoSolidDict
)
{
forAll(components_, i)
{
solidData_.set
(
i,
new ThermoType
(
thermoSolidDict.subDict(components_[i] + "Coeffs")
)
);
}
return solidData_[0];
}
template<class ThermoType>
void Foam::multiComponentSolidMixture<ThermoType>::correctMassFractions()
{
volScalarField Yt("Yt", Y_[0]);
for (label n=1; n<Y_.size(); n++)
{
Yt += Y_[n];
}
forAll(Y_, n)
{
Y_[n] /= Yt;
}
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::X
(
label specieI, label celli, scalar p, scalar T
) const
{
scalar rhoInv = 0.0;
forAll(solidData_, i)
{
rhoInv += Y_[i][celli]/solidData_[i].rho(p, T);
}
scalar X = Y_[specieI][celli]/solidData_[specieI].rho(p, T);
return (X/rhoInv);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ThermoType>
Foam::multiComponentSolidMixture<ThermoType>::multiComponentSolidMixture
(
const dictionary& thermoSolidDict,
const fvMesh& mesh
)
:
basicSolidMixture
(
thermoSolidDict.lookup("solidComponents"),
mesh
),
solidData_(components_.size()),
mixture_("mixture", constructSolidData(thermoSolidDict)),
mixtureVol_("mixture", constructSolidData(thermoSolidDict))
{
correctMassFractions();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ThermoType>
const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::cellVolMixture
(
const scalar p,
const scalar T,
const label celli
) const
{
scalar rhoInv = 0.0;
forAll(solidData_, i)
{
rhoInv += Y_[i][celli]/solidData_[i].rho(p, T);
}
mixtureVol_ = Y_[0][celli]/solidData_[0].rho(p, T)/rhoInv*solidData_[0];
for (label n=1; n<Y_.size(); n++)
{
mixtureVol_ +=
Y_[n][celli]/solidData_[n].rho(p, T)/rhoInv*solidData_[n];
}
return mixtureVol_;
}
template<class ThermoType>
const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::cellMixture
(
const label celli
) const
{
mixture_ = Y_[0][celli]*solidData_[0];
for (label n=1; n<Y_.size(); n++)
{
mixture_ += Y_[n][celli]*solidData_[n];
}
return mixture_;
}
template<class ThermoType>
const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::
patchFaceVolMixture
(
const scalar p,
const scalar T,
const label patchi,
const label facei
) const
{
scalar rhoInv = 0.0;
forAll(solidData_, i)
{
rhoInv += Y_[i].boundaryField()[patchi][facei]/solidData_[i].rho(p, T);
}
mixtureVol_ =
Y_[0].boundaryField()[patchi][facei]
/ solidData_[0].rho(p, T)
/ rhoInv
* solidData_[0];
for (label n=1; n<Y_.size(); n++)
{
mixtureVol_ +=
Y_[n].boundaryField()[patchi][facei]
/ solidData_[n].rho(p,T)
/ rhoInv
* solidData_[n];
}
return mixtureVol_;
}
template<class ThermoType>
const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::
patchFaceMixture
(
const label patchi,
const label facei
) const
{
mixture_ =
Y_[0].boundaryField()[patchi][facei]*solidData_[0];
for (label n=1; n<Y_.size(); n++)
{
mixture_ += Y_[n].boundaryField()[patchi][facei]*solidData_[n];
}
return mixture_;
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Cp
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].Cp(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Cv
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].Cv(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Ha
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].Ha(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Hs
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].Hs(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Hc
(
const label specieI
) const
{
return solidData_[specieI].Hc();
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::rho
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].rho(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::kappa
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].kappa(T);
}
template<class ThermoType>
Foam::vector Foam::multiComponentSolidMixture<ThermoType>::Kappa
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].Kappa(T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::alpha
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].kappa(T)/solidData_[specieI].Cpv(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::rho
(
scalar p, scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].rho(p, T)*X(i, celli, p, T);
}
return tmp;
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::kappaRad
(
scalar p, scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].kappaRad(T)*X(i, celli, p, T);
}
return tmp;
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::sigmaS
(
scalar p, scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].sigmaS(T)*X(i, celli, p, T);
}
return tmp;
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::kappa
(
scalar p, scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].kappa(T)*X(i, celli, p, T);
}
return tmp;
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::emissivity
(
scalar p, scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].emissivity(T)*X(i, celli, p, T);
}
return tmp;
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Cp
(
scalar p, scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].Cp(p, T)*Y_[i][celli];
}
return tmp;
}
template<class ThermoType>
void Foam::multiComponentSolidMixture<ThermoType>::read
(
const dictionary& thermoDict
)
{
forAll(components_, i)
{
solidData_[i] =
ThermoType(thermoDict.subDict(components_[i] + "Coeffs"));
}
}
// ************************************************************************* //

View File

@ -0,0 +1,246 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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::multiComponentSolidMixture
Description
Foam::multiComponentSolidMixture
\*---------------------------------------------------------------------------*/
#ifndef multiComponentSolidMixture_H
#define multiComponentSolidMixture_H
#include "PtrList.H"
#include "autoPtr.H"
#include "basicSolidMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class multiComponentSolidMixture Declaration
\*---------------------------------------------------------------------------*/
template<class ThermoType>
class multiComponentSolidMixture
:
public basicSolidMixture
{
// Private data
//- Solid data
PtrList<ThermoType> solidData_;
//- Temporary storage for the mass cell/face mixture thermo data
mutable ThermoType mixture_;
//- Temporary storage for the volume weighted
// cell/face mixture thermo data
mutable ThermoType mixtureVol_;
// Private Member Functions
//- Correct the mass fractions to sum to 1
void correctMassFractions();
//- Return molar fraction for specieI in celli
scalar X(label specieI, label celli, scalar p, scalar T) const;
//- Construct solid data
const ThermoType& constructSolidData(const dictionary&);
public:
//- The type of thermodynamics this mixture is instantiated for
typedef ThermoType thermoType;
//- Runtime type information
TypeName("multiComponentSolidMixture");
// Constructors
//- Construct from dictionary and mesh
multiComponentSolidMixture(const dictionary&, const fvMesh&);
//- Destructor
virtual ~multiComponentSolidMixture()
{}
// Member Functions
const ThermoType& cellMixture(const label celli) const;
const ThermoType& patchFaceMixture
(
const label patchi,
const label facei
) const;
const ThermoType& cellVolMixture
(
const scalar p,
const scalar T,
const label celli
) const;
const ThermoType& patchFaceVolMixture
(
const scalar p,
const scalar T,
const label patchi,
const label facei
) const;
//- Return the raw solid data
const PtrList<ThermoType>& solidData() const
{
return solidData_;
}
//- Read dictionary
void read(const dictionary&);
// Per specie thermo properties
//- Heat capacity at constant pressure [J/(kg K)]
virtual scalar Cp
(
const label specieI,
const scalar p,
const scalar T
) const;
//- Heat capacity at constant volume [J/(kg K)]
virtual scalar Cv
(
const label specieI,
const scalar p,
const scalar T
) const;
//- Absolute enthalpy [J/kg]
virtual scalar Ha
(
const label specieI,
const scalar p,
const scalar T
) const;
//- Sensible enthalpy [J/kg]
virtual scalar Hs
(
const label specieI,
const scalar p,
const scalar T
) const;
//- Chemical enthalpy [J/kg]
virtual scalar Hc(const label specieI) const;
//- Density [Kg/m3]
virtual scalar rho
(
const label specieI,
const scalar p,
const scalar T
) const;
// Per specie transport properties
//- Thermal conductivity [W/m/K]
virtual scalar kappa
(
const label specieI,
const scalar p,
const scalar T
) const;
//- An-isotropic thermal conductivity [W/m/K]
virtual vector Kappa
(
const label specieI,
const scalar p,
const scalar T
) const;
//- Thermal diffusivity of enthalpy/internal energy [kg/m/s]
virtual scalar alpha
(
const label specieI,
const scalar p,
const scalar T
) const;
// Cell based properties with on the run mixture calculation.
//- Density
virtual scalar rho(scalar p, scalar T, label celli) const;
//- Absorption coefficient
virtual scalar kappaRad(scalar p, scalar T, label celli) const;
//- Scatter coefficient
virtual scalar sigmaS(scalar p, scalar T, label celli) const;
//- Thermal conductivity
virtual scalar kappa(scalar p, scalar T, label celli) const;
//- Emissivity coefficient
virtual scalar emissivity(scalar p, scalar T, label celli) const;
//- Specific heat capacity
virtual scalar Cp(scalar p, scalar T, label celli) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "multiComponentSolidMixture.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 "pureSolidMixture.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ThermoType>
pureSolidMixture<ThermoType>::pureSolidMixture
(
const dictionary& thermoDict,
const fvMesh& mesh
)
:
basicMixture(thermoDict, mesh),
mixture_(thermoDict.subDict("mixture"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ThermoType>
pureSolidMixture<ThermoType>::~pureSolidMixture()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ThermoType>
void pureSolidMixture<ThermoType>::read(const dictionary& thermoDict)
{
mixture_ = ThermoType(thermoDict.subDict("mixture"));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -22,21 +22,20 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::interpolateSolid Foam::pureSolidMixture
Description Description
Helping class for T-interpolated solid thermo. Foam::pureSolidMixture
SourceFiles SourceFiles
interpolateSolid.C pureSolidMixture.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef interpolateSolid_H #ifndef pureSolidMixture_H
#define interpolateSolid_H #define pureSolidMixture_H
#include "volFields.H"
#include "dictionary.H" #include "basicMixture.H"
#include "interpolateXY.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,51 +43,81 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class interpolateSolid Declaration Class pureSolidMixture Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class interpolateSolid template<class ThermoType>
class pureSolidMixture
:
public basicMixture
{ {
protected: // Private data
// Protected data ThermoType mixture_;
Field<scalar> TValues_; //- Construct as copy (not implemented)
pureSolidMixture(const pureSolidMixture<ThermoType>&);
Field<scalar> rhoValues_;
Field<scalar> cpValues_;
Field<scalar> HfValues_;
Field<scalar> emissivityValues_;
Field<scalar> kappaRadValues_;
Field<scalar> sigmaSValues_;
public: public:
//- The type of thermodynamics this mixture is instantiated for
typedef ThermoType thermoType;
//- Runtime type information
TypeName("pureSolidMixture");
// Constructors // Constructors
//- Construct from mesh //- Construct from dictionary and mesh
interpolateSolid(const dictionary&); pureSolidMixture(const dictionary&, const fvMesh&);
//- Destructor //- Destructor
virtual ~interpolateSolid(); virtual ~pureSolidMixture();
// Member Functions // Member functions
// I-O const ThermoType& cellMixture(const label) const
{
return mixture_;
}
//- Read the interpolateSolid properties const ThermoType& cellVolMixture
bool read(const dictionary& dict); (
const scalar,
const scalar,
const label
) const
{
return mixture_;
}
//- Write the interpolateSolid properties const ThermoType& patchFaceMixture
bool writeData(Ostream& os) const; (
const label,
const label
) const
{
return mixture_;
}
const ThermoType& patchFaceVolMixture
(
const scalar,
const scalar,
const label,
const label
) const
{
return mixture_;
}
//- Read dictionary
void read(const dictionary&);
}; };
@ -96,6 +125,12 @@ public:
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "pureSolidMixture.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif

View File

@ -67,6 +67,8 @@ public:
//- The type of thermo package this mixture is instantiated for //- The type of thermo package this mixture is instantiated for
typedef ThermoSolidType thermoType; typedef ThermoSolidType thermoType;
//- Runtime type information
TypeName("reactingSolidMixture");
// Constructors // Constructors

View File

@ -1,250 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 "multiComponentSolidMixture.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ThermoSolidType>
void Foam::multiComponentSolidMixture<ThermoSolidType>::correctMassFractions()
{
volScalarField Yt("Yt", Y_[0]);
for (label n=1; n<Y_.size(); n++)
{
Yt += Y_[n];
}
forAll(Y_, n)
{
Y_[n] /= Yt;
}
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::X
(
label iComp, label celli, scalar T
) const
{
scalar rhoInv = 0.0;
forAll(solidData_, i)
{
rhoInv += Y_[i][celli]/solidData_[i].rho(T);
}
scalar X = Y_[iComp][celli]/solidData_[iComp].rho(T);
return (X/rhoInv);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ThermoSolidType>
Foam::multiComponentSolidMixture<ThermoSolidType>::multiComponentSolidMixture
(
const dictionary& thermoSolidDict,
const fvMesh& mesh
)
:
basicSolidMixture
(
thermoSolidDict.lookup("solidComponents"),
mesh
),
solidData_(components_.size())
{
forAll(components_, i)
{
solidData_.set
(
i,
new ThermoSolidType
(
thermoSolidDict.subDict(components_[i] + "Coeffs")
)
);
}
correctMassFractions();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::rho
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].rho(T)*X(i, celli, T);
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::hf
(
scalar, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].hf()*Y_[i][celli];
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::hs
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].hs(T)*Y_[i][celli];
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::h
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].h(T)*Y_[i][celli];
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::kappaRad
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].kappaRad(T)*X(i, celli, T);
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::sigmaS
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].sigmaS(T)*X(i, celli, T);
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::kappa
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].kappa(T)*X(i, celli, T);
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::emissivity
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].emissivity(T)*X(i, celli, T);
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::Cp
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].Cp(T)*Y_[i][celli];
}
return tmp;
}
template<class ThermoSolidType>
void Foam::multiComponentSolidMixture<ThermoSolidType>::read
(
const dictionary& thermoDict
)
{
forAll(components_, i)
{
solidData_[i] =
ThermoSolidType(thermoDict.subDict(components_[i] + "Coeffs"));
}
}
// ************************************************************************* //

View File

@ -1,141 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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::multiComponentSolidMixture
Description
Foam::multiComponentSolidMixture
\*---------------------------------------------------------------------------*/
#ifndef multiComponentSolidMixture_H
#define multiComponentSolidMixture_H
#include "PtrList.H"
#include "autoPtr.H"
#include "basicSolidMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class multiComponentSolidMixture Declaration
\*---------------------------------------------------------------------------*/
template<class ThermoSolidType>
class multiComponentSolidMixture
:
public basicSolidMixture
{
// Private data
//- Solid data
PtrList<ThermoSolidType> solidData_;
// Private Member Functions
//- Correct the mass fractions to sum to 1
void correctMassFractions();
//- Return molar fraction for component i in celli and at T
scalar X(label i, label celli, scalar T) const;
public:
// Constructors
//- Construct from dictionary and mesh
multiComponentSolidMixture(const dictionary&, const fvMesh&);
//- Destructor
virtual ~multiComponentSolidMixture()
{}
// Member Functions
//- Return the raw solid data
const PtrList<ThermoSolidType>& solidData() const
{
return solidData_;
}
//- Read dictionary
void read(const dictionary&);
// Cell-based properties
//- Density
virtual scalar rho(scalar T, label celli) const;
//- Absorption coefficient
virtual scalar kappaRad(scalar T, label celli) const;
//- Scatter coefficient
virtual scalar sigmaS(scalar T, label celli) const;
//- Thermal conductivity
virtual scalar kappa(scalar T, label celli) const;
//- Emissivity coefficient
virtual scalar emissivity(scalar T, label celli) const;
//- Formation enthalpy
virtual scalar hf(scalar T, label celli) const;
//- Sensible enthalpy
virtual scalar hs(scalar T, label celli) const;
//- Total enthalpy
virtual scalar h(scalar T, label celli) const;
//- Specific heat capacity
virtual scalar Cp(scalar T, label celli) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "multiComponentSolidMixture.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,68 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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/>.
InClass
Foam::solidMixtureThermo
\*---------------------------------------------------------------------------*/
#ifndef makeSolidMixtureThermo_H
#define makeSolidMixtureThermo_H
#include "addToRunTimeSelectionTable.H"
#include "solidMixtureThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeSolidMixtureThermo(CThermo,MixtureThermo,Mixture,Transport,Radiation,Thermo,Rho)\
\
typedef MixtureThermo<Mixture<Transport<Radiation<Thermo<Rho> > > > > \
MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho; \
\
defineTemplateTypeNameAndDebugWithName \
( \
MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \
#MixtureThermo \
"<"#Mixture"<"#Transport"<"#Radiation"<"#Thermo"<"#Rho">>>>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \
mesh \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \
dictionary \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,466 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "solidMixtureThermo.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::solidMixtureThermo<MixtureType>::calculate()
{
scalarField& rhoCells = rho_.internalField();
scalarField& kappaCells = kappa_.internalField();
scalarField& kappaRadCells = kappaRad_.internalField();
scalarField& sigmaSCells = sigmaS_.internalField();
scalarField& emissivityCells = emissivity_.internalField();
const volScalarField::InternalField& iT = T_.internalField();
forAll(iT, celli)
{
rhoCells[celli] = MixtureType::rho(iT[celli], celli);
kappaRadCells[celli] = MixtureType::kappaRad(iT[celli], celli);
sigmaSCells[celli] = MixtureType::sigmaS(iT[celli], celli);
kappaCells[celli] = MixtureType::kappa(iT[celli], celli);
emissivityCells[celli] = MixtureType::emissivity(iT[celli], celli);
}
const volScalarField::GeometricBoundaryField& bT = T_.boundaryField();
forAll(bT, patchI)
{
rho_.boundaryField()[patchI] == this->rho(patchI)();
kappa_.boundaryField()[patchI] == this->kappa(patchI)();
kappaRad_.boundaryField()[patchI] == this->kappaRad(patchI)();
sigmaS_.boundaryField()[patchI] == this->sigmaS(patchI)();
emissivity_.boundaryField()[patchI] == this->emissivity(patchI)();
}
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::rho
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const labelUList& cells = pp.faceCells();
tmp<scalarField> tRho(new scalarField(patchT.size()));
scalarField& Rho = tRho();
forAll(patchT, celli)
{
Rho[celli] = MixtureType::rho(patchT[celli], cells[celli]);
}
return tRho;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::sigmaS
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const labelUList& cells = pp.faceCells();
tmp<scalarField> tsigmaS(new scalarField(patchT.size()));
scalarField& sigmaS = tsigmaS();
forAll(patchT, celli)
{
sigmaS[celli] =
MixtureType::sigmaS(patchT[celli], cells[celli]);
}
return tsigmaS;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::kappaRad
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const labelUList& cells = pp.faceCells();
tmp<scalarField> tKappaRad(new scalarField(patchT.size()));
scalarField& kappaRad = tKappaRad();
forAll(patchT, celli)
{
kappaRad[celli] =
MixtureType::kappaRad(patchT[celli], cells[celli]);
}
return tKappaRad;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::emissivity
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const labelUList& cells = pp.faceCells();
tmp<scalarField> te(new scalarField(patchT.size()));
scalarField& e = te();
forAll(patchT, celli)
{
e[celli] = MixtureType::emissivity(patchT[celli], cells[celli]);
}
return te;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::solidMixtureThermo<MixtureType>::solidMixtureThermo
(
const fvMesh& mesh
)
:
basicSolidThermo(mesh),
MixtureType(*this, mesh),
kappa_
(
IOobject
(
"kappa",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimEnergy/dimTime/(dimLength*dimTemperature)
)
{
calculate();
}
template<class MixtureType>
Foam::solidMixtureThermo<MixtureType>::solidMixtureThermo
(
const fvMesh& mesh,
const dictionary& dict
)
:
basicSolidThermo(mesh, dict),
MixtureType(*this, mesh),
kappa_
(
IOobject
(
"kappa",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimEnergy/dimTime/(dimLength*dimTemperature)
)
{
calculate();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::solidMixtureThermo<MixtureType>::~solidMixtureThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::solidMixtureThermo<MixtureType>::correct()
{
calculate();
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::solidMixtureThermo<MixtureType>::
kappa() const
{
return kappa_;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::solidMixtureThermo<MixtureType>::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();
const volScalarField::InternalField& iT = T_.internalField();
forAll(iT, celli)
{
Cp[celli] = MixtureType::Cp(T_[celli], celli);
}
volScalarField::GeometricBoundaryField& bCp = Cp.boundaryField();
forAll(bCp, patchI)
{
bCp[patchI] == this->Cp(patchI)();
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::solidMixtureThermo<MixtureType>::hs() const
{
tmp<volScalarField> ths
(
new volScalarField
(
IOobject
(
"Hs",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/(dimMass*dimTemperature)
)
);
volScalarField& hs = ths();
const volScalarField::InternalField& iT = T_.internalField();
forAll(iT, celli)
{
hs[celli] = MixtureType::hs(T_[celli], celli);
}
volScalarField::GeometricBoundaryField& bHs = hs.boundaryField();
forAll(bHs, patchI)
{
bHs[patchI] == this->hs(patchI)();
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::solidMixtureThermo<MixtureType>::Hf() const
{
tmp<volScalarField> thF
(
new volScalarField
(
IOobject
(
"hF",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/(dimMass*dimTemperature)
)
);
volScalarField& hf = thF();
const volScalarField::InternalField& iT = T_.internalField();
forAll(iT, celli)
{
hf[celli] = MixtureType::hf(T_[celli], celli);
}
volScalarField::GeometricBoundaryField& bhf = hf.boundaryField();
forAll(bhf, patchI)
{
bhf[patchI] == this->Hf(patchI)();
}
return thF;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::kappa
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const labelUList& cells = pp.faceCells();
tmp<scalarField> tkappa(new scalarField(patchT.size()));
scalarField& kappa = tkappa();
forAll(patchT, celli)
{
kappa[celli] = MixtureType::kappa(patchT[celli], cells[celli]);
}
return tkappa;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::Cp
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const labelUList& cells = pp.faceCells();
tmp<scalarField> tCp(new scalarField(patchT.size()));
scalarField& Cp = tCp();
forAll(patchT, celli)
{
Cp[celli] = MixtureType::Cp(patchT[celli], cells[celli]);
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::hs
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const labelUList& cells = pp.faceCells();
tmp<scalarField> ths(new scalarField(patchT.size()));
scalarField& hs = ths();
forAll(patchT, celli)
{
hs[celli] = MixtureType::hs(patchT[celli], cells[celli]);
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::Hf
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const labelUList& cells = pp.faceCells();
tmp<scalarField> tHf(new scalarField(patchT.size()));
scalarField& Hf = tHf();
forAll(patchT, celli)
{
Hf[celli] = MixtureType::hf(patchT[celli], cells[celli]);
}
return tHf;
}
template<class MixtureType>
bool Foam::solidMixtureThermo<MixtureType>::read()
{
if (basicSolidThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
template<class MixtureType>
bool Foam::solidMixtureThermo<MixtureType>::writeData(Ostream& os) const
{
bool ok = basicSolidThermo::writeData(os);
return ok && os.good();
}
// ************************************************************************* //

View File

@ -1,188 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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::solidMixtureThermo
Description
Foam::solidMixtureThermo
SourceFiles
solidMixtureThermo.C
\*---------------------------------------------------------------------------*/
#ifndef solidMixtureThermo_H
#define solidMixtureThermo_H
#include "basicSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class solidMixtureThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class solidMixtureThermo
:
public basicSolidThermo,
public MixtureType
{
protected:
// Protected data
//- Thermal conductivity [W/m/K]
volScalarField kappa_;
private:
// Private Member Functions
//- Calculate K
void calculate();
// Per patch helpers to get mixture properties on a patch
tmp<scalarField> rho(const label patchI) const;
tmp<scalarField> sigmaS(const label patchI) const;
tmp<scalarField> kappaRad(const label patchI) const;
tmp<scalarField> emissivity(const label patchI) const;
public:
//- Runtime type information
TypeName("solidMixtureThermo");
// Constructors
//- Construct from mesh
solidMixtureThermo(const fvMesh&);
//- Construct from mesh and dictionary
solidMixtureThermo(const fvMesh&, const dictionary&);
//- Destructor
virtual ~solidMixtureThermo();
// Member functions
//- Update properties
virtual void correct();
//- Return the compostion of the solid mixture
virtual MixtureType& composition()
{
return *this;
}
//- Return the compostion of the solid mixture
virtual const MixtureType& composition() const
{
return *this;
}
// Derived thermal properties
//- Thermal conductivity [W/m/K]
virtual tmp<volScalarField> kappa() const;
//- Thermal conductivity [W/m/K]
virtual tmp<volSymmTensorField> directionalKappa() const
{
notImplemented("solidMixtureThermo::directionalKappa() const");
return tmp<volSymmTensorField>(NULL);
}
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> Cp() const;
//- Sensible enthalpy [J/(kg.K)]
virtual tmp<volScalarField> hs() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
// Per patch calculation
//- Thermal conductivity [W/(m.K)]
virtual tmp<scalarField> kappa(const label patchI) const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<symmTensorField> directionalKappa(const label) const
{
notImplemented
(
"solidMixtureThermo::directionalKappa(const label) const"
);
return tmp<symmTensorField>(NULL);
}
//- Specific heat capacity [J/(kg.K)]
virtual tmp<scalarField> Cp(const label patchI) const;
//- Sensible enthalpy [J/(kg.K)]
virtual tmp<scalarField> hs(const label patchI) const;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) const;
//- Read thermophysicalProperties dictionary
virtual bool read();
//- Write the basicSolidThermo properties
virtual bool writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "solidMixtureThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -23,40 +23,39 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "solidReactionThermo.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(solidReactionThermo, 0);
defineRunTimeSelectionTable(solidReactionThermo, mesh);
defineRunTimeSelectionTable(solidReactionThermo, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class thermo> Foam::solidReactionThermo::solidReactionThermo(const fvMesh& mesh)
inline Foam::constSolidTransport<thermo>::constSolidTransport
(
const thermo& t,
const scalar kappa
)
: :
thermo(t), solidThermo(mesh)
kappa_(kappa)
{} {}
template<class thermo> Foam::solidReactionThermo::solidReactionThermo
inline Foam::constSolidTransport<thermo>::constSolidTransport
( (
const word& name, const fvMesh& mesh,
const constSolidTransport& ct const dictionary& dict
) )
: :
thermo(name, ct), solidThermo(mesh, dict)
kappa_(ct.kappa_)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::solidReactionThermo::~solidReactionThermo()
{}
template<class thermo>
inline Foam::scalar Foam::constSolidTransport<thermo>::
kappa(const scalar T) const
{
return kappa_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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::solidReactionThermo
Description
Foam::solidReactionThermo
SourceFiles
solidReactionThermo.C
\*---------------------------------------------------------------------------*/
#ifndef solidReactionThermo_H
#define solidReactionThermo_H
#include "rhoThermo.H"
#include "basicSolidMixture.H"
#include "solidThermo.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class solidReactionThermo Declaration
\*---------------------------------------------------------------------------*/
class solidReactionThermo
:
public solidThermo
{
public:
//- Runtime type information
TypeName("solidReactionThermo");
//- Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
solidReactionThermo,
mesh,
(const fvMesh& mesh),
(mesh)
);
// Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
solidReactionThermo,
dictionary,
(const fvMesh& mesh, const dictionary& dict),
(mesh, dict)
);
// Constructors
//- Construct from mesh
solidReactionThermo(const fvMesh&);
//- Construct from dictionary and mesh
solidReactionThermo(const fvMesh&, const dictionary&);
// Selectors
//- Standard selection based on fvMesh
static autoPtr<solidReactionThermo> New(const fvMesh&);
//- Standard selection based on fvMesh amd dictionary
static autoPtr<solidReactionThermo> New
(
const fvMesh&,
const dictionary&
);
//- Destructor
virtual ~solidReactionThermo();
// Member functions
//- Return the composition of the multi-component mixture
virtual basicSolidMixture& composition() = 0;
//- Return the composition of the multi-component mixture
virtual const basicSolidMixture& composition() const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "solidReactionThermo.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::solidReactionThermo> Foam::solidReactionThermo::New
(
const fvMesh& mesh
)
{
// get model name, but do not register the dictionary
// otherwise it is registered in the database twice
const word modelType
(
IOdictionary
(
IOobject
(
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).lookup("thermoType")
);
Info<< "Selecting thermodynamics package " << modelType << endl;
meshConstructorTable::iterator cstrIter =
meshConstructorTablePtr_->find(modelType);
if (cstrIter == meshConstructorTablePtr_->end())
{
FatalErrorIn("solidReactionThermo::New(const fvMesh&)")
<< "Unknown solidReactionThermo type "
<< modelType << nl << nl
<< "Valid solidReactionThermo types:" << nl
<< meshConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
return autoPtr<solidReactionThermo>(cstrIter()(mesh));
}
Foam::autoPtr<Foam::solidReactionThermo> Foam::solidReactionThermo::New
(
const fvMesh& mesh, const dictionary& dict
)
{
if (debug)
{
Info<< "solidReactionThermo::New(const fvMesh&, const dictionary&): "
<< "constructing solidReactionThermo"
<< endl;
}
const word thermoType = dict.lookup("thermoType");
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(thermoType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"solidReactionThermo::New(const fvMesh&, const dictionary&)"
) << "Unknown solidReactionThermo type " << thermoType
<< endl << endl
<< "Valid solidReactionThermo types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<solidReactionThermo>(cstrIter()(mesh, dict));
}
// ************************************************************************* //

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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/>.
InClass
Foam::solidThermo
Description
Macros for creating solid thermo packages
\*---------------------------------------------------------------------------*/
#ifndef makeSolidThermo_H
#define makesolidThermo_H
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
#define makeSolidThermo(BaseThermo,Cthermo,Mixture,Transport,Radiation,Type,Thermo,Rho)\
\
typedef Cthermo \
< \
Mixture \
< \
Transport \
< \
Radiation \
< \
specieThermo \
< \
Thermo \
< \
Rho \
>, \
Type \
> \
> \
> \
>, \
BaseThermo \
> Cthermo##Mixture##Transport##Radiation##Type##Thermo##Rho##BaseThermo; \
\
defineTemplateTypeNameAndDebugWithName \
( \
Cthermo##Mixture##Transport##Radiation##Type##Thermo##Rho##BaseThermo, \
#Cthermo \
"<" \
#Mixture \
"<" \
#Transport \
"<" \
#Radiation \
"<specieThermo<" \
#Thermo \
"<" \
#Rho \
">," \
#Type \
">>>>" \
">", \
0 \
); \
\
\
typedef Mixture \
< \
Transport \
< \
Radiation \
< \
specieThermo \
< \
Thermo \
< \
Rho \
>, \
Type \
> \
> \
> \
> Mixture##Transport##Radiation##Type##Thermo##Rho; \
\
\
\
defineTemplateTypeNameAndDebugWithName \
( \
Mixture##Transport##Radiation##Type##Thermo##Rho, \
#Mixture \
"<" \
#Transport \
"<" \
#Radiation \
"<specieThermo<" \
#Thermo \
"<" \
#Rho \
">," \
#Type \
">>>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
BaseThermo, \
Cthermo##Mixture##Transport##Radiation##Type##Thermo##Rho##BaseThermo, \
mesh \
); \
\
addToRunTimeSelectionTable \
( \
BaseThermo, \
Cthermo##Mixture##Transport##Radiation##Type##Thermo##Rho##BaseThermo, \
dictionary \
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "solidThermo.H"
#include "fvMesh.H"
#include "volFields.H"
#include "HashTable.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
defineTypeNameAndDebug(solidThermo, 0);
defineRunTimeSelectionTable(solidThermo, mesh);
defineRunTimeSelectionTable(solidThermo, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidThermo::solidThermo(const fvMesh& mesh)
:
basicThermo(mesh),
rho_
(
IOobject
(
"rho",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimMass/dimVolume
)
{}
Foam::solidThermo::solidThermo
(
const fvMesh& mesh,
const dictionary& dict
)
:
basicThermo(mesh, dict),
rho_
(
IOobject
(
"rho",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimMass/dimVolume
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::solidThermo::~solidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::volScalarField& Foam::solidThermo::T()
{
return this->T_;
}
const Foam::volScalarField& Foam::solidThermo::T() const
{
return this->T_;
}
const Foam::volScalarField& Foam::solidThermo::rhos() const
{
return rho_;
}
Foam::volScalarField& Foam::solidThermo::rhos()
{
return rho_;
}
const Foam::volScalarField& Foam::solidThermo::p() const
{
return this->p_;
}
Foam::volScalarField& Foam::solidThermo::p()
{
return this->p_;
}
const Foam::volScalarField& Foam::solidThermo::alpha() const
{
return this->alpha_;
}
Foam::tmp<Foam::volScalarField> Foam::solidThermo::rho() const
{
return tmp<volScalarField>(rho_);
}
bool Foam::solidThermo::read()
{
return regIOobject::read();
}
// ************************************************************************* //

View File

@ -22,20 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::basicSolidThermo Foam::solidThermo
Description Description
Basic solid thermodynamic properties Basic solid thermodynamic properties
SourceFiles SourceFiles
basicSolidThermo.C solidThermo.C
newBasicThermo.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef basicSolidThermo_H #ifndef solidThermo_H
#define basicSolidThermo_H #define solidThermo_H
#include "volFields.H" #include "volFields.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
@ -43,6 +41,7 @@ SourceFiles
#include "IOdictionary.H" #include "IOdictionary.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "basicSolidMixture.H" #include "basicSolidMixture.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,48 +49,33 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class basicSolidThermo Declaration Class solidThermo Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class basicSolidThermo class solidThermo
: :
public IOdictionary public basicThermo
{ {
protected: protected:
// Protected data
const fvMesh& mesh_;
// Fields // Fields
//- Temperature [K]
volScalarField T_;
//- Density [kg/m3] //- Density [kg/m3]
volScalarField rho_; volScalarField rho_;
//- Absorption coefficient [1/m]
volScalarField kappaRad_;
//- Scatter coeffcient [1/m]
volScalarField sigmaS_;
//- Emissivity coeffcient []
volScalarField emissivity_;
public: public:
//- Runtime type information //- Runtime type information
TypeName("basicSolidThermo"); TypeName("solidThermo");
// Declare run-time constructor selection tables // Declare run-time constructor selection tables
declareRunTimeSelectionTable declareRunTimeSelectionTable
( (
autoPtr, autoPtr,
basicSolidThermo, solidThermo,
mesh, mesh,
(const fvMesh& mesh), (const fvMesh& mesh),
(mesh) (mesh)
@ -102,7 +86,7 @@ public:
declareRunTimeSelectionTable declareRunTimeSelectionTable
( (
autoPtr, autoPtr,
basicSolidThermo, solidThermo,
dictionary, dictionary,
(const fvMesh& mesh, const dictionary& dict), (const fvMesh& mesh, const dictionary& dict),
(mesh, dict) (mesh, dict)
@ -112,22 +96,22 @@ public:
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
basicSolidThermo(const fvMesh&); solidThermo(const fvMesh&);
//- Construct from mesh and dict //- Construct from mesh and dict
basicSolidThermo(const fvMesh&, const dictionary& dict); solidThermo(const fvMesh&, const dictionary& dict);
//- Return a pointer to a new basicSolidThermo created from //- Return a pointer to a new solidThermo created from
// the solidThermophysicalProperties dictionary // the solidThermophysicalProperties dictionary
static autoPtr<basicSolidThermo> New(const fvMesh&); static autoPtr<solidThermo> New(const fvMesh&);
//- Return a pointer to a new basicSolidThermo created from //- Return a pointer to a new solidThermo created from
// local dictionary // local dictionary
static autoPtr<basicSolidThermo> New(const fvMesh&, const dictionary&); static autoPtr<solidThermo> New(const fvMesh&, const dictionary&);
//- Destructor //- Destructor
virtual ~basicSolidThermo(); virtual ~solidThermo();
// Member functions // Member functions
@ -135,85 +119,131 @@ public:
//- Update properties //- Update properties
virtual void correct() = 0; virtual void correct() = 0;
//- Return the composition of the solid mixture
virtual basicSolidMixture& composition();
//- Return the composition of the solid mixture
virtual const basicSolidMixture& composition() const;
// Access to thermodynamic state variables // Access to thermodynamic state variables
//- Temperature [K] //- Constant access to temperature [K]
virtual const volScalarField& T() const; virtual const volScalarField& T() const;
//- non-const access for T //- Non constant access to temperature [K]
virtual volScalarField& T(); virtual volScalarField& T();
//- Density [kg/m^3] //- Solid density [kg/m3]
virtual const volScalarField& rho() const; virtual const volScalarField& rhos() const;
//- non-const access for rho //- Non-const access for solid density [kg/m3]
virtual volScalarField& rho(); virtual volScalarField& rhos();
//- Absorption coefficient [1/m]
virtual const volScalarField& kappaRad() const;
//- Emissivity coefficient //- Constant access to p [Pa]
virtual const volScalarField& sigmaS() const; virtual const volScalarField& p() const;
//- Emissivity coefficient [1/m] //- Non-constant access to p [Pa]
virtual const volScalarField& emissivity() const; virtual volScalarField& p();
// Access to transport state variables
//- Thermal diffusivity for enthalpy of mixture [kg/m/s]
virtual const volScalarField& alpha() const;
// Derived thermal properties // Derived thermal properties
//- Enthalpy/Internal energy [J/kg]
virtual const volScalarField& he() const = 0;
//- Enthalpy/Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& he() = 0;
//- Thermal conductivity [W/m/K] //- Thermal conductivity [W/m/K]
virtual tmp<volScalarField> kappa() const = 0; virtual tmp<volScalarField> kappa() const = 0;
//- Thermal conductivity [W/m/K] //- Thermal conductivity [W/m/K]
virtual tmp<volSymmTensorField> directionalKappa() const = 0; virtual tmp<volVectorField> Kappa() const = 0;
//- Absorption coefficient [1/m]
virtual tmp<volScalarField> kappaRad() const = 0;
//- Scatter coefficient
virtual tmp<volScalarField> sigmaS() const = 0;
//- Emissivity coefficient [1/m]
virtual tmp<volScalarField> emissivity() const = 0;
//- Specific heat capacity [J/kg/K] //- Specific heat capacity [J/kg/K]
virtual tmp<volScalarField> Cp() const = 0; virtual tmp<volScalarField> Cp() const = 0;
//- Sensible enthalpy [J/kg]
virtual tmp<volScalarField> hs() const;
//- Heat of formation [J/kg] //- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const = 0; virtual tmp<volScalarField> hc() const = 0;
//- Density [kg/m^3]
virtual tmp<volScalarField> rho() const;
// Per patch calculation // Per patch calculation
//- Thermal conductivity [W//m/K] //- Enthalpy/Internal energy [J/kg]
virtual tmp<scalarField> kappa(const label patchI) const = 0; virtual tmp<scalarField> he
//- Thermal conductivity [W//m/K]
virtual tmp<symmTensorField> directionalKappa
( (
const label const scalarField& p,
const scalarField& T,
const label patchi
) const = 0; ) const = 0;
//- Specific heat capacity [J/kg/K)] //- Specific heat capacity [J/kg/K)]
virtual tmp<scalarField> Cp(const label patchI) const = 0; virtual tmp<scalarField> Cp
(
const scalarField& p,
const scalarField& T,
const label patchI
) const = 0;
//- Sensible enthalpy [J/kg]
virtual tmp<scalarField> hs(const label patchI) const;
//- Heat of formation [J/kg] //- Isotropic thermal conductivity [W//m/K]
virtual tmp<scalarField> Hf(const label patchI) const = 0; virtual tmp<scalarField> kappa
(
const label patchI
) const = 0;
//- Anisotropic thermal conductivity [W/m/K]
virtual tmp<vectorField> Kappa
(
const label patchI
) const = 0;
//- Thermal diffusivity for enthalpy of mixture [kg/m/s]
virtual tmp<scalarField> alpha
(
const label patchI
) const = 0;
//- Absorption coefficient [1/m]
virtual tmp<scalarField> kappaRad
(
const label patchI
) const = 0;
//- Scatter coefficient
virtual tmp<scalarField> sigmaS
(
const label patchI
) const = 0;
//- Emissivity coefficient [1/m]
virtual tmp<scalarField> emissivity
(
const label patchI
) const = 0;
// I-O // I-O
//- Write the basicSolidThermo properties
virtual bool writeData(Ostream& os) const = 0;
//- Read thermophysicalProperties dictionary //- Read thermophysicalProperties dictionary
virtual bool read() = 0; virtual bool read();
//- Ostream Operator
friend Ostream& operator<<(Ostream& os, const basicSolidThermo& s);
}; };

View File

@ -23,19 +23,19 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "basicSolidThermo.H" #include "solidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::basicSolidThermo> Foam::basicSolidThermo::New Foam::autoPtr<Foam::solidThermo> Foam::solidThermo::New
( (
const fvMesh& mesh const fvMesh& mesh
) )
{ {
if (debug) if (debug)
{ {
Info<< "basicSolidThermo::New(const fvMesh&): " Info<< "solidThermo::New(const fvMesh&): "
<< "constructing basicSolidThermo" << "constructing solidThermo"
<< endl; << endl;
} }
@ -45,7 +45,7 @@ Foam::autoPtr<Foam::basicSolidThermo> Foam::basicSolidThermo::New
( (
IOobject IOobject
( (
"solidThermophysicalProperties", "thermophysicalProperties",
mesh.time().constant(), mesh.time().constant(),
mesh, mesh,
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
@ -62,7 +62,7 @@ Foam::autoPtr<Foam::basicSolidThermo> Foam::basicSolidThermo::New
{ {
FatalErrorIn FatalErrorIn
( (
"basicSolidThermo::New(const fvMesh&)" "solidThermo::New(const fvMesh&)"
) << "Unknown solidThermo type " << thermoType ) << "Unknown solidThermo type " << thermoType
<< endl << endl << endl << endl
<< "Valid solidThermo types are :" << endl << "Valid solidThermo types are :" << endl
@ -70,19 +70,19 @@ Foam::autoPtr<Foam::basicSolidThermo> Foam::basicSolidThermo::New
<< exit(FatalError); << exit(FatalError);
} }
return autoPtr<basicSolidThermo>(cstrIter()(mesh)); return autoPtr<solidThermo>(cstrIter()(mesh));
} }
Foam::autoPtr<Foam::basicSolidThermo> Foam::basicSolidThermo::New Foam::autoPtr<Foam::solidThermo> Foam::solidThermo::New
( (
const fvMesh& mesh, const dictionary& dict const fvMesh& mesh, const dictionary& dict
) )
{ {
if (debug) if (debug)
{ {
Info<< "basicSolidThermo::New(const fvMesh&, const dictionary&): " Info<< "solidThermo::New(const fvMesh&, const dictionary&): "
<< "constructing basicSolidThermo" << "constructing solidThermo"
<< endl; << endl;
} }
@ -95,7 +95,7 @@ Foam::autoPtr<Foam::basicSolidThermo> Foam::basicSolidThermo::New
{ {
FatalErrorIn FatalErrorIn
( (
"basicSolidThermo::New(const fvMesh&, const dictionary&)" "solidThermo::New(const fvMesh&, const dictionary&)"
) << "Unknown solidThermo type " << thermoType ) << "Unknown solidThermo type " << thermoType
<< endl << endl << endl << endl
<< "Valid solidThermo types are :" << endl << "Valid solidThermo types are :" << endl
@ -103,7 +103,7 @@ Foam::autoPtr<Foam::basicSolidThermo> Foam::basicSolidThermo::New
<< exit(FatalError); << exit(FatalError);
} }
return autoPtr<basicSolidThermo>(cstrIter()(mesh, dict)); return autoPtr<solidThermo>(cstrIter()(mesh, dict));
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -25,10 +25,11 @@ License
#include "radiationCoupledBase.H" #include "radiationCoupledBase.H"
#include "volFields.H" #include "volFields.H"
#include "basicSolidThermo.H"
#include "mappedPatchBase.H" #include "mappedPatchBase.H"
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "solidThermo.H"
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
@ -142,6 +143,12 @@ Foam::scalarField Foam::radiationCoupledBase::emissivity() const
const polyMesh& nbrMesh = mpp.sampleMesh(); const polyMesh& nbrMesh = mpp.sampleMesh();
const solidThermo& thermo =
nbrMesh.lookupObject<solidThermo>
(
"thermophysicalProperties"
);
// Force recalculation of mapping and schedule // Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map(); const mapDistribute& distMap = mpp.map();
@ -150,29 +157,10 @@ Foam::scalarField Foam::radiationCoupledBase::emissivity() const
nbrMesh nbrMesh
).boundary()[mpp.samplePolyPatch().index()]; ).boundary()[mpp.samplePolyPatch().index()];
if (nbrMesh.foundObject<volScalarField>("emissivity")) scalarField emissivity(thermo.emissivity(nbrPatch.index()));
{
tmp<scalarField> temissivity
(
new scalarField
(
nbrPatch.lookupPatchField<volScalarField, scalar>
(
"emissivity"
)
)
);
scalarField emissivity(temissivity);
// Use direct map mapping to exchange data
distMap.distribute(emissivity); distMap.distribute(emissivity);
//Pout << emissivity << endl;
return emissivity; return emissivity;
}
else
{
return scalarField(0);
}
} }
break; break;

View File

@ -357,6 +357,7 @@ void Foam::radiation::viewFactor::calculate()
>(QrPatch); >(QrPatch);
const scalarList eb = Qrp.emissivity(); const scalarList eb = Qrp.emissivity();
const scalarList& Hoi = Qrp.Qro(); const scalarList& Hoi = Qrp.Qro();
const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID]; const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID];
@ -373,10 +374,6 @@ void Foam::radiation::viewFactor::calculate()
labelListList coarseToFine(invertOneToMany(nAgglom, agglom)); labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
//scalarList Tave(pp.size(), 0.0);
//scalarList Eave(Tave.size(), 0.0);
//scalarList Hoiave(Tave.size(), 0.0);
forAll(coarseToFine, coarseI) forAll(coarseToFine, coarseI)
{ {
const label coarseFaceID = coarsePatchFace[coarseI]; const label coarseFaceID = coarsePatchFace[coarseI];
@ -395,10 +392,6 @@ void Foam::radiation::viewFactor::calculate()
Eave[coarseI] += (eb[faceI]*sf[faceI])/area; Eave[coarseI] += (eb[faceI]*sf[faceI])/area;
Hoiave[coarseI] += (Hoi[faceI]*sf[faceI])/area; Hoiave[coarseI] += (Hoi[faceI]*sf[faceI])/area;
} }
//localCoarseTave.append(Tave[coarseI]);
//localCoarseEave.append(Eave[coarseI]);
//localCoarseHoave.append(Hoiave[coarseI]);
} }
} }

View File

@ -37,25 +37,48 @@ Description
#include "constSolidThermo.H" #include "constSolidThermo.H"
#include "exponentialSolidThermo.H" #include "exponentialSolidThermo.H"
#include "constSolidTransport.H" #include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
#include "exponentialSolidTransport.H" #include "exponentialSolidTransport.H"
#include "constSolidRad.H" #include "constSolidRad.H"
#include "sensibleEnthalpy.H"
#include "specieThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
typedef constSolidTransport<constSolidRad<constSolidThermo<constRho> > > typedef
constSolidThermoPhysics; constIsoSolidTransport
typedef constSolidTransport
< <
constSolidRad constSolidRad
<
specieThermo
<
constSolidThermo
<
constRho
>,
sensibleEnthalpy
>
>
>
constSolidThermoPhysics;
typedef
exponentialSolidTransport
<
constSolidRad
<
specieThermo
< <
exponentialSolidThermo exponentialSolidThermo
< <
constRho constRho
>,
sensibleEnthalpy
> >
> >
> >

View File

@ -43,6 +43,13 @@ namespace Foam
template<class thermo> class constSolidRad; template<class thermo> class constSolidRad;
template<class thermo>
inline constSolidRad<thermo> operator*
(
const scalar,
const constSolidRad<thermo>&
);
template<class thermo> template<class thermo>
Ostream& operator<< Ostream& operator<<
( (
@ -110,6 +117,22 @@ public:
inline scalar emissivity(scalar T) const; inline scalar emissivity(scalar T) const;
// Member operators
inline constSolidRad& operator=(const constSolidRad&);
inline void operator+=(const constSolidRad&);
inline void operator-=(const constSolidRad&);
// Friend operators
friend constSolidRad operator* <thermo>
(
const scalar,
const constSolidRad&
);
// Ostream Operator // Ostream Operator
friend Ostream& operator<< <thermo> friend Ostream& operator<< <thermo>

View File

@ -25,15 +25,10 @@ License
#include "constSolidRad.H" #include "constSolidRad.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class thermo> template<class thermo>
inline constSolidRad<thermo>::constSolidRad inline Foam::constSolidRad<thermo>::constSolidRad
( (
const thermo& t, const thermo& t,
const scalar kappaRad, const scalar kappaRad,
@ -52,7 +47,7 @@ inline constSolidRad<thermo>::constSolidRad
template<class thermo> template<class thermo>
inline constSolidRad<thermo>::constSolidRad inline Foam::constSolidRad<thermo>::constSolidRad
( (
const word& name, const word& name,
const constSolidRad& pg const constSolidRad& pg
@ -66,14 +61,16 @@ inline constSolidRad<thermo>::constSolidRad
template<class thermo> template<class thermo>
inline autoPtr<constSolidRad<thermo> > constSolidRad<thermo>::clone() const inline Foam::autoPtr<Foam::constSolidRad<thermo> >
Foam::constSolidRad<thermo>::clone() const
{ {
return autoPtr<constSolidRad<thermo> >(new constSolidRad<thermo>(*this)); return autoPtr<constSolidRad<thermo> >(new constSolidRad<thermo>(*this));
} }
template<class thermo> template<class thermo>
inline autoPtr<constSolidRad<thermo> > constSolidRad<thermo>::New(Istream& is) inline Foam::autoPtr<Foam::constSolidRad<thermo> >
Foam::constSolidRad<thermo>::New(Istream& is)
{ {
return autoPtr<constSolidRad<thermo> >(new constSolidRad<thermo>(is)); return autoPtr<constSolidRad<thermo> >(new constSolidRad<thermo>(is));
} }
@ -82,28 +79,101 @@ inline autoPtr<constSolidRad<thermo> > constSolidRad<thermo>::New(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class thermo> template<class thermo>
inline scalar constSolidRad<thermo>::kappaRad(scalar) const inline Foam::scalar Foam::constSolidRad<thermo>::kappaRad(scalar) const
{ {
return kappaRad_; return kappaRad_;
} }
template<class thermo> template<class thermo>
inline scalar constSolidRad<thermo>::sigmaS(scalar) const inline Foam::scalar Foam::constSolidRad<thermo>::sigmaS(scalar) const
{ {
return sigmaS_; return sigmaS_;
} }
template<class thermo> template<class thermo>
inline scalar constSolidRad<thermo>::emissivity(scalar) const inline Foam::scalar Foam::constSolidRad<thermo>::emissivity(scalar) const
{ {
return emissivity_; return emissivity_;
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constSolidRad<thermo>&
Foam::constSolidRad<thermo>::operator=(const constSolidRad<thermo>& ct)
{
thermo::operator=(ct);
kappaRad_ = ct.kappaRad_;
sigmaS_ = ct.sigmaS_;
emissivity_ = ct.emissivity_;
return *this;
}
template<class thermo>
inline void Foam::constSolidRad<thermo>::operator+=
(
const constSolidRad<thermo>& ct
)
{
scalar molr1 = this->nMoles();
thermo::operator+=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
kappaRad_ = molr1*kappaRad_ + molr2*ct.kappaRad_;
sigmaS_ = molr1*sigmaS_ + molr2*ct.sigmaS_;
emissivity_ = molr1*emissivity_ + molr2*ct.emissivity_;
}
template<class thermo>
inline void Foam::constSolidRad<thermo>::operator-=
(
const constSolidRad<thermo>& ct
)
{
scalar molr1 = this->nMoles();
thermo::operator-=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
kappaRad_ = molr1*kappaRad_ - molr2*ct.kappaRad_;
sigmaS_ = molr1*sigmaS_ - molr2*ct.sigmaS_;
emissivity_ = molr1*emissivity_ - molr2*ct.emissivity_;
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constSolidRad<thermo> Foam::operator*
(
const scalar s,
const constSolidRad<thermo>& ct
)
{
return constSolidRad<thermo>
(
s*static_cast<const thermo&>(ct),
ct.kappaRad_,
ct.sigmaS_,
ct.emissivity_
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -29,6 +29,7 @@ License
Foam::constRho::constRho(const dictionary& dict) Foam::constRho::constRho(const dictionary& dict)
: :
specie(dict),
rho_(readScalar(dict.subDict("density").lookup("rho"))) rho_(readScalar(dict.subDict("density").lookup("rho")))
{} {}
@ -37,6 +38,7 @@ Foam::constRho::constRho(const dictionary& dict)
Foam::Ostream& Foam::operator<<(Ostream& os, const constRho& cr) Foam::Ostream& Foam::operator<<(Ostream& os, const constRho& cr)
{ {
os << static_cast<const specie&>(cr);
os << cr.rho_; os << cr.rho_;
os.check("Ostream& operator<<(Ostream& os, const constRho& cr)"); os.check("Ostream& operator<<(Ostream& os, const constRho& cr)");

View File

@ -37,6 +37,7 @@ SourceFiles
#define constRho_H #define constRho_H
#include "dictionary.H" #include "dictionary.H"
#include "specie.H"
#include "autoPtr.H" #include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,11 +45,23 @@ SourceFiles
namespace Foam namespace Foam
{ {
class constRho;
inline constRho operator*
(
const scalar,
const constRho&
);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class constRho Declaration Class constRho Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class constRho class constRho
:
public specie
{ {
// Private data // Private data
@ -60,15 +73,20 @@ public:
// Constructors // Constructors
//- Construct from components
inline constRho(scalar rho);
//- Construct from dictionary //- Construct from dictionary
//constRho(Istream&); //constRho(Istream&);
constRho(const dictionary& dict); constRho(const dictionary& dict);
//- Construct as named copy //- Construct as named copy
inline constRho(const constRho&); inline constRho(const word&, const constRho&);
//- Construct from components
inline constRho
(
const specie& t,
const scalar rho
);
//- Construct and return a clone //- Construct and return a clone
inline autoPtr<constRho> clone() const; inline autoPtr<constRho> clone() const;
@ -80,9 +98,23 @@ public:
// Member functions // Member functions
//- Return density [kg/m3] //- Return density [kg/m3]
inline scalar rho(scalar T) const; inline scalar rho(scalar p, scalar T) const;
// Member operators
inline constRho& operator=(const constRho&);
inline void operator+=(const constRho&);
inline void operator-=(const constRho&);
// Friend operators
friend constRho operator*
(
const scalar,
const constRho&
);
// Ostream Operator // Ostream Operator
friend Ostream& operator<<(Ostream&, const constRho&); friend Ostream& operator<<(Ostream&, const constRho&);

View File

@ -25,25 +25,23 @@ License
#include "constRho.H" #include "constRho.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::constRho::constRho
(
scalar rho
)
:
rho_(rho)
{}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::constRho::constRho(const constRho& pg) inline Foam::constRho::constRho(const word& name, const constRho& pg)
: :
specie(name, pg),
rho_(pg.rho_) rho_(pg.rho_)
{} {}
inline Foam::constRho::constRho(const specie& t, const scalar rho)
:
specie(t),
rho_(rho)
{}
inline Foam::autoPtr<Foam::constRho> Foam::constRho::clone() const inline Foam::autoPtr<Foam::constRho> Foam::constRho::clone() const
{ {
return autoPtr<constRho>(new constRho(*this)); return autoPtr<constRho>(new constRho(*this));
@ -58,10 +56,63 @@ inline Foam::autoPtr<Foam::constRho> Foam::constRho::New(const dictionary& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::scalar Foam::constRho::rho(scalar) const inline Foam::scalar Foam::constRho::rho(scalar, scalar) const
{ {
return rho_; return rho_;
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline Foam::constRho& Foam::constRho::operator=(const constRho& ct)
{
specie::operator=(ct);
rho_ = ct.rho_;
return *this;
}
inline void Foam::constRho::operator+=(const constRho& ct)
{
scalar molr1 = this->nMoles();
specie::operator+=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
rho_ = molr1*rho_ + molr2*ct.rho_;
}
inline void Foam::constRho::operator-=(const constRho& ct)
{
scalar molr1 = this->nMoles();
specie::operator-=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
rho_ = molr1*rho_ - molr2*ct.rho_;
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
inline Foam::constRho Foam::operator*
(
const scalar s,
const constRho& ct
)
{
return constRho
(
s*static_cast<const specie&>(ct),
ct.rho_
);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -46,6 +46,37 @@ namespace Foam
template<class rhoType> class constSolidThermo; template<class rhoType> class constSolidThermo;
template<class rhoType>
inline constSolidThermo<rhoType> operator*
(
const scalar,
const constSolidThermo<rhoType>&
);
/*
template<class rhoType>
inline constSolidThermo<rhoType> operator+
(
const constSolidThermo<rhoType>&,
const constSolidThermo<rhoType>&
);
template<class rhoType>
inline constSolidThermo<rhoType> operator-
(
const constSolidThermo<rhoType>&,
const constSolidThermo<rhoType>&
);
template<class rhoType>
inline constSolidThermo<rhoType> operator==
(
const constSolidThermo<rhoType>&,
const constSolidThermo<rhoType>&
);
*/
template<class rhoType> template<class rhoType>
Ostream& operator<< Ostream& operator<<
( (
@ -99,19 +130,40 @@ public:
// Member Functions // Member Functions
//- Limit the temperature to be in the range Tlow_ to Thigh_
inline scalar limit(const scalar T) const;
// Fundamental properties // Fundamental properties
//- Heat capacity at constant pressure [J/(kg K)] //- Heat capacity at constant pressure [J/(kmol K)]
inline scalar Cp(const scalar T) const; inline scalar cp(const scalar p, const scalar T) const;
//- Enthalpy [J/kg] //- Absolute enthalpy [J/kmol]
inline scalar h(const scalar T) const; inline scalar ha(const scalar p, const scalar T) const;
//- Sensible enthalpy [J/kg] //- Sensible enthalpy [J/kmol]
inline scalar hs(const scalar T) const; inline scalar hs(const scalar p, const scalar T) const;
//- Enthalpy of formation [J/kg] //- Chemical enthalpy [J/kmol]
inline scalar hf() const; inline scalar hc() const;
//- Entropy [J/(kmol K)]
inline scalar s(const scalar p, const scalar T) const;
// Member operators
inline constSolidThermo& operator=(const constSolidThermo&);
inline void operator+=(const constSolidThermo&);
inline void operator-=(const constSolidThermo&);
// Friend operators
friend constSolidThermo operator* <rhoType>
(
const scalar,
const constSolidThermo&
);
// IOstream Operators // IOstream Operators

View File

@ -78,42 +78,137 @@ Foam::constSolidThermo<rhoType>::New(dictionary& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class rhoType> template<class rhoType>
inline Foam::scalar Foam::constSolidThermo<rhoType>::Cp inline Foam::scalar Foam::constSolidThermo<rhoType>::limit
(
const scalar
) const
{
return Cp_;
}
template<class rhoType>
inline Foam::scalar Foam::constSolidThermo<rhoType>::h
( (
const scalar T const scalar T
) const ) const
{ {
scalar hOffset = Cp_*(specie::Tstd); return T;
}
return (Cp_*T + Hf_ - hOffset);
template<class rhoType>
inline Foam::scalar Foam::constSolidThermo<rhoType>::cp
(
const scalar, const scalar
) const
{
return Cp_*this->W();
}
template<class rhoType>
inline Foam::scalar Foam::constSolidThermo<rhoType>::ha
(
const scalar p, const scalar T
) const
{
scalar hOffset = Cp_*(specie::Tstd);
return (Cp_*T + Hf_ - hOffset)*this->W();
} }
template<class rhoType> template<class rhoType>
inline Foam::scalar Foam::constSolidThermo<rhoType>::hs inline Foam::scalar Foam::constSolidThermo<rhoType>::hs
( (
const scalar T const scalar p, const scalar T
) const ) const
{ {
return h(T) - Hf_; scalar hOffset = Cp_*(specie::Tstd);
return (Cp_*T - hOffset)*this->W();
} }
template<class rhoType> template<class rhoType>
inline Foam::scalar Foam::constSolidThermo<rhoType>::hf() const inline Foam::scalar Foam::constSolidThermo<rhoType>::hc() const
{ {
return Hf_; return Hf_*this->W();
} }
template<class rhoType>
inline Foam::scalar Foam::constSolidThermo<rhoType>::s
(
const scalar p, const scalar T
) const
{
notImplemented
(
"scalar constSolidThermo<rhoType>::"
"s(const scalar p, const scalar T) const"
);
return T;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class rhoType>
inline Foam::constSolidThermo<rhoType>&
Foam::constSolidThermo<rhoType>::operator=
(
const constSolidThermo<rhoType>& ct
)
{
rhoType::operator=(ct);
Hf_ = ct.Hf_;
Cp_ = ct.Cp_;
return *this;
}
template<class rhoType>
inline void Foam::constSolidThermo<rhoType>::operator+=
(
const constSolidThermo<rhoType>& ct
)
{
scalar molr1 = this->nMoles();
rhoType::operator+=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
Cp_ = molr1*Cp_ + molr2*ct.Cp_;
Hf_ = molr1*Hf_ + molr2*ct.Hf_;
}
template<class rhoType>
inline void Foam::constSolidThermo<rhoType>::operator-=
(
const constSolidThermo<rhoType>& ct
)
{
scalar molr1 = this->nMoles();
rhoType::operator-=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
Cp_ = molr1*Cp_ - molr2*ct.Cp_;
Hf_ = molr1*Hf_ - molr2*ct.Hf_;
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class rhoType>
inline Foam::constSolidThermo<rhoType> Foam::operator*
(
const scalar s,
const constSolidThermo<rhoType>& ct
)
{
return constSolidThermo<rhoType>
(
s*static_cast<const rhoType&>(ct),
ct.Cp_,
ct.Hf_
);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -47,6 +47,14 @@ namespace Foam
template<class rhoType> class exponentialSolidThermo; template<class rhoType> class exponentialSolidThermo;
template<class rhoType>
inline exponentialSolidThermo<rhoType> operator*
(
const scalar,
const exponentialSolidThermo<rhoType>&
);
template<class rhoType> template<class rhoType>
Ostream& operator<< Ostream& operator<<
( (
@ -109,17 +117,46 @@ public:
// Member Functions // Member Functions
//- Heat capacity at constant pressure [J/(kg K)] //- Limit the temperature to be in the range Tlow_ to Thigh_
inline scalar Cp(const scalar T) const; inline scalar limit(const scalar T) const;
//- Enthalpy [J/kmol]
inline scalar h(const scalar T) const; // Fundamental properties
//- Heat capacity at constant pressure [J/(kg K)]
inline scalar cp(const scalar p, const scalar T) const;
//- Absolute enthalpy [J/kmol]
inline scalar ha(const scalar p, const scalar T) const;
//- Sensible enthalpy [J/kg] //- Sensible enthalpy [J/kg]
inline scalar hs(const scalar T) const; inline scalar hs(const scalar p, const scalar T) const;
//- Formation enthalpy [J/kg] //- chemical enthalpy [J/kg]
inline scalar hf() const; inline scalar hc() const;
//- Entropy [J/(kmol K)]
inline scalar s(const scalar p, const scalar T) const;
// Member operators
inline exponentialSolidThermo& operator=
(
const exponentialSolidThermo&
);
inline void operator+=(const exponentialSolidThermo&);
inline void operator-=(const exponentialSolidThermo&);
// Friend operators
friend exponentialSolidThermo operator* <rhoType>
(
const scalar,
const exponentialSolidThermo&
);
// Ostream Operator // Ostream Operator

View File

@ -28,7 +28,6 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class rhoType> template<class rhoType>
inline void Foam::exponentialSolidThermo<rhoType>::checkT(const scalar T) const inline void Foam::exponentialSolidThermo<rhoType>::checkT(const scalar T) const
{ {
@ -45,6 +44,20 @@ inline void Foam::exponentialSolidThermo<rhoType>::checkT(const scalar T) const
} }
template<class rhoType>
inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::integrateCp
(
const scalar T
) const
{
return
(
c0_*pow(T, n0_ + 1.0)
/(pow(Tref_, n0_)*(n0_ + 1.0))
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class rhoType> template<class rhoType>
@ -83,40 +96,36 @@ inline Foam::exponentialSolidThermo<rhoType>::exponentialSolidThermo
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class rhoType> template<class rhoType>
inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::integrateCp inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::limit
( (
const scalar T const scalar T
) const ) const
{ {
return return T;
(
c0_*pow(T, n0_ + 1.0)
/(pow(Tref_, n0_)*(n0_ + 1.0))
);
} }
template<class rhoType> template<class rhoType>
inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::Cp inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::cp
( (
const scalar T const scalar p, const scalar T
) const ) const
{ {
return c0_*pow(T/Tref_, n0_); return c0_*pow(T/Tref_, n0_)*this->W();
} }
template<class rhoType> template<class rhoType>
inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::h inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::ha
( (
const scalar T const scalar p, const scalar T
) const ) const
{ {
scalar hOffset = integrateCp(specie::Tstd); scalar hOffset = integrateCp(specie::Tstd);
return return
( (
integrateCp(T) + Hf_ - hOffset (integrateCp(T) + Hf_ - hOffset)*this->W()
); );
} }
@ -124,18 +133,113 @@ inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::h
template<class rhoType> template<class rhoType>
inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::hs inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::hs
( (
const scalar T const scalar p, const scalar T
) const ) const
{ {
return h(T) - Hf_; scalar hOffset = integrateCp(specie::Tstd);
return (integrateCp(T) - hOffset)*this->W();
} }
template<class rhoType> template<class rhoType>
inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::hf() const inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::hc() const
{ {
return Hf_; return Hf_*this->W();
} }
template<class rhoType>
inline Foam::scalar Foam::exponentialSolidThermo<rhoType>::s
(
const scalar p, const scalar T
) const
{
notImplemented
(
"scalar exponentialSolidThermo<rhoType>::"
"s(const scalar p, const scalar T) const"
);
return T;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class rhoType>
inline Foam::exponentialSolidThermo<rhoType>&
Foam::exponentialSolidThermo<rhoType>::operator=
(
const exponentialSolidThermo<rhoType>& ct
)
{
rhoType::operator=(ct);
Hf_ = ct.Hf_;
c0_ = ct.c0_;
n0_ = ct.n0_;
Tref_ = ct.Tref_;
return *this;
}
template<class rhoType>
inline void Foam::exponentialSolidThermo<rhoType>::operator+=
(
const exponentialSolidThermo<rhoType>& ct
)
{
scalar molr1 = this->nMoles();
rhoType::operator+=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
Hf_ = molr1*Hf_ + molr2*ct.Hf_;
c0_ = molr1*c0_ + molr2*ct.c0_;
n0_ = (molr1*n0_ + molr2*ct.n0_);
Tref_ = (molr1*Tref_ + molr2*ct.Tref_);
}
template<class rhoType>
inline void Foam::exponentialSolidThermo<rhoType>::operator-=
(
const exponentialSolidThermo<rhoType>& ct
)
{
scalar molr1 = this->nMoles();
rhoType::operator-=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
Hf_ = molr1*Hf_ - molr2*ct.Hf_;
c0_ = (molr1*c0_ - molr2*ct.c0_);
n0_ = (molr1*n0_ - molr2*ct.n0_);
Tref_ = (molr1*Tref_ - molr2*ct.Tref_);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class rhoType>
inline Foam::exponentialSolidThermo<rhoType> Foam::operator*
(
const scalar s,
const exponentialSolidThermo<rhoType>& ct
)
{
return exponentialSolidThermo<rhoType>
(
s*static_cast<const rhoType&>(ct),
ct.Hf_,
ct.c0_,
ct.n0_,
ct.Tref_
);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -23,19 +23,40 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "basicSolidThermo.H" #include "constAnIsoSolidTransport.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
const Foam::volScalarField& Foam::basicSolidThermo::T() const template<class thermo>
Foam::constAnIsoSolidTransport<thermo>::constAnIsoSolidTransport
(
const dictionary& dict
)
:
thermo(dict),
kappa_(dict.subDict("transport").lookup("kappa"))
{}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class thermo>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const constAnIsoSolidTransport<thermo>& ct
)
{ {
return T_; operator<<(os, static_cast<const thermo&>(ct));
} os << tab << ct.kappa_;
os.check
(
"Ostream& operator<<(Ostream& os,const constAnIsoSolidTransport& ct)"
);
Foam::volScalarField& Foam::basicSolidThermo::T() return os;
{
return T_;
} }

View File

@ -0,0 +1,158 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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::constAnIsoSolidTransport
Description
Constant properties Transport package.
Templated into a given thermodynamics package (needed for thermal
conductivity).
SourceFiles
constAnIsoSolidTransportI.H
constAnIsoSolidTransport.C
\*---------------------------------------------------------------------------*/
#ifndef constAnIsoSolidTransport_H
#define constAnIsoSolidTransport_H
#include "vector.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<class thermo> class constAnIsoSolidTransport;
template<class thermo>
inline constAnIsoSolidTransport<thermo> operator*
(
const scalar,
const constAnIsoSolidTransport<thermo>&
);
template<class thermo>
Ostream& operator<<
(
Ostream&,
const constAnIsoSolidTransport<thermo>&
);
/*---------------------------------------------------------------------------*\
Class constAnIsoSolidTransport Declaration
\*---------------------------------------------------------------------------*/
template<class thermo>
class constAnIsoSolidTransport
:
public thermo
{
// Private data
//- Constant anisotropic thermal conductivity.
vector kappa_;
// Private Member Functions
//- Construct from components
inline constAnIsoSolidTransport
(
const thermo& t,
const vector kappa
);
public:
// Constructors
//- Construct as named copy
inline constAnIsoSolidTransport
(
const word&,
const constAnIsoSolidTransport&
);
//- Construct from Istream
//constAnIsoSolidTransport(Istream&);
constAnIsoSolidTransport(const dictionary&);
// Member functions
//- Isotropic thermal conductivity [W/mK]
inline scalar kappa(const scalar T) const;
//- Un-isotropic thermal conductivity [W/mK]
inline vector Kappa(const scalar T) const;
// Member operators
inline constAnIsoSolidTransport& operator=
(
const constAnIsoSolidTransport&
);
inline void operator+=(const constAnIsoSolidTransport&);
inline void operator-=(const constAnIsoSolidTransport&);
// Friend operators
friend constAnIsoSolidTransport operator* <thermo>
(
const scalar,
const constAnIsoSolidTransport&
);
// Ostream Operator
friend Ostream& operator<< <thermo>
(
Ostream&,
const constAnIsoSolidTransport&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "constAnIsoSolidTransportI.H"
#ifdef NoRepository
# include "constAnIsoSolidTransport.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constAnIsoSolidTransport<thermo>::constAnIsoSolidTransport
(
const thermo& t,
const vector kappa
)
:
thermo(t),
kappa_(kappa)
{}
template<class thermo>
inline Foam::constAnIsoSolidTransport<thermo>::constAnIsoSolidTransport
(
const word& name,
const constAnIsoSolidTransport& ct
)
:
thermo(name, ct),
kappa_(ct.kappa_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class thermo>
inline Foam::scalar Foam::constAnIsoSolidTransport<thermo>::
kappa(const scalar T) const
{
return mag(kappa_);
}
template<class thermo>
inline Foam::vector Foam::constAnIsoSolidTransport<thermo>::
Kappa(const scalar T) const
{
return kappa_;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constAnIsoSolidTransport<thermo>&
Foam::constAnIsoSolidTransport<thermo>::operator=
(
const constAnIsoSolidTransport<thermo>& ct
)
{
kappa_ = ct.kappa_;
return *this;
}
template<class thermo>
inline void Foam::constAnIsoSolidTransport<thermo>::operator+=
(
const constAnIsoSolidTransport<thermo>& ct
)
{
scalar molr1 = this->nMoles();
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
kappa_ = molr1*kappa_ + molr2*ct.kappa_;
}
template<class thermo>
inline void Foam::constAnIsoSolidTransport<thermo>::operator-=
(
const constAnIsoSolidTransport<thermo>& ct
)
{
scalar molr1 = this->nMoles();
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
kappa_ = molr1*kappa_ - molr2*ct.kappa_;
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constAnIsoSolidTransport<thermo> Foam::operator*
(
const scalar s,
const constAnIsoSolidTransport<thermo>& ct
)
{
return constAnIsoSolidTransport<thermo>
(
s*static_cast<const thermo&>(ct),
ct.kappa_
);
}
// ************************************************************************* //

View File

@ -23,13 +23,16 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "constSolidTransport.H" #include "constIsoSolidTransport.H"
#include "IOstreams.H" #include "IOstreams.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class thermo> template<class thermo>
Foam::constSolidTransport<thermo>::constSolidTransport(const dictionary& dict) Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport
(
const dictionary& dict
)
: :
thermo(dict), thermo(dict),
kappa_(readScalar(dict.subDict("transport").lookup("kappa"))) kappa_(readScalar(dict.subDict("transport").lookup("kappa")))
@ -42,13 +45,16 @@ template<class thermo>
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Ostream& os, Ostream& os,
const constSolidTransport<thermo>& ct const constIsoSolidTransport<thermo>& ct
) )
{ {
operator<<(os, static_cast<const thermo&>(ct)); operator<<(os, static_cast<const thermo&>(ct));
os << tab << ct.kappa_; os << tab << ct.kappa_;
os.check("Ostream& operator<<(Ostream& os,const constSolidTransport& ct)"); os.check
(
"Ostream& operator<<(Ostream& os,const constIsoSolidTransport& ct)"
);
return os; return os;
} }

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::constSolidTransport Foam::constIsoSolidTransport
Description Description
Constant properties Transport package. Constant properties Transport package.
@ -30,48 +30,57 @@ Description
conductivity). conductivity).
SourceFiles SourceFiles
constSolidTransportI.H constIsoSolidTransportI.H
constSolidTransport.C constIsoSolidTransport.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef constSolidTransport_H #ifndef constIsoSolidTransport_H
#define constSolidTransport_H #define constIsoSolidTransport_H
#include "vector.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
template<class thermo> class constSolidTransport; template<class thermo> class constIsoSolidTransport;
template<class thermo>
inline constIsoSolidTransport<thermo> operator*
(
const scalar,
const constIsoSolidTransport<thermo>&
);
template<class thermo> template<class thermo>
Ostream& operator<< Ostream& operator<<
( (
Ostream&, Ostream&,
const constSolidTransport<thermo>& const constIsoSolidTransport<thermo>&
); );
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class constSolidTransport Declaration Class constIsoSolidTransport Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class thermo> template<class thermo>
class constSolidTransport class constIsoSolidTransport
: :
public thermo public thermo
{ {
// Private data // Private data
//- Constant thermal conductivity. //- Constant isotropic thermal conductivity.
scalar kappa_; scalar kappa_;
// Private Member Functions // Private Member Functions
//- Construct from components //- Construct from components
inline constSolidTransport inline constIsoSolidTransport
( (
const thermo& t, const thermo& t,
const scalar kappa const scalar kappa
@ -83,25 +92,51 @@ public:
// Constructors // Constructors
//- Construct as named copy //- Construct as named copy
inline constSolidTransport(const word&, const constSolidTransport&); inline constIsoSolidTransport
(
const word&,
const constIsoSolidTransport&
);
//- Construct from Istream //- Construct from Istream
//constSolidTransport(Istream&); //constIsoSolidTransport(Istream&);
constSolidTransport(const dictionary&); constIsoSolidTransport(const dictionary&);
// Member functions // Member functions
//- Thermal conductivity [W/mK] //- Isotropic thermal conductivity [W/mK]
inline scalar kappa(const scalar T) const; inline scalar kappa(const scalar T) const;
//- Un-isotropic thermal conductivity [W/mK]
inline vector Kappa(const scalar T) const;
// Member operators
inline constIsoSolidTransport& operator=
(
const constIsoSolidTransport&
);
inline void operator+=(const constIsoSolidTransport&);
inline void operator-=(const constIsoSolidTransport&);
// Friend operators
friend constIsoSolidTransport operator* <thermo>
(
const scalar,
const constIsoSolidTransport&
);
// Ostream Operator // Ostream Operator
friend Ostream& operator<< <thermo> friend Ostream& operator<< <thermo>
( (
Ostream&, Ostream&,
const constSolidTransport& const constIsoSolidTransport&
); );
}; };
@ -112,10 +147,10 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "constSolidTransportI.H" #include "constIsoSolidTransportI.H"
#ifdef NoRepository #ifdef NoRepository
# include "constSolidTransport.C" # include "constIsoSolidTransport.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,134 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport
(
const thermo& t,
const scalar kappa
)
:
thermo(t),
kappa_(kappa)
{}
template<class thermo>
inline Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport
(
const word& name,
const constIsoSolidTransport& ct
)
:
thermo(name, ct),
kappa_(ct.kappa_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class thermo>
inline Foam::scalar Foam::constIsoSolidTransport<thermo>::
kappa(const scalar T) const
{
return kappa_;
}
template<class thermo>
inline Foam::vector Foam::constIsoSolidTransport<thermo>::
Kappa(const scalar T) const
{
return vector(kappa_, kappa_, kappa_);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constIsoSolidTransport<thermo>&
Foam::constIsoSolidTransport<thermo>::operator=
(
const constIsoSolidTransport<thermo>& ct
)
{
thermo::operator=(ct);
kappa_ = ct.kappa_;
return *this;
}
template<class thermo>
inline void Foam::constIsoSolidTransport<thermo>::operator+=
(
const constIsoSolidTransport<thermo>& ct
)
{
scalar molr1 = this->nMoles();
thermo::operator+=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
kappa_ = molr1*kappa_ + molr2*ct.kappa_;
}
template<class thermo>
inline void Foam::constIsoSolidTransport<thermo>::operator-=
(
const constIsoSolidTransport<thermo>& ct
)
{
scalar molr1 = this->nMoles();
thermo::operator-=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
kappa_ = molr1*kappa_ - molr2*ct.kappa_;
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constIsoSolidTransport<thermo> Foam::operator*
(
const scalar s,
const constIsoSolidTransport<thermo>& ct
)
{
return constIsoSolidTransport<thermo>
(
s*static_cast<const thermo&>(ct),
ct.kappa_
);
}
// ************************************************************************* //

View File

@ -44,6 +44,13 @@ namespace Foam
template<class thermo> class exponentialSolidTransport; template<class thermo> class exponentialSolidTransport;
template<class thermo>
inline exponentialSolidTransport<thermo> operator*
(
const scalar,
const exponentialSolidTransport<thermo>&
);
template<class thermo> template<class thermo>
Ostream& operator<< Ostream& operator<<
( (
@ -106,6 +113,27 @@ public:
//- Thermal conductivity [W/mK] //- Thermal conductivity [W/mK]
inline scalar kappa(const scalar T) const; inline scalar kappa(const scalar T) const;
//- Thermal conductivity [W/mK]
inline vector Kappa(const scalar T) const;
// Member operators
inline exponentialSolidTransport& operator=
(
const exponentialSolidTransport&
);
inline void operator+=(const exponentialSolidTransport&);
inline void operator-=(const exponentialSolidTransport&);
// Friend operators
friend exponentialSolidTransport operator* <thermo>
(
const scalar,
const exponentialSolidTransport&
);
// Ostream Operator // Ostream Operator

View File

@ -67,5 +67,91 @@ inline Foam::scalar Foam::exponentialSolidTransport<thermo>::kappa
} }
template<class thermo>
inline Foam::vector Foam::exponentialSolidTransport<thermo>::Kappa
(
const scalar T
) const
{
const scalar kappa(kappa0_*pow(T/Tref_, n0_));
return vector(kappa, kappa, kappa);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class thermo>
inline Foam::exponentialSolidTransport<thermo>&
Foam::exponentialSolidTransport<thermo>::operator=
(
const exponentialSolidTransport<thermo>& ct
)
{
//thermo::operator=(ct);
kappa0_ = ct.kappa0_;
n0_ = ct.n0_;
Tref_ = ct.Tref_;
return *this;
}
template<class thermo>
inline void Foam::exponentialSolidTransport<thermo>::operator+=
(
const exponentialSolidTransport<thermo>& ct
)
{
scalar molr1 = this->nMoles();
//thermo::operator+=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
kappa0_ = molr1*kappa0_ + molr2*ct.kappa0_;
n0_ = (molr1*n0_ + molr2*ct.n0_);
Tref_ = (molr1*Tref_ + molr2*ct.Tref_);
}
template<class thermo>
inline void Foam::exponentialSolidTransport<thermo>::operator-=
(
const exponentialSolidTransport<thermo>& ct
)
{
scalar molr1 = this->nMoles();
//thermo::operator-=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
kappa0_ = (molr1*kappa0_ - molr2*ct.kappa0_);
n0_ = (molr1*n0_ - molr2*ct.n0_);
Tref_ = (molr1*Tref_ - molr2*ct.Tref_);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class thermo>
inline Foam::exponentialSolidTransport<thermo> Foam::operator*
(
const scalar s,
const exponentialSolidTransport<thermo>& ct
)
{
return exponentialSolidTransport<thermo>
(
s*static_cast<const thermo&>(ct),
ct.kappa0_,
ct.n0_,
ct.Tref_
);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -39,7 +39,7 @@ ODESolidChemistryModel
: :
CompType(mesh, solidThermoName), CompType(mesh, solidThermoName),
ODE(), ODE(),
Ys_(this->solidThermo().composition().Y()), Ys_(this->solid().composition().Y()),
pyrolisisGases_ pyrolisisGases_
( (
mesh.lookupObject<dictionary> mesh.lookupObject<dictionary>
@ -47,13 +47,12 @@ ODESolidChemistryModel
), ),
reactions_ reactions_
( (
static_cast<const reactingSolidMixture<SolidThermo>& > dynamic_cast<const reactingSolidMixture<SolidThermo>& >(this->solid())
(this->solidThermo().composition())
), ),
solidThermo_ solidThermo_
( (
static_cast<const reactingSolidMixture<SolidThermo>& > dynamic_cast<const reactingSolidMixture<SolidThermo>& >
(this->solidThermo().composition()).solidData() (this->solid()).solidData()
), ),
gasThermo_(pyrolisisGases_.size()), gasThermo_(pyrolisisGases_.size()),
nGases_(pyrolisisGases_.size()), nGases_(pyrolisisGases_.size()),
@ -137,7 +136,7 @@ ODESolidChemistryModel
); );
// Calculate inital values of Ysi0 = rho*delta*Yi // Calculate inital values of Ysi0 = rho*delta*Yi
Ys0_[fieldI].internalField() = Ys0_[fieldI].internalField() =
this->solidThermo().rho() this->solid().rho()
*max(Ys_[fieldI], scalar(0.001))*mesh.V(); *max(Ys_[fieldI], scalar(0.001))*mesh.V();
} }
} }
@ -208,20 +207,20 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
scalar omegai = omega scalar omegai = omega
( (
R, c, T, 0.0, pf, cf, lRef, pr, cr, rRef R, c, T, p, pf, cf, lRef, pr, cr, rRef
); );
scalar rhoL = 0.0; scalar rhoL = 0.0;
forAll(R.slhs(), s) forAll(R.slhs(), s)
{ {
label si = R.slhs()[s]; label si = R.slhs()[s];
om[si] -= omegai; om[si] -= omegai;
rhoL = solidThermo_[si].rho(T); rhoL = solidThermo_[si].rho(p, T);
} }
scalar sr = 0.0; scalar sr = 0.0;
forAll(R.srhs(), s) forAll(R.srhs(), s)
{ {
label si = R.srhs()[s]; label si = R.srhs()[s];
scalar rhoR = solidThermo_[si].rho(T); scalar rhoR = solidThermo_[si].rho(p, T);
sr = rhoR/rhoL; sr = rhoR/rhoL;
om[si] += sr*omegai; om[si] += sr*omegai;
@ -266,9 +265,9 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
c1[i] = max(0.0, c[i]); c1[i] = max(0.0, c[i]);
} }
scalar kf = R.kf(0.0, T, c1); scalar kf = R.kf(p, T, c1);
scalar exponent = R.nReact(); const scalar exponent = R.nReact();
const label Nl = R.slhs().size(); const label Nl = R.slhs().size();
@ -286,18 +285,20 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::derivatives void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
derivatives
( (
const scalar time, const scalar time,
const scalarField &c, const scalarField &c,
scalarField& dcdt scalarField& dcdt
) const ) const
{ {
scalar T = c[nSpecie_]; const scalar T = c[nSpecie_];
const scalar p = c[nSpecie_ + 1];
dcdt = 0.0; dcdt = 0.0;
dcdt = omega(c, T, 0); dcdt = omega(c, T, p);
//Total mass concentration //Total mass concentration
scalar cTot = 0.0; scalar cTot = 0.0;
@ -312,8 +313,8 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::derivatives
{ {
scalar dYidt = dcdt[i]/cTot; scalar dYidt = dcdt[i]/cTot;
scalar Yi = c[i]/cTot; scalar Yi = c[i]/cTot;
newCp += Yi*solidThermo_[i].Cp(T); newCp += Yi*solidThermo_[i].Cp(p, T);
newhi -= dYidt*solidThermo_[i].hf(); newhi -= dYidt*solidThermo_[i].Hc();
} }
scalar dTdt = newhi/newCp; scalar dTdt = newhi/newCp;
@ -334,7 +335,8 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian
scalarSquareMatrix& dfdc scalarSquareMatrix& dfdc
) const ) const
{ {
scalar T = c[nSpecie_]; const scalar T = c[nSpecie_];
const scalar p = c[nSpecie_ + 1];
scalarField c2(nSpecie_, 0.0); scalarField c2(nSpecie_, 0.0);
@ -352,13 +354,13 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian
} }
// length of the first argument must be nSolids // length of the first argument must be nSolids
dcdt = omega(c2, T, 0.0); dcdt = omega(c2, T, p);
for (label ri=0; ri<reactions_.size(); ri++) for (label ri=0; ri<reactions_.size(); ri++)
{ {
const solidReaction& R = reactions_[ri]; const solidReaction& R = reactions_[ri];
scalar kf0 = R.kf(0.0, T, c2); scalar kf0 = R.kf(p, T, c2);
forAll(R.slhs(), j) forAll(R.slhs(), j)
{ {
@ -409,8 +411,8 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian
// calculate the dcdT elements numerically // calculate the dcdT elements numerically
scalar delta = 1.0e-8; scalar delta = 1.0e-8;
scalarField dcdT0 = omega(c2, T - delta, 0); scalarField dcdT0 = omega(c2, T - delta, p);
scalarField dcdT1 = omega(c2, T + delta, 0); scalarField dcdT1 = omega(c2, T + delta, p);
for (label i=0; i<nEqns(); i++) for (label i=0; i<nEqns(); i++)
{ {
@ -464,7 +466,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::Sh() const
{ {
forAll(Sh, cellI) forAll(Sh, cellI)
{ {
scalar hf = solidThermo_[i].hf(); scalar hf = solidThermo_[i].Hc();
Sh[cellI] -= hf*RRs_[i][cellI]; Sh[cellI] -= hf*RRs_[i][cellI];
} }
} }
@ -532,7 +534,7 @@ calculate()
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
this->solidThermo().rho() this->solid().rho()
); );
if (this->mesh().changing()) if (this->mesh().changing())
@ -567,7 +569,8 @@ calculate()
if (reactingCells_[celli]) if (reactingCells_[celli])
{ {
scalar rhoi = rho[celli]; scalar rhoi = rho[celli];
scalar Ti = this->solidThermo().T()[celli]; scalar Ti = this->solid().T()[celli];
scalar pi = this->solid().p()[celli];
scalarField c(nSpecie_, 0.0); scalarField c(nSpecie_, 0.0);
for (label i=0; i<nSolids_; i++) for (label i=0; i<nSolids_; i++)
@ -575,7 +578,7 @@ calculate()
c[i] = rhoi*Ys_[i][celli]*delta; c[i] = rhoi*Ys_[i][celli]*delta;
} }
const scalarField dcdt = omega(c, Ti, 0.0, true); const scalarField dcdt = omega(c, Ti, pi, true);
forAll(RRs_, i) forAll(RRs_, i)
{ {
@ -611,7 +614,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
this->solidThermo().rho() this->solid().rho()
); );
if (this->mesh().changing()) if (this->mesh().changing())
@ -649,7 +652,8 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
cellCounter_ = celli; cellCounter_ = celli;
scalar rhoi = rho[celli]; scalar rhoi = rho[celli];
scalar Ti = this->solidThermo().T()[celli]; scalar Ti = this->solid().T()[celli];
scalar pi = this->solid().p()[celli];
scalarField c(nSpecie_, 0.0); scalarField c(nSpecie_, 0.0);
scalarField c0(nSpecie_, 0.0); scalarField c0(nSpecie_, 0.0);
@ -672,7 +676,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
// calculate the chemical source terms // calculate the chemical source terms
while (timeLeft > SMALL) while (timeLeft > SMALL)
{ {
tauC = this->solve(c, Ti, 0.0, t, dt); tauC = this->solve(c, Ti, pi, t, dt);
t += dt; t += dt;
// update the temperature // update the temperature
@ -693,9 +697,9 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
{ {
scalar dYi = dcdt[i]/cTot; scalar dYi = dcdt[i]/cTot;
scalar Yi = c[i]/cTot; scalar Yi = c[i]/cTot;
newCp += Yi*solidThermo_[i].Cp(Ti); newCp += Yi*solidThermo_[i].Cp(pi, Ti);
newhi -= dYi*solidThermo_[i].hf(); newhi -= dYi*solidThermo_[i].Hc();
invRho += Yi/solidThermo_[i].rho(Ti); invRho += Yi/solidThermo_[i].rho(pi, Ti);
} }
scalar dTi = (newhi/newCp)*dt; scalar dTi = (newhi/newCp)*dt;
@ -722,7 +726,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
} }
// Update Ys0_ // Update Ys0_
dc = omega(c0, Ti, 0.0, true); dc = omega(c0, Ti, pi, true);
} }
} }

View File

@ -44,7 +44,7 @@ Foam::solidChemistryModel::solidChemistryModel
) )
: :
basicChemistryModel(mesh), basicChemistryModel(mesh),
solidThermo_(basicSolidThermo::New(mesh)) //, thermoTypeName)) solidThermo_(solidReactionThermo::New(mesh)) //, thermoTypeName))
{} {}

View File

@ -40,7 +40,7 @@ SourceFiles
#include "basicChemistryModel.H" #include "basicChemistryModel.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "basicSolidThermo.H" #include "solidReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -73,7 +73,7 @@ protected:
// Protected data // Protected data
//- Solid thermo package //- Solid thermo package
autoPtr<basicSolidThermo> solidThermo_; autoPtr<solidReactionThermo> solidThermo_;
public: public:
@ -118,10 +118,10 @@ public:
// Member Functions // Member Functions
//- Return access to the solid thermo package //- Return access to the solid thermo package
inline basicSolidThermo& solidThermo(); inline solidReactionThermo& solid();
//- Return const access to the solid thermo package //- Return const access to the solid thermo package
inline const basicSolidThermo& solidThermo() const; inline const solidReactionThermo& solid() const;
//- Return total gases mass source term [kg/m3/s] //- Return total gases mass source term [kg/m3/s]
virtual tmp<volScalarField> RRg() const = 0; virtual tmp<volScalarField> RRg() const = 0;

View File

@ -25,14 +25,14 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::basicSolidThermo& Foam::solidChemistryModel::solidThermo() inline Foam::solidReactionThermo& Foam::solidChemistryModel::solid()
{ {
return solidThermo_(); return solidThermo_();
} }
inline const Foam::basicSolidThermo& inline const Foam::solidReactionThermo&
Foam::solidChemistryModel::solidThermo() const Foam::solidChemistryModel::solid() const
{ {
return solidThermo_(); return solidThermo_();
} }

View File

@ -25,7 +25,7 @@ License
#include "temperatureCoupledBase.H" #include "temperatureCoupledBase.H"
#include "volFields.H" #include "volFields.H"
#include "basicSolidThermo.H" #include "solidThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicThermo.H" #include "basicThermo.H"
@ -105,10 +105,10 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
case SOLIDTHERMO: case SOLIDTHERMO:
{ {
const basicSolidThermo& thermo = const solidThermo& thermo =
mesh.lookupObject<basicSolidThermo> mesh.lookupObject<solidThermo>
( (
"solidThermophysicalProperties" "thermophysicalProperties"
); );
return thermo.kappa(patch_.index()); return thermo.kappa(patch_.index());
} }
@ -118,12 +118,21 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
{ {
const vectorField n(patch_.nf()); const vectorField n(patch_.nf());
const basicSolidThermo& thermo = const solidThermo& thermo =
mesh.lookupObject<basicSolidThermo> mesh.lookupObject<solidThermo>
( (
"solidThermophysicalProperties" "solidThermophysicalProperties"
); );
return n & thermo.directionalKappa(patch_.index()) & n; // note SAF : Temporarily!
//return n & thermo.Kappa(patch_.index()) & n;
/*
scalarField isoK =
(thermo.Kappa(patch_.index())[0] +
thermo.Kappa(patch_.index())[1] +
thermo.Kappa(patch_.index())[2]) / 3.0;
*/
return scalarField(0);
} }
break; break;

View File

@ -219,48 +219,32 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
// local properties // local properties
const scalarField alphaw = model.alphaEff()().boundaryField()[patchI]; const scalarField kappaw = model.kappaEff()().boundaryField()[patchI];
const fvPatchScalarField& hew = const fvPatchScalarField& Tp =
model.thermo().he().boundaryField()[patchI];
const scalarField qDot(alphaw*hew.snGrad());
const scalarField& Tp =
patch().template lookupPatchField<volScalarField, scalar>(TName_); patch().template lookupPatchField<volScalarField, scalar>(TName_);
const scalarField& pp = model.thermo().p().boundaryField()[patchI]; const scalarField qDot(kappaw*Tp.snGrad());
tmp<scalarField> Ti = patchInternalField(); tmp<scalarField> Ti = patchInternalField();
const scalarField Cpw(model.thermo().Cp(pp, Ti, patchI)); scalarField myh(patch().deltaCoeffs()*kappaw);
scalarField myh(patch().deltaCoeffs()*alphaw*Cpw);
scalarField alphawCp(alphaw*Cpw);
// nbr properties // nbr properties
scalarField nbrAlphaw =
model.alphaEff()().boundaryField()[nbrPatchI];
mpp.map().distribute(nbrAlphaw);
const fvPatchScalarField& nbrHw = scalarField nbrKappaw =
model.thermo().he().boundaryField()[nbrPatchI]; model.kappaEff()().boundaryField()[nbrPatchI];
mpp.map().distribute(nbrKappaw);
const scalarField& nbrHwPp = const fvPatchScalarField& nbrTw =
model.thermo().p().boundaryField()[nbrPatchI]; model.thermo().T().boundaryField()[nbrPatchI];
scalarField nbrQDot scalarField nbrQDot
( (
model.alphaEff()().boundaryField()[nbrPatchI]*nbrHw.snGrad() model.kappaEff()().boundaryField()[nbrPatchI]*nbrTw.snGrad()
); );
mpp.map().distribute(nbrQDot); mpp.map().distribute(nbrQDot);
scalarField nbrTp =
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_);
mpp.map().distribute(nbrTp);
const temperatureThermoBaffle1DFvPatchScalarField& nbrField = const temperatureThermoBaffle1DFvPatchScalarField& nbrField =
refCast<const temperatureThermoBaffle1DFvPatchScalarField> refCast<const temperatureThermoBaffle1DFvPatchScalarField>
( (
@ -273,17 +257,15 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
scalarField nbrTi(nbrField.patchInternalField()); scalarField nbrTi(nbrField.patchInternalField());
mpp.map().distribute(nbrTi); mpp.map().distribute(nbrTi);
const scalarField nbrCpw scalarField nbrTp =
( nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_);
model.thermo().Cp(nbrHwPp, nbrField.patchInternalField(), nbrPatchI) mpp.map().distribute(nbrTp);
);
scalarField nbrh scalarField nbrh
( (
nbrPatch.deltaCoeffs()*nbrCpw nbrPatch.deltaCoeffs()
*model.alphaEff()().boundaryField()[nbrPatchI] *model.kappaEff()().boundaryField()[nbrPatchI]
); );
mpp.map().distribute(nbrh); mpp.map().distribute(nbrh);
@ -296,7 +278,7 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
// Create fields for solid properties // Create fields for solid properties
forAll(KDeltaw, i) forAll(KDeltaw, i)
{ {
KDeltaw[i] = solid_().kappa((Tp[i] + nbrTp[i])/2.0)/thickness_[i]; KDeltaw[i] = solid_().kappa((Tp[i] + nbrTw[i])/2.0)/thickness_[i];
} }
const scalarField q const scalarField q
@ -304,7 +286,6 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
(Ti() - nbrTi)/(1.0/KDeltaw + 1.0/nbrh + 1.0/myh) (Ti() - nbrTi)/(1.0/KDeltaw + 1.0/nbrh + 1.0/myh)
); );
forAll(qDot, i) forAll(qDot, i)
{ {
if (Qs_[i] == 0) if (Qs_[i] == 0)
@ -327,21 +308,21 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
/ /
( (
1.0 1.0
+ patch().deltaCoeffs()[i]*alphawCp[i]/KDeltaw[i] + patch().deltaCoeffs()[i]*kappaw[i]/KDeltaw[i]
); );
} }
else if (q[i] < 0) else if (q[i] < 0)
{ {
this->refValue()[i] = 0.0; this->refValue()[i] = 0.0;
this->refGrad()[i] = this->refGrad()[i] =
(-nbrQDot[i] + Q[i]*thickness_[i])/alphawCp[i]; (-nbrQDot[i] + Q[i]*thickness_[i])/kappaw[i];
this->valueFraction()[i] = 0.0; this->valueFraction()[i] = 0.0;
} }
else else
{ {
scalar Qt = Q[i]*thickness_[i]; scalar Qt = Q[i]*thickness_[i];
this->refValue()[i] = 0.0; this->refValue()[i] = 0.0;
this->refGrad()[i] = Qt/2/alphawCp[i]; this->refGrad()[i] = Qt/2/kappaw[i];
this->valueFraction()[i] = 0.0; this->valueFraction()[i] = 0.0;
} }
} }

View File

@ -64,6 +64,7 @@ class temperatureThermoBaffle1DFvPatchScalarField
autoPtr<solidType> solidPtr_; autoPtr<solidType> solidPtr_;
// Solid dictionaries // Solid dictionaries
dictionary specieDict_;
dictionary transportDict_; dictionary transportDict_;
dictionary radiationDict_; dictionary radiationDict_;
dictionary thermoDict_; dictionary thermoDict_;
@ -76,6 +77,7 @@ class temperatureThermoBaffle1DFvPatchScalarField
solidThermoData(const dictionary& dict) solidThermoData(const dictionary& dict)
: :
solidPtr_(new solidType(dict)), solidPtr_(new solidType(dict)),
specieDict_(dict.subDict("specie")),
transportDict_(dict.subDict("transport")), transportDict_(dict.subDict("transport")),
radiationDict_(dict.subDict("radiation")), radiationDict_(dict.subDict("radiation")),
thermoDict_(dict.subDict("thermodynamics")), thermoDict_(dict.subDict("thermodynamics")),
@ -87,6 +89,7 @@ class temperatureThermoBaffle1DFvPatchScalarField
solidThermoData() solidThermoData()
: :
solidPtr_(), solidPtr_(),
specieDict_(),
transportDict_(), transportDict_(),
radiationDict_(), radiationDict_(),
thermoDict_(), thermoDict_(),
@ -103,6 +106,8 @@ class temperatureThermoBaffle1DFvPatchScalarField
void write(Ostream& os) const void write(Ostream& os) const
{ {
os.writeKeyword("specie");
os << specieDict_ << nl;
os.writeKeyword("transport"); os.writeKeyword("transport");
os << transportDict_ << nl; os << transportDict_ << nl;
os.writeKeyword("radiation"); os.writeKeyword("radiation");

View File

@ -53,7 +53,7 @@ boundaryField
"(region0_to.*)" "(region0_to.*)"
{ {
type fixedFluxPressure; type buoyantPressure;
value $internalField; value $internalField;
} }
} }

Some files were not shown because too many files have changed in this diff Show More