1
1
#ifndef RKC_UTIL_H
2
2
#define RKC_UTIL_H
3
3
4
+ #include < AMReX_REAL.H>
5
+
6
+ using namespace amrex ::literals;
7
+
4
8
template <typename BurnT, typename IntT>
5
9
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)
7
11
{
8
12
9
13
// estimate the initial timestep
@@ -13,9 +17,9 @@ Real rkc_init_dt (BurnT& state, IntT& rstate, const Real max_timestep, const Rea
13
17
// finally, we require the initial spectral radius, sprad, and the maximum
14
18
// timestep (tout - tstart), max_timestep.
15
19
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);
17
21
18
- Real absh = max_timestep;
22
+ amrex:: Real absh = max_timestep;
19
23
20
24
if (sprad * absh > 1 .0_rt) {
21
25
absh = 1 .0_rt / sprad;
@@ -39,11 +43,11 @@ Real rkc_init_dt (BurnT& state, IntT& rstate, const Real max_timestep, const Rea
39
43
}
40
44
41
45
rstate.nfe ++;
42
- Real est{};
46
+ amrex:: Real est{};
43
47
44
48
// compute the weights using the tolerances
45
49
for (int i = 1 ; i <= INT_NEQS; ++i) {
46
- Real wt{};
50
+ amrex:: Real wt{};
47
51
if (i <= NumSpec) {
48
52
wt = rstate.rtol_spec * std::abs (rstate.yn (i)) + rstate.atol_spec ;
49
53
} else {
@@ -65,7 +69,7 @@ Real rkc_init_dt (BurnT& state, IntT& rstate, const Real max_timestep, const Rea
65
69
66
70
template <typename BurnT, typename IntT>
67
71
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)
69
73
{
70
74
71
75
// 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)
94
98
// sprad smaller than small = 1/hmax are not
95
99
// interesting because they do not constrain the step size.
96
100
97
- Real small = 1 .0_rt / max_timestep;
101
+ amrex:: Real small = 1 .0_rt / max_timestep;
98
102
99
103
// The initial slope is used as guess when nsteps = 0 and
100
104
// thereafter the last computed eigenvector. Some care
@@ -112,16 +116,16 @@ int rkcrho (BurnT& state, IntT& rstate, const Real max_timestep, Real& sprad)
112
116
}
113
117
}
114
118
115
- Real ynrm{};
116
- Real vnrm{};
119
+ amrex:: Real ynrm{};
120
+ amrex:: Real vnrm{};
117
121
for (int i = 1 ; i <= INT_NEQS; ++i) {
118
122
ynrm += amrex::Math::powi<2 >(rstate.yn (i));
119
123
vnrm += amrex::Math::powi<2 >(rstate.yjm1 (i));
120
124
}
121
125
ynrm = std::sqrt (ynrm);
122
126
vnrm = std::sqrt (vnrm);
123
127
124
- Real dynrm{};
128
+ amrex:: Real dynrm{};
125
129
if (ynrm != 0 .0_rt && vnrm != 0 .0_rt) {
126
130
dynrm = ynrm * std::sqrt (UROUND);
127
131
for (int i = 1 ; i <= INT_NEQS; ++i) {
@@ -146,7 +150,7 @@ int rkcrho (BurnT& state, IntT& rstate, const Real max_timestep, Real& sprad)
146
150
147
151
// Now iterate with a nonlinear power method.
148
152
149
- Real sigma{};
153
+ amrex:: Real sigma{};
150
154
151
155
for (int iter = 0 ; iter < itmax; ++iter) {
152
156
@@ -162,12 +166,12 @@ int rkcrho (BurnT& state, IntT& rstate, const Real max_timestep, Real& sprad)
162
166
rstate.y (i) = ysav (i);
163
167
}
164
168
rstate.nfesig ++;
165
- Real dfnrm{};
169
+ amrex:: Real dfnrm{};
166
170
for (int i = 1 ; i <= INT_NEQS; ++i) {
167
171
dfnrm += amrex::Math::powi<2 >(rstate.yjm2 (i) - rstate.fn (i));
168
172
}
169
173
dfnrm = std::sqrt (dfnrm);
170
- Real sigmal = sigma;
174
+ amrex:: Real sigmal = sigma;
171
175
sigma = dfnrm / dynrm;
172
176
173
177
// sprad is a little bigger than the estimate sigma of the
0 commit comments