Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <array>
7 : #include <cstddef>
8 : #include <pup.h>
9 :
10 : #include "Domain/Amr/Flag.hpp"
11 : #include "Domain/Creators/Tags/Domain.hpp"
12 : #include "Domain/Domain.hpp"
13 : #include "Domain/Structure/ElementId.hpp"
14 : #include "Domain/Tags.hpp"
15 : #include "Elliptic/Tags.hpp"
16 : #include "Options/String.hpp"
17 : #include "Parallel/GlobalCache.hpp"
18 : #include "ParallelAlgorithms/Amr/Criteria/Criterion.hpp"
19 : #include "ParallelAlgorithms/Amr/Criteria/Type.hpp"
20 : #include "PointwiseFunctions/InitialDataUtilities/Background.hpp"
21 : #include "Utilities/Serialization/CharmPupable.hpp"
22 : #include "Utilities/TMPL.hpp"
23 :
24 0 : namespace ScalarSelfForce::AmrCriteria {
25 :
26 : /*!
27 : * \brief h-refine (split) elements containing a puncture
28 : *
29 : * This refinement scheme is expected to yield exponential convergence, despite
30 : * the presence of the non-smooth punctures.
31 : *
32 : * Currently only works with ScalarSelfForce::AnalyticData::CircularOrbit.
33 : * For more generic orbits, the refinement needs to happen not only at a single
34 : * point but along the trajectory of the puncture.
35 : */
36 1 : class RefineAtPuncture : public amr::Criterion {
37 : public:
38 0 : using options = tmpl::list<>;
39 :
40 0 : static constexpr Options::String help = {
41 : "h-refine (split) elements containing a puncture."};
42 :
43 0 : RefineAtPuncture() = default;
44 :
45 : /// \cond
46 : explicit RefineAtPuncture(CkMigrateMessage* msg) : Criterion(msg) {}
47 : using PUP::able::register_constructor;
48 : WRAPPED_PUPable_decl_template(RefineAtPuncture); // NOLINT
49 : /// \endcond
50 :
51 0 : amr::Criteria::Type type() override { return amr::Criteria::Type::h; }
52 :
53 0 : std::string observation_name() override { return "RefineAtPuncture"; }
54 :
55 0 : using argument_tags = tmpl::list<
56 : elliptic::Tags::Background<elliptic::analytic_data::Background>,
57 : domain::Tags::Domain<2>>;
58 0 : using compute_tags_for_observation_box = tmpl::list<>;
59 :
60 : template <typename Metavariables>
61 0 : std::array<amr::Flag, 2> operator()(
62 : const elliptic::analytic_data::Background& background,
63 : const Domain<2>& domain, Parallel::GlobalCache<Metavariables>& /*cache*/,
64 : const ElementId<2>& element_id) const {
65 : return impl(background, domain, element_id);
66 : }
67 :
68 : private:
69 0 : static std::array<amr::Flag, 2> impl(
70 : const elliptic::analytic_data::Background& background,
71 : const Domain<2>& domain, const ElementId<2>& element_id);
72 : };
73 :
74 : } // namespace ScalarSelfForce::AmrCriteria
|