Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
SinkParticlesAccreteQuantities.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
18
20#include "shambackends/vec.hpp"
26#include <stdexcept>
27#include <vector>
28
29#define NODE_EDGES(X_RO, X_RW, X_RO_OPTIONAL, X_RW_OPTIONAL) \
30 /* ------------------- (param) inputs ------------------- */ \
31 X_RO(shamrock::solvergraph::IDataEdge<Tscal>, gpart_mass) \
32 X_RO(shamrock::solvergraph::IDataEdge<Tscal>, dt) \
33 \
34 /* ------------------- (field) inputs ------------------- */ \
35 X_RO(shamrock::solvergraph::Indexes<u32>, part_counts) \
36 X_RO(shamrock::solvergraph::IFieldSpan<Tvec>, positions) \
37 X_RO(shamrock::solvergraph::IFieldSpan<Tvec>, velocities) \
38 X_RO(shamrock::solvergraph::IFieldSpan<Tvec>, accelerations) \
39 \
40 /* ------------------- (field) dust inputs (monofluid TVA) ------------------- */ \
41 /* S_j = sqrt(rho epsilon_j), needs h to get rho */ \
42 X_RO_OPTIONAL(shamrock::solvergraph::IFieldSpan<Tscal>, hpart) \
43 X_RO_OPTIONAL(shamrock::solvergraph::IFieldSpan<Tscal>, s_j) \
44 \
45 /* ------------------- (sink) accretion table ------------------- */ \
46 X_RW(shamrock::solvergraph::Field<u32>, sink_accretion_table) \
47 \
48 /* ------------------- (sink) in/out ------------------- */ \
49 X_RW(shamrock::solvergraph::IDataEdge<std::vector<Tvec>>, sink_positions) \
50 X_RW(shamrock::solvergraph::IDataEdge<std::vector<Tvec>>, sink_velocities) \
51 X_RW(shamrock::solvergraph::IDataEdge<std::vector<Tvec>>, sink_accelerations) \
52 X_RW(shamrock::solvergraph::IDataEdge<std::vector<Tvec>>, sink_angmom) \
53 X_RW(shamrock::solvergraph::IDataEdge<std::vector<Tscal>>, sink_mass) \
54 X_RW_OPTIONAL(shamrock::solvergraph::IDataEdge<std::vector<Tscal>>, sink_accreted_dust_mass)
55
57
58 template<class Tvec>
60
61 using Tscal = shambase::VecComponent<Tvec>;
62
63 u32 ndust;
64 Tscal hfactd;
65
66 public:
73 SinkParticlesAccreteQuantities(u32 ndust = 0, Tscal hfactd = 0)
74 : ndust(ndust), hfactd(hfactd) {
75 if (ndust != 0 && hfactd == 0) {
77 "hfactd must be set when tracking the accreted dust mass (ndust != 0)");
78 }
79 }
80
81 EXPAND_NODE_EDGES_OPTIONAL(NODE_EDGES)
82
84
85 inline virtual std::string _impl_get_label() const {
86 return "SinkParticlesAccreteQuantities";
87 }
88
89 virtual std::string _impl_get_tex() const;
90 };
91
92} // namespace shammodels::sph::modules
93
94#undef NODE_EDGES
std::uint32_t u32
32 bit unsigned integer
virtual std::string _impl_get_label() const
get the label of the node
virtual std::string _impl_get_tex() const
get the tex of the node
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition INode.hpp:31
This header file contains utility functions related to exception handling in the code.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
namespace for the sph model modules