Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ComputeEos.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
19
21#include "shambackends/vec.hpp"
28#include <memory>
29#include <optional>
30
32
38 template<class Tvec, template<class> class SPHKernel>
39 class ComputeEos {
40 public:
41 using Tscal = shambase::VecComponent<Tvec>;
42 static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension;
43 using Kernel = SPHKernel<Tscal>;
44
45 using Config = SolverConfig<Tvec, SPHKernel>;
46 using Storage = SolverStorage<Tvec, u32>;
47
48 ShamrockCtx &context;
49 Config &solver_config;
50 Storage &storage;
51
52 ComputeEos(ShamrockCtx &context, Config &solver_config, Storage &storage)
53 : context(context), solver_config(solver_config), storage(storage) {}
54
56 void compute_eos();
57
58 private:
59 void compute_eos_internal(
60 const std::shared_ptr<shamrock::solvergraph::IDataEdge<Tscal>> &hfactd,
61 const std::shared_ptr<shamrock::solvergraph::IDataEdge<Tscal>> &pmass,
62 const std::optional<std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>>>
63 &spans_rho,
64 const std::optional<std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>>> &spans_h,
65 const std::optional<std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>>>
66 &spans_uint,
67 const std::shared_ptr<shamrock::solvergraph::Indexes<u32>> &sizes,
68 const std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> &spans_pressure,
69 const std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> &spans_soundspeed);
70
71 inline PatchScheduler &scheduler() { return shambase::get_check_ref(context.sched); }
72 };
73
74} // namespace shammodels::sph::modules
std::uint32_t u32
32 bit unsigned integer
The MPI scheduler.
void compute_eos()
Computes pressure and sound speed from equation of state.
Interface for a solver graph edge representing a field as spans.
T & get_check_ref(const std::unique_ptr< T > &ptr, SourceLocation loc=SourceLocation())
Takes a std::unique_ptr and returns a reference to the object it holds. It throws a std::runtime_erro...
Definition memory.hpp:112
namespace for the sph model modules
The configuration for a sph solver.