From f64b5a1b77185f436ba9298e135afd0a41a2f1a1 Mon Sep 17 00:00:00 2001 From: sergio <sergio> Date: Wed, 4 Jul 2012 14:22:08 +0100 Subject: [PATCH] BUG: Re-arrenging the solidThermo interface --- .../reactingOneDim/reactingOneDim.C | 4 +- .../thermoBaffle2D/thermoBaffle2D.C | 2 +- .../basic/basicThermo/basicThermo.C | 55 ----------- .../basic/rhoThermo/rhoThermo/rhoThermo.C | 19 ++++ .../basic/rhoThermo/rhoThermo/rhoThermo.H | 3 + .../heSolidThermo/heSolidThermo.H | 3 - .../solidThermo/solidThermo.C | 78 +--------------- .../solidThermo/solidThermo.H | 92 +------------------ 8 files changed, 29 insertions(+), 227 deletions(-) diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index e19084dd3d4..65143f5d27d 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -349,7 +349,7 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh) pyrolysisModel(modelType, mesh), solidChemistry_(solidChemistryModel::New(regionMesh())), solidThermo_(solidChemistry_->solid()), - rho_(solidThermo_.rhos()), + rho_(solidThermo_.rho()), Ys_(solidThermo_.composition().Y()), h_(solidThermo_.he()), primaryRadFluxName_(coeffs().lookupOrDefault<word>("radFluxName", "Qr")), @@ -449,7 +449,7 @@ reactingOneDim::reactingOneDim pyrolysisModel(modelType, mesh, dict), solidChemistry_(solidChemistryModel::New(regionMesh())), solidThermo_(solidChemistry_->solid()), - rho_(solidThermo_.rhos()), + rho_(solidThermo_.rho()), Ys_(solidThermo_.composition().Y()), h_(solidThermo_.he()), primaryRadFluxName_(dict.lookupOrDefault<word>("radFluxName", "Qr")), diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C index a0495d2d06f..97faec40cb5 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C @@ -359,7 +359,7 @@ void thermoBaffle2D::info() const ( mag(regionMesh().Sf().boundaryField()[patchI]) * ph.snGrad() - * thermo_->alpha(patchI) + * thermo_->alpha().boundaryField()[patchI] ) << endl; } } diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index aa90283d519..1390c214a2b 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -40,62 +40,7 @@ namespace Foam defineTypeNameAndDebug(basicThermo, 0); defineRunTimeSelectionTable(basicThermo, fvMesh); } -/* -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -Foam::wordList Foam::basicThermo::heBoundaryTypes() -{ - const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField(); - - wordList hbt = tbf.types(); - - forAll(tbf, patchi) - { - if (isA<fixedValueFvPatchScalarField>(tbf[patchi])) - { - hbt[patchi] = fixedEnergyFvPatchScalarField::typeName; - } - else if - ( - isA<zeroGradientFvPatchScalarField>(tbf[patchi]) - || isA<fixedGradientFvPatchScalarField>(tbf[patchi]) - ) - { - 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; -} - - -void Foam::basicThermo::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(); - } - } -} -*/ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C index 8cafa9454c9..33c7905fee0 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C @@ -55,6 +55,25 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh) {} +Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dicy) +: + basicThermo(mesh, dict), + rho_ + ( + IOobject + ( + "rhoThermo", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimDensity + ) +{} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::rhoThermo::~rhoThermo() diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.H index 098e2ec0f15..77a4c4fd12a 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.H @@ -90,6 +90,9 @@ public: //- Construct from mesh rhoThermo(const fvMesh&); + //- Construct from mesh + rhoThermo(const fvMesh&, const dictionary&); + //- Selector static autoPtr<rhoThermo> New(const fvMesh&); diff --git a/src/thermophysicalModels/basicSolidThermo/heSolidThermo/heSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/heSolidThermo/heSolidThermo.H index fac27226ff8..88a8d8aab61 100644 --- a/src/thermophysicalModels/basicSolidThermo/heSolidThermo/heSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/heSolidThermo/heSolidThermo.H @@ -89,9 +89,6 @@ public: // 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; diff --git a/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C b/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C index 24220ee9bb7..7a791b59cc7 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C @@ -42,20 +42,7 @@ namespace Foam Foam::solidThermo::solidThermo(const fvMesh& mesh) : - basicThermo(mesh), - rho_ - ( - IOobject - ( - "rho", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimMass/dimVolume - ) + rhoThermo(mesh) {} @@ -65,20 +52,7 @@ Foam::solidThermo::solidThermo const dictionary& dict ) : - basicThermo(mesh, dict), - rho_ - ( - IOobject - ( - "rho", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimMass/dimVolume - ) + rhoThermo(mesh, dict) {} @@ -90,54 +64,6 @@ 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(); diff --git a/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.H b/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.H index 79741f466fe..08b9f82ab43 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.H @@ -41,7 +41,7 @@ SourceFiles #include "IOdictionary.H" #include "autoPtr.H" #include "basicSolidMixture.H" -#include "basicThermo.H" +#include "rhoThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,18 +54,9 @@ namespace Foam class solidThermo : - public basicThermo + public rhoThermo { -protected: - - - // Fields - - //- Density [kg/m3] - volScalarField rho_; - - public: //- Runtime type information @@ -116,50 +107,9 @@ public: // Member functions - //- Update properties - virtual void correct() = 0; - - - // Access to thermodynamic state variables - - //- Constant access to temperature [K] - virtual const volScalarField& T() const; - - //- Non constant access to temperature [K] - virtual volScalarField& T(); - - //- Solid density [kg/m3] - virtual const volScalarField& rhos() const; - - //- Non-const access for solid density [kg/m3] - virtual volScalarField& rhos(); - - - //- Constant access to p [Pa] - virtual const volScalarField& p() const; - - //- Non-constant access to p [Pa] - 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 - //- 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] - virtual tmp<volScalarField> kappa() const = 0; - //- Thermal conductivity [W/m/K] virtual tmp<volVectorField> Kappa() const = 0; @@ -172,50 +122,12 @@ public: //- Emissivity coefficient [1/m] virtual tmp<volScalarField> emissivity() const = 0; - //- Specific heat capacity [J/kg/K] - virtual tmp<volScalarField> Cp() const = 0; - - //- Heat of formation [J/kg] - virtual tmp<volScalarField> hc() const = 0; - - //- Density [kg/m^3] - virtual tmp<volScalarField> rho() const; - // Per patch calculation - //- Enthalpy/Internal energy [J/kg] - virtual tmp<scalarField> he - ( - const scalarField& p, - const scalarField& T, - const label patchi - ) const = 0; - - - //- Specific heat capacity [J/kg/K)] - virtual tmp<scalarField> Cp - ( - const scalarField& p, - const scalarField& T, - const label patchI - ) const = 0; - - - //- Isotropic thermal conductivity [W//m/K] - 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; -- GitLab