How to use the landlab.ca.celllab_cts.Transition function in landlab

To help you get started, we’ve selected a few landlab examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github landlab / landlab / examples / ca / cts_lattice_gas.py View on Github external
xn_list.append(Transition((3, 5, 1), (5, 3, 1), 1.0, "glancing collision"))
    xn_list.append(Transition((3, 1, 2), (1, 3, 2), 1.0, "glancing collision"))
    xn_list.append(Transition((3, 5, 2), (5, 3, 2), 1.0, "glancing collision"))
    xn_list.append(Transition((2, 6, 2), (6, 2, 2), 1.0, "glancing collision"))
    xn_list.append(Transition((4, 6, 2), (6, 4, 2), 1.0, "glancing collision"))

    # Rule 4: Transitions for oblique-from-behind collisions
    xn_list.append(Transition((1, 2, 0), (2, 1, 0), 1.0, "oblique"))
    xn_list.append(Transition((1, 6, 0), (6, 1, 0), 1.0, "oblique"))
    xn_list.append(Transition((3, 4, 0), (4, 3, 0), 1.0, "oblique"))
    xn_list.append(Transition((5, 4, 0), (4, 5, 0), 1.0, "oblique"))
    xn_list.append(Transition((2, 1, 1), (1, 2, 1), 1.0, "oblique"))
    xn_list.append(Transition((2, 3, 1), (3, 2, 1), 1.0, "oblique"))
    xn_list.append(Transition((4, 5, 1), (5, 4, 1), 1.0, "oblique"))
    xn_list.append(Transition((6, 5, 1), (5, 6, 1), 1.0, "oblique"))
    xn_list.append(Transition((3, 2, 2), (2, 3, 2), 1.0, "oblique"))
    xn_list.append(Transition((3, 4, 2), (4, 3, 2), 1.0, "oblique"))
    xn_list.append(Transition((1, 6, 2), (6, 1, 2), 1.0, "oblique"))
    xn_list.append(Transition((5, 6, 2), (6, 5, 2), 1.0, "oblique"))

    # Rule 5: Transitions for direct-from-behind collisions
    xn_list.append(Transition((1, 1, 0), (2, 6, 0), 0.25, "behind"))
    xn_list.append(Transition((1, 1, 0), (6, 2, 0), 0.25, "behind"))
    xn_list.append(Transition((4, 4, 0), (3, 5, 0), 0.25, "behind"))
    xn_list.append(Transition((4, 4, 0), (5, 3, 0), 0.25, "behind"))
    xn_list.append(Transition((2, 2, 1), (1, 3, 1), 0.25, "behind"))
    xn_list.append(Transition((2, 2, 1), (3, 1, 1), 0.25, "behind"))
    xn_list.append(Transition((5, 5, 1), (4, 6, 1), 0.25, "behind"))
    xn_list.append(Transition((5, 5, 1), (6, 4, 1), 0.25, "behind"))
    xn_list.append(Transition((3, 3, 2), (2, 4, 2), 0.25, "behind"))
    xn_list.append(Transition((3, 3, 2), (4, 2, 2), 0.25, "behind"))
    xn_list.append(Transition((6, 6, 2), (1, 5, 2), 0.25, "behind"))
github landlab / landlab / examples / ca / cts_lattice_grain.py View on Github external
xn_list.append(Transition((1, 1, 0), (2, 6, 0), 0.5, "behind"))
    xn_list.append(Transition((1, 1, 0), (6, 2, 0), 0.5, "behind"))
    xn_list.append(Transition((4, 4, 0), (3, 5, 0), 0.5, "behind"))
    xn_list.append(Transition((4, 4, 0), (5, 3, 0), 0.5, "behind"))
    xn_list.append(Transition((2, 2, 1), (1, 3, 1), 0.5, "behind"))
    xn_list.append(Transition((2, 2, 1), (3, 1, 1), 0.5, "behind"))
    xn_list.append(Transition((5, 5, 1), (4, 6, 1), 0.5, "behind"))
    xn_list.append(Transition((5, 5, 1), (6, 4, 1), 0.5, "behind"))
    xn_list.append(Transition((3, 3, 2), (2, 4, 2), 0.5, "behind"))
    xn_list.append(Transition((3, 3, 2), (4, 2, 2), 0.5, "behind"))
    xn_list.append(Transition((6, 6, 2), (1, 5, 2), 0.5, "behind"))
    xn_list.append(Transition((6, 6, 2), (5, 1, 2), 0.5, "behind"))
    xn_list.append(Transition((1, 1, 0), (7, 1, 0), f, "behind"))
    xn_list.append(Transition((4, 4, 0), (4, 7, 0), f, "behind"))
    xn_list.append(Transition((2, 2, 1), (7, 2, 1), f, "behind"))
    xn_list.append(Transition((5, 5, 1), (5, 7, 1), f, "behind"))
    xn_list.append(Transition((3, 3, 2), (7, 3, 2), f, "behind"))
    xn_list.append(Transition((6, 6, 2), (6, 7, 2), f, "behind"))

    # Transitions for collision with stationary (resting) particle
    xn_list.append(Transition((1, 7, 0), (7, 2, 0), 0.5, "rest"))
    xn_list.append(Transition((1, 7, 0), (7, 6, 0), 0.5, "rest"))
    xn_list.append(Transition((7, 4, 0), (3, 7, 0), 0.5, "rest"))
    xn_list.append(Transition((7, 4, 0), (5, 7, 0), 0.5, "rest"))
    xn_list.append(Transition((2, 7, 1), (7, 1, 1), 0.5, "rest"))
    xn_list.append(Transition((2, 7, 1), (7, 3, 1), 0.5, "rest"))
    xn_list.append(Transition((7, 5, 1), (4, 7, 1), 0.5, "rest"))
    xn_list.append(Transition((7, 5, 1), (6, 7, 1), 0.5, "rest"))
    xn_list.append(Transition((3, 7, 2), (7, 2, 2), 0.5, "rest"))
    xn_list.append(Transition((3, 7, 2), (7, 4, 2), 0.5, "rest"))
    xn_list.append(Transition((7, 6, 2), (1, 7, 2), 0.5, "rest"))
    xn_list.append(Transition((7, 6, 2), (5, 7, 2), 0.5, "rest"))
github landlab / landlab / landlab / ca / examples / diffusion_in_gravity.py View on Github external
Pair state      Transition to       Process         Rate
    ==========      =============       =======         ====
    0 (0-0)         (none)              -               -
    1 (0-1)         2 (1-0)             left motion     1.0
    2 (1-0)         1 (0-1)             right motion    1.0
    3 (1-1)         (none)              -               -
    4 (0/0)         (none)              -               -
    5 (0/1)         6 (1/0)             down motion     1.1
    6 (1/0)         5 (0/1)             up motion       0.9
    7 (1/1)         (none)              -               -

    """
    xn_list = []

    xn_list.append( Transition((0,1,0), (1,0,0), 1., 'left motion') )
    xn_list.append( Transition((1,0,0), (0,1,0), 1., 'right motion') )
    xn_list.append( Transition((0,1,1), (1,0,1), 1.1, 'down motion') )
    xn_list.append( Transition((1,0,1), (0,1,1), 0.9, 'up motion') )

    if _DEBUG:
        print()
        print('setup_transition_list(): list has',len(xn_list),'transitions:')
        for t in xn_list:
            print('  From state',t.from_state,'to state',t.to_state,'at rate',t.rate,'called',t.name)

    return xn_list
github landlab / landlab / examples / ca / cts_lattice_gas_with_gravity.py View on Github external
xn_list : list of Transition objects
        List of objects that encode information about the link-state transitions.
    """
    xn_list = []

    # Transitions for particle movement into an empty cell
    xn_list.append(Transition((1, 0, 0), (0, 1, 0), 1., "motion"))
    xn_list.append(Transition((2, 0, 1), (0, 2, 1), 1., "motion"))
    xn_list.append(Transition((3, 0, 2), (0, 3, 2), 1., "motion"))
    xn_list.append(Transition((0, 4, 0), (4, 0, 0), 1., "motion"))
    xn_list.append(Transition((0, 5, 1), (5, 0, 1), 1., "motion"))
    xn_list.append(Transition((0, 6, 2), (6, 0, 2), 1., "motion"))

    # Transitions for wall impact
    xn_list.append(Transition((1, 8, 0), (4, 8, 0), 1.0, "wall rebound"))
    xn_list.append(Transition((2, 8, 1), (5, 8, 1), 1.0, "wall rebound"))
    xn_list.append(Transition((3, 8, 2), (6, 8, 2), 1.0, "wall rebound"))
    xn_list.append(Transition((8, 4, 0), (8, 1, 0), 1.0, "wall rebound"))
    xn_list.append(Transition((8, 5, 1), (8, 2, 1), 1.0, "wall rebound"))
    xn_list.append(Transition((8, 6, 2), (8, 3, 2), 1.0, "wall rebound"))

    # Transitions for head-on collision
    xn_list.append(Transition((1, 4, 0), (3, 6, 0), 0.5, "head-on collision"))
    xn_list.append(Transition((1, 4, 0), (5, 2, 0), 0.5, "head-on collision"))
    xn_list.append(Transition((2, 5, 1), (4, 1, 1), 0.5, "head-on collision"))
    xn_list.append(Transition((2, 5, 1), (6, 3, 1), 0.5, "head-on collision"))
    xn_list.append(Transition((3, 6, 2), (1, 4, 2), 0.5, "head-on collision"))
    xn_list.append(Transition((3, 6, 2), (5, 2, 2), 0.5, "head-on collision"))

    # Transitions for glancing collision
    xn_list.append(Transition((1, 3, 0), (3, 1, 0), 1.0, "glancing collision"))
    xn_list.append(Transition((1, 5, 0), (5, 1, 0), 1.0, "glancing collision"))
github landlab / landlab / examples / ca / cts_lattice_gas.py View on Github external
# Rule 2: Transitions for head-on collision: elastic
    xn_list.append(Transition((1, 4, 0), (4, 1, 0), 1. / 3, "head-on collision"))
    xn_list.append(Transition((1, 4, 0), (3, 6, 0), 1. / 3, "head-on collision"))
    xn_list.append(Transition((1, 4, 0), (5, 2, 0), 1. / 3, "head-on collision"))
    xn_list.append(Transition((2, 5, 1), (5, 2, 1), 1. / 3, "head-on collision"))
    xn_list.append(Transition((2, 5, 1), (4, 1, 1), 1. / 3, "head-on collision"))
    xn_list.append(Transition((2, 5, 1), (6, 3, 1), 1. / 3, "head-on collision"))
    xn_list.append(Transition((3, 6, 2), (6, 3, 2), 1. / 3, "head-on collision"))
    xn_list.append(Transition((3, 6, 2), (1, 4, 2), 1. / 3, "head-on collision"))
    xn_list.append(Transition((3, 6, 2), (5, 2, 2), 1. / 3, "head-on collision"))

    # Rule 3: Transitions for oblique collision: elastic
    xn_list.append(Transition((1, 3, 0), (3, 1, 0), 1.0, "glancing collision"))
    xn_list.append(Transition((1, 5, 0), (5, 1, 0), 1.0, "glancing collision"))
    xn_list.append(Transition((2, 4, 0), (4, 2, 0), 1.0, "glancing collision"))
    xn_list.append(Transition((6, 4, 0), (4, 6, 0), 1.0, "glancing collision"))
    xn_list.append(Transition((2, 4, 1), (4, 2, 1), 1.0, "glancing collision"))
    xn_list.append(Transition((2, 6, 1), (6, 2, 1), 1.0, "glancing collision"))
    xn_list.append(Transition((1, 5, 1), (5, 1, 1), 1.0, "glancing collision"))
    xn_list.append(Transition((3, 5, 1), (5, 3, 1), 1.0, "glancing collision"))
    xn_list.append(Transition((3, 1, 2), (1, 3, 2), 1.0, "glancing collision"))
    xn_list.append(Transition((3, 5, 2), (5, 3, 2), 1.0, "glancing collision"))
    xn_list.append(Transition((2, 6, 2), (6, 2, 2), 1.0, "glancing collision"))
    xn_list.append(Transition((4, 6, 2), (6, 4, 2), 1.0, "glancing collision"))

    # Rule 4: Transitions for oblique-from-behind collisions
    xn_list.append(Transition((1, 2, 0), (2, 1, 0), 1.0, "oblique"))
    xn_list.append(Transition((1, 6, 0), (6, 1, 0), 1.0, "oblique"))
    xn_list.append(Transition((3, 4, 0), (4, 3, 0), 1.0, "oblique"))
    xn_list.append(Transition((5, 4, 0), (4, 5, 0), 1.0, "oblique"))
    xn_list.append(Transition((2, 1, 1), (1, 2, 1), 1.0, "oblique"))
    xn_list.append(Transition((2, 3, 1), (3, 2, 1), 1.0, "oblique"))
github landlab / landlab / examples / ca / cts_lattice_grain.py View on Github external
xn_list.append(Transition((2, 0, 1), (0, 2, 1), 1., "motion"))
    xn_list.append(Transition((3, 0, 2), (0, 3, 2), 1., "motion"))
    xn_list.append(Transition((0, 4, 0), (4, 0, 0), 1., "motion"))
    xn_list.append(Transition((0, 5, 1), (5, 0, 1), 1., "motion"))
    xn_list.append(Transition((0, 6, 2), (6, 0, 2), 1., "motion"))

    # Transitions for wall impact
    xn_list.append(Transition((1, 8, 0), (4, 8, 0), 1.0, "wall rebound"))
    xn_list.append(Transition((2, 8, 1), (5, 8, 1), 1.0, "wall rebound"))
    xn_list.append(Transition((3, 8, 2), (6, 8, 2), 1.0, "wall rebound"))
    xn_list.append(Transition((8, 4, 0), (8, 1, 0), 1.0, "wall rebound"))
    xn_list.append(Transition((8, 5, 1), (8, 2, 1), 1.0, "wall rebound"))
    xn_list.append(Transition((8, 6, 2), (8, 3, 2), 1.0, "wall rebound"))

    # Transitions for wall impact frictional stop
    xn_list.append(Transition((1, 8, 0), (7, 8, 0), f, "wall stop"))
    xn_list.append(Transition((2, 8, 1), (7, 8, 1), f, "wall stop"))
    xn_list.append(Transition((3, 8, 2), (7, 8, 2), f, "wall stop"))
    xn_list.append(Transition((8, 4, 0), (8, 7, 0), f, "wall stop"))
    xn_list.append(Transition((8, 5, 1), (8, 7, 1), f, "wall stop"))
    xn_list.append(Transition((8, 6, 2), (8, 7, 2), f, "wall stop"))

    # Transitions for head-on collision
    xn_list.append(Transition((1, 4, 0), (3, 6, 0), 0.5, "head-on collision"))
    xn_list.append(Transition((1, 4, 0), (5, 2, 0), 0.5, "head-on collision"))
    xn_list.append(Transition((2, 5, 1), (4, 1, 1), 0.5, "head-on collision"))
    xn_list.append(Transition((2, 5, 1), (6, 3, 1), 0.5, "head-on collision"))
    xn_list.append(Transition((3, 6, 2), (1, 4, 2), 0.5, "head-on collision"))
    xn_list.append(Transition((3, 6, 2), (5, 2, 2), 0.5, "head-on collision"))
    xn_list.append(Transition((1, 4, 0), (7, 7, 0), f, "head-on collision"))
    xn_list.append(Transition((2, 5, 1), (7, 7, 1), f, "head-on collision"))
    xn_list.append(Transition((3, 6, 2), (7, 7, 2), f, "head-on collision"))
github landlab / landlab / examples / ca / cts_lattice_grain.py View on Github external
List of objects that encode information about the link-state transitions.
    """
    xn_list = []

    # Transitions for particle movement into an empty cell
    xn_list.append(Transition((1, 0, 0), (0, 1, 0), 1., "motion"))
    xn_list.append(Transition((2, 0, 1), (0, 2, 1), 1., "motion"))
    xn_list.append(Transition((3, 0, 2), (0, 3, 2), 1., "motion"))
    xn_list.append(Transition((0, 4, 0), (4, 0, 0), 1., "motion"))
    xn_list.append(Transition((0, 5, 1), (5, 0, 1), 1., "motion"))
    xn_list.append(Transition((0, 6, 2), (6, 0, 2), 1., "motion"))

    # Transitions for wall impact
    xn_list.append(Transition((1, 8, 0), (4, 8, 0), 1.0, "wall rebound"))
    xn_list.append(Transition((2, 8, 1), (5, 8, 1), 1.0, "wall rebound"))
    xn_list.append(Transition((3, 8, 2), (6, 8, 2), 1.0, "wall rebound"))
    xn_list.append(Transition((8, 4, 0), (8, 1, 0), 1.0, "wall rebound"))
    xn_list.append(Transition((8, 5, 1), (8, 2, 1), 1.0, "wall rebound"))
    xn_list.append(Transition((8, 6, 2), (8, 3, 2), 1.0, "wall rebound"))

    # Transitions for wall impact frictional stop
    xn_list.append(Transition((1, 8, 0), (7, 8, 0), f, "wall stop"))
    xn_list.append(Transition((2, 8, 1), (7, 8, 1), f, "wall stop"))
    xn_list.append(Transition((3, 8, 2), (7, 8, 2), f, "wall stop"))
    xn_list.append(Transition((8, 4, 0), (8, 7, 0), f, "wall stop"))
    xn_list.append(Transition((8, 5, 1), (8, 7, 1), f, "wall stop"))
    xn_list.append(Transition((8, 6, 2), (8, 7, 2), f, "wall stop"))

    # Transitions for head-on collision
    xn_list.append(Transition((1, 4, 0), (3, 6, 0), 0.5, "head-on collision"))
    xn_list.append(Transition((1, 4, 0), (5, 2, 0), 0.5, "head-on collision"))
    xn_list.append(Transition((2, 5, 1), (4, 1, 1), 0.5, "head-on collision"))
github landlab / landlab / examples / ca / cts_lattice_grain_silo.py View on Github external
xn_list.append(Transition((6, 3, 0), (5, 2, 0), p_elast, "glancing"))
    xn_list.append(Transition((3, 6, 1), (4, 1, 1), p_elast, "glancing"))
    xn_list.append(Transition((1, 4, 1), (6, 3, 1), p_elast, "glancing"))
    xn_list.append(Transition((4, 1, 2), (5, 2, 2), p_elast, "glancing"))
    xn_list.append(Transition((2, 5, 2), (1, 4, 2), p_elast, "glancing"))

    # Rule 8 frictional
    xn_list.append(Transition((2, 5, 0), (7, 7, 0), f, "glancing"))
    xn_list.append(Transition((6, 3, 0), (7, 7, 0), f, "glancing"))
    xn_list.append(Transition((3, 6, 1), (7, 7, 1), f, "glancing"))
    xn_list.append(Transition((1, 4, 1), (7, 7, 1), f, "glancing"))
    xn_list.append(Transition((4, 1, 2), (7, 7, 2), f, "glancing"))
    xn_list.append(Transition((2, 5, 2), (7, 7, 2), f, "glancing"))

    # Rule 9: Transitions for "near-on" collisions
    xn_list.append(Transition((6, 5, 0), (5, 6, 0), p_elast, "near-on"))
    xn_list.append(Transition((2, 3, 0), (3, 2, 0), p_elast, "near-on"))
    xn_list.append(Transition((1, 6, 1), (6, 1, 1), p_elast, "near-on"))
    xn_list.append(Transition((3, 4, 1), (4, 3, 1), p_elast, "near-on"))
    xn_list.append(Transition((2, 1, 2), (1, 2, 2), p_elast, "near-on"))
    xn_list.append(Transition((4, 5, 2), (5, 4, 2), p_elast, "near-on"))

    # Rule 9 frictional
    xn_list.append(Transition((6, 5, 0), (7, 6, 0), f / 2, "near-on"))
    xn_list.append(Transition((6, 5, 0), (5, 7, 0), f / 2, "near-on"))
    xn_list.append(Transition((2, 3, 0), (7, 2, 0), f / 2, "near-on"))
    xn_list.append(Transition((2, 3, 0), (3, 7, 0), f / 2, "near-on"))
    xn_list.append(Transition((1, 6, 1), (7, 1, 1), f / 2, "near-on"))
    xn_list.append(Transition((1, 6, 1), (6, 7, 1), f / 2, "near-on"))
    xn_list.append(Transition((3, 4, 1), (7, 3, 1), f / 2, "near-on"))
    xn_list.append(Transition((3, 4, 1), (4, 7, 1), f / 2, "near-on"))
    xn_list.append(Transition((2, 1, 2), (7, 2, 2), f / 2, "near-on"))
github landlab / landlab / landlab / ca / examples / sir / sir.py View on Github external
2 (0-2)         (none)              -
    3 (1-0)         4 (1-1)             infection
                    6 (2-0)             recovery
    4 (1-1)         5 (1-2)             recovery
                    6 (2-1)             recovery
    5 (1-2)         8 (2-2)             recovery
    6 (2-0)         (none)              -
    7 (2-1)         8 (2-2)             recovery
    8 (2-2)         (none)              -

    """
    xn_list = []

    xn_list.append( Transition((0,1,0), (1,1,0), infection_rate, 'infection') )
    xn_list.append( Transition((0,1,0), (0,2,0), 1., 'recovery') )
    xn_list.append( Transition((1,0,0), (1,1,0), infection_rate, 'infection') )
    xn_list.append( Transition((1,0,0), (2,0,0), 1., 'recovery') )
    xn_list.append( Transition((1,1,0), (1,2,0), 1., 'recovery') )
    xn_list.append( Transition((1,1,0), (2,1,0), 1., 'recovery') )
    xn_list.append( Transition((1,2,0), (2,2,0), 1., 'recovery') )
    xn_list.append( Transition((2,1,0), (2,2,0), 1., 'recovery') )

    if _DEBUG:
        print()
        print('setup_transition_list(): list has',len(xn_list),'transitions:')
        for t in xn_list:
            print('  From state',t.from_state,'to state',t.to_state,'at rate',t.rate,'called',t.name)

    return xn_list
github landlab / landlab / landlab / ca / examples / rock_weathering.py View on Github external
3 (1-1)         (none)                                  -
    
    """
    
    # Create an empty transition list
    xn_list = []
    
    # Append two transitions to the list.
    # Note that the arguments to the Transition() object constructor are:
    #  - Tuple representing starting pair state
    #    (left/bottom cell, right/top cell, orientation)
    #  - Tuple representing new pair state
    #    (left/bottom cell, right/top cell, orientation)
    #  - Transition rate (cells per time step, in this case 1 sec)
    #  - Name for transition
    xn_list.append( Transition((0,1,0), (1,1,0), 1., 'weathering') )
    xn_list.append( Transition((1,0,0), (1,1,0), 1., 'weathering') )
    
    return xn_list