diff --git a/amr-wind/utilities/sampling/PlaneSampler.H b/amr-wind/utilities/sampling/PlaneSampler.H index 468f284789..e3c3542345 100644 --- a/amr-wind/utilities/sampling/PlaneSampler.H +++ b/amr-wind/utilities/sampling/PlaneSampler.H @@ -72,7 +72,7 @@ private: amrex::Vector m_axis1; amrex::Vector m_axis2; amrex::Vector m_origin; - amrex::Vector m_normal{0.0, 0.0, 0.0}; + amrex::Vector m_offset_vector{0.0, 0.0, 0.0}; amrex::Vector m_poffsets; amrex::Vector m_npts_dir; diff --git a/amr-wind/utilities/sampling/PlaneSampler.cpp b/amr-wind/utilities/sampling/PlaneSampler.cpp index d097f2cd7b..67322b734c 100644 --- a/amr-wind/utilities/sampling/PlaneSampler.cpp +++ b/amr-wind/utilities/sampling/PlaneSampler.cpp @@ -26,9 +26,15 @@ void PlaneSampler::initialize(const std::string& key) pp.queryarr("offsets", m_poffsets); int noffsets = static_cast(m_poffsets.size()); if (noffsets > 0) { - pp.getarr("normal", m_normal); + if (pp.contains("normal")) { + amrex::Abort( + "PlaneSampler: option normal is deprecated and renamed to " + "offset_vector"); + } + + pp.getarr("offset_vector", m_offset_vector); AMREX_ALWAYS_ASSERT( - static_cast(m_normal.size()) == AMREX_SPACEDIM); + static_cast(m_offset_vector.size()) == AMREX_SPACEDIM); } else { m_poffsets.push_back(0.0); } @@ -62,7 +68,7 @@ void PlaneSampler::sampling_locations(SampleLocType& locs) const for (int i = 0; i < m_npts_dir[0]; ++i) { for (int d = 0; d < AMREX_SPACEDIM; ++d) { locs[idx][d] = m_origin[d] + dx[d] * i + dy[d] * j + - m_poffsets[k] * m_normal[d]; + m_poffsets[k] * m_offset_vector[d]; } ++idx; } @@ -80,7 +86,7 @@ void PlaneSampler::define_netcdf_metadata(const ncutils::NCGroup& grp) const grp.put_attr("origin", m_origin); grp.put_attr("axis1", m_axis1); grp.put_attr("axis2", m_axis2); - grp.put_attr("axis3", m_normal); + grp.put_attr("offset_vector", m_offset_vector); grp.put_attr("offsets", m_poffsets); } diff --git a/docs/sphinx/user/inputs_Sampling.rst b/docs/sphinx/user/inputs_Sampling.rst index cde86490e9..a564e738be 100644 --- a/docs/sphinx/user/inputs_Sampling.rst +++ b/docs/sphinx/user/inputs_Sampling.rst @@ -124,18 +124,26 @@ The ``PlaneSampler`` samples the flow-field on two-dimensional planes defined by two axes: ``axis1`` and ``axis2`` with the bottom corner located at ``origin`` and is divided into equally spaced nodes defined by the two entries in ``num_points`` vector. Multiple planes parallel to the reference planes can be -sampled by specifying the ``normal`` vector along which the the planes are +sampled by specifying the ``offset_vector`` vector along which the the planes are offset for as many planes as there are entries in the ``offset`` array. Example:: - sampling.plane1.type = PlaneSampler - sampling.plane1.axis1 = 0.0 1.0 0.0 - sampling.plane1.axis2 = 0.0 0.0 1.0 - sampling.plane1.origin = 0.0 0.0 0.0 - sampling.plane1.num_points = 10 10 - sampling.plane1.normal = 1.0 0.0 0.0 - sampling.plane1.offsets = -10.0 0.0 10.0 + sampling.plane1.type = PlaneSampler + sampling.plane1.axis1 = 1.0 0.0 0.0 + sampling.plane1.axis2 = 0.0 0.0 1.0 + sampling.plane1.origin = 0.0 0.0 0.0 + sampling.plane1.num_points = 10 10 + sampling.plane1.offset_vector = 1.0 0.0 0.0 + sampling.plane1.offsets = 0.0 2.0 3.0 + +Illustration of this example: + +.. figure:: planesampler.png + :alt: PlaneSampler + :width: 800 + + Example of sampling on planes. Sampling at arbitrary locations ```````````````````````````````` diff --git a/docs/sphinx/user/planesampler.png b/docs/sphinx/user/planesampler.png new file mode 100644 index 0000000000..d5d7e1d2c3 Binary files /dev/null and b/docs/sphinx/user/planesampler.png differ diff --git a/unit_tests/utilities/test_sampling.cpp b/unit_tests/utilities/test_sampling.cpp index efc495513d..d4f0ce0c42 100644 --- a/unit_tests/utilities/test_sampling.cpp +++ b/unit_tests/utilities/test_sampling.cpp @@ -275,7 +275,7 @@ TEST_F(SamplingTest, plane_sampler) pp.addarr("origin", amrex::Vector{0.0, 0.0, 0.0}); pp.addarr("num_points", amrex::Vector{3, 3}); pp.addarr("offsets", amrex::Vector{-1.0, 1.0}); - pp.addarr("normal", amrex::Vector{1.0, 0.0, 0.0}); + pp.addarr("offset_vector", amrex::Vector{1.0, 0.0, 0.0}); } amr_wind::sampling::PlaneSampler plane(sim());