Skip to content

Commit

Permalink
fvOption::radiation: New fvOption providing the radiation source to t…
Browse files Browse the repository at this point in the history
…he energy equation

Radiative heat transfer may now be added to any solver in which an energy
equation is solved at run-time rather than having to change the solver code.

For example, radiative heat transfer is now enabled in the SandiaD_LTS
reactingFoam tutorial by providing a constant/fvOptions file containing

radiation
{
    type            radiation;
    libs ("libradiationModels.so");
}

and appropriate settings in the constant/radiationProperties file.
  • Loading branch information
Henry Weller committed Apr 13, 2017
1 parent 045014d commit 9a06a1e
Show file tree
Hide file tree
Showing 8 changed files with 318 additions and 36 deletions.
3 changes: 3 additions & 0 deletions src/thermophysicalModels/radiation/Make/files
Expand Up @@ -40,4 +40,7 @@ derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedF
derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C
derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C

/* fvOptions */
fvOptions/radiation/radiation.C

LIB = $(FOAM_LIBBIN)/libradiationModels
96 changes: 96 additions & 0 deletions src/thermophysicalModels/radiation/fvOptions/radiation/radiation.C
@@ -0,0 +1,96 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ 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 "radiation.H"
#include "fluidThermo.H"
#include "fvMatrices.H"
#include "addToRunTimeSelectionTable.H"

// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //

namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(radiation, 0);

addToRunTimeSelectionTable
(
option,
radiation,
dictionary
);
}
}


// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::fv::radiation::radiation
(
const word& sourceName,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
option(sourceName, modelType, dict, mesh)
{
const basicThermo& thermo =
mesh_.lookupObject<basicThermo>(basicThermo::dictName);

fieldNames_.setSize(1);
fieldNames_[0] = thermo.he().name();
applied_.setSize(fieldNames_.size(), false);

radiation_ = Foam::radiation::radiationModel::New(thermo.T());
}


// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

bool Foam::fv::radiation::read(const dictionary& dict)
{
return option::read(dict);
}


void Foam::fv::radiation::addSup
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const label fieldi
)
{
const basicThermo& thermo =
mesh_.lookupObject<basicThermo>(basicThermo::dictName);

radiation_->correct();

eqn += radiation_->Sh(thermo, eqn.psi());
}


// ************************************************************************* //
129 changes: 129 additions & 0 deletions src/thermophysicalModels/radiation/fvOptions/radiation/radiation.H
@@ -0,0 +1,129 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ 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::fv::radiation
Description
Calculates and applies the buoyancy energy source rho*(U&g) to the energy
equation.
Usage
Example usage:
\verbatim
radiationCoeffs
{
fields (h); // Name of energy field
}
\endverbatim
SourceFiles
radiation.C
\*---------------------------------------------------------------------------*/

#ifndef radiation_H
#define radiation_H

#include "fvOption.H"
#include "uniformDimensionedFields.H"
#include "radiationModel.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace fv
{

/*---------------------------------------------------------------------------*\
Class radiation Declaration
\*---------------------------------------------------------------------------*/

class radiation
:
public option
{
// Private data

//- The radiation model pointer
autoPtr<Foam::radiation::radiationModel> radiation_;


// Private Member Functions

//- Disallow default bitwise copy construct
radiation(const radiation&);

//- Disallow default bitwise assignment
void operator=(const radiation&);


public:

//- Runtime type information
TypeName("radiation");


// Constructors

//- Construct from explicit source name and mesh
radiation
(
const word& sourceName,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);


// Member Functions

// Evaluate

//- Add explicit contribution to compressible momentum equation
virtual void addSup
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const label fieldi
);


// IO

//- Read source dictionary
virtual bool read(const dictionary& dict);
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace fv
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
44 changes: 44 additions & 0 deletions tutorials/combustion/reactingFoam/RAS/SandiaD_LTS/0.orig/G
@@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------* \
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object G;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [1 0 -3 0 0 0 0];

internalField uniform 0;

boundaryField
{
".*"
{
type MarshakRadiation;
T T;
emissivityMode lookup;
emissivity uniform 1.0;
value uniform 0;
}

frontAndBack_pos
{
type wedge;
}

frontAndBack_neg
{
type wedge;
}
}


// ************************************************************************* //
@@ -0,0 +1,24 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

radiation
{
type radiation;
libs ("libradiationModels.so");
}

// ************************************************************************* //
Expand Up @@ -5,6 +5,7 @@
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

FoamFile
{
version 2.0;
Expand All @@ -15,48 +16,19 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Radiation model on/off
radiation on;
radiation on;

// Radiation model
radiationModel P1;

// Absorption coefficients model
absorptionEmissionModel greyMeanAbsorptionEmission;

// Number of flow iterations per radiation iteration
solverFreq 1;

//
noRadiation
{
}

// P1 Model
P1Coeffs
{

C C [0 0 0 0 0 0 0] 0;
}

// Number of flow iterations per radiation iteration
solverFreq 1;

fvDOMCoeffs
{
nPhi 2; // azimuthal angles in PI/2 on X-Y.(from Y to X)
nTheta 2; // polar angles in PI (from Z to X-Y plane)
convergence 1e-1; // convergence criteria for radiation iteration
maxIter 1; // maximum number of iterations
cacheDiv true; // cache the div of the RTE equation.

// NOTE: Caching div is "only" accurate if the upwind scheme is used in
// div(Ji,Ii_h)
}

constantAbsorptionEmissionCoeffs
{
absorptivity absorptivity [ m^-1 ] 0.01;
emissivity emissivity [ m^-1 ] 0.01;
E E [ kg m^-1 s^-3 ] 0;
}
absorptionEmissionModel greyMeanAbsorptionEmission;

greyMeanAbsorptionEmissionCoeffs
{
Expand Down Expand Up @@ -206,5 +178,4 @@ scatterModel none;

sootModel none;


// ************************************************************************* //
Expand Up @@ -13,6 +13,7 @@ FoamFile
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application reactingFoam;

Expand All @@ -22,7 +23,7 @@ startTime 0;

stopAt endTime;

endTime 5000;
endTime 7000;

deltaT 1;

Expand Down

0 comments on commit 9a06a1e

Please sign in to comment.