ryujin 2.1.1 revision 7ab52d499a3934b3ba6afcabe5103994024860b0
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 by the ryujin authors
4//
5
6#pragma once
7
8#include "flux.h"
9
10namespace ryujin
11{
12 namespace FluxLibrary
13 {
19 class KPP : public Flux
20 {
21 public:
22 KPP(const std::string &subsection)
23 : Flux("kpp", subsection)
24 {
25 flux_formula_ = "f(u)={sin(u),cos(u)}";
26 }
27
28
29 double value(const double state,
30 const unsigned int direction) const override
31 {
32 switch (direction) {
33 case 0:
34 return std::sin(state);
35 case 1:
36 return std::cos(state);
37 default:
38 AssertThrow(false,
39 dealii::ExcMessage(
40 "KPP is only defined in (1 or) 2 space dimensions"));
41 __builtin_trap();
42 }
43 }
44
45
46 double gradient(const double state,
47 const unsigned int direction) const override
48 {
49 switch (direction) {
50 case 0:
51 return std::cos(state);
52 case 1:
53 return -std::sin(state);
54 default:
55 AssertThrow(false,
56 dealii::ExcMessage(
57 "KPP is only defined in (1 or) 2 space dimensions"));
58 __builtin_trap();
59 }
60 }
61 };
62 } // namespace FluxLibrary
63} // namespace ryujin
std::string flux_formula_
Definition: flux.h:87
double value(const double state, const unsigned int direction) const override
Definition: flux_kpp.h:29
KPP(const std::string &subsection)
Definition: flux_kpp.h:22
double gradient(const double state, const unsigned int direction) const override
Definition: flux_kpp.h:46