Skip to content

Commit 7659878

Browse files
committed
Merge branch 'photoionization' of https://github.com/quokka-astro/quokka into photoionization
2 parents 063caca + 3c2e219 commit 7659878

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/problems/StromgrenSphere/testStromgrenSphere.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ void RadSystem<StromgrenSphere>::SetRadEnergySource(array_t &radEnergy, const am
120120
// Numerically integrate dR/dt = (Q - 4*pi*R^3*alpha_B*n_HI0^2/3) / (Q/c + 4*pi*R^2*n_HI0)
121121
// Integrates forward by `dt_target` starting from `R0` using RK4 with step-doubling.
122122
// Aborts the run if convergence is not reached within allowed iterations.
123-
static amrex::Real integrate_radius(amrex::Real dt_target, amrex::Real Q, amrex::Real alpha_B, amrex::Real n_HI0,
124-
amrex::Real c_light, amrex::Real R0, amrex::Real r_s_est)
123+
static amrex::Real integrate_radius(amrex::Real dt_target, amrex::Real Q, amrex::Real alpha_B, amrex::Real n_HI0, amrex::Real c_light, amrex::Real R0,
124+
amrex::Real r_s_est)
125125
{
126-
if (dt_target <= 0.0_rt) return R0;
126+
if (dt_target <= 0.0_rt)
127+
return R0;
127128

128129
auto rhs = [&](amrex::Real R) -> amrex::Real {
129130
const amrex::Real num = Q - (4.0_rt * M_PI * R * R * R * alpha_B * n_HI0 * n_HI0) / 3.0_rt;
@@ -146,7 +147,8 @@ static amrex::Real integrate_radius(amrex::Real dt_target, amrex::Real Q, amrex:
146147
const amrex::Real k3 = rhs(R + 0.5_rt * dt * k2);
147148
const amrex::Real k4 = rhs(R + dt * k3);
148149
R += (dt / 6.0_rt) * (k1 + 2.0_rt * k2 + 2.0_rt * k3 + k4);
149-
if (R < 0.0_rt) R = 0.0_rt;
150+
if (R < 0.0_rt)
151+
R = 0.0_rt;
150152
}
151153

152154
if (iter > 0 && std::abs(R - R_prev) < tol) {
@@ -160,7 +162,6 @@ static amrex::Real integrate_radius(amrex::Real dt_target, amrex::Real Q, amrex:
160162
return R_prev; // unreachable
161163
}
162164

163-
164165
template <> struct SimulationData<StromgrenSphere> {
165166
amrex::Real small_temp;
166167
amrex::Real small_dens;
@@ -432,8 +433,7 @@ template <> void QuokkaSimulation<StromgrenSphere>::computeAfterTimestep()
432433
if (amrex::ParallelDescriptor::IOProcessor()) {
433434
const amrex::Real n_HI0 = userData_.primary_species_2;
434435
const amrex::Real alpha_B = 2.6e-13;
435-
const amrex::Real r_s =
436-
std::pow((3.0_rt * userData_.Q) / (4.0_rt * M_PI * alpha_B * n_HI0 * n_HI0), 1.0_rt / 3.0_rt);
436+
const amrex::Real r_s = std::pow((3.0_rt * userData_.Q) / (4.0_rt * M_PI * alpha_B * n_HI0 * n_HI0), 1.0_rt / 3.0_rt);
437437

438438
amrex::Real dt = tNew_[lev] - userData_.r_analytical_last_t;
439439
if (dt < 0.0_rt) {
@@ -457,7 +457,7 @@ template <> void QuokkaSimulation<StromgrenSphere>::computeAfterTimestep()
457457
userData_.r_analytical_vec_.push_back(r_analytical);
458458

459459
if (amrex::ParallelDescriptor::IOProcessor()) {
460-
userData_.output_file_ << tNew_[lev] << ',' << r16 << ',' << r50 << ',' << r84 << ',' << r_analytical << '\n';
460+
userData_.output_file_ << tNew_[lev] << ',' << r16 << ',' << r50 << ',' << r84 << ',' << r_analytical << '\n';
461461
}
462462
}
463463

0 commit comments

Comments
 (0)