ENH: solarLoadBase: new base class to access various solar-load data

This commit is contained in:
Kutalmis Bercin 2022-09-14 15:51:28 +01:00 committed by Andrew Heather
parent 0fde8ac91d
commit eaffe4c2cf
5 changed files with 191 additions and 1 deletions

View File

@ -12,6 +12,7 @@ radiationModels/opaqueSolid/opaqueSolid.C
radiationModels/solarLoad/solarLoad.C
radiationModels/solarLoad/faceShading/faceShading.C
radiationModels/solarLoad/faceReflecting/faceReflecting.C
radiationModels/solarLoad/solarLoadBase.C
/* Scatter model */
submodels/scatterModel/scatterModel/scatterModel.C

View File

@ -760,6 +760,7 @@ void Foam::radiation::solarLoad::calculateQdiff
Foam::radiation::solarLoad::solarLoad(const volScalarField& T)
:
radiationModel(typeName, T),
solarLoadBase(mesh_),
solarCalc_(coeffs_, mesh_),
dict_(coeffs_),
qr_
@ -814,6 +815,7 @@ Foam::radiation::solarLoad::solarLoad
)
:
radiationModel(typeName, dict, T),
solarLoadBase(mesh_),
solarCalc_(dict, mesh_),
dict_(dict),
qr_
@ -985,4 +987,18 @@ Foam::radiation::solarLoad::Ru() const
}
const Foam::solarCalculator&
Foam::radiation::solarLoad::solarCalculatorRef() const
{
return solarCalc_;
}
const Foam::faceShading&
Foam::radiation::solarLoad::faceShadingRef() const
{
return hitFaces_();
}
// ************************************************************************* //

View File

@ -99,6 +99,7 @@ SourceFiles
#define radiation_solarLoad_H
#include "radiationModel.H"
#include "solarLoadBase.H"
#include "volFields.H"
#include "faceShading.H"
#include "faceReflecting.H"
@ -118,7 +119,8 @@ namespace radiation
class solarLoad
:
public radiationModel
public radiationModel,
public solarLoadBase
{
// Private Data
@ -262,6 +264,12 @@ public:
{
return qprimaryRad_[bandI];
}
//- Return const reference to the solar calculator
virtual const solarCalculator& solarCalculatorRef() const;
//- Return const reference to the face shading calculator
virtual const faceShading& faceShadingRef() const;
};

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "solarLoadBase.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(solarLoadBase, 0);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::solarLoadBase::solarLoadBase
(
const fvMesh& mesh
)
:
regIOobject
(
IOobject
(
solarLoadBase::typeName,
mesh.polyMesh::instance(),
mesh
)
)
{}
// ************************************************************************* //

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::radiation::solarLoadBase
Group
grpRadiationModels
Description
Base class for solarLoad models.
\*---------------------------------------------------------------------------*/
#ifndef radiation_solarLoadBase_H
#define radiation_solarLoadBase_H
#include "regIOobject.H"
#include "fvMesh.H"
#include "solarCalculator.H"
#include "faceShading.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class solarLoadBase Declaration
\*---------------------------------------------------------------------------*/
class solarLoadBase
:
public regIOobject
{
public:
//- Runtime type information
TypeName("solarLoadBase");
// Constructors
//- Construct
solarLoadBase(const fvMesh& mesh);
//- Destructor
virtual ~solarLoadBase() = default;
// Member Functions
// Access
//- Return const reference to the solar calculator
virtual const solarCalculator& solarCalculatorRef() const = 0;
//- Return const reference to the face shading calculator
virtual const faceShading& faceShadingRef() const = 0;
// IO
bool writeData(Foam::Ostream&) const
{
return true;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace radiation
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //