63 template <DeviceBackend B>
76 template <DeviceBackend B, BCType T>
92#define DNDS_EULERP_BC_INTERFACE_APPLY \
93 template <class tU, class tUOut, class tx, class tn> \
94 DNDS_DEVICE_CALLABLE static void apply( \
95 tU &&U, tUOut &&UOut, int32_t uSiz, \
98 BCStorageVecDeviceView<B> value, PhysicsDeviceView<B> &phy)
101 template <DeviceBackend B>
111 template <DeviceBackend B>
121 template <DeviceBackend B>
131 template <DeviceBackend B>
141 template <DeviceBackend B>
151 template <DeviceBackend B>
161 template <DeviceBackend B>
171 template <DeviceBackend B>
181 template <DeviceBackend B>
191 template <DeviceBackend B>
209 template <DeviceBackend B>
212 BCStorageVecDeviceView<B> values;
226 BCStorageVecDeviceView<B> n_values,
229 : values(n_values),
id(n_id), type(n_type) {}
253 template <
class tU,
class tUOut,
class tx,
class tn>
258#define DNDS_EULERP_CASE_BC_APPLY(type) \
261 BCFunc_Impl<B, type>::apply(U, UOut, uSiz, x, n, id, values, phy); \
324 template <DeviceBackend B>
332 template <DeviceBackend B>
348 template <DeviceBackend B>
419 for (
auto &[name,
id] :
name2id.n2id_map)
422 bcs.at(
id).setId(
id);
428 bcs.at(
id).setType(
input.type);
429 bcs.at(
id).setId(
id);
430 bcs.at(
id).setValues(
input.value);
433 auto &
bcC = bcs.at(Geom::BC_ID_DEFAULT_WALL);
438 auto &
bcC = bcs.at(Geom::BC_ID_DEFAULT_WALL_INVIS);
443 auto &
bcC = bcs.at(Geom::BC_ID_DEFAULT_FAR);
447 for (
auto id : std::vector<Geom::t_index>{Geom::BC_ID_DEFAULT_SPECIAL_2DRiemann_FAR,
448 Geom::BC_ID_DEFAULT_SPECIAL_DMR_FAR,
449 Geom::BC_ID_DEFAULT_SPECIAL_IV_FAR,
450 Geom::BC_ID_DEFAULT_SPECIAL_RT_FAR})
452 auto &
bcC = bcs.at(
id);
506 template <DeviceBackend B>
541 template <DeviceBackend B>
545 bcs_device_view.resize(bcs.size());
553 bcs_device_view.to_device(B);
Extended enum-to-JSON serialization macro that also exposes allowed string values for JSON Schema gen...
#define DNDS_DEFINE_ENUM_JSON(EnumType_,...)
Define JSON serialization for an enum AND expose its allowed string values.
#define DNDS_DEVICE_TRIVIAL_COPY_DEFINE(T, T_Self)
#define DNDS_DEVICE_CALLABLE
#define DNDS_DEVICE_TRIVIAL_COPY_DEFINE_NO_EMPTY_CTOR(T, T_Self)
Device memory abstraction layer with backend-specific storage and factory creation.
#define DNDS_assert_info(expr, info)
Debug-only assertion with an extra std::string info message.
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
#define DNDS_HD_assert(cond)
Host-only expansion of DNDS_HD_assert (equivalent to DNDS_assert).
Core type definitions and utilities for the EulerP alternative Navier-Stokes evaluator module.
#define DNDS_EULERP_CASE_BC_APPLY(type)
#define DNDS_EULERP_BC_INTERFACE_APPLY
Macro defining the standard BC apply interface signature.
Physics model definitions for the EulerP module: gas properties, state conversions,...
#define DNDS_NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_ORDERED_AND_UNORDERED_JSON(Type,...)
Like DNDS_NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_ORDERED_JSON but additionally installs the unordered-JS...
Device-callable view of the BC handler providing BC lookup by zone ID.
DNDS_DEVICE_CALLABLE BC_DeviceView< B > & id2bc(Geom::t_index id)
Looks up a boundary condition by zone ID.
Host-side boundary condition handler managing all BC objects for a simulation.
void to_host()
Transfers all BC values to host memory.
t_deviceView< B > deviceView()
Creates a device view of all managed BCs for kernel invocation.
BC & id2bc(Geom::t_index id)
Looks up a boundary condition by zone ID.
void to_device(DeviceBackend B)
Transfers all BC values to the specified device backend.
DeviceBackend device()
Returns the device backend where BCs reside (asserts all BCs are on the same device).
BCHandler(const std::vector< BCInput > &bc_inputs, Geom::AutoAppendName2ID &name2id)
Constructs the BC handler from JSON-deserialized inputs and a name-to-ID map.
Device-callable view of a single boundary condition.
DNDS_DEVICE_CALLABLE int32_t getNValues() const
Returns the number of BC parameter values.
DNDS_DEVICE_CALLABLE BCType getType() const
Returns the boundary condition type.
DNDS_DEVICE_CALLABLE Geom::t_index getId() const
Returns the boundary zone ID.
DNDS_DEVICE_CALLABLE real value(int32_t i) const
Returns the i-th BC parameter value.
DNDS_DEVICE_CALLABLE void apply(tU &&U, tUOut &&UOut, int32_t uSiz, tx &&x, tn &&n, PhysicsDeviceView< B > &phy)
Applies this boundary condition to compute the ghost state.
Host-side boundary condition object managing parameter values and device transfer.
DeviceBackend device()
Returns the current device backend where BC values reside.
void setId(Geom::t_index n_id)
Sets the boundary zone ID.
BCType getType() const
Returns the BC type.
t_deviceView< B > deviceView()
Creates a device-callable view of this BC object.
void to_device(DeviceBackend B)
Transfers BC values to the specified device backend.
BC_DeviceView< B > t_deviceView
Device view type alias.
Geom::t_index getId() const
Returns the boundary zone ID.
auto getValues() const
Returns a copy of BC parameter values as std::vector.
void setValues(const std::vector< real > &v)
Sets BC parameter values from a vector.
void setType(BCType n_type)
Sets the BC type.
int32_t getNValues() const
Returns the number of parameter values.
real value(int i) const
Returns the i-th parameter value (bounds-checked).
void to_host()
Transfers BC values to host memory.
const T & at(size_t i) const
Host + optional device vector of trivially copyable T.
DNDS_HOST void to_device(DeviceBackend backend=DeviceBackend::Host)
t_deviceView< B, TSize > deviceView()
DNDS_HOST size_t size() const
Non-owning device-callable view {pointer, size} over a typed array.
Namespace for the EulerP alternative evaluator module with GPU support.
BCType
Enumeration of boundary condition types for the EulerP module.
@ InPsTs
Inflow with specified stagnation pressure and temperature.
@ WallInvis
Inviscid (slip) wall BC.
@ WallIsothermal
No-slip viscous wall with fixed temperature.
@ Out
Supersonic/subsonic outflow BC.
@ Unknown
Uninitialized or unrecognized BC type.
@ Wall
No-slip viscous wall (adiabatic).
@ Special
Special-purpose BC for benchmark cases (e.g., DMR, Riemann).
@ Far
Farfield BC (characteristic-based).
@ In
Supersonic/subsonic inflow BC.
@ OutP
Outflow with specified back-pressure.
the host side operators are provided as implemented
DeviceBackend
Enumerates the backends a DeviceStorage / Array can live on.
@ Unknown
Unset / sentinel.
const char * device_backend_name(DeviceBackend B)
Canonical string name for a DeviceBackend (used in log messages).
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
double real
Canonical floating-point scalar used throughout DNDSR (double precision).
Primary template for boundary condition function implementations.
Move-only device view wrapper owning the BC device view storage.
t_deviceView(const t_deviceView &R)=delete
t_deviceView & operator=(const t_deviceView &R)=delete
host_device_vector< BC_DeviceView< B > > bcs_device_view
Owned device storage of BC views.
t_deviceView(t_deviceView &&R) noexcept=default
only permit moving to avoid host_device_vector to change
t_deviceView(host_device_vector< BC_DeviceView< B > > &&n_bcs_device_view)
t_deviceView & operator=(t_deviceView &&R)=delete
BCHandlerDeviceView< B > view
The handler device view referencing bcs_device_view.
Device-callable view of physics parameters providing thermodynamic operations.
Eigen::Matrix< real, 5, 1 > v
Eigen::Vector3d n(1.0, 0.0, 0.0)