ENH: mmore modification to the radiation model

This commit is contained in:
sergio
2011-02-10 18:06:13 +00:00
parent 9a74ca1a19
commit abbf00eff0
18 changed files with 1314 additions and 75 deletions

View File

@ -30,5 +30,6 @@ derivedFvPatchFields/MarshakRadiationFixedT/MarshakRadiationFixedTMixedFvPatchSc
derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C
derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C
derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C
derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libradiationModels

View File

@ -0,0 +1,182 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "greyDiffusiveViewFactorFixedValueFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
radiationCoupledBase(patch(), "undefined", scalarField::null()),
Qro_(p.size(), 0.0)
{}
Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
radiationCoupledBase
(
patch(),
ptf.emissivityMethod(),
ptf.emissivity_
),
Qro_(ptf.Qro_)
{}
Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF),
radiationCoupledBase(p, dict),
Qro_("Qro", dict, p.size())
{
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
}
else
{
fvPatchScalarField::operator=(0.0);
}
}
Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField& ptf
)
:
fixedValueFvPatchScalarField(ptf),
radiationCoupledBase
(
ptf.patch(),
ptf.emissivityMethod(),
ptf.emissivity_
),
Qro_(ptf.Qro_)
{}
Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(ptf, iF),
radiationCoupledBase
(
ptf.patch(),
ptf.emissivityMethod(),
ptf.emissivity_
),
Qro_(ptf.Qro_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
updateCoeffs()
{
//Do nothing
if (debug)
{
scalar Q = gSum((*this)*patch().magSf());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " <- "
<< " heat[W]:" << Q
<< " wall radiative heat flux "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
}
}
void Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
write
(
Ostream& os
) const
{
fixedValueFvPatchScalarField::write(os);
radiationCoupledBase::write(os);
Qro_.writeEntry("Qro", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
makePatchTypeField
(
fvPatchScalarField,
greyDiffusiveViewFactorFixedValueFvPatchScalarField
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,167 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::greyDiffusiveViewFactorFixedValueFvPatchScalarField
Description
Radiation temperature specified
SourceFiles
greyDiffusiveViewFactorFixedValueFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef greyDiffusiveViewFactorFixedValueFvPatchScalarField_H
#define greyDiffusiveViewFactorFixedValueFvPatchScalarField_H
#include "radiationCoupledBase.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class greyDiffusiveViewFactorFixedValueFvPatchScalarField declaration
\*---------------------------------------------------------------------------*/
class greyDiffusiveViewFactorFixedValueFvPatchScalarField
:
public fixedValueFvPatchScalarField,
public radiationCoupledBase
{
// Private data
//- External radiative heat flux
scalarField Qro_;
public:
//- Runtime type information
TypeName("greyDiffusiveRadiationViewFactor");
// Constructors
//- Construct from patch and internal field
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given a
// greyDiffusiveViewFactorFixedValueFvPatchScalarField onto a new patch
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new greyDiffusiveViewFactorFixedValueFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField&,
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 greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
*this,
iF
)
);
}
// Member functions
// Access
//- Return external radiative heat flux
const scalarList& Qro()
{
return Qro_;
}
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -56,12 +56,13 @@ const Foam::NamedEnum<Foam::radiationCoupledBase::emissivityMethodType, 2>
Foam::radiationCoupledBase::radiationCoupledBase
(
const fvPatch& patch,
const word& calculationType
const word& calculationType,
const scalarField& emissivity
)
:
patch_(patch),
method_(emissivityMethodTypeNames_[calculationType]),
emissivity_(patch.size(), 0.0)
emissivity_(emissivity)
{}
@ -93,35 +94,7 @@ Foam::radiationCoupledBase::radiationCoupledBase
<< exit(FatalError);
}
const directMappedPatchBase& mpp = refCast
<
const directMappedPatchBase
>
(
patch_.patch()
);
const polyMesh& nbrMesh = mpp.sampleMesh();
if
(
!nbrMesh.foundObject<basicSolidThermo>
(
"solidThermophysicalProperties"
)
)
{
FatalErrorIn
(
"radiationCoupledBase::radiationCoupledBase\n"
"(\n"
" const fvPatch& p,\n"
" const dictionary& dict\n"
")\n"
) << "\n solidThermophysicalProperties does not exist "
<< "\n in mesh ' " << nbrMesh.name() << "'"
<< exit(FatalError);
}
emissivity_ = scalarField(patch_.size(), 0.0);
}
break;
@ -136,9 +109,8 @@ Foam::radiationCoupledBase::radiationCoupledBase
" const fvPatch& p,\n"
" const dictionary& dict\n"
")\n"
) << "\n emissivity key"
<< "\n does not exist "
<< "\n for patch " << patch_.name()
) << "\n emissivity key does not exist for patch "
<< patch_.name()
<< exit(FatalError);
}
else
@ -159,7 +131,6 @@ Foam::tmp<Foam::scalarField> Foam::radiationCoupledBase::emissivity() const
{
case SOLIDTHERMO:
{
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp =
refCast<const directMappedPatchBase>
@ -168,25 +139,36 @@ Foam::tmp<Foam::scalarField> Foam::radiationCoupledBase::emissivity() const
);
const polyMesh& nbrMesh = mpp.sampleMesh();
const fvPatch& nbrPatch = refCast<const fvMesh>
(
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];
scalarField emissivity
(
nbrPatch.lookupPatchField<volScalarField, scalar>("emissivity")
);
if (nbrMesh.foundObject<volScalarField>("emissivity"))
{
tmp<scalarField> temissivity
(
new scalarField
(
nbrPatch.lookupPatchField<volScalarField, scalar>
(
"emissivity"
)
)
);
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
scalarField& emissivity = temissivity();
distMap.distribute(emissivity);
// Use direct map mapping to exchange data
mpp.map().distribute(emissivity);
return tmp<scalarField>
(
new scalarField(emissivity)
);
return temissivity;
}
else
{
return scalarField(0);
}
}
break;
@ -219,8 +201,7 @@ void Foam::radiationCoupledBase::write(Ostream& os) const
{
os.writeKeyword("emissivityMode") << emissivityMethodTypeNames_[method_]
<< token::END_STATEMENT << nl;
os.writeKeyword("emissivity") << emissivity_
<< token::END_STATEMENT << nl;
emissivity_.writeEntry("emissivity", os);
}

View File

@ -25,9 +25,8 @@ Class
radiationCoupledBase
Description
Common functions for use in temperature coupled boundaries when
radiation is used. For now only emissivity() : emissivity
gets supplied from lookup or calculate:
Common functions to emissivity. It gets supplied from lookup into a
dictionary or calculated by the solidThermo:
- 'lookup' : lookup volScalarField with name
- 'solidThermo' : use basicSolidThermo emissivity()
@ -73,11 +72,15 @@ private:
//- Underlying patch
const fvPatch& patch_;
protected:
// Protected data
//- How to get emissivity
const emissivityMethodType method_;
//- Emissivity
// Cached locally when is read from dictionary
// Cached locally when is read from dictionary (lookup mode)
scalarField emissivity_;
@ -85,11 +88,12 @@ public:
// Constructors
//- Construct from patch and emissivity name
//- Construct from patch, emissivity mode and emissivity
radiationCoupledBase
(
const fvPatch& patch,
const word& calculationMethod
const word& calculationMethod,
const scalarField& emissivity
);
//- Construct from patch and dictionary
@ -108,13 +112,7 @@ public:
return emissivityMethodTypeNames_[method_];
}
/*
//- Name of thermal conductivity field
const word& emissivityName() const
{
return emissivityName_;
}
*/
//- Calculate corresponding emissivity field
tmp<scalarField> emissivity() const;