51 mixedFvPatchScalarField(
p, iF),
58 valueFraction() = 1.0;
71 mixedFvPatchScalarField(ptf,
p, iF, mapper),
73 qRadExt_(ptf.qRadExt_),
74 qRadExtDir_(ptf.qRadExtDir_)
86 mixedFvPatchScalarField(
p, iF),
87 TName_(
dict.getOrDefault<
word>(
"T",
"T")),
88 qRadExt_(
dict.getOrDefault<scalar>(
"qRadExt", 0)),
91 if (this->readMixedEntries(
dict))
100 valueFraction() = 1.0;
113 mixedFvPatchScalarField(ptf),
115 qRadExt_(ptf.qRadExt_),
116 qRadExtDir_(ptf.qRadExtDir_)
127 mixedFvPatchScalarField(ptf, iF),
129 qRadExt_(ptf.qRadExt_),
130 qRadExtDir_(ptf.qRadExtDir_)
150 const fvDOM& dom = db().lookupObject<
fvDOM>(
"radiationProperties");
156 const label patchi =
patch().index();
158 if (dom.nLambda() != 1)
161 <<
" a grey boundary condition is used with a non-grey " 169 radiativeIntensityRay& ray =
170 const_cast<radiativeIntensityRay&
>(dom.IRay(rayId));
174 ray.qr().boundaryFieldRef()[patchi] += Iw*nAve;
176 const boundaryRadiationProperties& boundaryRadiation =
179 const tmp<scalarField> temissivity
181 boundaryRadiation.emissivity(
patch().index(), 0,
nullptr, &Tp)
186 const tmp<scalarField> ttransmissivity
188 boundaryRadiation.transmissivity(
patch().index(), 0,
nullptr, &Tp)
191 const scalarField& transmissivity = ttransmissivity();
193 scalarField& qem = ray.qem().boundaryFieldRef()[patchi];
194 scalarField& qin = ray.qin().boundaryFieldRef()[patchi];
196 const vector& myRayId = dom.IRay(rayId).d();
201 for (label rayi=0; rayi < dom.nRay(); rayi++)
203 const vector& d = dom.IRay(rayi).d();
205 if ((-
n[facei] & d) < 0.0)
209 dom.IRay(rayi).ILambda(lambdaId).boundaryField()[patchi];
211 const vector& rayDave = dom.IRay(rayi).dAve();
212 Ir[facei] += IFace[facei]*(
n[facei] & rayDave);
217 if (dom.useSolarLoad())
222 dom.primaryFluxName_ +
"_0" 225 word qSecName = dom.relfectedFluxName_ +
"_0";
238 if (dom.useExternalBeam())
240 const vector sunDir = dom.solarCalc().direction();
241 const scalar directSolarRad = dom.solarCalc().directSolarRad();
245 scalar maxSunRay = -GREAT;
248 for (label rayI=0; rayI < dom.nRay(); rayI++)
250 const vector& iD = dom.IRay(rayI).d();
251 scalar dir = sunDir & iD;
259 if (rayId == SunRayId)
264 Iexternal[faceI] = directSolarRad/
mag(dom.IRay(rayId).dAve());
273 if (
mag(qRadExtDir_) > 0)
276 scalar maxRay = -GREAT;
279 for (label rayI = 0; rayI < dom.nRay(); ++rayI)
281 const vector& iD = dom.IRay(rayI).d();
282 const scalar dir = qRadExtDir_ & iD;
291 if (rayId == rayqoId)
295 Isource[faceI] += qRadExt_/
mag(dom.IRay(rayId).dAve());
304 scalar maxRay = -GREAT;
307 for (label rayI = 0; rayI < dom.nRay(); ++rayI)
309 const vector& iD = dom.IRay(rayI).d();
310 const scalar dir = -
n[faceI] & iD;
319 if (rayId == rayqoId)
321 Isource[faceI] += qRadExt_/
mag(dom.IRay(rayId).dAve());
329 if ((-
n[faceI] & myRayId) > 0.0)
332 refGrad()[faceI] = 0.0;
333 valueFraction()[faceI] = 1.0;
336 + Iexternal[faceI]*transmissivity[faceI]
338 Ir[faceI]*(scalar(1) - emissivity[faceI])
344 qem[faceI] = refValue()[faceI]*nAve[faceI];
349 valueFraction()[faceI] = 0.0;
350 refGrad()[faceI] = 0.0;
351 refValue()[faceI] = 0.0;
354 qin[faceI] = Iw[faceI]*nAve[faceI];
360 mixedFvPatchScalarField::updateCoeffs();
370 os.writeEntryIfDifferent<
word>(
"T",
"T", TName_);
371 os.writeEntryIfDifferent<scalar>(
"qRadExt",
Zero, qRadExt_);
372 os.writeEntryIfDifferent<
vector>(
"qRadExtDir",
Zero, qRadExtDir_);
Different types of constants.
virtual void write(Ostream &) const
Write.
makePatchTypeField(fvPatchScalarField, greyDiffusiveRadiationMixedFvPatchScalarField)
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int incrMsgType(int val=1) noexcept
Increment the message tag for standard messages.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
This boundary condition provides a grey-diffuse condition for radiation intensity, I, for use with the finite-volume discrete-ordinates model (fvDOM), in which the radiation temperature is retrieved from the temperature field boundary condition.
static const boundaryRadiationProperties & New(const fvMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
Unit conversion functions.
constexpr char nl
The newline '\n' character (0x0a)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
static int & msgType() noexcept
Message tag of standard messages.
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
void setRayIdLambdaId(const word &name, label &rayId, label &lambdaId) const
Set the rayId and lambdaId from by decomposing an intensity.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
constexpr scalar pi(M_PI)
greyDiffusiveRadiationMixedFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
virtual void operator=(const UList< scalar > &)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensionedScalar pow4(const dimensionedScalar &ds)
const std::string patch
OpenFOAM patch number as a std::string.
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual void write(Ostream &) const
Write.
Finite Volume Discrete Ordinates Method. Solves the RTE equation for n directions in a participating ...
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
static constexpr const zero Zero
Global zero (0)