Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 : #include <memory>
8 :
9 : #include "DataStructures/DataBox/Tag.hpp"
10 : #include "Evolution/DgSubcell/SubcellOptions.hpp"
11 : #include "Evolution/DgSubcell/Tags/SubcellOptions.hpp"
12 : #include "Evolution/DgSubcell/Tags/SubcellSolver.hpp"
13 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Reconstructor.hpp"
14 : #include "Options/String.hpp"
15 : #include "Utilities/ErrorHandling/Error.hpp"
16 : #include "Utilities/TMPL.hpp"
17 :
18 : namespace grmhd::ValenciaDivClean::fd {
19 : /// Option tags for reconstruction
20 1 : namespace OptionTags {
21 : /// \brief Option tag for the reconstructor
22 1 : struct Reconstructor {
23 0 : using type = std::unique_ptr<fd::Reconstructor>;
24 :
25 0 : static constexpr Options::String help = {"The reconstruction scheme to use."};
26 0 : using group = evolution::dg::subcell::OptionTags::SubcellSolverGroup;
27 : };
28 : } // namespace OptionTags
29 :
30 : /// %Tags for reconstruction
31 1 : namespace Tags {
32 : /// \brief Tag for the reconstructor
33 1 : struct Reconstructor : db::SimpleTag {
34 0 : using type = std::unique_ptr<fd::Reconstructor>;
35 0 : using option_tags =
36 : tmpl::list<OptionTags::Reconstructor,
37 : ::evolution::dg::subcell::OptionTags::SubcellOptions>;
38 :
39 0 : static constexpr bool pass_metavariables = false;
40 0 : static type create_from_options(
41 : const type& reconstructor,
42 : const ::evolution::dg::subcell::SubcellOptions& subcell_options) {
43 : if (static_cast<int>(subcell_options.finite_difference_derivative_order()) <
44 : 0 and
45 : not reconstructor->supports_adaptive_order()) {
46 : ERROR_NO_TRACE(
47 : "Cannot use adaptive finite difference derivative order with "
48 : "specified reconstructor.");
49 : }
50 : if ((static_cast<int>(
51 : subcell_options.finite_difference_derivative_order()) /
52 : 2 -
53 : 1) > static_cast<int>(reconstructor->ghost_zone_size())) {
54 : ERROR_NO_TRACE(
55 : "The derivative order chosen ("
56 : << subcell_options.finite_difference_derivative_order()
57 : << ") requires more ghost zones ("
58 : << (static_cast<int>(
59 : subcell_options.finite_difference_derivative_order()) /
60 : 2 -
61 : 1)
62 : << ") than the reconstructor sends, "
63 : << reconstructor->ghost_zone_size());
64 : }
65 : return reconstructor->get_clone();
66 : }
67 : };
68 : } // namespace Tags
69 : } // namespace NewtonianEuler::fd
|