ryujin 2.1.1 revision e1e0c9cf84519540dcc04ed5bb49dc8a8c052779
Loading...
Searching...
No Matches
solution_transfer.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception or LGPL-2.1-or-later
3// Copyright (C) 2020 - 2026 by the ryujin authors
4//
5
6#pragma once
7
8#include <compile_time_options.h>
9
10#include <ryujin/interface/parabolic_system.h>
11
12#include "mpi_ensemble.h"
13#include "observer_pointer.h"
14#include "offline_data.h"
15#include "state_vector.h"
16
17#include <deal.II/base/parameter_acceptor.h>
18
19#include <utility>
20
21namespace ryujin
22{
33 template <typename HyperbolicDescription, int dim, typename Number = double>
34 class SolutionTransfer final : public dealii::ParameterAcceptor
35 {
36 public:
41
43
44 using View = typename HyperbolicSystem::template View<dim, Number>;
45
46 using Limiter = typename HyperbolicDescription::template Limiter<Number>;
47
49 decltype(std::declval<const Limiter &>().template view<dim, Number>());
50
51 static constexpr auto problem_dimension = View::problem_dimension;
52
53 static constexpr auto n_precomputed_values = View::n_precomputed_values;
54
55 using state_type = typename View::state_type;
56
60 static constexpr unsigned int n_bounds = LimiterView::n_bounds;
61
65 using Bounds = typename LimiterView::Bounds;
66
68
72
76 SolutionTransfer(const MPIEnsemble &mpi_ensemble,
77 const OfflineData<dim, Number> &offline_data,
78 const HyperbolicSystem &hyperbolic_system,
79 const Interface::ParabolicSystem &parabolic_system,
80 const std::string &subsection = "/SolutionTransfer");
81
85 ~SolutionTransfer() override = default;
86
88
93
100 void prepare_projection(const StateVector<Number> &old_state_vector);
101
114 void project(StateVector<Number> &new_state_vector);
115
117
121
127 unsigned int get_handle() const
128 {
129 Assert(
130 handle_ != dealii::numbers::invalid_unsigned_int,
131 dealii::ExcMessage("Invalid handle: Cannot retrieve a valid "
132 "handle. get_handle() can only be called after a "
133 "call to prepare_projection(), or set_handle()."));
134 return handle_;
135 }
136
142 void set_handle(unsigned int handle)
143 {
144 Assert(
145 handle_ == dealii::numbers::invalid_unsigned_int,
146 dealii::ExcMessage("Invalid state: Cannot set handle because we "
147 "already have a valid handle due to a prior call "
148 "to prepare_projection(), or set_handle()."));
149 handle_ = handle;
150 }
151
158 {
159 handle_ = dealii::numbers::invalid_unsigned_int;
160 }
161
162 private:
164
168
169 Limiter limiter_;
170
172
176
177 const MPIEnsemble &mpi_ensemble_;
178
179 dealii::ObserverPointer<const OfflineData<dim, Number>> offline_data_;
180 dealii::ObserverPointer<const HyperbolicSystem> hyperbolic_system_;
181 dealii::ObserverPointer<const Interface::ParabolicSystem> parabolic_system_;
182
183 unsigned int handle_;
184
186
190
201 state_type read_tensor(const MultiComponentVector<Number> &U,
202 const dealii::types::global_dof_index global_i);
203
209 void add_tensor(MultiComponentVector<Number> &U,
210 const state_type &U_i,
211 const dealii::types::global_dof_index global_i);
212
214 };
215} // namespace ryujin
static constexpr unsigned int n_bounds
Definition limiter.h:165
std::array< Number, n_bounds > Bounds
Definition limiter.h:170
void prepare_projection(const StateVector< Number > &old_state_vector)
typename HyperbolicDescription::template Limiter< Number > Limiter
~SolutionTransfer() override=default
static constexpr unsigned int n_bounds
typename HyperbolicSystem::template View< dim, Number > View
typename HyperbolicDescription::HyperbolicSystem HyperbolicSystem
static constexpr auto problem_dimension
typename LimiterView::Bounds Bounds
unsigned int get_handle() const
void set_handle(unsigned int handle)
static constexpr auto n_precomputed_values
typename View::state_type state_type
void project(StateVector< Number > &new_state_vector)