64Foam::radiation::laserDTRM::powerDistNames_
66 { powerDistributionMode::pdGaussian,
"Gaussian" },
67 { powerDistributionMode::pdManual,
"manual" },
68 { powerDistributionMode::pdUniform,
"uniform" },
69 { powerDistributionMode::pdGaussianPeak,
"GaussianPeak" },
75Foam::scalar Foam::radiation::laserDTRM::calculateIp(scalar r, scalar theta)
78 const scalar power = laserPower_->value(t);
88 scalar I0 = power/(mathematical::twoPi*
sqr(sigma_));
95 return power*powerDistribution_()(theta, r);
100 return power/(mathematical::pi*
sqr(focalLaserRadius_));
106 <<
"Unhandled type " << powerDistNames_[mode_]
135 return gradAlphaf/(
mag(gradAlphaf)+ deltaN);
139void Foam::radiation::laserDTRM::initialiseReflection()
141 if (
found(
"reflectionModel"))
143 dictTable modelDicts(
lookup(
"reflectionModel"));
160 if (reflections_.size())
162 reflectionSwitch_ =
true;
170void Foam::radiation::laserDTRM::initialise()
175 const scalar t = mesh_.time().value();
176 const vector lPosition = focalLaserPosition_->value(t);
180 <<
"Laser position : " << lPosition <<
nl
181 <<
"Laser direction : " << lDir <<
endl;
190 while (magr < VSMALL)
193 rArea = v - (v & lDir)*lDir;
199 scalar dr = focalLaserRadius_/ndr_;
200 scalar dTheta = mathematical::twoPi/ndTheta_;
202 nParticles_ = ndr_*ndTheta_;
208 I0_ = get<scalar>(
"I0");
209 sigma_ = get<scalar>(
"sigma");
214 sigma_ = get<scalar>(
"sigma");
219 powerDistribution_.reset
244 if (mesh_.nGeometricD() == 3)
246 for (label ri = 0; ri < ndr_; ri++)
248 scalar r1 = SMALL + dr*ri;
252 scalar rP = ((r1 + r2)/2);
255 vector localR = ((r1 + r2)/2)*rArea;
261 for (label thetai = 0; thetai < ndTheta_; thetai++)
263 scalar theta1 = theta0 + SMALL + dTheta*thetai;
265 scalar theta2 = theta1 + dTheta;
267 scalar thetaP = (theta1 + theta2)/2.0;
272 vector initialPos = (Q.R() & localR);
275 vector finalPos = (Q.R() & finalR);
278 p0 = lPosition + initialPos;
281 p1 = lPosition + finalPos + (0.5*maxTrackLength_*lDir);
283 scalar Ip = calculateIp(rP, thetaP);
285 scalar dAi = (
sqr(r2) -
sqr(r1))*(theta2 - theta1)/2.0;
290 label cellI = mesh_.findCell(
p0);
299 DTRMCloud_.addParticle(pPtr);
307 <<
"Cannot find owner cell for focalPoint at "
317 <<
"Current functionality limited to 3-D cases"
323 Info<<
"Seeding missed " << nMissed <<
" locations" <<
endl;
327 <<
"Total Power in the laser : " << power <<
nl
328 <<
"Total Area in the laser : " <<
area <<
nl
338 mode_(powerDistNames_.
get(
"mode", *this)),
341 ndTheta_(
get<label>(
"nTheta")),
342 ndr_(
get<label>(
"nr")),
343 maxTrackLength_(mesh_.bounds().
mag()),
355 focalLaserRadius_(
get<scalar>(
"focalLaserRadius")),
358 getOrDefault<scalar>(
"qualityBeamLaser", 0)
363 laserPower_(
Function1<scalar>::
New(
"laserPower", *this, &mesh_)),
364 powerDistribution_(),
366 reflectionSwitch_(false),
368 alphaCut_(getOrDefault<scalar>(
"alphaCut", 0.5)),
423 initialiseReflection();
436 mode_(powerDistNames_.
get(
"mode", *this)),
439 ndTheta_(
get<label>(
"nTheta")),
440 ndr_(
get<label>(
"nr")),
441 maxTrackLength_(mesh_.bounds().
mag()),
452 focalLaserRadius_(
get<scalar>(
"focalLaserRadius")),
455 getOrDefault<scalar>(
"qualityBeamLaser", 0)
460 laserPower_(
Function1<scalar>::
New(
"laserPower", *this, &mesh_)),
461 powerDistribution_(),
463 reflectionSwitch_(false),
465 alphaCut_(getOrDefault<scalar>(
"alphaCut", 0.5)),
520 initialiseReflection();
551 "reflectingCellsVol",
552 mesh_.time().timeName(),
571 mesh_.time().timeName(),
586 a_ = absorptionEmission_->a();
587 e_ = absorptionEmission_->e();
588 E_ = absorptionEmission_->E();
595 labelField reflectingCells(mesh_.nCells(), -1);
599 if (reflectionSwitch_)
601 reflectionUPtr.
resize(reflections_.size());
603 label reflectionModelId(0);
608 reflectionUPtr.
set(reflectionModelId, &model);
639 &&
mag(nHatPhase[cellI]) > 0.99
643 reflectingCells[cellI] = reflectionModelId;
644 reflectingCellsVol[cellI] = reflectionModelId;
645 if (
mag(nHat[cellI]) == 0.0)
647 nHat[cellI] += nHatPhase[cellI];
670 Info<<
"Move particles..."
673 DTRMCloud_.move(DTRMCloud_, td, mesh_.time().deltaTValue());
676 Q_.primitiveFieldRef() /= mesh_.V();
680 Info<<
"Final number of particles..."
688 lines[i] =
p.position();
700 for (label pointi = 0; pointi < lines.size(); pointi += 2)
706 scalar totalQ =
gSum(Q_.primitiveFieldRef()*mesh_.V());
707 Info <<
"Total energy absorbed [W]: " << totalQ <<
endl;
709 if (mesh_.time().outputTime())
711 reflectingCellsVol.
write();
730 mesh_.time().timeName(),
745 return Q_.internalField();
Macros for easy insertion into run-time selection tables.
const volScalarField & alpha1
const volScalarField & alpha2
Base cloud calls templated on particle type.
Class used to pass tracking data to the trackToFace function.
Discrete Transfer Radiation Model (DTRM) particle.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
Template class for intrusive linked lists.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
OFstream that keeps track of vertices.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
const T * set(const label i) const
void resize(const label newLen)
Change the size of the list.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const Type & value() const
Return const reference to value.
const Time & time() const
Return the top-level database.
static void gatherInplaceOp(List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
Inplace collect data in processor order on master (in serial: a no-op).
2D table interpolation. The data must be in ascending order in both dimensions x and y.
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
Uses the cell value for any location within the cell.
An ordered or unorder pair of phase names. Typically specified as follows.
Quaternion class used to perform rotations in 3D space.
Discrete Tray Radiation Method for collimated radiation flux. At the moment the particles are injecte...
virtual label nBands() const
Number of bands for this radiation model.
virtual tmp< DimensionedField< scalar, volMesh > > Ru() const
Source term component (constant)
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
bool read()
Read radiation properties dictionary.
void calculate()
Solve radiation equation(s)
Lookup type of boundary radiation properties.
Top level model for radiation modelling.
const fvMesh & mesh_
Reference to the mesh database.
virtual bool read()=0
Read radiationProperties dictionary.
Base class for radiation scattering.
virtual bool write(const bool valid=true) const
Write using setting from DB.
splitCell * master() const
A class for managing temporary objects.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define defineTemplateTypeNameAndDebugWithName(Type, Name, DebugSwitch)
Define the typeName and debug information, lookup as Name.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const volScalarField & p0
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
Calculate the matrix for the laplacian of the field.
Calculate the finiteVolume matrix for implicit and explicit sources.
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
Different types of constants.
const wordList area
Standard area field types (scalar, vector, tensor, etc)
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedScalar pos(const dimensionedScalar &ds)
const dimensionSet dimPower
Type gSum(const FieldField< Field, Type > &f)
dimensionedScalar exp(const dimensionedScalar &ds)
const dimensionSet dimless
Dimensionless.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
line< point, const point & > linePointRef
A line using referred points.
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
dimensionedScalar pow4(const dimensionedScalar &ds)
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
dimensionedScalar cbrt(const dimensionedScalar &ds)
const dimensionSet dimVolume(pow3(dimLength))
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
constexpr char nl
The newline '\n' character (0x0a)
#define addToRadiationRunTimeSelectionTables(model)
#define forAll(list, i)
Loop across all elements in list.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
A non-counting (dummy) refCount.
Unit conversion functions.