Skip to content

Commit 92a7312

Browse files
committed
Remove use of std::numbers so you don't have to use c++20.
1 parent 531fda2 commit 92a7312

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

swm_AMReX/GNUmakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DIM = 2
1111
#USE_HDF5=TRUE
1212
#HDF5_HOME=/home/lalo/spack/opt/spack/linux-ubuntu24.04-skylake/gcc-13.3.0/hdf5-1.14.5-vm6rifl2savzhynhyx56ayutfhmycs3s/
1313

14-
CXXSTD = c++20
14+
#CXXSTD = c++20
1515

1616
include $(AMREX_HOME)/Tools/GNUMake/Make.defs
1717

swm_AMReX/main.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
*
33
*/
44

5-
#include <numbers>
65
#include <cmath>
76

87
#include <AMReX.H>

swm_AMReX/run_local.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ set +e
5252

5353
# TODO: Make the plotfile name a so it automatically finds the plotfile for the last time step
5454
# TODO: Do a check to see if the corresponding reference plotfile exists step
55-
$AMREX_HOME/Tools/Plotfile/fcompare.gnu.ex plt00000 "$SWM_AMREX_ROOT"/plt04000_reference
55+
$AMREX_HOME/Tools/Plotfile/fcompare.gnu.ex plt04000 "$SWM_AMREX_ROOT"/plt04000_reference
5656

5757
if [ $? -eq 0 ]; then
5858
echo -e "\nSolution Verification: PASS"

swm_AMReX/swm_mini_app_utils.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ void InitializeVariables(const amrex::Geometry & geom,
175175

176176
// coefficient for initialization psi
177177
const amrex::Real a = 1000000;
178+
const double pi = 4. * std::atan(1.);
178179

179180
for (amrex::MFIter mfi(psi); mfi.isValid(); ++mfi)
180181
{
@@ -187,8 +188,8 @@ void InitializeVariables(const amrex::Geometry & geom,
187188
const amrex::Real x_cell_center = (i+0.5) * dx;
188189
const amrex::Real y_cell_center = (j+0.5) * dy;
189190

190-
const amrex::Real x_transformed = LinearMapCoordinates(x_cell_center, x_min, x_max, 0.0, 2*std::numbers::pi);
191-
const amrex::Real y_transformed = LinearMapCoordinates(y_cell_center, y_min, y_max, 0.0, 2*std::numbers::pi);
191+
const amrex::Real x_transformed = LinearMapCoordinates(x_cell_center, x_min, x_max, 0.0, 2*pi);
192+
const amrex::Real y_transformed = LinearMapCoordinates(y_cell_center, y_min, y_max, 0.0, 2*pi);
192193

193194
phi_array(i,j,k) = a*std::sin(x_transformed)*std::sin(y_transformed);
194195
});
@@ -202,7 +203,7 @@ void InitializeVariables(const amrex::Geometry & geom,
202203

203204
// coefficient for pressure
204205
double el = geom.ProbLength(0);
205-
amrex::Real pcf = (std::numbers::pi * std::numbers::pi * a * a)/(el * el);
206+
amrex::Real pcf = (pi * pi * a * a)/(el * el);
206207

207208
for (amrex::MFIter mfi(p); mfi.isValid(); ++mfi)
208209
{
@@ -215,8 +216,8 @@ void InitializeVariables(const amrex::Geometry & geom,
215216
amrex::Real x_node = i * dx;
216217
amrex::Real y_node = j * dy;
217218

218-
const amrex::Real x_transformed = LinearMapCoordinates(x_node, x_min, x_max, 0.0, 2*std::numbers::pi);
219-
const amrex::Real y_transformed = LinearMapCoordinates(y_node, y_min, y_max, 0.0, 2*std::numbers::pi);
219+
const amrex::Real x_transformed = LinearMapCoordinates(x_node, x_min, x_max, 0.0, 2*pi);
220+
const amrex::Real y_transformed = LinearMapCoordinates(y_node, y_min, y_max, 0.0, 2*pi);
220221

221222
p_array(i,j,k) = pcf * (std::cos(2*x_transformed) + std::cos(2*y_transformed)) + 5000;
222223
});

0 commit comments

Comments
 (0)