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)
77 const scalar t =
mesh_.time().value();
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_]
116Foam::tmp<Foam::volVectorField> Foam::radiation::laserDTRM::nHatfv
135 return gradAlphaf/(
mag(gradAlphaf)+ deltaN);
139void Foam::radiation::laserDTRM::initialiseReflection()
141 if (
found(
"reflectionModel"))
143 dictTable modelDicts(
lookup(
"reflectionModel"));
147 const phasePairKey&
key = iter.key();
165void Foam::radiation::laserDTRM::initialise()
170 const scalar t = mesh_.time().value();
171 const vector lPosition = focalLaserPosition_->value(t);
175 <<
"Laser position : " << lPosition <<
nl
176 <<
"Laser direction : " << lDir <<
endl;
185 while (magr < VSMALL)
188 rArea = v - (v & lDir)*lDir;
194 scalar dr = focalLaserRadius_/ndr_;
195 scalar dTheta = mathematical::twoPi/ndTheta_;
197 nParticles_ = ndr_*ndTheta_;
203 I0_ = get<scalar>(
"I0");
204 sigma_ = get<scalar>(
"sigma");
209 sigma_ = get<scalar>(
"sigma");
214 powerDistribution_.reset
216 new interpolation2DTable<scalar>(*
this)
239 if (mesh_.nGeometricD() == 3)
241 for (label ri = 0; ri < ndr_; ri++)
243 scalar r1 = SMALL + dr*ri;
247 scalar rP = ((r1 + r2)/2);
250 vector localR = ((r1 + r2)/2)*rArea;
256 for (label thetai = 0; thetai < ndTheta_; thetai++)
258 scalar theta1 = theta0 + SMALL + dTheta*thetai;
260 scalar theta2 = theta1 + dTheta;
262 scalar thetaP = (theta1 + theta2)/2.0;
264 quaternion Q(lDir, thetaP);
267 vector initialPos = (Q.R() & localR);
270 vector finalPos = (Q.R() & finalR);
273 p0 = lPosition + initialPos;
276 p1 = lPosition + finalPos + (0.5*maxTrackLength_*lDir);
278 scalar Ip = calculateIp(rP, thetaP);
280 scalar dAi = (
sqr(r2) -
sqr(r1))*(theta2 - theta1)/2.0;
285 label cellI = mesh_.findCell(
p0);
291 new DTRMParticle(mesh_,
p0, p1, Ip, cellI, dAi, -1);
294 DTRMCloud_.addParticle(pPtr);
301 <<
"Cannot find owner cell for focalPoint at "
310 <<
"Current functionality limited to 3-D cases"
316 Info<<
"Seeding missed " << nMissed <<
" locations" <<
endl;
320 <<
"Total Power in the laser : " << power <<
nl
321 <<
"Total Area in the laser : " <<
area <<
nl
331 mode_(powerDistNames_.
get(
"mode", *this)),
332 DTRMCloud_(mesh_, Foam::zero{},
"DTRMCloud"),
334 ndTheta_(
get<label>(
"nTheta")),
335 ndr_(
get<label>(
"nr")),
336 maxTrackLength_(mesh_.bounds().
mag()),
340 Function1<
point>::
New(
"focalLaserPosition", *this, &mesh_)
345 Function1<
vector>::
New(
"laserDirection", *this, &mesh_)
348 focalLaserRadius_(
get<scalar>(
"focalLaserRadius")),
351 getOrDefault<scalar>(
"qualityBeamLaser", 0)
356 laserPower_(Function1<scalar>::
New(
"laserPower", *this, &mesh_)),
357 powerDistribution_(),
359 reflectionSwitch_(false),
361 alphaCut_(getOrDefault<scalar>(
"alphaCut", 0.5)),
410 IOobject::AUTO_WRITE,
417 initialiseReflection();
423Foam::radiation::laserDTRM::laserDTRM
430 mode_(powerDistNames_.
get(
"mode", *this)),
431 DTRMCloud_(mesh_,
Foam::
zero{},
"DTRMCloud"),
433 ndTheta_(
get<label>(
"nTheta")),
434 ndr_(
get<label>(
"nr")),
446 focalLaserRadius_(
get<scalar>(
"focalLaserRadius")),
449 getOrDefault<scalar>(
"qualityBeamLaser", 0)
454 laserPower_(
Function1<scalar>::
New(
"laserPower", *this, &mesh_)),
455 powerDistribution_(),
457 reflectionSwitch_(false),
459 alphaCut_(getOrDefault<scalar>(
"alphaCut", 0.5)),
515 initialiseReflection();
542 "reflectingCellsVol",
547 auto& reflectingCellsVol = treflectingCells.ref();
556 auto& nHat = tnHat.ref();
562 a_ = absorptionEmission_->a();
563 e_ = absorptionEmission_->e();
564 E_ = absorptionEmission_->E();
566 const interpolationCell<scalar> aInterp(a_);
567 const interpolationCell<scalar> eInterp(e_);
568 const interpolationCell<scalar> EInterp(E_);
569 const interpolationCell<scalar> TInterp(T_);
571 labelField reflectingCells(mesh_.nCells(), -1);
573 UPtrList<reflectionModel> reflectionUPtr;
575 if (reflectionSwitch_)
577 reflectionUPtr.
resize(reflections_.size());
579 label reflectionModelId(0);
584 reflectionUPtr.
set(reflectionModelId, &model);
615 &&
mag(nHatPhase[cellI]) > 0.99
619 reflectingCells[cellI] = reflectionModelId;
620 reflectingCellsVol[cellI] = reflectionModelId;
621 if (
mag(nHat[cellI]) == 0.0)
623 nHat[cellI] += nHatPhase[cellI];
631 interpolationCellPoint<vector> nHatInterp(nHat);
633 DTRMParticle::trackingData
td
646 Info<<
"Move particles..."
649 DTRMCloud_.move(DTRMCloud_,
td, mesh_.time().deltaTValue());
652 Q_.primitiveFieldRef() /= mesh_.V();
656 Info<<
"Final number of particles..."
662 for (
const DTRMParticle&
p : DTRMCloud_)
664 lines[i] =
p.position();
674 OBJstream
os(
type() +
"-particlePath.obj");
676 for (label pointi = 0; pointi < lines.size(); pointi += 2)
678 os.writeLine(lines[pointi], lines[pointi+1]);
682 scalar totalQ =
gWeightedSum(mesh_.V(), Q_.primitiveField());
683 Info <<
"Total energy absorbed [W]: " << totalQ <<
endl;
685 if (mesh_.time().writeTime())
687 reflectingCellsVol.write();
706 mesh_.time().timeName(),
718Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
721 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.
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...
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
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.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
void resize(const label newLen)
Change the size of the list. Any new entries are nullptr.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static void gatherInplaceOp(List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
Inplace collect data in processor order on master (in serial: a no-op).
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.
static autoPtr< reflectionModel > New(const dictionary &dict, const fvMesh &mesh)
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#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
#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.
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
#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)
List of values generated by applying the access operation to each list item.
Namespace for bounding specifications. At the moment, mostly for tables.
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)
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
Namespace for radiation modelling.
dimensionedScalar pos(const dimensionedScalar &ds)
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
const dimensionSet dimPower
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
dimensionedScalar exp(const dimensionedScalar &ds)
GeometricField< vector, fvPatchField, volMesh > volVectorField
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)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Type gWeightedSum(const UList< scalar > &weights, const UList< Type > &fld, const label comm)
The global weighted sum (integral) of a field, using the mag() of the weights.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
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)
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
dimensionedScalar pow4(const dimensionedScalar &ds)
errorManip< error > abort(error &err)
Field< label > labelField
Specialisation of Field<T> for label.
vector point
Point is a vector.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
dimensionedScalar cbrt(const dimensionedScalar &ds)
const dimensionSet dimVolume(pow3(dimLength))
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1, const label comm)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
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.
Unit conversion functions.