Skip to content

Commit 17f67f8

Browse files
committed
update RKCX
1 parent 983b0bf commit 17f67f8

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

integration/utils/rkc_util.H

+17-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#ifndef RKC_UTIL_H
22
#define RKC_UTIL_H
33

4+
#include <AMReX_REAL.H>
5+
6+
using namespace amrex::literals;
7+
48
template <typename BurnT, typename IntT>
59
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
6-
Real rkc_init_dt (BurnT& state, IntT& rstate, const Real max_timestep, const Real sprad)
10+
amrex::Real rkc_init_dt (BurnT& state, IntT& rstate, const amrex::Real max_timestep, const amrex::Real sprad)
711
{
812

913
// estimate the initial timestep
@@ -13,9 +17,9 @@ Real rkc_init_dt (BurnT& state, IntT& rstate, const Real max_timestep, const Rea
1317
// finally, we require the initial spectral radius, sprad, and the maximum
1418
// timestep (tout - tstart), max_timestep.
1519

16-
Real hmin = 10.0_rt * UROUND * std::max(std::abs(rstate.t), max_timestep);
20+
amrex::Real hmin = 10.0_rt * UROUND * std::max(std::abs(rstate.t), max_timestep);
1721

18-
Real absh = max_timestep;
22+
amrex::Real absh = max_timestep;
1923

2024
if (sprad * absh > 1.0_rt) {
2125
absh = 1.0_rt / sprad;
@@ -39,11 +43,11 @@ Real rkc_init_dt (BurnT& state, IntT& rstate, const Real max_timestep, const Rea
3943
}
4044

4145
rstate.nfe++;
42-
Real est{};
46+
amrex::Real est{};
4347

4448
// compute the weights using the tolerances
4549
for (int i = 1; i <= INT_NEQS; ++i) {
46-
Real wt{};
50+
amrex::Real wt{};
4751
if (i <= NumSpec) {
4852
wt = rstate.rtol_spec * std::abs(rstate.yn(i)) + rstate.atol_spec;
4953
} else {
@@ -65,7 +69,7 @@ Real rkc_init_dt (BurnT& state, IntT& rstate, const Real max_timestep, const Rea
6569

6670
template <typename BurnT, typename IntT>
6771
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
68-
int rkcrho (BurnT& state, IntT& rstate, const Real max_timestep, Real& sprad)
72+
int rkcrho (BurnT& state, IntT& rstate, const amrex::Real max_timestep, amrex::Real& sprad)
6973
{
7074

7175
// RKCRHO attempts to compute a close upper bound, SPRAD, on
@@ -94,7 +98,7 @@ int rkcrho (BurnT& state, IntT& rstate, const Real max_timestep, Real& sprad)
9498
// sprad smaller than small = 1/hmax are not
9599
// interesting because they do not constrain the step size.
96100

97-
Real small = 1.0_rt / max_timestep;
101+
amrex::Real small = 1.0_rt / max_timestep;
98102

99103
// The initial slope is used as guess when nsteps = 0 and
100104
// thereafter the last computed eigenvector. Some care
@@ -112,16 +116,16 @@ int rkcrho (BurnT& state, IntT& rstate, const Real max_timestep, Real& sprad)
112116
}
113117
}
114118

115-
Real ynrm{};
116-
Real vnrm{};
119+
amrex::Real ynrm{};
120+
amrex::Real vnrm{};
117121
for (int i = 1; i <= INT_NEQS; ++i) {
118122
ynrm += amrex::Math::powi<2>(rstate.yn(i));
119123
vnrm += amrex::Math::powi<2>(rstate.yjm1(i));
120124
}
121125
ynrm = std::sqrt(ynrm);
122126
vnrm = std::sqrt(vnrm);
123127

124-
Real dynrm{};
128+
amrex::Real dynrm{};
125129
if (ynrm != 0.0_rt && vnrm != 0.0_rt) {
126130
dynrm = ynrm * std::sqrt(UROUND);
127131
for (int i = 1; i <= INT_NEQS; ++i) {
@@ -146,7 +150,7 @@ int rkcrho (BurnT& state, IntT& rstate, const Real max_timestep, Real& sprad)
146150

147151
// Now iterate with a nonlinear power method.
148152

149-
Real sigma{};
153+
amrex::Real sigma{};
150154

151155
for (int iter = 0; iter < itmax; ++iter) {
152156

@@ -162,12 +166,12 @@ int rkcrho (BurnT& state, IntT& rstate, const Real max_timestep, Real& sprad)
162166
rstate.y(i) = ysav(i);
163167
}
164168
rstate.nfesig++;
165-
Real dfnrm{};
169+
amrex::Real dfnrm{};
166170
for (int i = 1; i <= INT_NEQS; ++i) {
167171
dfnrm += amrex::Math::powi<2>(rstate.yjm2(i) - rstate.fn(i));
168172
}
169173
dfnrm = std::sqrt(dfnrm);
170-
Real sigmal = sigma;
174+
amrex::Real sigmal = sigma;
171175
sigma = dfnrm / dynrm;
172176

173177
// sprad is a little bigger than the estimate sigma of the

0 commit comments

Comments
 (0)