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