Go to the documentation of this file.
63 Foam::radiation::laserDTRM::powerDistNames_
65 { powerDistributionMode::pdGaussian,
"Gaussian" },
66 { powerDistributionMode::pdManual,
"manual" },
67 { powerDistributionMode::pdUniform,
"uniform" },
68 { powerDistributionMode::pdGaussianPeak,
"GaussianPeak" },
74 Foam::scalar Foam::radiation::laserDTRM::calculateIp(scalar r, scalar theta)
76 const scalar t = mesh_.time().value();
77 const scalar power = laserPower_->value(t);
94 return power*powerDistribution_()(theta, r);
105 <<
"Unhandled type " << powerDistNames_[mode_]
134 return gradAlphaf/(
mag(gradAlphaf)+ deltaN);
138 void Foam::radiation::laserDTRM::initialiseReflection()
140 if (
found(
"reflectionModel"))
142 dictTable modelDicts(
lookup(
"reflectionModel"));
146 const phasePairKey& key = iter.key();
159 if (reflections_.size())
161 reflectionSwitch_ =
true;
164 reflectionSwitch_ =
returnReduce(reflectionSwitch_, orOp<bool>());
169 void Foam::radiation::laserDTRM::initialise()
174 const scalar t = mesh_.time().value();
175 const vector lPosition = focalLaserPosition_->value(t);
179 <<
"Laser position : " << lPosition <<
nl
180 <<
"Laser direction : " << lDir <<
endl;
189 while (magr < VSMALL)
192 rArea = v - (v & lDir)*lDir;
198 scalar dr = focalLaserRadius_/ndr_;
201 nParticles_ = ndr_*ndTheta_;
207 I0_ = get<scalar>(
"I0");
208 sigma_ = get<scalar>(
"sigma");
213 sigma_ = get<scalar>(
"sigma");
218 powerDistribution_.reset
220 new interpolation2DTable<scalar>(*
this)
243 if (mesh_.nGeometricD() == 3)
245 for (label ri = 0; ri < ndr_; ri++)
247 scalar r1 = SMALL + dr*ri;
251 scalar rP = ((r1 + r2)/2);
254 vector localR = ((r1 + r2)/2)*rArea;
260 for (label thetai = 0; thetai < ndTheta_; thetai++)
262 scalar theta1 = theta0 + SMALL + dTheta*thetai;
264 scalar theta2 = theta1 + dTheta;
266 scalar thetaP = (theta1 + theta2)/2.0;
268 quaternion Q(lDir, thetaP);
271 vector initialPos = (Q.R() & localR);
274 vector finalPos = (Q.R() & finalR);
277 p0 = lPosition + initialPos;
280 p1 = lPosition + finalPos + (0.5*maxTrackLength_*lDir);
282 scalar Ip = calculateIp(rP, thetaP);
284 scalar dAi = (
sqr(r2) -
sqr(r1))*(theta2 - theta1)/2.0;
289 label cellI = mesh_.findCell(
p0);
295 new DTRMParticle(mesh_,
p0, p1, Ip, cellI, dAi, -1);
298 DTRMCloud_.addParticle(pPtr);
306 <<
"Cannot find owner cell for focalPoint at "
316 <<
"Current functionality limited to 3-D cases"
322 Info<<
"Seeding missed " << nMissed <<
" locations" <<
endl;
326 <<
"Total Power in the laser : " << power <<
nl
327 <<
"Total Area in the laser : " <<
area <<
nl
336 radiationModel(typeName,
T),
337 mode_(powerDistNames_.get(
"mode", *this)),
338 DTRMCloud_(mesh_,
"DTRMCloud",
IDLList<DTRMParticle>()),
340 ndTheta_(get<label>(
"nTheta")),
341 ndr_(get<label>(
"nr")),
342 maxTrackLength_(mesh_.bounds().
mag()),
346 Function1<
point>::
New(
"focalLaserPosition", *this)
351 Function1<
vector>::
New(
"laserDirection", *this)
354 focalLaserRadius_(get<scalar>(
"focalLaserRadius")),
357 getOrDefault<scalar>(
"qualityBeamLaser", 0)
362 laserPower_(Function1<scalar>::
New(
"laserPower", *this)),
363 powerDistribution_(),
365 reflectionSwitch_(false),
367 alphaCut_(getOrDefault<scalar>(
"alphaCut", 0.5)),
422 initialiseReflection();
428 Foam::radiation::laserDTRM::laserDTRM
430 const dictionary&
dict,
434 radiationModel(typeName,
dict,
T),
435 mode_(powerDistNames_.get(
"mode", *this)),
436 DTRMCloud_(mesh_,
"DTRMCloud",
IDLList<DTRMParticle>()),
438 ndTheta_(get<label>(
"nTheta")),
439 ndr_(get<label>(
"nr")),
440 maxTrackLength_(mesh_.bounds().
mag()),
444 Function1<
point>::
New(
"focalLaserPosition", *this)
448 Function1<
vector>::
New(
"laserDirection", *this)
451 focalLaserRadius_(get<scalar>(
"focalLaserRadius")),
454 getOrDefault<scalar>(
"qualityBeamLaser", 0)
459 laserPower_(Function1<scalar>::
New(
"laserPower", *this)),
460 powerDistribution_(),
462 reflectionSwitch_(false),
464 alphaCut_(getOrDefault<scalar>(
"alphaCut", 0.5)),
519 initialiseReflection();
544 tmp<volScalarField> treflectingCells
550 "reflectingCellsVol",
551 mesh_.time().timeName(),
563 tmp<volVectorField> tnHat
570 mesh_.time().timeName(),
585 a_ = absorptionEmission_->a();
586 e_ = absorptionEmission_->e();
587 E_ = absorptionEmission_->E();
589 const interpolationCell<scalar> aInterp(a_);
590 const interpolationCell<scalar> eInterp(e_);
591 const interpolationCell<scalar> EInterp(E_);
592 const interpolationCell<scalar> TInterp(T_);
594 labelField reflectingCells(mesh_.nCells(), -1);
596 autoPtr<interpolationCellPoint<vector>> nHatIntrPtr;
598 UPtrList<reflectionModel> reflectionUPtr;
600 if (reflectionSwitch_)
602 reflectionUPtr.resize(reflections_.size());
604 label reflectionModelId(0);
607 reflectionModel& model = iter1()();
609 reflectionUPtr.set(reflectionModelId, &model);
640 &&
mag(nHatPhase[cellI]) > 0.99
644 reflectingCells[cellI] = reflectionModelId;
645 reflectingCellsVol[cellI] = reflectionModelId;
646 if (
mag(nHat[cellI]) == 0.0)
648 nHat[cellI] += nHatPhase[cellI];
658 new interpolationCellPoint<vector>(nHat)
661 DTRMParticle::trackingData td
674 Info<<
"Move particles..."
677 DTRMCloud_.move(DTRMCloud_, td, mesh_.time().deltaTValue());
680 Q_.primitiveFieldRef() /= mesh_.V();
684 Info<<
"Final number of particles..."
687 OFstream osRef(
type() +
":particlePath.obj");
693 DynamicList<point> positionsMyProc;
694 DynamicList<point> p0MyProc;
696 for (
const DTRMParticle&
p : DTRMCloud_)
698 positionsMyProc.append(
p.position());
699 p0MyProc.append(
p.p0());
720 osRef <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
726 scalar totalQ =
gSum(Q_.primitiveFieldRef()*mesh_.V());
727 Info <<
"Total energy absorbed [W]: " << totalQ <<
endl;
729 if (mesh_.time().outputTime())
731 reflectingCellsVol.
write();
750 mesh_.time().timeName(),
765 return Q_.internalField();
int debug
Static debugging option.
vectorField pointField
pointField is a vectorField.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
const volScalarField & alpha2
Different types of constants.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
ILList< DLListBase, T > IDLList
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Unit conversion functions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Type gSum(const FieldField< Field, Type > &f)
const volScalarField & alpha1
dimensionedScalar exp(const dimensionedScalar &ds)
#define forAll(list, i)
Loop across all elements in list.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
dimensionedScalar pow4(const dimensionedScalar &ds)
virtual bool read()=0
Read radiationProperties dictionary.
Field< label > labelField
Specialisation of Field<T> for label.
dimensionedScalar pow3(const dimensionedScalar &ds)
messageStream Info
Information stream (uses stdout - output is on the master only)
const cellModel * lookup(const word &modelName)
Deprecated(2017-11) equivalent to cellModel::ptr static method.
Calculate the matrix for the laplacian of the field.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
void calculate()
Solve radiation equation(s)
virtual tmp< DimensionedField< scalar, volMesh > > Ru() const
Source term component (constant)
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
#define forAllIters(container, iter)
Iterate across all elements in the container object.
constexpr scalar twoPi(2 *M_PI)
const dimensionSet dimPower
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
Macros for easy insertion into run-time selection tables.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
errorManip< error > abort(error &err)
Vector< scalar > vector
A scalar version of the templated Vector.
Calculate the matrix for implicit and explicit sources.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
VectorSpace< Form, Cmpt, Ncmpts > normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
GeometricField< vector, fvPatchField, volMesh > volVectorField
virtual label nBands() const
Number of bands for this radiation model.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
#define DebugInfo
Report an information message using Foam::Info.
constexpr scalar pi(M_PI)
forAllConstIters(mixture.phases(), phase)
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const dimensionedScalar e
Elementary charge.
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
bool read()
Read radiation properties dictionary.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
const wordList area
Standard area field types (scalar, vector, tensor, etc)
static const Vector< scalar > zero
static autoPtr< reflectionModel > New(const dictionary &dict, const fvMesh &mesh)
#define addToRadiationRunTimeSelectionTables(model)
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
const volScalarField & p0
vector point
Point is a vector.
dimensionedScalar cbrt(const dimensionedScalar &ds)
const dimensionSet dimVolume(pow3(dimLength))
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
defineTemplateTypeNameAndDebugWithName(psiReactionsSensitivityAnalysisFunctionObject, "psiReactionsSensitivityAnalysis", 0)
dimensionedScalar pos(const dimensionedScalar &ds)