ENH: Adding general constructors with dictionary to implement

thermal baffle hold at a boundary
This commit is contained in:
sergio
2011-07-12 15:51:08 +01:00
parent d9d8c9c02d
commit bbbaf89c20
32 changed files with 1245 additions and 68 deletions

View File

@ -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

View File

@ -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();

View File

@ -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;

View File

@ -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_;

View File

@ -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::labelField> 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()

View File

@ -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<labelField> 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();

View File

@ -3,5 +3,7 @@ thermoBaffleModel/thermoBaffleModelNew.C
thermoBaffle2D/thermoBaffle2D.C
noThermo/noThermo.C
derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libthermoBaffleModels

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "temperatureThermoBaffleFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
temperatureThermoBaffleFvPatchScalarField::
temperatureThermoBaffleFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(p, iF),
owner_(false),
baffle_(),
solidThermoType_("undefined")
{}
temperatureThermoBaffleFvPatchScalarField::
temperatureThermoBaffleFvPatchScalarField
(
const temperatureThermoBaffleFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& 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<scalar, volMesh>& iF,
const dictionary& dict
)
:
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(p, iF, dict),
owner_(false),
baffle_(),
solidThermoType_()
{
if (!isA<directMappedPatchBase>(patch().patch()))
{
FatalErrorIn
(
"temperatureThermoBaffleFvPatchScalarField::"
"temperatureThermoBaffleFvPatchScalarField\n"
"(\n"
" const fvPatch& p,\n"
" const DimensionedField<scalar, volMesh>& 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<baffle>("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<scalar, volMesh>& 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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
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<regionModels::thermoBaffleModels::thermoBaffleModel> 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<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
temperatureThermoBaffleFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// temperatureThermoBaffleFvPatchScalarField onto a new patch
temperatureThermoBaffleFvPatchScalarField
(
const temperatureThermoBaffleFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new temperatureThermoBaffleFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
temperatureThermoBaffleFvPatchScalarField
(
const temperatureThermoBaffleFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
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
// ************************************************************************* //

View File

@ -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<const basicSolidThermo&>(null);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace thermoBaffleModels

View File

@ -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]

View File

@ -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<scalar>::zero
)
),
Q_
(
IOobject
(
"Q",
regionMesh().time().timeName(),
regionMesh(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
regionMesh(),
dimensionedScalar
(
"zero",
dimEnergy/dimVolume/dimTime,
pTraits<scalar>::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() << ", "

View File

@ -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();

View File

@ -38,11 +38,6 @@ namespace thermoBaffleModels
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const basicSolidThermo& thermoBaffle2D::thermo() const
{
return thermo_;
}
inline tmp<scalarField> thermoBaffle2D::hs
(

View File

@ -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<wedgePolyPatch>(rbm[patchi]))
if (
rbm[patchi].size()
&&
(
isA<wedgePolyPatch>(rbm[patchi])
|| isA<emptyPolyPatch>(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<directMappedVariableThicknessWallPolyPatch>(pp) && oneD_)
if (
!isA<directMappedVariableThicknessWallPolyPatch>(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<bool>("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<bool>("constantThickness", true))
{
init();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
thermoBaffleModel::~thermoBaffleModel()

View File

@ -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<thermoBaffleModel> New(const fvMesh& mesh);
//- Return a reference to the selected model using dictionary
static autoPtr<thermoBaffleModel> 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

View File

@ -76,6 +76,35 @@ autoPtr<thermoBaffleModel> thermoBaffleModel::New(const fvMesh& mesh)
}
autoPtr<thermoBaffleModel> 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<thermoBaffleModel>(cstrIter()(modelType, mesh, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace thermoBaffleModels

View File

@ -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()

View File

@ -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<basicSolidThermo> New(const fvMesh&);
//- Return a pointer to a new basicSolidThermo created from
// local dictionary
static autoPtr<basicSolidThermo> New(const fvMesh&, const dictionary&);
//- Destructor
virtual ~basicSolidThermo();

View File

@ -62,7 +62,7 @@ Foam::autoPtr<Foam::basicSolidThermo> 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> Foam::basicSolidThermo::New
}
Foam::autoPtr<Foam::basicSolidThermo> 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<basicSolidThermo>(cstrIter()(mesh, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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),

View File

@ -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();

View File

@ -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<vector>(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,

View File

@ -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();

View File

@ -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();
}

View File

@ -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()

View File

@ -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();

View File

@ -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<scalar>(subDict(typeName + "Coeffs").lookup("KValues")))
{
correct();
}
Foam::isotropicKSolidThermo::isotropicKSolidThermo(const fvMesh& mesh)
:
interpolatedSolidThermo(mesh, typeName + "Coeffs"),

View File

@ -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();

View File

@ -54,6 +54,12 @@ addToRunTimeSelectionTable \
mesh \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \
dictionary \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -87,6 +87,32 @@ Foam::solidMixtureThermo<MixtureType>::solidMixtureThermo
}
template<class MixtureType>
Foam::solidMixtureThermo<MixtureType>::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<class MixtureType>

View File

@ -79,6 +79,9 @@ public:
//- Construct from mesh
solidMixtureThermo(const fvMesh&);
//- Construct from mesh and dictionary
solidMixtureThermo(const fvMesh&, const dictionary&);
//- Destructor
virtual ~solidMixtureThermo();