![]() |
Shamrock 2025.10.0
Astrophysical Code
|
Compute the gravitational acceleration \( \mathbf{g} = -\nabla \phi \) of every cell. More...
#include <shammodels/ramses/include/shammodels/ramses/modules/NodeSelfGravityAcceleration.hpp>
Public Member Functions | |
| NodeSelfGravityAcceleration (u32 block_size) | |
| void | _impl_evaluate_internal () |
| evaluate the node | |
| 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 | |
| Public Member Functions inherited from shamrock::solvergraph::INode | |
| INode (const INode &)=delete | |
| INode & | operator= (const INode &)=delete |
| would violate shared_from_this() & unique UUID | |
| INode (INode &&) noexcept=default | |
| would violate shared_from_this() & unique UUID | |
| INode & | operator= (INode &&) noexcept=default |
| Move assignment - automatically delegates to base classes and members. | |
| u64 | get_uuid () const |
| Get the UUID of the node. | |
| std::shared_ptr< INode > | getptr_shared () |
| Get a shared pointer to this node. | |
| std::weak_ptr< INode > | getptr_weak () |
| Get a weak pointer to this node. | |
| std::vector< std::shared_ptr< IEdge > > & | get_ro_edges () |
| Get the read only edges. | |
| std::vector< std::shared_ptr< IEdge > > & | get_rw_edges () |
| Get the read write edges. | |
| void | __internal_set_ro_edges (std::vector< std::shared_ptr< IEdge > > new_ro_edges) |
| Set the read only edges. | |
| void | __internal_set_rw_edges (std::vector< std::shared_ptr< IEdge > > new_rw_edges) |
| Set the read write edges. | |
| template<class Func> | |
| void | on_edge_ro_edges (Func &&f) |
| Apply a function to the read only edges. | |
| template<class Func> | |
| void | on_edge_rw_edges (Func &&f) |
| Apply a function to the read write edges. | |
| virtual | ~INode () |
| template<class T> | |
| const T & | get_ro_edge (int slot) |
| Get a read only edge and cast it to the type T. | |
| template<class T> | |
| T & | get_rw_edge (int slot) |
| Get a read write edge and cast it to the type T. | |
| template<class T> | |
| std::optional< std::reference_wrapper< const T > > | get_ro_edge_optional (int slot) |
| Get a read only edge and cast it to the type T, return an optional. | |
| template<class T> | |
| std::optional< std::reference_wrapper< T > > | get_rw_edge_optional (int slot) |
| Get a read write edge and cast it to the type T, return an optional. | |
| const IEdge & | get_ro_edge_base (int slot) |
| Get a reference to a read only edge. | |
| const IEdge & | get_ro_edge_base (int slot) const |
| IEdge & | get_rw_edge_base (int slot) |
| Get a reference to a read write edge and cast it to the type IEdge. | |
| const IEdge & | get_rw_edge_base (int slot) const |
| void | evaluate () |
| Evaluate the node. | |
| std::string | get_dot_graph () |
| Get the dot graph of the node (Currently only an alias to get_dot_graph_partial). | |
| std::string | get_dot_graph_partial () |
| Get the dot graph of the subgraph corresponding to the node. | |
| std::string | get_dot_graph_node_start () |
| Get the id of the node start in the dot graph. | |
| std::string | get_dot_graph_node_end () |
| Get the id of the node end in the dot graph. | |
| std::string | get_tex () |
| Get the TeX of the node. | |
| std::string | get_tex_partial () |
| Get the TeX of the node partial. | |
| std::string | get_label () const |
| Get the label of the node. | |
| virtual std::string | print_node_info () const |
| print the node info | |
Additional Inherited Members | |
| Protected Member Functions inherited from shamrock::solvergraph::INode | |
| void | notify_self_state_update () |
| virtual std::string | _impl_get_dot_graph_partial () const |
| get the dot graph of the node partial | |
| virtual std::string | _impl_get_dot_graph_node_start () const |
| get the dot graph of the node start | |
| virtual std::string | _impl_get_dot_graph_node_end () const |
| get the dot graph of the node end | |
Compute the gravitational acceleration \( \mathbf{g} = -\nabla \phi \) of every cell.
In each direction the gradient is the mean of the gradients across the two faces, the gradient across a face being the mean over the neighbours of \( (\phi_b - \phi_i) / d \), with the same distances \( d \) between the cell centers as in laplacian_7pt ( \( \Delta x \) for a neighbour of the same level, \( 3 \Delta x / 2 \) for a coarser one and \( 3 \Delta x / 4 \) for a finer one). On a uniform grid this is the second order centered difference.
TODO: (kept from #1942) a face without any neighbour contributes a zero gradient that is still averaged with the other face, which halves the gradient in that direction (only matters for non periodic boundaries).
sizes holds the block counts per patch, each block holding block_size cells. spans_phi_g is resized to match sizes if needed.
Definition at line 60 of file NodeSelfGravityAcceleration.hpp.
|
inline |
Definition at line 67 of file NodeSelfGravityAcceleration.hpp.
|
virtual |
evaluate the node
Implements shamrock::solvergraph::INode.
Definition at line 91 of file NodeSelfGravityAcceleration.cpp.
|
inlinevirtual |
get the label of the node
Implements shamrock::solvergraph::INode.
Definition at line 73 of file NodeSelfGravityAcceleration.hpp.
|
virtual |
get the tex of the node
Implements shamrock::solvergraph::INode.
Definition at line 163 of file NodeSelfGravityAcceleration.cpp.