From bbbaf89c20b7488d7fd42cef8c7cc02a4d3ffa60 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 12 Jul 2011 15:51:08 +0100 Subject: [PATCH] ENH: Adding general constructors with dictionary to implement thermal baffle hold at a boundary --- .../extrudeToRegionMeshDict | 7 + .../regionModel/regionModel/regionModel.C | 90 ++++++- .../regionModel/regionModel/regionModel.H | 20 ++ .../regionModel/regionModel/regionModelI.H | 6 + .../regionModel/regionModel1D/regionModel1D.C | 44 ++++ .../regionModel/regionModel1D/regionModel1D.H | 14 ++ .../thermoBaffleModels/Make/files | 2 + ...emperatureThermoBaffleFvPatchScalarField.C | 235 ++++++++++++++++++ ...emperatureThermoBaffleFvPatchScalarField.H | 216 ++++++++++++++++ .../thermoBaffleModels/noThermo/noThermo.C | 8 + .../thermoBaffleModels/noThermo/noThermo.H | 7 + .../thermoBaffle2D/thermoBaffle2D.C | 111 +++++++-- .../thermoBaffle2D/thermoBaffle2D.H | 22 +- .../thermoBaffle2D/thermoBaffle2DI.H | 5 - .../thermoBaffleModel/thermoBaffleModel.C | 81 ++++-- .../thermoBaffleModel/thermoBaffleModel.H | 49 +++- .../thermoBaffleModel/thermoBaffleModelNew.C | 29 +++ .../basicSolidThermo/basicSolidThermo.C | 87 +++++++ .../basicSolidThermo/basicSolidThermo.H | 18 ++ .../basicSolidThermo/basicSolidThermoNew.C | 34 ++- .../constSolidThermo/constSolidThermo.C | 44 ++++ .../constSolidThermo/constSolidThermo.H | 4 + .../directionalKSolidThermo.C | 70 +++++- .../directionalKSolidThermo.H | 6 + .../interpolateSolid/interpolateSolid.C | 7 +- .../interpolatedSolidThermo.C | 15 +- .../interpolatedSolidThermo.H | 9 + .../isotropicKSolidThermo.C | 34 +++ .../isotropicKSolidThermo.H | 4 + .../makeSolidMixtureThermo.H | 6 + .../solidMixtureThermo/solidMixtureThermo.C | 26 ++ .../solidMixtureThermo/solidMixtureThermo.H | 3 + 32 files changed, 1245 insertions(+), 68 deletions(-) create mode 100644 src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C create mode 100644 src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict index fbd26416b8..739f929fd3 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict @@ -20,6 +20,9 @@ region liquidFilm; // FaceZones to extrude faceZones (f0); +// FaceZone shadow +//faceZonesShadow (fBaffleShadow); + // Adapt the original mesh to have directMapped patches at where the // faceZones are? // If true: @@ -32,6 +35,10 @@ adaptMesh true; // Extrude 1D-columns of cells? oneD false; +// If oneD is true. Specify which boundary is wanted between the layers +//oneDPolyPatchType emptyPolyPatch; //wedgePolyPatch + + //- Extrusion model to use. The only logical choice is linearNormal? //- Linear extrusion in normal direction diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index bd699e05ae..df40e55b1e 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -60,6 +60,28 @@ void Foam::regionModels::regionModel::constructMeshObjects() } +void Foam::regionModels::regionModel::constructMeshObjects +( + const dictionary& dict +) +{ + // construct region mesh + regionMeshPtr_.reset + ( + new fvMesh + ( + IOobject + ( + dict.lookup("regionName"), + time_.timeName(), + time_, + IOobject::MUST_READ + ) + ) + ); +} + + void Foam::regionModels::regionModel::initialise() { if (debug) @@ -148,6 +170,26 @@ bool Foam::regionModels::regionModel::read() } +bool Foam::regionModels::regionModel::read(const dictionary& dict) +{ + if (active_) + { + if (const dictionary* dictPtr = dict.subDictPtr(modelName_ + "Coeffs")) + { + coeffs_ <<= *dictPtr; + } + + infoOutput_.readIfPresent("infoOutput", dict); + + return true; + } + else + { + return false; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::regionModels::regionModel::regionModel(const fvMesh& mesh) @@ -219,6 +261,52 @@ Foam::regionModels::regionModel::regionModel } +Foam::regionModels::regionModel::regionModel +( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields +) +: + IOdictionary + ( + IOobject + ( + regionType, + mesh.time().constant(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + true + ), + dict + ), + primaryMesh_(mesh), + time_(mesh.time()), + active_(dict.lookup("active")), + infoOutput_(false), + modelName_(modelName), + regionMeshPtr_(NULL), + coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")), + primaryPatchIDs_(), + intCoupledPatchIDs_(), + mappedPatches_() +{ + if (active_) + { + constructMeshObjects(dict); + initialise(); + + if (readFields) + { + read(dict); + } + } +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::regionModels::regionModel::~regionModel() @@ -254,7 +342,7 @@ void Foam::regionModels::regionModel::evolve() << regionMesh().name() << endl; // Update any input information - read(); + //read(); // Pre-evolve preEvolveRegion(); diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H index 01300671d9..9caf929e2e 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.H +++ b/src/regionModels/regionModel/regionModel/regionModel.H @@ -76,6 +76,9 @@ private: //- Construct region mesh and fields void constructMeshObjects(); + //- Construct region mesh and dictionary + void constructMeshObjects(const dictionary& dict); + //- Initialise the region void initialise(); @@ -123,6 +126,9 @@ protected: //- Read control parameters from dictionary virtual bool read(); + //- Read control parameters from dictionary + virtual bool read(const dictionary& dict); + public: @@ -144,6 +150,17 @@ public: bool readFields = true ); + //- Construct from mesh and name and dict + regionModel + ( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields = true + ); + + //- Destructor virtual ~regionModel(); @@ -162,6 +179,9 @@ public: //- Return the active flag inline const Switch& active() const; + //- Return the information flag + inline const Switch& infoOutput() const; + //- Return the model name inline const word& modelName() const; diff --git a/src/regionModels/regionModel/regionModel/regionModelI.H b/src/regionModels/regionModel/regionModel/regionModelI.H index d99b156bf6..bf543c7b4b 100644 --- a/src/regionModels/regionModel/regionModel/regionModelI.H +++ b/src/regionModels/regionModel/regionModel/regionModelI.H @@ -46,6 +46,12 @@ inline const Foam::Switch& Foam::regionModels::regionModel::active() const } +inline const Foam::Switch& Foam::regionModels::regionModel::infoOutput() const +{ + return infoOutput_; +} + + inline const Foam::word& Foam::regionModels::regionModel::modelName() const { return modelName_; diff --git a/src/regionModels/regionModel/regionModel1D/regionModel1D.C b/src/regionModels/regionModel/regionModel1D/regionModel1D.C index 3902a689a7..2266ffc655 100644 --- a/src/regionModels/regionModel/regionModel1D/regionModel1D.C +++ b/src/regionModels/regionModel/regionModel1D/regionModel1D.C @@ -159,6 +159,21 @@ bool Foam::regionModels::regionModel1D::read() } +bool Foam::regionModels::regionModel1D::read(const dictionary& dict) +{ + if (regionModel::read(dict)) + { + moveMesh_.readIfPresent("moveMesh", dict); + + return true; + } + else + { + return false; + } +} + + Foam::tmp Foam::regionModels::regionModel1D::moveMesh ( const scalarList& deltaV, @@ -301,6 +316,35 @@ Foam::regionModels::regionModel1D::regionModel1D } +Foam::regionModels::regionModel1D::regionModel1D +( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields +) +: + regionModel(mesh, regionType, modelName, dict, readFields), + boundaryFaceFaces_(regionMesh().nCells()), + boundaryFaceCells_(regionMesh().nCells()), + boundaryFaceOppositeFace_(regionMesh().nCells()), + nLayers_(0), + nMagSfPtr_(NULL), + moveMesh_(false) +{ + if (active_) + { + constructMeshObjects(); + initialise(); + + if (readFields) + { + read(dict); + } + } +} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::regionModels::regionModel1D::~regionModel1D() diff --git a/src/regionModels/regionModel/regionModel1D/regionModel1D.H b/src/regionModels/regionModel/regionModel1D/regionModel1D.H index 7d51d3ef36..eb7304d704 100644 --- a/src/regionModels/regionModel/regionModel1D/regionModel1D.H +++ b/src/regionModels/regionModel/regionModel1D/regionModel1D.H @@ -105,6 +105,9 @@ protected: //- Read control parameters from dictionary virtual bool read(); + //- Read control parameters from dictionary + virtual bool read(const dictionary& dict); + //- Move mesh points according to change in cell volumes // Returns map ordered by cell where 1 = cell moved, 0 = cell unchanged tmp moveMesh @@ -134,6 +137,17 @@ public: bool readFields = true ); + //- Construct from mesh, region type and name and dict + regionModel1D + ( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields = true + ); + + //- Destructor virtual ~regionModel1D(); diff --git a/src/regionModels/thermoBaffleModels/Make/files b/src/regionModels/thermoBaffleModels/Make/files index 1a0352a4bf..41bb7d03db 100644 --- a/src/regionModels/thermoBaffleModels/Make/files +++ b/src/regionModels/thermoBaffleModels/Make/files @@ -3,5 +3,7 @@ thermoBaffleModel/thermoBaffleModelNew.C thermoBaffle2D/thermoBaffle2D.C noThermo/noThermo.C +derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C + LIB = $(FOAM_LIBBIN)/libthermoBaffleModels diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C new file mode 100644 index 0000000000..a78bb2c311 --- /dev/null +++ b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C @@ -0,0 +1,235 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "temperatureThermoBaffleFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(p, iF), + owner_(false), + baffle_(), + solidThermoType_("undefined") +{} + + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const temperatureThermoBaffleFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField + ( + ptf, + p, + iF, + mapper + ), + owner_(ptf.owner_), + baffle_(ptf.baffle_), + solidThermoType_(ptf.solidThermoType_) +{} + + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(p, iF, dict), + owner_(false), + baffle_(), + solidThermoType_() +{ + if (!isA(patch().patch())) + { + FatalErrorIn + ( + "temperatureThermoBaffleFvPatchScalarField::" + "temperatureThermoBaffleFvPatchScalarField\n" + "(\n" + " const fvPatch& p,\n" + " const DimensionedField& iF,\n" + " const dictionary& dict\n" + ")\n" + ) << "\n patch type '" << patch().type() + << "' not type '" << directMappedPatchBase::typeName << "'" + << "\n for patch " << patch().name() + << " of field " << dimensionedInternalField().name() + << " in file " << dimensionedInternalField().objectPath() + << exit(FatalError); + } + + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); + + typedef regionModels::thermoBaffleModels::thermoBaffleModel baffle; + + if + ( + thisMesh.name() == polyMesh::defaultRegion + && !thisMesh.foundObject("thermoBaffle") + && !owner_ + ) + { + Info << "Creating thermal baffle..." << endl; + baffle_.reset(baffle::New(thisMesh, dict).ptr()); + owner_ = true; + dict.lookup("thermoType") >> solidThermoType_; + } +} + + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const temperatureThermoBaffleFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(ptf, iF), + owner_(ptf.owner_), + baffle_(ptf.baffle_), + solidThermoType_(ptf.solidThermoType_) +{} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +void temperatureThermoBaffleFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + mixedFvPatchScalarField::autoMap(m); +} + + +void temperatureThermoBaffleFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + mixedFvPatchScalarField::rmap(ptf, addr); +} + + +void temperatureThermoBaffleFvPatchScalarField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); + + if + ( + thisMesh.name() == polyMesh::defaultRegion + && owner_ + ) + { + baffle_->evolve(); + } + + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs(); +} + + +void temperatureThermoBaffleFvPatchScalarField::write(Ostream& os) const +{ + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write(os); + + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); + + if (thisMesh.name() == polyMesh::defaultRegion && owner_) + { + os.writeKeyword("thermoBaffleModel") << baffle_->modelName() + << token::END_STATEMENT << nl; + + os.writeKeyword("regionName") << baffle_->regionMesh().name() + << token::END_STATEMENT << nl; + + os.writeKeyword("infoOutput") << baffle_->infoOutput() + << token::END_STATEMENT << nl; + + os.writeKeyword("active") << baffle_->active() + << token::END_STATEMENT << nl; + + os.writeKeyword(word(baffle_->modelName() + "coeffs")); + + os << baffle_->coeffs() << nl; + + os.writeKeyword("thermoType") << solidThermoType_ + << token::END_STATEMENT << nl; + + os.writeKeyword(word(solidThermoType_ + "Coeffs")) << nl; + + os << indent << '{' << nl + << indent << baffle_->thermo() << nl + << indent << '}' << nl; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + temperatureThermoBaffleFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H new file mode 100644 index 0000000000..2d61bf09c6 --- /dev/null +++ b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H @@ -0,0 +1,216 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::temperatureThermoBaffleFvPatchScalarField + +Description + Thermal bounday applied to both sides of the thermal baffle region and + 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 + primary region. + + type compressible::temperatureThermoBaffle; + + // Coupled BC. + neighbourFieldName T; + K basicThermo; + KName none; + + + // Thermo baffle model + thermoBaffleModel thermoBaffle2D; + regionName baffleRegion; + infoOutput yes; + active yes; + thermoBaffle2DCoeffs + { + } + + + // Solid thermo + thermoType constSolidThermo; + + constSolidThermoCoeffs + { + //- thermo properties + rho rho [1 -3 0 0 0 0 0] 80; + Cp Cp [0 2 -2 -1 0 0 0] 15; + K K [1 1 -3 -1 0 0 0] 0.01; + + //- radiative properties + kappa kappa [0 -1 0 0 0 0 0] 0; + sigmaS sigmaS [0 -1 0 0 0 0 0] 0; + emissivity emissivity [0 0 0 0 0 0 0] 1; + + //- chemical properties + Hf Hf [0 2 -2 0 0 0 0] 0; + } + + value uniform 300; + + +SourceFiles + temperatureThermoBaffleFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef temperatureThermoBaffleFvPatchScalarField_H +#define temperatureThermoBaffleFvPatchScalarField_H + + +#include "autoPtr.H" +#include "regionModel.H" +#include "thermoBaffleModel.H" +#include "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +namespace Foam +{ +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class temperatureThermoBaffleFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class temperatureThermoBaffleFvPatchScalarField +: + public turbulentTemperatureCoupledBaffleMixedFvPatchScalarField +{ + // Private data + + //- Is the baffle owner + bool owner_; + + //- Thermal baffle + autoPtr baffle_; + + //- Solid thermo type + word solidThermoType_; + + +public: + + //- Runtime type information + TypeName("compressible::temperatureThermoBaffle"); + + + // Constructors + + //- Construct from patch and internal field + temperatureThermoBaffleFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + temperatureThermoBaffleFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // temperatureThermoBaffleFvPatchScalarField onto a new patch + temperatureThermoBaffleFvPatchScalarField + ( + const temperatureThermoBaffleFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new temperatureThermoBaffleFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + temperatureThermoBaffleFvPatchScalarField + ( + const temperatureThermoBaffleFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new temperatureThermoBaffleFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/thermoBaffleModels/noThermo/noThermo.C b/src/regionModels/thermoBaffleModels/noThermo/noThermo.C index 32b8e32e04..841cfba283 100644 --- a/src/regionModels/thermoBaffleModels/noThermo/noThermo.C +++ b/src/regionModels/thermoBaffleModels/noThermo/noThermo.C @@ -127,6 +127,14 @@ const volScalarField& noThermo::T() const } +const basicSolidThermo& noThermo::thermo() const +{ + FatalErrorIn("const volScalarField& noThermo::T() const") + << "T field not available for " << type() << abort(FatalError); + return reinterpret_cast(null); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace thermoBaffleModels diff --git a/src/regionModels/thermoBaffleModels/noThermo/noThermo.H b/src/regionModels/thermoBaffleModels/noThermo/noThermo.H index 387241cca4..fa4f7f289c 100644 --- a/src/regionModels/thermoBaffleModels/noThermo/noThermo.H +++ b/src/regionModels/thermoBaffleModels/noThermo/noThermo.H @@ -92,6 +92,13 @@ public: // Member Functions + + // Thermo properties + + //- Return const reference to the basicSolidThermo + virtual const basicSolidThermo& thermo() const; + + // Fields //- Return the film specific heat capacity [J/kg/K] diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C index 0cf810afc1..c77ac867d7 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C @@ -46,6 +46,7 @@ namespace thermoBaffleModels defineTypeNameAndDebug(thermoBaffle2D, 0); addToRunTimeSelectionTable(thermoBaffleModel, thermoBaffle2D, mesh); +addToRunTimeSelectionTable(thermoBaffleModel, thermoBaffle2D, dictionary); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -90,8 +91,8 @@ void thermoBaffle2D::solveEnergy() volScalarField K("K", thermo_->K()); - //If region is one-dimension variable thickness can be used. - if (oneD_) + //If region is one-dimension variable thickness + if (oneD_ && !constantThickness_) { // Scale K and rhoCp and fill Q in the internal baffle region. const label patchI = intCoupledPatchIDs_[0]; @@ -136,6 +137,60 @@ void thermoBaffle2D::solveEnergy() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermoBaffle2D::thermoBaffle2D +( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict +) +: + thermoBaffleModel(modelType, mesh, dict), + nNonOrthCorr_(readLabel(solution().lookup("nNonOrthCorr"))), + thermo_(basicSolidThermo::New(regionMesh(), dict)), + T_(thermo_->T()), + Qs_ + ( + IOobject + ( + "Qs", + regionMesh().time().timeName(), + regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar + ( + "zero", + dimEnergy/dimArea/dimTime, + pTraits::zero + ) + ), + Q_ + ( + IOobject + ( + "Q", + regionMesh().time().timeName(), + regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar + ( + "zero", + dimEnergy/dimVolume/dimTime, + pTraits::zero + ) + ) +{ + init(); + thermo_->correct(); +} + + thermoBaffle2D::thermoBaffle2D ( const word& modelType, @@ -183,26 +238,7 @@ thermoBaffle2D::thermoBaffle2D ) ) { - if (oneD_) - { - label patchI = intCoupledPatchIDs_[0]; - const label Qsb = Qs_.boundaryField()[patchI].size(); - if (Qsb!= thickness_.size()) - { - FatalErrorIn - ( - "thermoBaffle2D::thermoBaffle2D" - "(" - " const word& modelType," - " const fvMesh& mesh" - ")" - ) << "the boundary field of Qs is " - << Qsb << " and " << nl - << "the field 'thickness' is " << thickness_.size() << nl - << exit(FatalError); - } - } - + init(); thermo_->correct(); } @@ -215,6 +251,31 @@ thermoBaffle2D::~thermoBaffle2D() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +void thermoBaffle2D::init() +{ + if (oneD_ && !constantThickness_) + { + label patchI = intCoupledPatchIDs_[0]; + const label Qsb = Qs_.boundaryField()[patchI].size(); + if (Qsb!= thickness_.size()) + { + FatalErrorIn + ( + "thermoBaffle2D::thermoBaffle2D" + "(" + " const word& modelType," + " const fvMesh& mesh," + " const dictionary& dict" + ")" + ) << "the boundary field of Qs is " + << Qsb << " and " << nl + << "the field 'thickness' is " << thickness_.size() << nl + << exit(FatalError); + } + } +} + + void thermoBaffle2D::preEvolveRegion() {} @@ -258,6 +319,12 @@ const volScalarField& thermoBaffle2D::T() const } +const basicSolidThermo& thermoBaffle2D::thermo() const +{ + return thermo_; +} + + void thermoBaffle2D::info() const { Info<< indent << "min/max(T) = " << min(T_).value() << ", " diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H index 8cd28b76e5..1b66813be8 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H @@ -37,7 +37,6 @@ SourceFiles #define thermoBaffle2D_H #include "thermoBaffleModel.H" -#include "basicSolidThermo.H" #include "volFieldsFwd.H" @@ -69,6 +68,9 @@ private: //- Disallow default bitwise assignment void operator=(const thermoBaffle2D&); + //- Initialize thermoBaffle2D + void init(); + protected: @@ -106,7 +108,7 @@ protected: // Equations //- Solve energy equation - virtual void solveEnergy(); + void solveEnergy(); public: @@ -120,6 +122,16 @@ public: //- Construct from components thermoBaffle2D(const word& modelType, const fvMesh& mesh); + //- Construct from components and dict + thermoBaffle2D + ( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + + ); + + //- Destructor virtual ~thermoBaffle2D(); @@ -130,7 +142,7 @@ public: // Thermo properties //- Return const reference to the basicSolidThermo - inline const basicSolidThermo& thermo() const; + virtual const basicSolidThermo& thermo() const; // Fields @@ -176,10 +188,10 @@ public: // Evolution - //- Pre-evolve film + //- Pre-evolve thermal baffle virtual void preEvolveRegion(); - //- Evolve the film equations + //- Evolve the thermal baffle virtual void evolveRegion(); diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H index 0e3978da3c..227a25975b 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H @@ -38,11 +38,6 @@ namespace thermoBaffleModels // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -inline const basicSolidThermo& thermoBaffle2D::thermo() const -{ - return thermo_; -} - inline tmp thermoBaffle2D::hs ( diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C index 901e8c1600..0ca4856fe6 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C @@ -41,6 +41,7 @@ namespace thermoBaffleModels defineTypeNameAndDebug(thermoBaffleModel, 0); defineRunTimeSelectionTable(thermoBaffleModel, mesh); +defineRunTimeSelectionTable(thermoBaffleModel, dictionary); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -52,23 +53,7 @@ bool thermoBaffleModel::read() } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -thermoBaffleModel::thermoBaffleModel(const fvMesh& mesh) -: - regionModel1D(mesh), - thickness_(), - delta_("delta", dimLength, 0.0), - oneD_(false) -{} - - -thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) -: - regionModel1D(mesh, "thermoBaffle", modelType), - thickness_(), - delta_("delta", dimLength, 0.0), - oneD_(false) +void thermoBaffleModel::init() { if (active_) { @@ -86,7 +71,14 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) label nFaces = 0; forAll (rbm, patchi) { - if (rbm[patchi].size() && isA(rbm[patchi])) + if ( + rbm[patchi].size() + && + ( + isA(rbm[patchi]) + || isA(rbm[patchi]) + ) + ) { nFaces += rbm[patchi].size(); } @@ -108,7 +100,11 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) const label patchI = intCoupledPatchIDs_[i]; const polyPatch& pp = rbm[patchI]; - if (!isA(pp) && oneD_) + if ( + !isA(pp) + && oneD_ + && !constantThickness_ + ) { FatalErrorIn ( @@ -120,7 +116,8 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) ) << "\n patch type '" << pp.type() << "' not type '" << directMappedVariableThicknessWallPolyPatch::typeName - << "'. This is necessary for 1D solution" + << "'. This is necessary for 1D solution " + << " and variable thickness" << "\n for patch. " << pp.name() << exit(FatalError); } @@ -142,7 +139,7 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) } } - if (oneD_) + if (oneD_ && !constantThickness_) { const label patchI = intCoupledPatchIDs_[0]; const polyPatch& pp = rbm[patchI]; @@ -192,6 +189,48 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermoBaffleModel::thermoBaffleModel(const fvMesh& mesh) +: + regionModel1D(mesh), + thickness_(), + delta_("delta", dimLength, 0.0), + oneD_(false), + constantThickness_(true) +{} + + +thermoBaffleModel::thermoBaffleModel +( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + +) +: + regionModel1D(mesh, "thermoBaffle", modelType, dict, true), + thickness_(), + delta_("delta", dimLength, 0.0), + oneD_(false), + constantThickness_(dict.lookupOrDefault("constantThickness", true)) +{ + init(); +} + + +thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) +: + regionModel1D(mesh, "thermoBaffle", modelType), + thickness_(), + delta_("delta", dimLength, 0.0), + oneD_(false), + constantThickness_(lookupOrDefault("constantThickness", true)) +{ + init(); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // thermoBaffleModel::~thermoBaffleModel() diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H index 1a20d9222b..cee13d8e68 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H +++ b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H @@ -38,6 +38,7 @@ SourceFiles #include "scalarIOField.H" #include "autoPtr.H" #include "volFieldsFwd.H" +#include "basicSolidThermo.H" #include "regionModel1D.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,6 +68,9 @@ private: //- Disallow default bitwise assignment void operator=(const thermoBaffleModel&); + //- Initialize thermal Baffle + void init(); + protected: @@ -75,12 +79,15 @@ protected: //- Baffle physical thickness scalarField thickness_; - //- Baffle geometric thickness + //- Baffle mesh thickness dimensionedScalar delta_; //- Is it one dimension bool oneD_; + //- Is thickness constant + bool constantThickness_; + // Protected Member Functions @@ -94,7 +101,7 @@ public: TypeName("thermoBaffleModel"); - // Declare runtime constructor selection table + // Declare runtime constructor selection tables declareRunTimeSelectionTable ( @@ -108,6 +115,20 @@ public: (modelType, mesh) ); + declareRunTimeSelectionTable + ( + autoPtr, + thermoBaffleModel, + dictionary, + ( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + ), + (modelType, mesh, dict) + ); + + // Constructors //- Construct null from mesh @@ -116,12 +137,27 @@ public: //- Construct from type name and mesh thermoBaffleModel(const word& modelType, const fvMesh& mesh); + //- Construct from type name and mesh and dict + thermoBaffleModel + ( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + ); + // Selectors //- Return a reference to the selected model static autoPtr New(const fvMesh& mesh); + //- Return a reference to the selected model using dictionary + static autoPtr New + ( + const fvMesh& mesh, + const dictionary& dict + ); + //- Destructor virtual ~thermoBaffleModel(); @@ -129,8 +165,11 @@ public: // Member Functions + // Access + //- Return solid thermo + virtual const basicSolidThermo& thermo() const = 0; //- Return thickness const scalarField& thickness() const @@ -150,6 +189,12 @@ public: return oneD_; } + //- Return if region has constant thickness + bool constantThickness() const + { + return constantThickness_; + } + // Fields diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C index 976b478e33..15dcb296a1 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C @@ -76,6 +76,35 @@ autoPtr thermoBaffleModel::New(const fvMesh& mesh) } +autoPtr thermoBaffleModel::New +( + const fvMesh& mesh, + const dictionary& dict +) +{ + + word modelType = dict.lookup("thermoBaffleModel"); + + Info<< "Selecting baffle model " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + + FatalErrorIn("thermoBaffleModel::New(const fvMesh&,const dictionary&)") + << "Unknown thermoBaffleModel type " << modelType + << nl << nl + << "Valid thermoBaffleModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(modelType, mesh, dict)); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace thermoBaffleModels diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C index 2888eeea17..991a7c2a4f 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C @@ -33,6 +33,7 @@ namespace Foam { defineTypeNameAndDebug(basicSolidThermo, 0); defineRunTimeSelectionTable(basicSolidThermo, mesh); + defineRunTimeSelectionTable(basicSolidThermo, dictionary); } @@ -120,6 +121,92 @@ Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh) {} +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 + ), + kappa_ + ( + IOobject + ( + "kappa", + 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() diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H index f93a89bc73..c9deef0ee4 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H @@ -98,15 +98,33 @@ public: ); + // Declare run-time constructor selection tables + declareRunTimeSelectionTable + ( + autoPtr, + basicSolidThermo, + dictionary, + (const fvMesh& mesh, const dictionary& dict), + (mesh, dict) + ); + + // Constructors //- Construct from mesh basicSolidThermo(const fvMesh&); + //- Construct from mesh and dict + basicSolidThermo(const fvMesh&, const dictionary& dict); + //- Return a pointer to a new basicSolidThermo created from // the solidThermophysicalProperties dictionary static autoPtr New(const fvMesh&); + //- Return a pointer to a new basicSolidThermo created from + // local dictionary + static autoPtr New(const fvMesh&, const dictionary&); + //- Destructor virtual ~basicSolidThermo(); diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C index a398516f2a..8a7ca3bc57 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C @@ -62,7 +62,7 @@ Foam::autoPtr Foam::basicSolidThermo::New { FatalErrorIn ( - "basicSolidThermo::New(const fvMesh&, const word&)" + "basicSolidThermo::New(const fvMesh&)" ) << "Unknown solidThermo type " << thermoType << endl << endl << "Valid solidThermo types are :" << endl @@ -74,4 +74,36 @@ Foam::autoPtr Foam::basicSolidThermo::New } +Foam::autoPtr Foam::basicSolidThermo::New +( + const fvMesh& mesh, const dictionary& dict +) +{ + if (debug) + { + Info<< "basicSolidThermo::New(const fvMesh&, const dictionary&): " + << "constructing basicSolidThermo" + << endl; + } + + const word thermoType = dict.lookup("thermoType"); + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(thermoType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "basicSolidThermo::New(const fvMesh&, const dictionary&)" + ) << "Unknown solidThermo type " << thermoType + << endl << endl + << "Valid solidThermo types are :" << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(mesh, dict)); +} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C index 083849c7ab..6d6ac784a4 100644 --- a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C @@ -32,11 +32,55 @@ 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")), + constK_(dimensionedScalar(dict_.lookup("K"))), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + constK_ + ), + constRho_(dimensionedScalar(dict_.lookup("rho"))), + constCp_(dimensionedScalar(dict_.lookup("Cp"))), + constHf_(dimensionedScalar(dict_.lookup("Hf"))), + constEmissivity_(dimensionedScalar(dict_.lookup("emissivity"))), + constKappa_(dimensionedScalar(dict_.lookup("kappa"))), + constSigmaS_(dimensionedScalar(dict_.lookup("sigmaS"))) +{ + read(); + + K_ = constK_; + + rho_ = constRho_; + + emissivity_ = constEmissivity_; + + kappa_ = constKappa_; + + sigmaS_ = constSigmaS_; +} + + Foam::constSolidThermo::constSolidThermo(const fvMesh& mesh) : basicSolidThermo(mesh), diff --git a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H index aff314ae73..fa4743706e 100644 --- a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H @@ -93,6 +93,10 @@ public: //- Construct from mesh constSolidThermo(const fvMesh& mesh); + //- Construct from mesh and dict + constSolidThermo(const fvMesh& mesh, const dictionary& dict); + + //- Destructor virtual ~constSolidThermo(); diff --git a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C index 908db0b62a..b0a05d6e64 100644 --- a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C @@ -39,11 +39,57 @@ namespace Foam directionalKSolidThermo, mesh ); + + addToRunTimeSelectionTable + ( + basicSolidThermo, + directionalKSolidThermo, + dictionary + ); + } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +Foam::directionalKSolidThermo::directionalKSolidThermo +( + const fvMesh& mesh, + const dictionary& dict +) +: + interpolatedSolidThermo(mesh, typeName + "Coeffs", dict), + directionalK_ + ( + IOobject + ( + "K", + 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"), @@ -73,9 +119,25 @@ Foam::directionalKSolidThermo::directionalKSolidThermo(const fvMesh& mesh) mesh, dimLength ) +{ + init(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::directionalKSolidThermo::~directionalKSolidThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::directionalKSolidThermo::init() { KValues_ = Field(subDict(typeName + "Coeffs").lookup("KValues")); + const fvMesh& mesh = K().mesh(); + // Determine transforms for cell centres forAll(mesh.C(), cellI) { @@ -244,14 +306,6 @@ Foam::directionalKSolidThermo::directionalKSolidThermo(const fvMesh& mesh) } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::directionalKSolidThermo::~directionalKSolidThermo() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - Foam::symmTensor Foam::directionalKSolidThermo::transformPrincipal ( const tensor& tt, diff --git a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H index e1ee3cba9f..d879db4c1a 100644 --- a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H @@ -86,6 +86,9 @@ class directionalKSolidThermo //- Calculate properties void calculate(); + //- Initialize thermo + void init(); + public: @@ -98,6 +101,9 @@ public: //- Construct from mesh directionalKSolidThermo(const fvMesh& mesh); + //- Construct from mesh and dictionary + directionalKSolidThermo(const fvMesh& mesh, const dictionary& dict); + //- Destructor virtual ~directionalKSolidThermo(); diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C index 9e08c9bd16..9066081803 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C @@ -86,11 +86,14 @@ bool Foam::interpolateSolid::writeData(Ostream& os) const 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_ << nl; - os.writeKeyword("kappaValues") << kappaValues_ << nl; + os.writeKeyword("emissivityValues") << emissivityValues_ << + token::END_STATEMENT << nl; + os.writeKeyword("kappaValues") << kappaValues_ + << token::END_STATEMENT << nl; os.writeKeyword("sigmaSValues") << sigmaSValues_ << token::END_STATEMENT << nl; + return os.good(); } diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C index 431e6c98b4..5164710a65 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "interpolatedSolidThermo.H" -#include "addToRunTimeSelectionTable.H" #include "interpolateXY.H" @@ -44,6 +43,20 @@ Foam::interpolatedSolidThermo::interpolatedSolidThermo } +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() diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H index d604b160be..0719d67baf 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H @@ -67,6 +67,15 @@ public: //- 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(); diff --git a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C index 9b1a7d3858..41f587a6b9 100644 --- a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C @@ -37,11 +37,45 @@ namespace Foam isotropicKSolidThermo, mesh ); + + addToRunTimeSelectionTable + ( + basicSolidThermo, + isotropicKSolidThermo, + dictionary + ); + } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +Foam::isotropicKSolidThermo::isotropicKSolidThermo +( + const fvMesh& mesh, + const dictionary& dict +) +: + interpolatedSolidThermo(mesh, typeName + "Coeffs", dict), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimTime/(dimLength*dimTemperature) + ), + KValues_ (Field(subDict(typeName + "Coeffs").lookup("KValues"))) +{ + correct(); +} + + Foam::isotropicKSolidThermo::isotropicKSolidThermo(const fvMesh& mesh) : interpolatedSolidThermo(mesh, typeName + "Coeffs"), diff --git a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H index a54e386c38..44a85f9af1 100644 --- a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H @@ -70,6 +70,10 @@ public: //- Construct from mesh isotropicKSolidThermo(const fvMesh& mesh); + //- Construct from mesh and dicionary + isotropicKSolidThermo(const fvMesh& mesh, const dictionary& dict); + + //- Destructor virtual ~isotropicKSolidThermo(); diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H index 94c4880a1d..537ca0b083 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H @@ -54,6 +54,12 @@ addToRunTimeSelectionTable \ mesh \ ); \ \ +addToRunTimeSelectionTable \ +( \ + CThermo, \ + MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \ + dictionary \ +); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C index 36f590e838..6dfbd3c339 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C @@ -87,6 +87,32 @@ Foam::solidMixtureThermo::solidMixtureThermo } +template +Foam::solidMixtureThermo::solidMixtureThermo +( + const fvMesh& mesh, + const dictionary& dict +) +: + basicSolidThermo(mesh, dict), + MixtureType(*this, mesh), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimEnergy/dimTime/(dimLength*dimTemperature) + ) +{ + calculate(); +} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H index a8c2f9e3e4..c6c16917d1 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H @@ -79,6 +79,9 @@ public: //- Construct from mesh solidMixtureThermo(const fvMesh&); + //- Construct from mesh and dictionary + solidMixtureThermo(const fvMesh&, const dictionary&); + //- Destructor virtual ~solidMixtureThermo();