Setup graph for SPH#
SPH simulations come with an overwhelming diversity of possible setups. To tackle this, Shamrock provides generalized setups in the form of a graph, where links pass PatchData from one node to another.
Node types#
Nodes can be:
Generators: create particle distributions (e.g. HCP lattice, cubic lattice, Monte Carlo disc, …)
Modifiers: transform the output of another node (e.g. offset, disc warp, filter, …)
Combiners: combine the results of two other nodes.
Example#
Imagine an even number generator, a modifier (multiplier) that multiplies the result by 10, and a combiner.
Such a graph generates the list of even numbers multiplied by 10, twice.
Usage#
In a runscript the setup graph is manipulated through the model.get_setup() object. Nodes are created using the make_* factory functions, and the resulting graph is applied with apply_setup.
The available factories are currently:
Generators:
make_generator_lattice_hcpmake_generator_lattice_cubicmake_generator_disc_mcmake_generator_from_context
Modifiers:
make_modifier_warp_discmake_modifier_custom_warpmake_modifier_offsetmake_modifier_filtermake_modifier_split_part
Combiners:
make_combiner_add
See the Python API documentation for the complete and up-to-date list.
For example, the Sedov-Taylor setup for SPH is:
setup = model.get_setup()
gen = setup.make_generator_lattice_hcp(dr, bmin, bmax)
setup.apply_setup(gen)
Or for the Sod tube:
setup = model.get_setup()
gen1 = setup.make_generator_lattice_hcp(dr, (-xs, -ys / 2, -zs / 2), (0, ys / 2, zs / 2))
gen2 = setup.make_generator_lattice_hcp(dr * fact, (0, -ys / 2, -zs / 2), (xs, ys / 2, zs / 2))
comb = setup.make_combiner_add(gen1, gen2)
setup.apply_setup(comb)