44 scalar specularRadiationMixedFvPatchScalarField::azimuthAngle
53 scalar specularRadiationMixedFvPatchScalarField::polarAngle
62 tmp<scalarField> specularRadiationMixedFvPatchScalarField::interpolateI
65 const label closestRayi
74 const label nPolar = dom.nTheta();
75 const label nAzimuth = 4*dom.nPhi();
81 const label polari = std::floor(closestRayi/nAzimuth) + 1;
82 label eastRayi = closestRayi + 1;
83 if (eastRayi == nAzimuth*polari)
88 label westRayi = closestRayi - 1;
89 if (westRayi < nAzimuth*(polari - 1))
96 label azimuthRayi = -1;
100 if (
mag(dSpe - dEast) <
mag(dSpe - dWest))
102 azimuthRayi = eastRayi;
107 azimuthRayi = westRayi;
114 label northRayi = closestRayi - nAzimuth;
121 label southRayi = closestRayi + nAzimuth;
122 if (southRayi > nPolar*nAzimuth-1)
130 label polarRayi = -1;
131 if (northRayi != -1 && southRayi != -1)
136 if (
mag(dSpe - dNorth) <
mag(dSpe - dSouth))
138 polarRayi = northRayi;
142 polarRayi = southRayi;
145 else if (northRayi != -1)
147 polarRayi = northRayi;
149 else if (southRayi != -1)
151 polarRayi = southRayi;
156 label cornerRayi = -1;
161 cornerRayi = polarRayi + 1;
163 if (!(cornerRayi % nAzimuth))
165 cornerRayi -= nAzimuth;
170 cornerRayi = polarRayi - 1;
171 if (!(polarRayi % nAzimuth))
173 cornerRayi += nAzimuth;
181 const label patchi = this->
patch().index();
183 auto& Ic = tIc.ref();
192 const scalar
phic = azimuthAngle(dSpe);
193 const scalar
phi1 = azimuthAngle(d1);
194 const scalar
phi2 = azimuthAngle(d2);
197 dom.IRayLambda(closestRayi, lambdaID_).boundaryField()[patchi];
199 dom.IRayLambda(azimuthRayi, lambdaID_).boundaryField()[patchi];
211 const scalar
phic = azimuthAngle(dSpe);
212 const scalar
phi1 = azimuthAngle(d1);
213 const scalar
phi2 = azimuthAngle(d2);
214 const scalar phi3 = azimuthAngle(d3);
215 const scalar phi4 = azimuthAngle(d4);
217 const scalar thetac = polarAngle(dSpe);
218 const scalar theta1 = polarAngle(d1);
219 const scalar theta3 = polarAngle(d3);
222 dom.IRayLambda(closestRayi, lambdaID_).boundaryField()[patchi];
224 dom.IRayLambda(azimuthRayi, lambdaID_).boundaryField()[patchi];
226 dom.IRayLambda(polarRayi, lambdaID_).boundaryField()[patchi];
228 dom.IRayLambda(cornerRayi, lambdaID_).boundaryField()[patchi];
233 Ic =
lerp(Ia, Ib, (thetac - theta1)/(theta3 - theta1));
240 label specularRadiationMixedFvPatchScalarField::calcComplementaryRayID
248 dAve[rayi] =
normalised(dom.IRay(rayi).dAve());
253 if ((dAve[rayID_] & n_) > 0)
262 normalised(dAve[rayID_] - 2*(dAve[rayID_] & n_)*n_)
267 label complementaryRayID = -1;
268 scalar dotProductThisRay = -GREAT;
271 const scalar dotProductOtherRay = dAve[i] & dSpe;
273 if (dotProductThisRay < dotProductOtherRay)
275 complementaryRayID = i;
276 dotProductThisRay = dotProductOtherRay;
280 return complementaryRayID;
293 mixedFvPatchScalarField(
p, iF),
299 this->refValue() =
Zero;
301 this->valueFraction() =
Zero;
314 mixedFvPatchScalarField(ptf,
p, iF, mapper),
317 lambdaID_(ptf.lambdaID_),
318 interpolate_(ptf.interpolate_)
330 mixedFvPatchScalarField(
p, iF),
334 interpolate_(
dict.getOrDefault(
"interpolate", false))
336 this->refValue() =
Zero;
337 this->refGrad() =
Zero;
338 this->valueFraction() =
Zero;
340 if (!this->readValueEntry(
dict))
346 if (isA<wedgePolyPatch>(
p.patch()))
348 const auto& wp = refCast<const wedgePolyPatch>(
p.patch());
351 else if (isA<symmetryPlanePolyPatch>(
p.patch()))
353 const auto& sp = refCast<const symmetryPlanePolyPatch>(
p.patch());
359 <<
" specularRadiation boundary condition is limited to " 360 <<
"wedge or symmetry-plane geometries." <<
nl 373 mixedFvPatchScalarField(ptf, iF),
376 lambdaID_(ptf.lambdaID_),
377 interpolate_(ptf.interpolate_)
387 mixedFvPatchScalarField(ptf),
390 lambdaID_(ptf.lambdaID_),
391 interpolate_(ptf.interpolate_)
404 const fvDOM& dom = db().lookupObject<
fvDOM>(
"radiationProperties");
407 if (rayID_ == -1 && lambdaID_ == -1)
414 const label compID = calcComplementaryRayID(dom);
420 this->valueFraction() = 0;
425 this->valueFraction() = 1;
440 this->refValue() = interpolateI(dom, compID);
444 mixedFvPatchScalarField::updateCoeffs();
451 os.writeEntryIfDifferent<
bool>(
"interpolate",
false, interpolate_);
452 this->writeValueEntry(
os);
461 specularRadiationMixedFvPatchScalarField
dimensionedScalar sign(const dimensionedScalar &ds)
makePatchTypeField(fvPatchScalarField, greyDiffusiveRadiationMixedFvPatchScalarField)
dimensionedScalar acos(const dimensionedScalar &ds)
const volScalarField & IRayLambda(const label rayI, const label lambdaI) const
Ray intensity for rayI and lambda bandwidth.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const Internal & internalField() const noexcept
Return a const-reference to the dimensioned internal field.
constexpr char nl
The newline '\n' character (0x0a)
dimensionedScalar sqrt(const dimensionedScalar &ds)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
List< vector > vectorList
List of vector.
surfaceScalarField & phi1
Macros for easy insertion into run-time selection tables.
This boundary condition provides a specular radiation condition for axisymmetric and symmetry-plane f...
#define forAll(list, i)
Loop across all elements in list.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
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.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
fvPatchField< scalar > fvPatchScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
surfaceScalarField & phi2
OBJstream os(runTime.globalPath()/outputName)
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
surfaceScalarField phic(mixture.cAlpha() *mag(alphaPhic/mesh.magSf()))
virtual void operator=(const UList< scalar > &)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const std::string patch
OpenFOAM patch number as a std::string.
specularRadiationMixedFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void write(Ostream &) const
Write.
Finite Volume Discrete Ordinates Method. Solves the RTE equation for n directions in a participating ...
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
static constexpr const zero Zero
Global zero (0)