64 Foam::radiation::laserDTRM::powerDistNames_
66 { powerDistributionMode::pdGaussian,
"Gaussian" },
67 { powerDistributionMode::pdManual,
"manual" },
68 { powerDistributionMode::pdUniform,
"uniform" },
69 { powerDistributionMode::pdGaussianPeak,
"GaussianPeak" },
75 Foam::scalar Foam::radiation::laserDTRM::calculateIp(scalar r, scalar theta)
77 const scalar t = mesh_.time().value();
78 const scalar power = laserPower_->value(t);
95 return power*powerDistribution_()(theta, r);
106 <<
"Unhandled type " << powerDistNames_[mode_]
135 return gradAlphaf/(
mag(gradAlphaf)+ deltaN);
139 void Foam::radiation::laserDTRM::initialiseReflection()
141 if (
found(
"reflectionModel"))
143 dictTable modelDicts(lookup(
"reflectionModel"));
147 const phasePairKey&
key = iter.key();
165 void 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_;
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)
231 point p1 = vector::zero;
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 330 radiationModel(typeName,
T),
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)),
368 mesh_.time().timeName(),
381 mesh_.time().timeName(),
394 mesh_.time().timeName(),
407 mesh_.time().timeName(),
416 initialiseReflection();
422 Foam::radiation::laserDTRM::laserDTRM
424 const dictionary&
dict,
428 radiationModel(typeName,
dict,
T),
429 mode_(powerDistNames_.
get(
"mode", *this)),
430 DTRMCloud_(mesh_,
Foam::zero{},
"DTRMCloud"),
432 ndTheta_(get<label>(
"nTheta")),
433 ndr_(get<label>(
"nr")),
434 maxTrackLength_(mesh_.bounds().mag()),
438 Function1<point>::New(
"focalLaserPosition", *
this, &mesh_)
442 Function1<vector>::New(
"laserDirection", *
this, &mesh_)
445 focalLaserRadius_(get<scalar>(
"focalLaserRadius")),
448 getOrDefault<scalar>(
"qualityBeamLaser", 0)
453 laserPower_(Function1<scalar>::New(
"laserPower", *
this, &mesh_)),
454 powerDistribution_(),
456 reflectionSwitch_(
false),
458 alphaCut_(getOrDefault<scalar>(
"alphaCut", 0.5)),
465 mesh_.time().timeName(),
478 mesh_.time().timeName(),
491 mesh_.time().timeName(),
504 mesh_.time().timeName(),
513 initialiseReflection();
538 tmp<volScalarField> treflectingCells
544 "reflectingCellsVol",
545 mesh_.time().timeName(),
557 tmp<volVectorField> tnHat
564 mesh_.time().timeName(),
579 a_ = absorptionEmission_->a();
580 e_ = absorptionEmission_->e();
581 E_ = absorptionEmission_->E();
583 const interpolationCell<scalar> aInterp(a_);
584 const interpolationCell<scalar> eInterp(e_);
585 const interpolationCell<scalar> EInterp(E_);
586 const interpolationCell<scalar> TInterp(T_);
588 labelField reflectingCells(mesh_.nCells(), -1);
590 UPtrList<reflectionModel> reflectionUPtr;
592 if (reflectionSwitch_)
594 reflectionUPtr.
resize(reflections_.size());
596 label reflectionModelId(0);
599 reflectionModel& model = iter1()();
601 reflectionUPtr.set(reflectionModelId, &model);
632 &&
mag(nHatPhase[cellI]) > 0.99
636 reflectingCells[cellI] = reflectionModelId;
637 reflectingCellsVol[cellI] = reflectionModelId;
638 if (
mag(nHat[cellI]) == 0.0)
640 nHat[cellI] += nHatPhase[cellI];
648 interpolationCellPoint<vector> nHatInterp(nHat);
650 DTRMParticle::trackingData td
663 Info<<
"Move particles..." 666 DTRMCloud_.move(DTRMCloud_, td, mesh_.time().deltaTValue());
669 Q_.primitiveFieldRef() /= mesh_.V();
673 Info<<
"Final number of particles..." 681 lines[i] =
p.position();
691 OBJstream
os(
type() +
":particlePath.obj");
693 for (label pointi = 0; pointi < lines.size(); pointi += 2)
695 os.writeLine(lines[pointi], lines[pointi+1]);
699 scalar totalQ =
gSum(Q_.primitiveFieldRef()*mesh_.V());
700 Info <<
"Total energy absorbed [W]: " << totalQ <<
endl;
702 if (mesh_.time().writeTime())
704 reflectingCellsVol.
write();
723 mesh_.time().timeName(),
738 return Q_.internalField();
Different types of constants.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
Field< label > labelField
Specialisation of Field<T> for label.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1)
bool read()
Read radiation properties dictionary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void resize(const label len)
Adjust allocated size of list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static autoPtr< reflectionModel > New(const dictionary &dict, const fvMesh &mesh)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Unit conversion functions.
constexpr char nl
The newline '\n' character (0x0a)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
DTRMParticle(const polyMesh &mesh, const vector &position, const vector &targetPosition, const scalar I, const label cellI, const scalar dA, const label transmissiveId)
Construct from components, with searching for tetFace and.
Calculate the matrix for the laplacian of the field.
const volScalarField & alpha2
Ignore writing from objectRegistry::writeObject()
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
const dimensionSet dimless
Dimensionless.
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
GeometricField< vector, fvPatchField, volMesh > volVectorField
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
virtual label nBands() const
Number of bands for this radiation model.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
dimensionedScalar pos(const dimensionedScalar &ds)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const dimensionSet dimVolume(pow3(dimLength))
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
Type gSum(const FieldField< Field, Type > &f)
dimensionedScalar exp(const dimensionedScalar &ds)
virtual bool read()=0
Read radiationProperties dictionary.
constexpr scalar twoPi(2 *M_PI)
const wordList area
Standard area field types (scalar, vector, tensor, etc)
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
dimensionedScalar cbrt(const dimensionedScalar &ds)
#define forAllIters(container, iter)
Iterate across all elements in the container object.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
constexpr scalar pi(M_PI)
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
errorManip< error > abort(error &err)
#define DebugInfo
Report an information message using Foam::Info.
const dimensionSet dimPower
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
void calculate()
Solve radiation equation(s)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar pow3(const dimensionedScalar &ds)
vector point
Point is a vector.
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).
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
dimensionedScalar pow4(const dimensionedScalar &ds)
Automatically write from objectRegistry::writeObject()
virtual tmp< DimensionedField< scalar, volMesh > > Ru() const
Source term component (constant)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
A class for managing temporary objects.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
#define addToRadiationRunTimeSelectionTables(model)
defineTemplateTypeNameAndDebugWithName(psiReactionsSensitivityAnalysisFunctionObject, "psiReactionsSensitivityAnalysis", 0)
Do not request registration (bool: false)
const volScalarField & p0
Calculate the finiteVolume matrix for implicit and explicit sources.
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
forAllConstIters(mixture.phases(), phase)
static constexpr const zero Zero
Global zero (0)
const volScalarField & alpha1