Skip to content

Commit fe6f093

Browse files
committed
a bit more
1 parent fe3d395 commit fe6f093

File tree

1 file changed

+20
-30
lines changed

1 file changed

+20
-30
lines changed

EOS/helmholtz/actual_eos.H

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -117,32 +117,19 @@ void fwt (const amrex::Real* AMREX_RESTRICT fi,
117117

118118
// cubic hermite polynomial functions
119119
// psi0 & derivatives
120-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
120+
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
121121
amrex::Real xpsi0(amrex::Real z) noexcept
122122
{
123123
return z * z * (2.0e0_rt * z - 3.0e0_rt) + 1.0_rt;
124124
}
125125

126-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
127-
amrex::Real xdpsi0(amrex::Real z) noexcept
128-
{
129-
return z * (6.0e0_rt * z - 6.0e0_rt);
130-
}
131-
132126
// psi1 & derivatives
133-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
127+
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
134128
amrex::Real xpsi1(amrex::Real z) noexcept
135129
{
136130
return z * (z * (z - 2.0e0_rt) + 1.0e0_rt);
137131
}
138132

139-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
140-
amrex::Real xdpsi1(amrex::Real z) noexcept
141-
{
142-
return z * (3.0e0_rt * z - 4.0e0_rt) + 1.0e0_rt;
143-
}
144-
145-
146133

147134
namespace electron_table_indexing {
148135

@@ -337,15 +324,16 @@ void apply_electrons (T& state)
337324
// giving the j offset, i offset, and component
338325

339326
// pressure derivative with density
340-
amrex::Real dpepdd = 0.0e0_rt;
341-
amrex::constexpr_for<0, 16>([&] (auto K) {
342-
constexpr int k = K;
343-
constexpr auto m = electron_table_indexing::map[k];
344-
345-
dpepdd += dpdf[jat+m.dj][iat+m.di][m.n] * wdt[k];
346-
});
347-
dpepdd = amrex::max(state.y_e * dpepdd, 0.0e0_rt);
327+
[[maybe_unused]] amrex::Real dpepdd = 0.0e0_rt;
328+
if constexpr (has_pressure<T>::value) {
329+
amrex::constexpr_for<0, 16>([&] (auto K) {
330+
constexpr int k = K;
331+
constexpr auto m = electron_table_indexing::map[k];
348332

333+
dpepdd += dpdf[jat+m.dj][iat+m.di][m.n] * wdt[k];
334+
});
335+
dpepdd = amrex::max(state.y_e * dpepdd, 0.0e0_rt);
336+
}
349337

350338
// electron chemical potential etaele
351339
[[maybe_unused]] amrex::Real etaele{};
@@ -380,13 +368,15 @@ void apply_electrons (T& state)
380368
amrex::Real dpepdt = x * df_dt;
381369
[[maybe_unused]] amrex::Real dpepda{};
382370
[[maybe_unused]] amrex::Real dpepdz{};
383-
if constexpr (has_dpdA<T>::value || has_dpdZ<T>::value) {
384-
amrex::Real s = dpepdd/state.y_e - 2.0e0_rt * din * df_d;
385-
if constexpr (has_dpdA<T>::value) {
386-
dpepda = -ytot1 * (2.0e0_rt * pele + s * din);
387-
}
388-
if constexpr (has_dpdZ<T>::value) {
389-
dpepdz = state.rho*ytot1*(2.0e0_rt * din * df_d + s);
371+
if constexpr (has_pressure<T>::value) {
372+
if constexpr (has_dpdA<T>::value || has_dpdZ<T>::value) {
373+
amrex::Real s = dpepdd/state.y_e - 2.0e0_rt * din * df_d;
374+
if constexpr (has_dpdA<T>::value) {
375+
dpepda = -ytot1 * (2.0e0_rt * pele + s * din);
376+
}
377+
if constexpr (has_dpdZ<T>::value) {
378+
dpepdz = state.rho*ytot1*(2.0e0_rt * din * df_d + s);
379+
}
390380
}
391381
}
392382

0 commit comments

Comments
 (0)