ryujin 2.5.0 revision 485f4d86eecc4b07216617ffc8f94b531c9f6085
Loading...
Searching...
No Matches
flux_kpp.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2023 - 2026 by the ryujin authors
4//
5
6#pragma once
7
8#include <ryujin/base/compile_time_options.h>
10
11namespace ryujin
12{
13 namespace Fluxes
14 {
20 class KPP : public Flux
21 {
22 public:
23 KPP(const std::string &subsection)
24 : Flux("kpp", subsection)
25 {
26 flux_formula_ = "f(u)={sin(u),cos(u)}";
27 }
28
29
30 double value(const double state,
31 const unsigned int direction) const override
32 {
33 switch (direction) {
34 case 0:
35 return std::sin(state);
36 case 1:
37 return std::cos(state);
38 default:
39 AssertThrow(false,
40 dealii::ExcMessage(
41 "KPP is only defined in (1 or) 2 space dimensions"));
42 __builtin_trap();
43 }
44 }
45
46
47 double gradient(const double state,
48 const unsigned int direction) const override
49 {
50 switch (direction) {
51 case 0:
52 return std::cos(state);
53 case 1:
54 return -std::sin(state);
55 default:
56 AssertThrow(false,
57 dealii::ExcMessage(
58 "KPP is only defined in (1 or) 2 space dimensions"));
59 __builtin_trap();
60 }
61 }
62 };
63 } // namespace Fluxes
64} // namespace ryujin
std::string flux_formula_
Definition flux.h:84
KPP(const std::string &subsection)
Definition flux_kpp.h:23
double gradient(const double state, const unsigned int direction) const override
Definition flux_kpp.h:47
double value(const double state, const unsigned int direction) const override
Definition flux_kpp.h:30