7 #include "../parameter_input.hpp"
8 #include "../coordinates/coordinates.hpp"
9 #include "../thermodynamics/thermodynamics.hpp"
10 #include "../mesh/mesh.hpp"
11 #include "../utils/utils.hpp"
12 #include "../math/core.h"
13 #include "../debugger/debugger.hpp"
24 pmy_block(pmb), pband(nullptr), rflags(0
LL),
25 cooldown(0.), current(0.), planet(nullptr), stellarDistance_au_(1.)
29 pmy_block(pmb), pband(nullptr), rflags(0
LL)
31 pmb->
pdebug->Enter(
"Radiation");
32 std::stringstream &msg = pmb->
pdebug->msg;
46 std::string str = pin->
GetOrAddString(
"radiation",
"indir",
"(0.,0.)");
53 while (
p !=
nullptr) {
54 nout +=
p->rayOutput.size();
62 while (
p !=
nullptr) {
63 p->btoa.InitWithShallowSlice(
radiance,3,nout,
p->rayOutput.size());
64 nout +=
p->rayOutput.size();
73 planet =
new CelestrialBody(pin);
79 if (
pband !=
nullptr) {
90 std::stringstream msg;
93 while (
p !=
nullptr) {
103 while (
p !=
nullptr) {
111 int k,
int j,
int il,
int iu)
118 if (
pband ==
nullptr)
return;
120 while (
p !=
nullptr) {
123 planet->ParentZenithAngle(&ray.
mu, &ray.
phi, time, pcoord->
x2v(j), pcoord->
x3v(k));
124 dist =
planet->ParentDistanceInAu(time);
130 p->setSpectralProperties(w, k, j, il - NGHOST, iu + NGHOST - 1);
131 p->calculateRadiativeFlux(ray, dist, k, j, il, iu);
138 int k,
int j,
int il,
int iu)
145 if (
pband ==
nullptr)
return;
149 planet->ParentZenithAngle(&ray.
mu, &ray.
phi, time, pcoord->
x2v(j), pcoord->
x3v(k));
150 dist =
planet->ParentDistanceInAu(time);
153 while (
p !=
nullptr) {
155 p->setSpectralProperties(w, k, j, il - NGHOST, iu + NGHOST - 1);
156 p->calculateRadiance(ray, dist, k, j, il, iu);
163 int k,
int j,
int il,
int iu)
166 if (
pband ==
nullptr)
return;
169 pmb->
pdebug->Call(
"Radiation::addRadiativeFluxes");
173 while (
p !=
nullptr) {
175 for (
int i = il; i <= iu; ++i)
176 x1flux(
IEN,k,j,i) +=
p->bflxup(k,j,i) -
p->bflxdn(k,j,i);
186 while (plast !=
nullptr)
190 sprintf(name,
"b%d", bid);
194 if (plast ==
nullptr) {
209 infile.Open(pin->
GetString(
"radiation",
"bands_file").c_str(), IOWrapper::FileMode::read);
216 while (pline->
pnext !=
nullptr) {
220 pline->
pnext = pnext;
223 pline = pline->
pnext;
230 while (pline !=
nullptr) {
232 pline = pline->
pnext;
242 while (
p !=
nullptr) {
243 num +=
p->rayOutput.size();
254 while (
p !=
nullptr) {
255 size +=
p->bflxup.GetSizeInBytes() +
p->bflxdn.GetSizeInBytes();
266 while (
p !=
nullptr) {
267 std::memcpy(pdst + offset,
p->bflxup.data(),
p->bflxup.GetSizeInBytes());
268 offset +=
p->bflxup.GetSizeInBytes();
269 std::memcpy(pdst + offset,
p->bflxdn.data(),
p->bflxdn.GetSizeInBytes());
270 offset +=
p->bflxdn.GetSizeInBytes();
281 while (
p !=
nullptr) {
282 std::memcpy(
p->bflxup.data(), psrc + offset,
p->bflxup.GetSizeInBytes());
283 offset +=
p->bflxup.GetSizeInBytes();
284 std::memcpy(
p->bflxdn.data(), psrc + offset,
p->bflxdn.GetSizeInBytes());
285 offset +=
p->bflxdn.GetSizeInBytes();
static Real const cLight_cgs
void calculateRadiances(AthenaArray< Real > const &w, Real time, int k, int j, int il, int iu)
static Real const hPlanck
size_t dumpRestartData(char *pdst)
Radiation(MeshBlock *pmb)
size_t loadRestartData(char *psrc)
void calculateRadiativeFluxes(AthenaArray< Real > const &w, Real time, int k, int j, int il, int iu)
static Real const hPlanck_cgs
static Real const stefanBoltzmann
std::string radiance_units
RadiationBand * getBand(int n)
std::vector< Direction > rayInput
int getTotalNumberOutgoingRays()
size_t getRestartDataSizeInBytes()
void addRadiativeFluxes(AthenaArray< Real > &x1flux, int k, int j, int il, int iu)
void readRadiationBands(ParameterInput *pin, int &b)
AthenaArray< Real > radiance
void readRadiationDirections(std::vector< Direction > &ray, std::string str)
void setRadiationFlags(uint64_t *flags, std::string str)