/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018-2019 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 .
\*---------------------------------------------------------------------------*/
#include "faceReflecting.H"
#include "boundaryRadiationProperties.H"
#include "cyclicAMIPolyPatch.H"
#include "volFields.H"
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(faceReflecting, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::faceReflecting::initialise(const dictionary& coeffs)
{
forAll(qreflective_, bandI)
{
qreflective_.set
(
bandI,
new volScalarField
(
IOobject
(
"qreflective_" + Foam::name(bandI) ,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimMass/pow3(dimTime), Zero)
)
);
}
label rayI = 0;
if (mesh_.nSolutionD() == 3)
{
nRay_ = 4*nPhi_*nTheta_;
refDiscAngles_.resize(nRay_);
const scalar deltaPhi = pi/(2.0*nPhi_);
const scalar deltaTheta = pi/nTheta_;
for (label n = 1; n <= nTheta_; n++)
{
for (label m = 1; m <= 4*nPhi_; m++)
{
const scalar thetai = (2*n - 1)*deltaTheta/2.0;
const scalar phii = (2*m - 1)*deltaPhi/2.0;
scalar sinTheta = Foam::sin(thetai);
scalar cosTheta = Foam::cos(thetai);
scalar sinPhi = Foam::sin(phii);
scalar cosPhi = Foam::cos(phii);
refDiscAngles_[rayI++] =
vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta);
}
}
}
else if (mesh_.nSolutionD() == 2)
{
nRay_ = 4*nPhi_;
refDiscAngles_.resize(nRay_);
const scalar thetai = piByTwo;
//const scalar deltaTheta = pi;
const scalar deltaPhi = pi/(2.0*nPhi_);
for (label m = 1; m <= 4*nPhi_; m++)
{
const scalar phii = (2*m - 1)*deltaPhi/2.0;
scalar sinTheta = Foam::sin(thetai);
scalar cosTheta = Foam::cos(thetai);
scalar sinPhi = Foam::sin(phii);
scalar cosPhi = Foam::cos(phii);
refDiscAngles_[rayI++] =
vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta);
}
}
else
{
FatalErrorInFunction
<< "The reflected rays are available in 2D or 3D "
<< abort(FatalError);
}
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
const radiation::boundaryRadiationProperties& boundaryRadiation =
radiation::boundaryRadiationProperties::New(mesh_);
// global face index
globalIndex globalNumbering(mesh_.nFaces());
// Collect faces with t = 0, r = 0 and a > 0 to shoot rays
// and patches to construct the triSurface
DynamicList dynCf;
DynamicList dynNf;
DynamicList