From 6d0e1e04792cba0d33eb3653c9d00b16ec170fe6 Mon Sep 17 00:00:00 2001 From: AMLattanzi Date: Mon, 17 Jul 2023 15:32:31 -0700 Subject: [PATCH] Let DynamicMeshRefinement run with OneWay. --- Docs/sphinx_doc/Discretizations.rst | 22 +++++++++---------- Source/BoundaryConditions/ERF_FillPatcher.H | 20 ++--------------- Source/BoundaryConditions/ERF_FillPatcher.cpp | 9 -------- Source/TimeIntegration/ERF_TimeStep.cpp | 4 +++- 4 files changed, 16 insertions(+), 39 deletions(-) diff --git a/Docs/sphinx_doc/Discretizations.rst b/Docs/sphinx_doc/Discretizations.rst index d16ab5ac3..9205b4dae 100644 --- a/Docs/sphinx_doc/Discretizations.rst +++ b/Docs/sphinx_doc/Discretizations.rst @@ -202,7 +202,7 @@ Additionally, weighted essentially non-oscillatory (WENO) schemes are available .. math:: \begin{array}{ll} - q_{m - \frac{1}{2}} = \sum_{n=1}^{N} w_n q_{m - \frac{1}{2}}^{(n)} & \\ + q_{m + \frac{1}{2}} = \sum_{n=1}^{N} w_n q_{m + \frac{1}{2}}^{(n)} & \\ w_{n} = \frac{\hat{w}_{n}}{\sum_{l=1}^{N} \hat{w}_{l}} & \hat{w}_{l} = \frac{\omega_{l}}{\left(\epsilon + \beta_{l} \right)^2} \\ \end{array} @@ -211,10 +211,10 @@ With the WENO3 scheme, one has :math:`N=2, \; \omega_{1} = 1/3, \; \omega_{2} = .. math:: \begin{array}{l} - \beta_{1} = \left(q_{m - 1} - q_{m-2} \right)^2 \\ - \beta_{2} = \left(q_{m} - q_{m-1} \right)^2 \\ - q_{m - \frac{1}{2}}^{(1)} = -\frac{1}{2} q_{m-2} + \frac{3}{2} q_{m-1} \\ - q_{m - \frac{1}{2}}^{(2)} = \frac{1}{2} q_{m-1} + \frac{1}{2} q_{m} + \beta_{1} = \left(q_{m} - q_{m-1} \right)^2 \\ + \beta_{2} = \left(q_{m+1} - q_{m} \right)^2 \\ + q_{m + \frac{1}{2}}^{(1)} = -\frac{1}{2} q_{m-1} + \frac{3}{2} q_{m} \\ + q_{m + \frac{1}{2}}^{(2)} = \frac{1}{2} q_{m} + \frac{1}{2} q_{m+1} \end{array} With the WENO5 scheme, one has :math:`N=3, \; \omega_{1} = 1/10, \; \omega_{2} = 3/5, \; \omega_{3} = 3/10` and the following closures @@ -222,12 +222,12 @@ With the WENO5 scheme, one has :math:`N=3, \; \omega_{1} = 1/10, \; \omega_{2} = .. math:: \begin{array}{l} - \beta_{1} = \frac{13}{12} \left(q_{m - 3} - 2 q_{m-2} + q_{m-1} \right)^2 + \frac{1}{4} \left(q_{m - 3} - 4 q_{m-2} + 3 q_{m-1} \right)^2 \\ - \beta_{2} = \frac{13}{12} \left(q_{m - 2} - 2 q_{m-1} + q_{m} \right)^2 + \frac{1}{4} \left(q_{m - 2} - q_{m} \right)^2 \\ - \beta_{3} = \frac{13}{12} \left(q_{m - 1} - 2 q_{m} + q_{m+1} \right)^2 + \frac{1}{4} \left( 3 q_{m - 1} - 4 q_{m} + q_{m+1} \right)^2 \\ - q_{m - \frac{1}{2}}^{(1)} = \frac{1}{3} q_{m-3} - \frac{7}{6} q_{m-2} + \frac{11}{6} q_{m-1} \\ - q_{m - \frac{1}{2}}^{(2)} = -\frac{1}{6} q_{m-2} + \frac{5}{6} q_{m-1} + \frac{1}{3} q_{m} \\ - q_{m - \frac{1}{2}}^{(3)} = \frac{1}{3} q_{m-1} + \frac{5}{6} q_{m} - \frac{1}{6} q_{m+1} + \beta_{1} = \frac{13}{12} \left(q_{m-2} - 2 q_{m-1} + q_{m} \right)^2 + \frac{1}{4} \left(q_{m-2} - 4 q_{m-1} + 3 q_{m} \right)^2 \\ + \beta_{2} = \frac{13}{12} \left(q_{m-1} - 2 q_{m} + q_{m+1} \right)^2 + \frac{1}{4} \left(q_{m-1} - q_{m+1} \right)^2 \\ + \beta_{3} = \frac{13}{12} \left(q_{m} - 2 q_{m+1} + q_{m+2} \right)^2 + \frac{1}{4} \left( 3 q_{m} - 4 q_{m+1} + q_{m+2} \right)^2 \\ + q_{m + \frac{1}{2}}^{(1)} = \frac{1}{3} q_{m-2} - \frac{7}{6} q_{m-1} + \frac{11}{6} q_{m} \\ + q_{m + \frac{1}{2}}^{(2)} = -\frac{1}{6} q_{m-1} + \frac{5}{6} q_{m} + \frac{1}{3} q_{m+1} \\ + q_{m + \frac{1}{2}}^{(3)} = \frac{1}{3} q_{m} + \frac{5}{6} q_{m+1} - \frac{1}{6} q_{m+2} \end{array} By default, the WENO3 scheme will be employed for moisture variables if the code is compiled with moisture support. However, users may utilize the WENO scheme for all variables, with a specified order, via the following inputs: diff --git a/Source/BoundaryConditions/ERF_FillPatcher.H b/Source/BoundaryConditions/ERF_FillPatcher.H index bd9db0132..5874bf349 100644 --- a/Source/BoundaryConditions/ERF_FillPatcher.H +++ b/Source/BoundaryConditions/ERF_FillPatcher.H @@ -7,29 +7,12 @@ class ERFFillPatcher { public: - //ERFFillPatcher () = default; - ERFFillPatcher (amrex::BoxArray const& fba, amrex::DistributionMapping fdm, amrex::Geometry const& fgeom, amrex::BoxArray cba, amrex::DistributionMapping cdm, amrex::Geometry const& cgeom, int nghost, int nghost_subset, int ncomp, amrex::InterpBase* interp); - /* - // Declare a default move constructor so we ensure the destructor is - // not called when we return an object of this class by value - ERFFillPatcher (ERFFillPatcher&&) noexcept = default; - - // Delete the move assignment operator - ERFFillPatcher& operator=(ERFFillPatcher&& other) noexcept = delete; - - // Delete the copy constructor - ERFFillPatcher (const ERFFillPatcher& other) = delete; - - // Delete the copy assignment operator - ERFFillPatcher& operator=(const ERFFillPatcher& other) = delete; - */ - void registerCoarseData (amrex::Vector const& crse_data, amrex::Vector const& crse_time); @@ -70,7 +53,8 @@ void ERFFillPatcher::fill (amrex::MultiFab& mf, amrex::Real time, BC& cbc, amrex::Vector const& bcs, bool fill_subset) { - AMREX_ALWAYS_ASSERT((time >= m_crse_times[0]) && (time <= m_crse_times[1])); + constexpr amrex::Real eps = std::numeric_limits::epsilon(); + AMREX_ALWAYS_ASSERT((time >= m_crse_times[0]-eps) && (time <= m_crse_times[1]+eps)); // Time interpolation factors amrex::Real fac_new = (time - m_crse_times[0]) / m_dt_crse; diff --git a/Source/BoundaryConditions/ERF_FillPatcher.cpp b/Source/BoundaryConditions/ERF_FillPatcher.cpp index fbc1ac8c4..38e011317 100644 --- a/Source/BoundaryConditions/ERF_FillPatcher.cpp +++ b/Source/BoundaryConditions/ERF_FillPatcher.cpp @@ -108,15 +108,6 @@ ERFFillPatcher::ERFFillPatcher (BoxArray const& fba, DistributionMapping fdm, DistributionMapping gcf_dm(gcf_fba); DistributionMapping cf_dm_s(cf_fba_s); - /* - amrex::Print() << "\n"; - amrex::Print() << "BA: " << gcf_fba << ' ' << gcf_cba << "\n"; - amrex::Print() << "DM: " << gcf_dm << "\n"; - amrex::Print() << "BA_s: " << cf_fba_s << "\n"; - amrex::Print() << "DM_s: " << cf_dm_s << "\n"; - amrex::Print() << "\n"; - */ - // Fine patch to hold the time-interpolated state m_cf_fine_data.define(gcf_fba, gcf_dm, m_ncomp, 0); diff --git a/Source/TimeIntegration/ERF_TimeStep.cpp b/Source/TimeIntegration/ERF_TimeStep.cpp index c18187cad..074e37b43 100644 --- a/Source/TimeIntegration/ERF_TimeStep.cpp +++ b/Source/TimeIntegration/ERF_TimeStep.cpp @@ -76,7 +76,9 @@ ERF::timeStep (int lev, Real time, int iteration) timeStep(lev+1, time+(i-1)*dt[lev+1], i); } - AverageDownTo(lev); // average lev+1 down to lev + if (coupling_type == "TwoWay") { + AverageDownTo(lev); // average lev+1 down to lev + } } }