ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
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 "mpi_ensemble.h"
11#include "observer_pointer.h"
12#include "offline_data.h"
13#include "state_vector.h"
14
15#include <deal.II/base/parameter_acceptor.h>
16
17namespace ryujin
18{
29 template <typename Description, int dim, typename Number = double>
30 class SolutionTransfer final : public dealii::ParameterAcceptor
31 {
32 public:
37
40
41 using View = typename HyperbolicSystem::template View<dim, Number>;
42
43 using Limiter = typename Description::template Limiter<Number>;
44
45 using LimiterView = typename Limiter::template View<dim, Number>;
46
47 static constexpr auto problem_dimension = View::problem_dimension;
48
49 using state_type = typename View::state_type;
50
54 static constexpr unsigned int n_bounds = LimiterView::n_bounds;
55
59 using Bounds = typename LimiterView::Bounds;
60
61 using StateVector = typename View::StateVector;
62 using HyperbolicVector = typename View::HyperbolicVector;
63
65
69
73 SolutionTransfer(const MPIEnsemble &mpi_ensemble,
74 const OfflineData<dim, Number> &offline_data,
75 const HyperbolicSystem &hyperbolic_system,
76 const ParabolicSystem &parabolic_system,
77 const std::string &subsection = "/SolutionTransfer");
78
82 ~SolutionTransfer() override = default;
83
85
90
97 void prepare_projection(const StateVector &old_state_vector);
98
111 void project(StateVector &new_state_vector);
112
114
118
124 unsigned int get_handle() const
125 {
126 Assert(
127 handle_ != dealii::numbers::invalid_unsigned_int,
128 dealii::ExcMessage("Invalid handle: Cannot retrieve a valid "
129 "handle. get_handle() can only be called after a "
130 "call to prepare_projection(), or set_handle()."));
131 return handle_;
132 }
133
139 void set_handle(unsigned int handle)
140 {
141 Assert(
142 handle_ == dealii::numbers::invalid_unsigned_int,
143 dealii::ExcMessage("Invalid state: Cannot set handle because we "
144 "already have a valid handle due to a prior call "
145 "to prepare_projection(), or set_handle()."));
146 handle_ = handle;
147 }
148
155 {
156 handle_ = dealii::numbers::invalid_unsigned_int;
157 }
158
159 private:
161
165
166 Limiter limiter_;
167
169
173
174 const MPIEnsemble &mpi_ensemble_;
175
176 dealii::ObserverPointer<const OfflineData<dim, Number>> offline_data_;
177 dealii::ObserverPointer<const HyperbolicSystem> hyperbolic_system_;
178 dealii::ObserverPointer<const ParabolicSystem> parabolic_system_;
179
180 unsigned int handle_;
181
183
187
198 state_type read_tensor(const HyperbolicVector &U,
199 const dealii::types::global_dof_index global_i);
200
206 void add_tensor(HyperbolicVector &U,
207 const state_type &U_i,
208 const dealii::types::global_dof_index global_i);
209
211 };
212} // namespace ryujin
std::array< Number, n_bounds > Bounds
Definition limiter.h:151
static constexpr unsigned int n_bounds
Definition limiter.h:146
typename View::HyperbolicVector HyperbolicVector
unsigned int get_handle() const
typename HyperbolicSystem::template View< dim, Number > View
typename View::state_type state_type
typename Description::ParabolicSystem ParabolicSystem
~SolutionTransfer() override=default
typename Limiter::template View< dim, Number > LimiterView
static constexpr unsigned int n_bounds
void prepare_projection(const StateVector &old_state_vector)
static constexpr auto problem_dimension
void set_handle(unsigned int handle)
typename LimiterView::Bounds Bounds
typename Description::HyperbolicSystem HyperbolicSystem
void project(StateVector &new_state_vector)
typename Description::template Limiter< Number > Limiter
typename View::StateVector StateVector
Euler::HyperbolicSystem HyperbolicSystem
Definition description.h:34
ryujin::StubParabolicSystem ParabolicSystem
Definition description.h:36