Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammodels
sph
include
shammodels
sph
modules
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
19
#include "
shambase/exception.hpp
"
20
#include "
shambackends/vec.hpp
"
21
#include "
shamrock/solvergraph/Field.hpp
"
22
#include "
shamrock/solvergraph/IFieldSpan.hpp
"
23
#include "
shamrock/solvergraph/Indexes.hpp
"
24
#include "
shamsolvergraph/edge/IDataEdge.hpp
"
25
#include "
shamsolvergraph/node/INode.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
56
namespace
shammodels::sph::modules
{
57
58
template
<
class
Tvec>
59
class
SinkParticlesAccreteQuantities
:
public
shamrock::solvergraph::INode
{
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) {
76
shambase::throw_with_loc<std::invalid_argument>
(
77
"hfactd must be set when tracking the accreted dust mass (ndust != 0)"
);
78
}
79
}
80
81
EXPAND_NODE_EDGES_OPTIONAL(NODE_EDGES)
82
83
void
_impl_evaluate_internal
();
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
Field.hpp
IDataEdge.hpp
IFieldSpan.hpp
INode.hpp
Indexes.hpp
u32
std::uint32_t u32
32 bit unsigned integer
Definition
aliases_int.hpp:27
shammodels::sph::modules::SinkParticlesAccreteQuantities::_impl_get_label
virtual std::string _impl_get_label() const
get the label of the node
Definition
SinkParticlesAccreteQuantities.hpp:85
shammodels::sph::modules::SinkParticlesAccreteQuantities::_impl_get_tex
virtual std::string _impl_get_tex() const
get the tex of the node
Definition
SinkParticlesAccreteQuantities.cpp:258
shammodels::sph::modules::SinkParticlesAccreteQuantities::SinkParticlesAccreteQuantities
SinkParticlesAccreteQuantities(u32 ndust=0, Tscal hfactd=0)
Definition
SinkParticlesAccreteQuantities.hpp:73
shammodels::sph::modules::SinkParticlesAccreteQuantities::_impl_evaluate_internal
void _impl_evaluate_internal()
evaluate the node
Definition
SinkParticlesAccreteQuantities.cpp:36
shamrock::solvergraph::INode
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition
INode.hpp:31
exception.hpp
This header file contains utility functions related to exception handling in the code.
shambase::throw_with_loc
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
Definition
exception.hpp:132
shammodels::sph::modules
namespace for the sph model modules
Definition
AnalysisAngularMomentum.hpp:28
vec.hpp
Generated on
for Shamrock by
1.15.0