![]() |
Shamrock 2025.10.0
Astrophysical Code
|
Solve \( \Delta \phi = 4 \pi G (\rho - \bar{\rho}) \) with the BiCGSTAB method, starting from the current content of spans_phi. More...
#include <shammodels/ramses/include/shammodels/ramses/modules/NodeBiCGSTABLoop.hpp>
Classes | |
| struct | Edges |
Public Member Functions | |
| NodeBiCGSTABLoop (u32 block_size, Tscal fourPiG, u32 Niter_max, Tscal tol_cvg, Tscal tol_happy_bk) | |
| void | set_edges (INODE_PARAM_RO(shamrock::solvergraph::Indexes< u32 >, sizes) INODE_PARAM_RO(shamrock::solvergraph::Indexes< u32 >, sizes_no_gz) INODE_PARAM_RO(CellGraphEdge, cell_neigh_graph) INODE_PARAM_RO(shamrock::solvergraph::IFieldSpan< Tscal >, spans_block_cell_sizes) INODE_PARAM_RO(shamrock::solvergraph::IFieldSpan< Tscal >, spans_rho) INODE_PARAM_RO(shamrock::solvergraph::ScalarEdge< Tscal >, mean_rho) INODE_PARAM_RO(shamrock::solvergraph::DDSharedBuffers< u32 >, idx_in_ghost) INODE_PARAM_RO(shamrock::solvergraph::RankGetter, rank_owner) INODE_PARAM_RW(shamrock::solvergraph::IFieldRefs< Tscal >, spans_phi) INODE_PARAM_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_res) INODE_PARAM_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_res_bis) INODE_PARAM_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_p) INODE_PARAM_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_Ap) INODE_PARAM_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_s) INODE_PARAM_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_As) INODE_PARAM_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_hadamard_prod) INODE_PARAM_RW(shamrock::solvergraph::IDataEdge< Tscal >, old_values) INODE_PARAM_RW(shamrock::solvergraph::IDataEdge< Tscal >, new_values) INODE_PARAM_RW(shamrock::solvergraph::IDataEdge< Tscal >, e_norm) INODE_PARAM_RW(shamrock::solvergraph::IDataEdge< Tscal >, alpha) INODE_PARAM_RW(shamrock::solvergraph::IDataEdge< Tscal >, beta) INODE_PARAM_RW(shamrock::solvergraph::IDataEdge< Tscal >, w_stab) INODE_PARAM_RW(shamrock::solvergraph::IDataEdge< Tscal >, shadow_res_norm) INODE_PARAM_RW(shamrock::solvergraph::Field< Tscal >, spans_rhs) INODE_PARAM_RW(shamrock::solvergraph::IDataEdge< Tscal >, rhs_norm_value) SourceLocation loc=SourceLocation{}) |
| Edges | get_edges () |
| INODE_EXPAND_TEX_SYMBOLS (INODE_TEX_DECL(shamrock::solvergraph::Indexes< u32 >, sizes) INODE_TEX_DECL(shamrock::solvergraph::Indexes< u32 >, sizes_no_gz) INODE_TEX_DECL(CellGraphEdge, cell_neigh_graph) INODE_TEX_DECL(shamrock::solvergraph::IFieldSpan< Tscal >, spans_block_cell_sizes) INODE_TEX_DECL(shamrock::solvergraph::IFieldSpan< Tscal >, spans_rho) INODE_TEX_DECL(shamrock::solvergraph::ScalarEdge< Tscal >, mean_rho) INODE_TEX_DECL(shamrock::solvergraph::DDSharedBuffers< u32 >, idx_in_ghost) INODE_TEX_DECL(shamrock::solvergraph::RankGetter, rank_owner) INODE_TEX_DECL(shamrock::solvergraph::IFieldRefs< Tscal >, spans_phi) INODE_TEX_DECL(shamrock::solvergraph::Field< Tscal >, spans_phi_res) INODE_TEX_DECL(shamrock::solvergraph::Field< Tscal >, spans_phi_res_bis) INODE_TEX_DECL(shamrock::solvergraph::Field< Tscal >, spans_phi_p) INODE_TEX_DECL(shamrock::solvergraph::Field< Tscal >, spans_phi_Ap) INODE_TEX_DECL(shamrock::solvergraph::Field< Tscal >, spans_phi_s) INODE_TEX_DECL(shamrock::solvergraph::Field< Tscal >, spans_phi_As) INODE_TEX_DECL(shamrock::solvergraph::Field< Tscal >, spans_phi_hadamard_prod) INODE_TEX_DECL(shamrock::solvergraph::IDataEdge< Tscal >, old_values) INODE_TEX_DECL(shamrock::solvergraph::IDataEdge< Tscal >, new_values) INODE_TEX_DECL(shamrock::solvergraph::IDataEdge< Tscal >, e_norm) INODE_TEX_DECL(shamrock::solvergraph::IDataEdge< Tscal >, alpha) INODE_TEX_DECL(shamrock::solvergraph::IDataEdge< Tscal >, beta) INODE_TEX_DECL(shamrock::solvergraph::IDataEdge< Tscal >, w_stab) INODE_TEX_DECL(shamrock::solvergraph::IDataEdge< Tscal >, shadow_res_norm) INODE_TEX_DECL(shamrock::solvergraph::Field< Tscal >, spans_rhs) INODE_TEX_DECL(shamrock::solvergraph::IDataEdge< Tscal >, rhs_norm_value), INODE_TEX_GET_RO(shamrock::solvergraph::Indexes< u32 >, sizes) INODE_TEX_GET_RO(shamrock::solvergraph::Indexes< u32 >, sizes_no_gz) INODE_TEX_GET_RO(CellGraphEdge, cell_neigh_graph) INODE_TEX_GET_RO(shamrock::solvergraph::IFieldSpan< Tscal >, spans_block_cell_sizes) INODE_TEX_GET_RO(shamrock::solvergraph::IFieldSpan< Tscal >, spans_rho) INODE_TEX_GET_RO(shamrock::solvergraph::ScalarEdge< Tscal >, mean_rho) INODE_TEX_GET_RO(shamrock::solvergraph::DDSharedBuffers< u32 >, idx_in_ghost) INODE_TEX_GET_RO(shamrock::solvergraph::RankGetter, rank_owner) INODE_TEX_GET_RW(shamrock::solvergraph::IFieldRefs< Tscal >, spans_phi) INODE_TEX_GET_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_res) INODE_TEX_GET_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_res_bis) INODE_TEX_GET_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_p) INODE_TEX_GET_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_Ap) INODE_TEX_GET_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_s) INODE_TEX_GET_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_As) INODE_TEX_GET_RW(shamrock::solvergraph::Field< Tscal >, spans_phi_hadamard_prod) INODE_TEX_GET_RW(shamrock::solvergraph::IDataEdge< Tscal >, old_values) INODE_TEX_GET_RW(shamrock::solvergraph::IDataEdge< Tscal >, new_values) INODE_TEX_GET_RW(shamrock::solvergraph::IDataEdge< Tscal >, e_norm) INODE_TEX_GET_RW(shamrock::solvergraph::IDataEdge< Tscal >, alpha) INODE_TEX_GET_RW(shamrock::solvergraph::IDataEdge< Tscal >, beta) INODE_TEX_GET_RW(shamrock::solvergraph::IDataEdge< Tscal >, w_stab) INODE_TEX_GET_RW(shamrock::solvergraph::IDataEdge< Tscal >, shadow_res_norm) INODE_TEX_GET_RW(shamrock::solvergraph::Field< Tscal >, spans_rhs) INODE_TEX_GET_RW(shamrock::solvergraph::IDataEdge< Tscal >, rhs_norm_value), INODE_TEX_REPLACE(shamrock::solvergraph::Indexes< u32 >, sizes) INODE_TEX_REPLACE(shamrock::solvergraph::Indexes< u32 >, sizes_no_gz) INODE_TEX_REPLACE(CellGraphEdge, cell_neigh_graph) INODE_TEX_REPLACE(shamrock::solvergraph::IFieldSpan< Tscal >, spans_block_cell_sizes) INODE_TEX_REPLACE(shamrock::solvergraph::IFieldSpan< Tscal >, spans_rho) INODE_TEX_REPLACE(shamrock::solvergraph::ScalarEdge< Tscal >, mean_rho) INODE_TEX_REPLACE(shamrock::solvergraph::DDSharedBuffers< u32 >, idx_in_ghost) INODE_TEX_REPLACE(shamrock::solvergraph::RankGetter, rank_owner) INODE_TEX_REPLACE(shamrock::solvergraph::IFieldRefs< Tscal >, spans_phi) INODE_TEX_REPLACE(shamrock::solvergraph::Field< Tscal >, spans_phi_res) INODE_TEX_REPLACE(shamrock::solvergraph::Field< Tscal >, spans_phi_res_bis) INODE_TEX_REPLACE(shamrock::solvergraph::Field< Tscal >, spans_phi_p) INODE_TEX_REPLACE(shamrock::solvergraph::Field< Tscal >, spans_phi_Ap) INODE_TEX_REPLACE(shamrock::solvergraph::Field< Tscal >, spans_phi_s) INODE_TEX_REPLACE(shamrock::solvergraph::Field< Tscal >, spans_phi_As) INODE_TEX_REPLACE(shamrock::solvergraph::Field< Tscal >, spans_phi_hadamard_prod) INODE_TEX_REPLACE(shamrock::solvergraph::IDataEdge< Tscal >, old_values) INODE_TEX_REPLACE(shamrock::solvergraph::IDataEdge< Tscal >, new_values) INODE_TEX_REPLACE(shamrock::solvergraph::IDataEdge< Tscal >, e_norm) INODE_TEX_REPLACE(shamrock::solvergraph::IDataEdge< Tscal >, alpha) INODE_TEX_REPLACE(shamrock::solvergraph::IDataEdge< Tscal >, beta) INODE_TEX_REPLACE(shamrock::solvergraph::IDataEdge< Tscal >, w_stab) INODE_TEX_REPLACE(shamrock::solvergraph::IDataEdge< Tscal >, shadow_res_norm) INODE_TEX_REPLACE(shamrock::solvergraph::Field< Tscal >, spans_rhs) INODE_TEX_REPLACE(shamrock::solvergraph::IDataEdge< Tscal >, rhs_norm_value)) inline u32 get_last_iteration_count() const | |
| Number of iterations done by the last evaluation. | |
| 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 | |
Solve \( \Delta \phi = 4 \pi G (\rho - \bar{\rho}) \) with the BiCGSTAB method, starting from the current content of spans_phi.
Port of the BiCGSTAB of the new_amr_plus_grav branch of Léodasce Sewanou. The matrix, the right-hand side and the handling of the ghost blocks are the same as in NodeCGLoop. The ghost blocks of both \( p_k \) and \( s_k \) are exchanged before the matrix-vector products, and the ones of \( \phi \) at the end.
The loop stops when \( \langle s_k, s_k \rangle / \langle b, b \rangle < {\rm tol}^2 \) (then \( \phi_{k+1} = \phi_k + \alpha_k p_k \)) or \( \langle r_{k+1}, r_{k+1} \rangle / \langle b, b \rangle < {\rm tol}^2 \), on a breakdown ( \( \langle A p_k, r'_0 \rangle \), \( \langle A s_k, A s_k \rangle \) or \( \omega_k \) equal to 0), or after Niter_max iterations. It restarts ( \( r'_0 = p_{k+1} = r_{k+1} \)) when \( \langle r_{k+1}, r'_0 \rangle^2 < {\rm tol\_happy\_bk}^2 \langle r_{k+1}, r_{k+1} \rangle \langle r'_0, r'_0 \rangle \).
The work fields are resized to match sizes if needed.
Definition at line 102 of file NodeBiCGSTABLoop.hpp.
|
inline |
Definition at line 172 of file NodeBiCGSTABLoop.hpp.
|
virtual |
evaluate the node
Implements shamrock::solvergraph::INode.
Definition at line 29 of file NodeBiCGSTABLoop.cpp.
|
inlinevirtual |
get the label of the node
Implements shamrock::solvergraph::INode.
Definition at line 262 of file NodeBiCGSTABLoop.hpp.
|
virtual |
get the tex of the node
Implements shamrock::solvergraph::INode.
Definition at line 234 of file NodeBiCGSTABLoop.cpp.
|
inline |
Definition at line 246 of file NodeBiCGSTABLoop.hpp.
|
inline |
Number of iterations done by the last evaluation.
Definition at line 252 of file NodeBiCGSTABLoop.hpp.
|
inline |
Definition at line 182 of file NodeBiCGSTABLoop.hpp.