38 template <DeviceBackend B>
85 config_data.merge_patch(config_in);
128 template <
typename Tc>
156 if (u.
father->Size() !=
fv->mesh->NumFace())
161 if (u.
son->Size() !=
fv->mesh->NumFaceGhost())
163 auto B =
fv->device();
184 if (u.
father->Size() !=
fv->mesh->NumFace())
189 if (u.
son->Size() !=
fv->mesh->NumFaceGhost())
191 auto B =
fv->device();
219 return std::make_tuple(
261 const std::vector<std::string> &arrCellCentScalar_names_in,
263 const std::vector<std::string> &arrCellCentVec_names_in,
265 const std::vector<std::string> &arrNodeScalar_names_in,
267 const std::vector<std::string> &arrNodeVec_names_in,
303 template <DeviceBackend B>
319 static_assert(std::is_trivially_copyable_v<
remove_cvref_t<
decltype(
fv->deviceView<B>())>>);
330 template <DeviceBackend B>
392 template <
class TPair>
395 const std::string &name =
"unknown",
401 std::string
emit_info = fmt::format(
"{} varloc {} check failure", name,
varloc);
458 return std::make_tuple(
473 for (
size_t i = 0; i <
uScalar.size(); i++)
520 return std::make_tuple(
544 using namespace std::string_literals;
557 for (
size_t i = 0; i <
v.size(); i++)
602 return std::make_tuple(
619 using namespace std::string_literals;
631 for (
size_t i = 0; i <
v.size(); i++)
674 return std::make_tuple(
695 if (std::set<std::string>{
745 return std::make_tuple(
765 using namespace std::string_literals;
770 auto name_last2 = name.substr(std::max(name.size(), 2ul) - 2, 2);
779 for (
size_t i = 0; i <
v.size(); i++)
845 return std::make_tuple(
885 using namespace std::string_literals;
890 auto name_last2 = name.substr(std::max(name.size(), 2ul) - 2, 2);
899 for (
size_t i = 0; i <
v.size(); i++)
918 void Flux2nd(Flux2nd_Arg &arg);
Degree-of-freedom array with vector-space operations (MPI-collective).
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
#define DNDS_DEVICE_CALLABLE
#define DNDS_DEVICE_TRIVIAL_COPY_DEFINE_NO_EMPTY_CTOR(T, T_Self)
Helpers for shipping an array-of-views (e.g., ArrayDeviceView) to the device in one contiguous buffer...
Device memory abstraction layer with backend-specific storage and factory creation.
Assertion / error-handling macros and supporting helper functions.
#define DNDS_check_throw_info(expr, info)
Same as DNDS_check_throw but attaches a user-supplied info message to the thrown std::runtime_error.
#define DNDS_check_throw(expr)
Runtime check active in both debug and release builds. Throws std::runtime_error if expr evaluates to...
Core type definitions and utilities for the EulerP alternative Navier-Stokes evaluator module.
Boundary condition types, implementations, and handler for the EulerP module.
Physics model definitions for the EulerP module: gas properties, state conversions,...
Tiny reflection-style helpers (MemberRef, MemberPtr) and for_each_member_* visitors used by config / ...
#define DNDS_MAKE_1_MEMBER_PTR_SELF(member)
Like DNDS_MAKE_1_MEMBER_PTR but uses the surrounding t_self alias, common in DNDSR member definitions...
void to_device(DeviceBackend backend)
Mirror both father and son to the given device backend.
void to_host()
Bring both father and son mirrors back to host memory.
Device-callable view of the BC handler providing BC lookup by zone ID.
CRTP base class for packed kernel argument structs used by the Evaluator.
JSON-configurable settings for the Evaluator.
void merge_patch(const t_jsonconfig &config_in)
Validates and applies a JSON merge-patch to the configuration.
const t_jsonconfig & config() const
Returns a const reference to the underlying JSON configuration.
EvaluatorConfig()
Constructs the config with default values (threadsPerBlock=128, etc.).
void valid_patch_keys(const t_jsonconfig &config_in)
Validates that all keys in config_in exist in the current defaults.
Device-callable view of the Evaluator, combining finite volume, BC handler, and physics views.
t_bcHandler bcHandler
Device view of the boundary condition handler.
t_fv fv
Device view of the finite volume / VFV reconstruction object.
t_physics physics
Device view of the gas physics model.
Main EulerP evaluator orchestrating CFD kernel dispatch for compressible N-S solvers.
const t_jsonconfig & get_config()
Returns a const reference to the JSON configuration.
void RecGradient(RecGradient_Arg &arg)
Performs Green-Gauss gradient reconstruction with Barth-Jespersen limiting.
t_bcHandler bcHandler
Shared pointer to the boundary condition handler.
void to_host()
Transfers all sub-objects and face buffers from device memory back to host.
void Flux2nd(Flux2nd_Arg &arg)
Evaluates 2nd-order inviscid (Roe) flux and accumulates into the cell RHS residual.
void checkValidUDof(const ssp< TPair > &u, const std::string &name="unknown", int varloc=0, bool includeSon=true, DeviceBackend B=DeviceBackend::Unknown, bool optional=false)
Validates that a DOF array pair has the expected sizes and device placement.
DeviceBackend device()
Queries and validates the device backend across all sub-objects.
void PrintDataVTKHDF(std::string fname, std::string series_name, std::vector< ssp< TUScalar > > &arrCellCentScalar, const std::vector< std::string > &arrCellCentScalar_names_in, std::vector< ssp< TUVec > > &arrCellCentVec, const std::vector< std::string > &arrCellCentVec_names_in, std::vector< ssp< TUScalar > > &arrNodeScalar, const std::vector< std::string > &arrNodeScalar_names_in, std::vector< ssp< TUVec > > &arrNodeVec, const std::vector< std::string > &arrNodeVec_names_in, ssp< TUDof > uPrimCell, ssp< TUDof > uPrimNode, double t)
Writes cell-centered and node-centered field data to a VTK-HDF5 file.
void PrepareFaceBuffer(int nVarsScalar)
Prepares all face buffers (DOF + scalars) for left and right states.
void to_device(DeviceBackend B)
Transfers all sub-objects and face buffers to the specified device backend.
void EstEigenDt(EstEigenDt_Arg &arg)
Estimates per-face eigenvalues and computes per-cell local time steps.
t_config config
Runtime configuration (Riemann solver, CUDA settings, etc.).
TUDof u_face_bufferL
Left-side face DOF buffer for boundary value storage.
void BuildFaceBufferDof(TUDof &u)
Allocates or resizes the face DOF buffer u to match the current mesh face count.
void BuildFaceBufferDofScalar(TUScalar &u)
Allocates or resizes a scalar face buffer to match the current mesh face count.
void Cons2Prim(Cons2Prim_Arg &arg)
Converts conservative variables to primitive variables (no gradients or viscosity).
t_fv fv
Shared pointer to the Compact Finite Volume (VFV) reconstruction object.
void RecFace2nd(RecFace2nd_Arg &arg)
Performs 2nd-order face value reconstruction from cell-centered data.
void set_config(Tc &&config_in)
Merges a JSON patch into the evaluator configuration.
t_physics physics
Shared pointer to the gas physics model.
TUDof u_face_bufferR
Right-side face DOF buffer for boundary value storage.
static auto device_array_list_Buffer()
Returns a tuple of member pointers to face buffer arrays for device transfer.
std::vector< TUScalar > uScalar_face_bufferR
Right-side face scalar buffers for additional transported scalars.
Evaluator(t_fv n_fv, t_bcHandler n_bcHandler, t_physics n_physics)
Constructs the Evaluator with the given finite volume, BC handler, and physics objects.
t_deviceView< B > deviceView()
Creates a device view for backend B from the current evaluator state.
void Cons2PrimMu(Cons2PrimMu_Arg &arg)
Converts conservative variables to primitive variables and computes viscosity.
std::vector< TUScalar > uScalar_face_bufferL
Left-side face scalar buffers for additional transported scalars.
Namespace for the EulerP alternative evaluator module with GPU support.
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).
std::remove_cv_t< std::remove_reference_t< T > > remove_cvref_t
Convenience remove_cv + remove_reference composition (C++17 port of C++20's std::remove_cvref_t).
void for_each_member_ptr_list(Class &obj, TList &&obj_member_ptr_list, F &&f)
Invoke f(name, obj.*ptr) for every member in a list of MemberPtr.
std::shared_ptr< T > ssp
Shortened alias for std::shared_ptr used pervasively in DNDSR.
ssp< T > make_ssp(Args &&...args)
Type-safe replacement for DNDS_MAKE_SSP. Creates ssp<T> with forwarded args.
nlohmann::ordered_json t_jsonconfig
Project-wide JSON type alias: nlohmann/json with ordered keys.
ssp< TArray > father
Owned-side array (must be resized before ghost setup).
ssp< TArray > son
Ghost-side array (sized automatically by createMPITypes / BorrowAndPull).
Packed argument struct for conservative-to-primitive conversion with viscosity computation.
ssp< TUGrad > uGrad
Gradient of conservative state (input).
static auto member_list()
Returns a tuple of member-to-pointer mappings for CRTP iteration / device transfer.
ssp< TUScalar > gamma
Ratio of specific heats (output).
ssp< TUScalar > mu
Total (laminar + turbulent) viscosity (output).
std::vector< ssp< TUScalar > > muComp
Component-wise viscosity contributions (output).
ssp< TUScalar > a
Speed of sound (output).
ssp< TUDof > uPrim
Primitive state (output).
std::vector< ssp< TUScalarGrad > > uScalarGradPrim
Gradients of primitive scalars (output).
ssp< TUGrad > uGradPrim
Gradient of primitive state (output).
std::vector< ssp< TUScalar > > uScalar
Transported scalar fields (input).
void Validate(Evaluator &self)
Validates all member arrays against the mesh topology and device backend.
std::vector< ssp< TUScalarGrad > > uScalarGrad
Gradients of transported scalars (input).
ssp< TUScalar > p
Pressure (output).
ssp< TUScalar > T
Temperature (output).
ssp< TUDof > u
Conservative state (input).
std::vector< ssp< TUScalar > > uScalarPrim
Primitive transported scalars (output).
Packed argument struct for conservative-to-primitive conversion without gradients or viscosity.
ssp< TUScalar > a
Speed of sound (output).
ssp< TUScalar > p
Pressure (output).
static auto member_list()
Returns a tuple of member-to-pointer mappings for CRTP iteration / device transfer.
ssp< TUScalar > gamma
Ratio of specific heats (output).
ssp< TUScalar > T
Temperature (output).
void Validate(Evaluator &self)
Validates all member arrays against the mesh topology and device backend.
ssp< TUDof > u
Conservative state (input).
std::vector< ssp< TUScalar > > uScalarPrim
Primitive transported scalars (output).
ssp< TUDof > uPrim
Primitive state (output).
std::vector< ssp< TUScalar > > uScalar
Transported scalar fields (input).
Packed argument struct for eigenvalue estimation and local time-step computation.
ssp< TUDof > u
Conservative state (cell-centered, input).
ssp< TUScalar > deltaLamFace
Per-face eigenvalue difference for H-correction (output).
static auto member_list()
Returns a tuple of member-to-pointer mappings for CRTP iteration / device transfer.
ssp< TUScalar > faceLamVisEst
Per-face viscous eigenvalue estimate (output).
ssp< TUScalar > deltaLamCell
Per-cell maximum eigenvalue difference (output).
ssp< TUScalarGrad > faceLamEst
Per-face eigenvalue estimates [lam-, lam0, lam+] (output).
ssp< TUScalar > muCell
Per-cell total viscosity (input).
ssp< TUScalar > aCell
Per-cell speed of sound (input).
ssp< TUScalar > dt
Per-cell local time step (output).
void Validate(Evaluator &self)
Validates all member arrays, distinguishing cell-located from face-located fields.
Packed argument struct for 2nd-order inviscid (and eventually viscous) flux evaluation.
std::vector< ssp< TUScalar > > uScalarFR
Right reconstructed scalar face values (input).
std::vector< ssp< TUScalarGrad > > uScalarGradFF
Face-averaged scalar gradients (input).
std::vector< ssp< TUScalarGrad > > uScalarGrad
Gradients of transported scalars (input).
ssp< TUDof > uPrim
Primitive state (cell-centered, input).
ssp< TUScalar > T
Temperature (cell-centered, input).
std::vector< ssp< TUScalar > > fluxScalarFF
Scalar numerical flux at each face (output).
ssp< TUGrad > uGradPrim
Gradient of primitive state (input).
std::vector< ssp< TUScalar > > muComp
Component-wise viscosity contributions (input).
std::vector< ssp< TUScalar > > uScalar
Transported scalar fields (input).
ssp< TUGrad > uGrad
Gradient of conservative state (input).
ssp< TUScalar > pFL
Left face pressure (face-located, input).
static auto member_list()
Returns a tuple of member-to-pointer mappings for CRTP iteration / device transfer.
ssp< TUGrad > uGradFF
Face-averaged gradient (face-located, input).
std::vector< ssp< TUScalar > > rhsScalar
Accumulated scalar RHS residual (cell-centered, in-out).
ssp< TUScalar > gamma
Ratio of specific heats (cell-centered, input).
std::vector< ssp< TUScalar > > uScalarPrim
Primitive transported scalars (input).
ssp< TUScalar > mu
Total viscosity (cell-centered, input).
ssp< TUDof > uFR
Right reconstructed face values (face-located, input).
std::vector< ssp< TUScalar > > uScalarFL
Left reconstructed scalar face values (input).
ssp< TUDof > u
Conservative state (cell-centered, input).
ssp< TUScalar > deltaLamCell
Per-cell eigenvalue difference for H-correction (input).
ssp< TUScalar > a
Speed of sound (cell-centered, input).
void Validate(Evaluator &self)
Validates member arrays, auto-detecting cell vs. face location by name suffix.
ssp< TUDof > uFL
Left reconstructed face values (face-located, input).
ssp< TUScalar > pFR
Right face pressure (face-located, input).
std::vector< ssp< TUScalarGrad > > uScalarGradPrim
Gradients of primitive scalars (input).
ssp< TUDof > fluxFF
Numerical flux at each face (face-located, output).
ssp< TUScalar > p
Pressure (cell-centered, input).
ssp< TUDof > rhs
Accumulated right-hand-side residual (cell-centered, in-out).
Packed argument struct for 2nd-order face value reconstruction.
std::vector< ssp< TUScalar > > uScalarFR
Right reconstructed scalar face values (output).
std::vector< ssp< TUScalarGrad > > uScalarGradFF
Face-averaged scalar gradients (output).
std::vector< ssp< TUScalar > > uScalarFL
Left reconstructed scalar face values (output).
void Validate(Evaluator &self)
Validates member arrays, auto-detecting cell vs. face location by name suffix.
ssp< TUGrad > uGradFF
Face-averaged gradient (face-located, output).
std::vector< ssp< TUScalar > > uScalar
Cell-centered transported scalars (input).
ssp< TUDof > uFL
Left reconstructed face values (face-located, output).
ssp< TUGrad > uGrad
Cell gradient of conservative state (input).
ssp< TUDof > u
Conservative state (cell-centered, input).
static auto member_list()
Returns a tuple of member-to-pointer mappings for CRTP iteration / device transfer.
ssp< TUDof > uFR
Right reconstructed face values (face-located, output).
std::vector< ssp< TUScalarGrad > > uScalarGrad
Gradients of transported scalars (input).
Packed argument struct for Green-Gauss gradient reconstruction with Barth-Jespersen limiting.
std::vector< ssp< TUScalar > > uScalar
Additional transported scalar fields (cell-centered).
ssp< TUDof > u
Conservative state vector (cell-centered, nVarsFlow components).
void Validate(Evaluator &self)
Validates all member arrays against the mesh topology and device backend.
std::vector< ssp< TUScalarGrad > > uScalarGrad
Gradients of transported scalars (in-out).
ssp< TUGrad > uGrad
Gradient of conservative state (in-out: reconstructed by Green-Gauss).
static auto member_list()
Returns a tuple of member-to-pointer mappings for CRTP iteration / device transfer.
Non-trivially-copyable device view holding shared_ptr to fv and device views of BC/physics.
t_physics::element_type::t_deviceView< B > physics
t_deviceView(const t_deviceView &R)=delete
ssp< CFV::FiniteVolume > fv
t_deviceView & operator=(t_deviceView &&R)=delete
t_bcHandler::element_type::t_deviceView< B > bcHandler
t_deviceView & operator=(const t_deviceView &R)=delete
t_deviceView(t_deviceView &&R) noexcept=default
only permit moving to avoid host_device_vector to change
Device-callable view of physics parameters providing thermodynamic operations.
Tag type for naming objects created via make_ssp.
Eigen::Matrix< real, 5, 1 > v