mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Restructured and enhanced thermalPorousZone
- thermal model now run-time selectable - added option for 'none'
This commit is contained in:
@ -1,4 +1,9 @@
|
||||
thermalPorousZone/thermalPorousZone.C
|
||||
thermalPorousZone/thermalPorousZones.C
|
||||
|
||||
thermalModel/thermalModel/thermalModel.C
|
||||
thermalModel/thermalModel/thermalModelNew.C
|
||||
thermalModel/fixedTemperature/fixedTemperature.C
|
||||
thermalModel/noThermalModel/noThermalModel.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libthermalPorousZone
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fixedTemperature.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "basicThermo.H"
|
||||
#include "volFields.H"
|
||||
#include "fvMatrices.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fixedTemperature, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
thermalModel,
|
||||
fixedTemperature,
|
||||
pZone
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fixedTemperature::fixedTemperature(const porousZone& pZone)
|
||||
:
|
||||
thermalModel(pZone, typeName),
|
||||
T_(readScalar(coeffDict_.lookup("T")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fixedTemperature::~fixedTemperature()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fixedTemperature::addEnthalpySource
|
||||
(
|
||||
const basicThermo& thermo,
|
||||
const volScalarField& rho,
|
||||
fvScalarMatrix& hEqn
|
||||
) const
|
||||
{
|
||||
const labelList& zones = pZone_.zoneIds();
|
||||
if (zones.empty() || T_ < 0.0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const fvMesh& mesh = pZone_.mesh();
|
||||
const scalarField& V = mesh.V();
|
||||
scalarField& hDiag = hEqn.diag();
|
||||
scalarField& hSource = hEqn.source();
|
||||
|
||||
// TODO: generalize for non-fixedTemperature methods
|
||||
const scalar rate = 1e6;
|
||||
|
||||
forAll(zones, zoneI)
|
||||
{
|
||||
const labelList& cells = mesh.cellZones()[zones[zoneI]];
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
hDiag[cells[i]] += rate*V[cells[i]]*rho[cells[i]];
|
||||
hSource[cells[i]] += rate*V[cells[i]]*rho[cells[i]]*T_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,98 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fixedTemperature
|
||||
|
||||
Description
|
||||
Fixed temperature model
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixedTemperature_H
|
||||
#define fixedTemperature_H
|
||||
|
||||
#include "thermalModel.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fixedTemperature Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fixedTemperature
|
||||
:
|
||||
public thermalModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Fixed temperature
|
||||
const scalar T_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fixedTemperature");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from porous zone
|
||||
fixedTemperature(const porousZone& pZone);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fixedTemperature();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Add the thermal source to the enthalpy equation
|
||||
virtual void addEnthalpySource
|
||||
(
|
||||
const basicThermo& thermo,
|
||||
const volScalarField& rho,
|
||||
fvScalarMatrix& hEqn
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "noThermalModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "basicThermo.H"
|
||||
#include "volFields.H"
|
||||
#include "fvMatrices.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(noThermalModel, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
thermalModel,
|
||||
noThermalModel,
|
||||
pZone
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::noThermalModel::noThermalModel(const porousZone& pZone)
|
||||
:
|
||||
thermalModel(pZone)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::noThermalModel::~noThermalModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::noThermalModel::addEnthalpySource
|
||||
(
|
||||
const basicThermo&,
|
||||
const volScalarField&,
|
||||
fvScalarMatrix&
|
||||
) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,90 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::noThermalModel
|
||||
|
||||
Description
|
||||
Dummy model for 'none' option
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef noThermalModel_H
|
||||
#define noThermalModel_H
|
||||
|
||||
#include "thermalModel.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class noThermalModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class noThermalModel
|
||||
:
|
||||
public thermalModel
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from porous zone
|
||||
noThermalModel(const porousZone& pZone);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~noThermalModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Add the thermal source to the enthalpy equation
|
||||
virtual void addEnthalpySource
|
||||
(
|
||||
const basicThermo& thermo,
|
||||
const volScalarField& rho,
|
||||
fvScalarMatrix& hEqn
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermalModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(thermalModel, 0);
|
||||
defineRunTimeSelectionTable(thermalModel, pZone);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::thermalModel::thermalModel(const porousZone& pZone)
|
||||
:
|
||||
pZone_(pZone),
|
||||
coeffDict_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
Foam::thermalModel::thermalModel
|
||||
(
|
||||
const porousZone& pZone,
|
||||
const word& modelType
|
||||
)
|
||||
:
|
||||
pZone_(pZone),
|
||||
coeffDict_(pZone_.dict().subDict(modelType + "Coeffs"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::thermalModel::~thermalModel()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,122 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::thermalModel
|
||||
|
||||
Description
|
||||
Base class for selecting the temperature specification models
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef thermalModel_H
|
||||
#define thermalModel_H
|
||||
|
||||
#include "porousZone.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class basicThermo;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class thermalModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class thermalModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the porous zone
|
||||
const porousZone& pZone_;
|
||||
|
||||
//- Sub-model coefficients dictionary
|
||||
const dictionary coeffDict_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("thermalModel");
|
||||
|
||||
//- Declare runtime constructor selection table
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
thermalModel,
|
||||
pZone,
|
||||
(
|
||||
const porousZone& pZone
|
||||
),
|
||||
(pZone)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from porous zone
|
||||
thermalModel(const porousZone& pZone);
|
||||
|
||||
//- Construct from porous zone and model type name
|
||||
thermalModel(const porousZone& pZone, const word& modelType);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~thermalModel();
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<thermalModel> New(const porousZone& pZone);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Add the thermal source to the enthalpy equation
|
||||
virtual void addEnthalpySource
|
||||
(
|
||||
const basicThermo& thermo,
|
||||
const volScalarField& rho,
|
||||
fvScalarMatrix& hEqn
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermalModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::thermalModel> Foam::thermalModel::New
|
||||
(
|
||||
const porousZone& pZone
|
||||
)
|
||||
{
|
||||
const word modelType(pZone.dict().lookup("thermalModel"));
|
||||
|
||||
Info<< "Selecting thermalModel " << modelType << endl;
|
||||
|
||||
pZoneConstructorTable::iterator cstrIter =
|
||||
pZoneConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == pZoneConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"thermalModel::New(const porousZone&)"
|
||||
) << "Unknown thermalModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid thermalModel types are :" << endl
|
||||
<< pZoneConstructorTablePtr_->sortedToc()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<thermalModel>(cstrIter()(pZone));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,9 +24,9 @@ License
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermalPorousZone.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "basicThermo.H"
|
||||
#include "volFields.H"
|
||||
#include "fvMatrices.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,29 +38,8 @@ Foam::thermalPorousZone::thermalPorousZone
|
||||
)
|
||||
:
|
||||
porousZone(key, mesh, dict),
|
||||
T_("T", dimTemperature, -GREAT)
|
||||
{
|
||||
if (const dictionary* dictPtr = dict.subDictPtr("thermalModel"))
|
||||
{
|
||||
const word thermalModel(dictPtr->lookup("type"));
|
||||
|
||||
if (thermalModel == "fixedTemperature")
|
||||
{
|
||||
dictPtr->lookup("T") >> T_;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"thermalPorousZone::thermalPorousZone"
|
||||
"(const keyType&, const fvMesh&, const dictionary&)",
|
||||
*dictPtr
|
||||
) << "thermalModel " << thermalModel << " is not supported" << nl
|
||||
<< " Supported thermalModels are: fixedTemperature"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
}
|
||||
model_(thermalModel::New(*this))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -72,29 +51,7 @@ void Foam::thermalPorousZone::addEnthalpySource
|
||||
fvScalarMatrix& hEqn
|
||||
) const
|
||||
{
|
||||
const labelList& zones = this->zoneIds();
|
||||
if (zones.empty() || T_.value() < 0.0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const scalarField& V = mesh().V();
|
||||
scalarField& hDiag = hEqn.diag();
|
||||
scalarField& hSource = hEqn.source();
|
||||
|
||||
// TODO: generalize for non-fixedTemperature methods
|
||||
const scalar rate = 1e6;
|
||||
|
||||
forAll(zones, zoneI)
|
||||
{
|
||||
const labelList& cells = mesh().cellZones()[zones[zoneI]];
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
hDiag[cells[i]] += rate*V[cells[i]]*rho[cells[i]];
|
||||
hSource[cells[i]] += rate*V[cells[i]]*rho[cells[i]]*T_.value();
|
||||
}
|
||||
}
|
||||
model_->addEnthalpySource(thermo, rho, hEqn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -29,7 +29,8 @@ Description
|
||||
equations.
|
||||
|
||||
See Also
|
||||
porousZone, thermalPorousZones and coordinateSystems
|
||||
porousZone, thermalPorousZones and coordinateSystems with run-time
|
||||
selectable thermal model
|
||||
|
||||
SourceFiles
|
||||
thermalPorousZone.C
|
||||
@ -40,6 +41,7 @@ SourceFiles
|
||||
#define thermalPorousZone_H
|
||||
|
||||
#include "porousZone.H"
|
||||
#include "thermalModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,7 +52,7 @@ class fvMesh;
|
||||
class basicThermo;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class thermalPorousZone Declaration
|
||||
Class thermalPorousZone Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class thermalPorousZone
|
||||
@ -59,23 +61,27 @@ class thermalPorousZone
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Temperature in the porous-zone
|
||||
dimensionedScalar T_;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
thermalPorousZone(const thermalPorousZone&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const thermalPorousZone&);
|
||||
|
||||
//- Thermal model
|
||||
autoPtr<thermalModel> model_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
thermalPorousZone(const keyType& key, const fvMesh&, const dictionary&);
|
||||
thermalPorousZone
|
||||
(
|
||||
const keyType& key,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Return clone
|
||||
autoPtr<thermalPorousZone> clone() const
|
||||
@ -118,20 +124,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the temperature in the porous-zone
|
||||
const dimensionedScalar& T() const
|
||||
{
|
||||
return T_;
|
||||
}
|
||||
|
||||
//- Edit access to the temperature in the porous-zone
|
||||
dimensionedScalar& T()
|
||||
{
|
||||
return T_;
|
||||
}
|
||||
|
||||
//- Add the thermal source to the enthalpy equation
|
||||
void addEnthalpySource
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user