Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
boundary_condition/IsentropicPressureBoundary.hpp
Go to the documentation of this file.
1 // Copyright (c) 2019 Maikel Nadolski
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 
21 #ifndef FUB_AMREX_BOUNDARY_CONDITION_ISENTROPIC_HPP
22 #define FUB_AMREX_BOUNDARY_CONDITION_ISENTROPIC_HPP
23 
26 
27 #include "fub/ext/Log.hpp"
29 
30 #include <fmt/format.h>
31 
32 #include <optional>
33 
34 namespace fub::amrex {
35 
36 /// \ingroup BoundaryCondition
37 ///
41 
42  template <typename Log> void Print(Log& log) {
43  BOOST_LOG(log) << fmt::format(" - channel_name = {}", channel_name);
44  BOOST_LOG(log) << fmt::format(" - outer_pressure = {} [Pa]",
46  BOOST_LOG(log) << fmt::format(" - efficiency = {} [-]", efficiency);
47  if (boundary_section) {
48  std::array<int, AMREX_SPACEDIM> lower, upper;
49  std::copy_n(boundary_section->smallEnd().getVect(), AMREX_SPACEDIM,
50  lower.data());
51  std::copy_n(boundary_section->bigEnd().getVect(), AMREX_SPACEDIM,
52  upper.data());
53  BOOST_LOG(log) << fmt::format(
54  " - boundary_section = {{{{{}}}, {{{}}}}} [-]", lower, upper);
55  } else {
56  BOOST_LOG(log) << " - boundary_section = {} [-]";
57  }
58  BOOST_LOG(log) << fmt::format(" - direction = {} [-]", int(direction));
59  BOOST_LOG(log) << fmt::format(" - side = {} [-]", side);
60  }
61 
62  std::string channel_name{"IsentropicPressureBoundary"};
63  double outer_pressure = 101325.0;
64  double efficiency = 1.0;
65  std::optional<::amrex::Box> boundary_section{};
67  int side = 0;
68 };
69 
70 /// \ingroup BoundaryCondition
71 ///
72 /// \brief This boundary models an isentropic pressure expansion for the
73 /// one-dimensional ideal gas equations for mixtures.
75 public:
77  const IsentropicPressureBoundaryOptions& options);
78 
79  IsentropicPressureBoundary(const IdealGasMix<1>& eq, double outer_pressure,
80  Direction dir, int side);
81 
82  void FillBoundary(::amrex::MultiFab& mf, const GriddingAlgorithm& gridding,
83  int level);
84 
85  void FillBoundary(::amrex::MultiFab& mf, const GriddingAlgorithm& gridding,
86  int level, Direction dir);
87 
88  void FillBoundary(::amrex::MultiFab& mf, const ::amrex::Geometry& geom);
89 
90 private:
94  int side_;
95 };
96 
97 } // namespace fub::amrex
98 
99 #endif
This class modifies and initializes a PatchLevel in a PatchHierarchy.
Definition: AMReX/GriddingAlgorithm.hpp:60
This boundary models an isentropic pressure expansion for the one-dimensional ideal gas equations for...
Definition: boundary_condition/IsentropicPressureBoundary.hpp:74
int side_
Definition: boundary_condition/IsentropicPressureBoundary.hpp:94
Direction dir_
Definition: boundary_condition/IsentropicPressureBoundary.hpp:93
IsentropicPressureBoundary(const IdealGasMix< 1 > &eq, double outer_pressure, Direction dir, int side)
double outer_pressure_
Definition: boundary_condition/IsentropicPressureBoundary.hpp:92
IdealGasMix< 1 > equation_
Definition: boundary_condition/IsentropicPressureBoundary.hpp:91
void FillBoundary(::amrex::MultiFab &mf, const ::amrex::Geometry &geom)
void FillBoundary(::amrex::MultiFab &mf, const GriddingAlgorithm &gridding, int level, Direction dir)
IsentropicPressureBoundary(const IdealGasMix< 1 > &eq, const IsentropicPressureBoundaryOptions &options)
void FillBoundary(::amrex::MultiFab &mf, const GriddingAlgorithm &gridding, int level)
The amrex namespace.
Definition: AverageState.hpp:33
void Log(std::string message, Duration timepoint, boost::log::trivial::severity_level level=boost::log::trivial::severity_level::info)
Direction
This is a type safe type to denote a dimensional split direction.
Definition: Direction.hpp:30
std::map< std::string, pybind11::object > ProgramOptions
Definition: ProgramOptions.hpp:40
Definition: boundary_condition/IsentropicPressureBoundary.hpp:38
void Print(Log &log)
Definition: boundary_condition/IsentropicPressureBoundary.hpp:42
Direction direction
Definition: boundary_condition/IsentropicPressureBoundary.hpp:66
IsentropicPressureBoundaryOptions(const ProgramOptions &options)
std::string channel_name
Definition: boundary_condition/IsentropicPressureBoundary.hpp:62
int side
Definition: boundary_condition/IsentropicPressureBoundary.hpp:67
double efficiency
Definition: boundary_condition/IsentropicPressureBoundary.hpp:64
std::optional<::amrex::Box > boundary_section
Definition: boundary_condition/IsentropicPressureBoundary.hpp:65
double outer_pressure
Definition: boundary_condition/IsentropicPressureBoundary.hpp:63