1 #ifndef ABLATELIBRARY_RADIATION_HPP
2 #define ABLATELIBRARY_RADIATION_HPP
4 #include <petsc/private/dmimpl.h>
6 #include <petscdmswarm.h>
11 #include "eos/radiationProperties/radiationProperties.hpp"
12 #include "finiteVolume/compressibleFlowFields.hpp"
13 #include "finiteVolume/finiteVolumeSolver.hpp"
14 #include "io/interval/interval.hpp"
15 #include "monitors/logs/log.hpp"
16 #include "solver/cellSolver.hpp"
17 #include "solver/timeStepper.hpp"
18 #include "utilities/constants.hpp"
19 #include "utilities/loggable.hpp"
20 #include "utilities/mpiUtilities.hpp"
21 #include "utilities/petscUtilities.hpp"
23 namespace ablate::radiation {
36 Radiation(
const std::string&
solverId,
const std::shared_ptr<domain::Region>&
region,
const PetscInt raynumber, std::shared_ptr<eos::radiationProperties::RadiationModel> radiationModelIn,
37 std::shared_ptr<ablate::monitors::logs::Log> = {});
84 E_lambda /= refractiveIndex * refractiveIndex * wavelength * wavelength * wavelength * wavelength * wavelength;
113 inline void GetIntensity(PetscReal* intensity, PetscInt index,
const domain::Range& cellRange, PetscReal temperature, PetscReal kappa) {
121 netIntensity *= kappa;
136 inline std::string GetId() {
return solverId; };
147 PetscInt nglobalpoints);
150 virtual void IdentifyNewRaysOnRank(domain::SubDomain& subDomain, DM radReturn, PetscInt nlocalpoints);
155 virtual PetscReal
SurfaceComponent(
const PetscReal normal[], PetscInt iCell, PetscInt nphi, PetscInt ntheta);
166 Vec cellGeomVec =
nullptr;
176 PetscReal pathLength;
217 raySegment.
cell = index;
218 raySegment.pathLength = -1;
225 PetscReal minCellRadius{};
261 const std::shared_ptr<domain::Region>
region;
271 const std::shared_ptr<ablate::monitors::logs::Log> log =
nullptr;
272 static inline constexpr
char IdentifierField[] =
"identifier";
273 static inline constexpr
char VirtualCoordField[] =
"virtual coord";
288 std::ostream& operator<<(std::ostream& os,
const Radiation::Identifier&
id);
Definition: subDomain.hpp:19
Definition: radiation.hpp:25
PetscInt nPhi
The number of angles to solve with, given by user input (x2)
Definition: radiation.hpp:224
Radiation(const std::string &solverId, const std::shared_ptr< domain::Region > ®ion, const PetscInt raynumber, std::shared_ptr< eos::radiationProperties::RadiationModel > radiationModelIn, std::shared_ptr< ablate::monitors::logs::Log >={})
Definition: radiation.cpp:3
PetscInt dim
Class inputs and Variables.
Definition: radiation.hpp:222
std::vector< Carrier > raySegmentsCalculations
the calculation over each of the remoteRays. indexed over remote ray
Definition: radiation.hpp:231
virtual void ParticleStep(ablate::domain::SubDomain &subDomain, DM faceDM, const PetscScalar *faceGeomArray, DM radReturn, PetscInt nlocalpoints, PetscInt nglobalpoints)
Routine to move the particle one step.
Definition: radiation.cpp:453
MPI_Datatype carrierMpiType
create a data type to simplify moving the carrier
Definition: radiation.hpp:169
std::vector< PetscScalar > evaluatedGains
size up the evaluated gains, this index is based upon order of the requested cells
Definition: radiation.hpp:252
PetscReal FaceIntersect(PetscInt ip, Virtualcoord *virtualcoord, PetscFVFaceGeom *face) const
Class Methods.
Definition: radiation.cpp:373
virtual void IdentifyNewRaysOnRank(domain::SubDomain &subDomain, DM radReturn, PetscInt nlocalpoints)
If this local rank has never seen this search particle before, then it needs to add a new ray segment...
Definition: radiation.cpp:402
std::vector< PetscReal > gainsFactor
the factor for each origin ray
Definition: radiation.hpp:249
PetscInt numberOriginRays
store the number of originating rays
Definition: radiation.hpp:234
void UpdateCoordinates(PetscInt ipart, Virtualcoord *virtualcoord, PetscReal *coord, PetscReal adv) const
Definition: radiation.cpp:356
void EvaluateGains(Vec solVec, ablate::domain::Field temperatureField, Vec auxVec)
Definition: radiation.cpp:536
PetscInt nTheta
The number of angles to solve with, given by user input.
Definition: radiation.hpp:223
static PetscReal GetBlackBodyTotalIntensity(PetscReal temperature, const PetscReal refractiveIndex)
Definition: radiation.hpp:70
static PetscReal GetBlackBodyWavelengthIntensity(const PetscReal temperature, const PetscReal wavelength, const PetscReal refractiveIndex)
Definition: radiation.hpp:82
Vec faceGeomVec
Vector used to describe the entire face geom of the dm. This is constant and does not depend upon reg...
Definition: radiation.hpp:165
std::vector< unsigned short int > raySegmentsPerOriginRay
store the number of ray segments for each originating on this rank. This may be zero
Definition: radiation.hpp:243
PetscInt numberOriginCells
store the number of originating rays cells
Definition: radiation.hpp:237
eos::ThermodynamicTemperatureFunction absorptivityFunction
hold a pointer to the absorptivity function
Definition: radiation.hpp:267
const std::shared_ptr< eos::radiationProperties::RadiationModel > radiationModel
model used to provided the absorptivity function
Definition: radiation.hpp:264
void DeleteOutOfBounds(ablate::domain::SubDomain &subDomain)
Definition: radiation.cpp:656
void GetIntensity(PetscReal *intensity, PetscInt index, const domain::Range &cellRange, PetscReal temperature, PetscReal kappa)
Definition: radiation.hpp:113
virtual void Initialize(const ablate::domain::Range &cellRange, ablate::domain::SubDomain &subDomain)
Definition: radiation.cpp:156
std::vector< std::vector< CellSegment > > raySegments
store the local rays identified on this rank. This includes rays that do and do not originate on this...
Definition: radiation.hpp:228
std::string solverId
the name of this solver
Definition: radiation.hpp:258
std::shared_ptr< eos::radiationProperties::RadiationModel > GetRadiationModel()
provide access to the model used to provided the absorptivity function
Definition: radiation.hpp:158
static std::string GetClassType()
Definition: radiation.hpp:95
DM radSearch
DM which the search particles occupy. This representations the physical particle in space.
Definition: radiation.hpp:162
virtual void Setup(const ablate::domain::Range &cellRange, ablate::domain::SubDomain &subDomain)
Definition: radiation.cpp:15
virtual PetscReal SurfaceComponent(const PetscReal normal[], PetscInt iCell, PetscInt nphi, PetscInt ntheta)
Definition: radiation.cpp:400
const std::shared_ptr< domain::Region > region
the region for which this solver applies
Definition: radiation.hpp:261
PetscInt raysPerCell
the number of rays per cell
Definition: radiation.hpp:240
PetscSF remoteAccess
Store the petscSF that is used for pulling remote ray calculation.
Definition: radiation.hpp:255
std::shared_ptr< domain::Region > GetRegion() const
Definition: radiation.hpp:280
std::vector< Carrier > raySegmentSummary
a vector of raySegment information for every local/remote ray segment ordered as ray,...
Definition: radiation.hpp:246
constexpr static PetscReal pi
Pi.
Definition: constants.hpp:22
constexpr static PetscReal sbc
Stefan-Boltzman Constant (J/K)
Definition: constants.hpp:10
constexpr static PetscReal k
Boltzmann Constant.
Definition: constants.hpp:19
constexpr static PetscReal c
Speed of light.
Definition: constants.hpp:16
constexpr static PetscReal large
A somewhat large number.
Definition: constants.hpp:31
constexpr static PetscReal h
Planck Constant.
Definition: constants.hpp:13
Definition: loggable.hpp:9
PetscInt propertySize
the property size being set
Definition: eos.hpp:48
Definition: radiation.hpp:59
PetscReal Krad
Absorption for the segment. Make sure that this is reset every solve after the value has been transpo...
Definition: radiation.hpp:61
PetscReal Ij
Black body source for the segment. Make sure that this is reset every solve after the value has been ...
Definition: radiation.hpp:60
Definition: radiation.hpp:172
PetscInt cell
< Stores the cell indices of the segment locally.
Definition: radiation.hpp:174
Definition: radiation.hpp:44
PetscInt remoteRank
the remote rank (may be same as originating) for this segment id
Definition: radiation.hpp:50
PetscInt nSegment
The number of segments away from the origin, zero on the origin.
Definition: radiation.hpp:54
PetscInt remoteRayId
The local ray id 'index'.
Definition: radiation.hpp:52
PetscInt originRayId
The local ray id 'index'.
Definition: radiation.hpp:48
PetscInt originRank
the rank for the start of the ray
Definition: radiation.hpp:46
Definition: radiation.hpp:180