forked from AMReX-Combustion/PelePhysics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPelePhysics.H
67 lines (55 loc) · 1.63 KB
/
PelePhysics.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef PELEPHYSICS_H
#define PELEPHYSICS_H
#include <type_traits>
#include <iostream>
#include "PhysicsConstants.H"
#include "PelePhysicsConstraints.H"
#include "EOS.H"
#include "Transport.H"
namespace pele::physics {
template <typename T>
struct is_eos_type
{
static constexpr bool value = std::is_base_of_v<typename T::eos_type, T>;
};
template <typename T>
struct is_transport_type
{
static constexpr bool value =
std::is_base_of_v<typename T::transport_type, T>;
};
template <typename EosModel, typename TransportModel>
struct PelePhysics
{
static_assert(
is_eos_type<EosModel>::value,
"PelePhysics must have EOS model as its first argument");
static_assert(
is_transport_type<TransportModel>::value,
"PelePhysics must have Transport model as its second argument");
static_assert(
is_valid_physics_combination<EosModel, TransportModel>::value,
"Invalid physics combination attempted");
using eos_type = typename EosModel::eos_type;
using transport_type = typename TransportModel::transport_type;
static std::string identifier()
{
if (std::is_same_v<EosModel, TransportModel>) {
return EosModel::identifier();
}
return EosModel::identifier() + "-" + TransportModel::identifier();
}
template <class... Args>
AMREX_GPU_HOST_DEVICE static eos_type eos(Args... args)
{
return eos_type(std::forward<Args>(args)...);
}
template <class... Args>
AMREX_GPU_HOST_DEVICE static transport_type transport(Args... args)
{
return transport_type(std::forward<Args>(args)...);
}
};
using PhysicsType = PelePhysics<EosType, TransportType>;
} // namespace pele::physics
#endif