Skip to content

Commit

Permalink
Let DynamicMeshRefinement run with OneWay. (#1165)
Browse files Browse the repository at this point in the history
  • Loading branch information
AMLattanzi authored Jul 17, 2023
1 parent 4475c2c commit 552ae9c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 39 deletions.
22 changes: 11 additions & 11 deletions Docs/sphinx_doc/Discretizations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -211,23 +211,23 @@ 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

.. 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:
Expand Down
20 changes: 2 additions & 18 deletions Source/BoundaryConditions/ERF_FillPatcher.H
Original file line number Diff line number Diff line change
Expand Up @@ -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<amrex::MultiFab const*> const& crse_data,
amrex::Vector<amrex::Real> const& crse_time);

Expand Down Expand Up @@ -70,7 +53,8 @@ void
ERFFillPatcher::fill (amrex::MultiFab& mf, amrex::Real time,
BC& cbc, amrex::Vector<amrex::BCRec> 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<amrex::Real>::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;
Expand Down
9 changes: 0 additions & 9 deletions Source/BoundaryConditions/ERF_FillPatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 3 additions & 1 deletion Source/TimeIntegration/ERF_TimeStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 552ae9c

Please sign in to comment.