Skip to content

Commit d34c256

Browse files
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 0e37bc4 commit d34c256

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

doc/source/modules/radCooling.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Equations solved and method
77
---------------------------
88

99
The ``RadiativeCooling`` module implements the computation of the loss of internal thermal energy
10-
due radiation in an optically thin medium. Physically, it solves for :math:`\dot_{e}=\mathcal{L}`,
11-
where we have used :math:`\mathcal{L}=-n_H^2 \Lambda (T)` (where :math:`T` is the gas temperature,
12-
:math:`n_H=\rho X_H/m_p` is the total hydrogen number density, and :math:`\Lambda(T)`) is the
13-
radiative cooling rate computed seperately from quantum mechanical calculations
10+
due to radiation in an optically thin medium. Physically, it solves for :math:`\dot{e}=\mathcal{L}`,
11+
where we have used :math:`\mathcal{L}=-n_H^2 \Lambda(T)` (where :math:`T` is the gas temperature,
12+
:math:`n_H=\rho X_H/m_p` is the total hydrogen number density, and :math:`\Lambda(T)` is the
13+
radiative cooling rate computed separately from quantum mechanical calculations
1414
by other plasma modeling codes, for example, Cloudy (Ferland et. al, PASP 110, 749 (1998)).
1515

1616
This computation becomes especially relevant for multiphase gas in astrophysical environments

src/fluid/addSourceTerms.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,11 @@ struct Fluid_AddSourceTermsFunctor {
204204
Uc(MX2,k,j,i) += dt*Sm / rt(i);
205205
#endif // COMPONENTS
206206
#endif
207+
#if HAVE_ENERGY
207208
if (coolingOn) {
208209
Uc(ENG,k,j,i) += delta_eng_cool(k,j,i); // energy per unit volume
209210
}
211+
#endif
210212
}
211213
};
212214

src/fluid/cooling/cooling.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ void RadCooling::TownsendIntegration(real dt) {
164164
del_prs = -Vc(RHO,k,j,i)/(mu*m_p/kB)*(temperature-T_fin)/pow(vel_unit,2);
165165
delta_eng(k,j,i) = eos.GetInternalEnergy(del_prs, Vc(RHO,k,j,i));
166166
}
167-
else {
168-
del_prs = ZERO_F;
169-
delta_eng(k,j,i) = ZERO_F;
167+
} else {
168+
T_fin = TcoolFloor;
169+
del_prs = -Vc(RHO,k,j,i)/(mu*m_p/kB)*(temperature-T_fin)/pow(vel_unit,2);
170+
delta_eng(k,j,i) = eos.GetInternalEnergy(del_prs, Vc(RHO,k,j,i));
170171
}
171172
}
172173
});

src/fluid/cooling/cooling.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#define FLUID_COOLING_COOLING_HPP_
1010

1111
#include <string>
12-
12+
#include <functional>
1313
#include "idefix.hpp"
1414
#include "input.hpp"
1515
#include "grid.hpp"

0 commit comments

Comments
 (0)