def setup_transition_list():
    """
    Creates and returns a list of Transition() objects to represent state
    transitions for a biased random walk, in which the rate of downward
    motion is greater than the rate in the other three directions.
    
    Parameters
    ----------
    (none)
    
    Returns
    -------
    xn_list : list of Transition objects
        List of objects that encode information about the link-state transitions.
    
    Notes
    -----
    State 0 represents fluid and state 1 represents a particle (such as a 
    sediment grain or dissolved heavy particle).
    
    The states and transitions are as follows:

    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
示例#2
0
def setup_transition_list():
    """
    Creates and returns a list of Transition() objects to represent state
    transitions for simple granular mechanics model.
    
    Parameters
    ----------
    (none)
    
    Returns
    -------
    xn_list : list of Transition objects
        List of objects that encode information about the link-state transitions.
    
    Notes
    -----
    The states and transitions are as follows:

    Pair state        Transition to       Process
    ==========        =============       =======
    0 (0-0-0)         (none)              -       
    1 (0-1-0)         2 (1-0-0)           falling
    2 (1-0-0)         (none)              -
    3 (1-1-0)         (none)              -
    4 (0-0-1)         (none)              -
    5 (0-1-1)         6 (1-0-1)           falling
    6 (1-0-1)         (none)              -
    7 (1-1-1)         (none)              -
    8 (0-0-2)         (none)              -
    9 (0-1-2)         (none)              -
    10 (1-0-2)        9 (0-1-2)           falling
    11 (1-1-2)        (none)              -
    
    """
    xn_list = []
    
    xn_list.append( Transition((0,1,0), (1,0,0), 10., 'falling') )
    xn_list.append( Transition((0,1,1), (1,0,1), 1., 'falling') )
    xn_list.append( Transition((1,0,2), (0,1,2), 1., 'falling') )
        
    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
示例#3
0
def setup_transition_list():
    """
    Creates and returns a list of Transition() objects to represent state
    transitions for the SIR model.
    
    Parameters
    ----------
    (none)
    
    Returns
    -------
    xn_list : list of Transition objects
        List of objects that encode information about the link-state transitions.
    
    Notes
    -----
    The states and transitions are as follows:

    Pair state      Transition to       Process
    ==========      =============       =======
    0 (0-0)         (none)              -       
    1 (0-1)         4 (1-1)             infection
                    2 (0-2)             recovery
    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), 8., 'infection'))
    xn_list.append(Transition((0, 1, 0), (0, 2, 0), 1., 'recovery'))
    xn_list.append(Transition((1, 0, 0), (1, 1, 0), 8., '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
示例#4
0
def setup_transition_list():
    """
    Creates and returns a list of Transition() objects to represent state
    transitions for a weathering model.
    
    Parameters
    ----------
    (none)
    
    Returns
    -------
    xn_list : list of Transition objects
        List of objects that encode information about the link-state transitions.
    
    Notes
    -----
    The states and transitions are as follows:

    Pair state      Transition to       Process     Rate
    ==========      =============       =======     ====
    0 (0-0)         (none)              -           -
    1 (0-1)         3 (1-1)             weathering  1.0
    2 (1-0)         3 (1-1)             weathering  1.0
    3 (1-1)         (none)              -           -
    
    """
    xn_list = []

    xn_list.append(Transition(1, 3, 1., 'weathering'))  # rock-sap to sap-sap
    xn_list.append(Transition(2, 3, 1., 'weathering'))  # sap-rock to sap-sap

    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
示例#5
0
def setup_transition_list():
    """
    Creates and returns a list of Transition() objects to represent state
    transitions for particles that simply settle under gravity.
    
    Parameters
    ----------
    (none)
    
    Returns
    -------
    xn_list : list of Transition objects
        List of objects that encode information about the link-state transitions.
    
    Notes
    -----
    The states and transitions are as follows:

    Pair state      Transition to       Process     Rate
    ==========      =============       =======     ====
    0 (0-0,0)
    1 (0-1,0)
    2 (1-0,0)
    3 (1-1,0)
    4 (0-0,1)
    5 (0-1,1)
    1 (0-1)         2 (1-0)             settling    1.0
    
    """
    xn_list = []
    
    xn_list.append( Transition(5, 6, 1., 'settling') )
        
    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
def setup_transition_list(g=1.0, f=0.0):
    """
    Creates and returns a list of Transition() objects to represent state
    transitions for simple granular mechanics model.
    
    Parameters
    ----------
    (none)
    
    Returns
    -------
    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 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'))

    # 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'))
    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'))

    # 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'))
    xn_list.append(Transition((1, 2, 0), (7, 7, 0), f, 'oblique'))
    xn_list.append(Transition((1, 6, 0), (7, 7, 0), f, 'oblique'))
    xn_list.append(Transition((3, 4, 0), (7, 7, 0), f, 'oblique'))
    xn_list.append(Transition((5, 4, 0), (7, 7, 0), f, 'oblique'))
    xn_list.append(Transition((2, 1, 1), (7, 7, 1), f, 'oblique'))
    xn_list.append(Transition((2, 3, 1), (7, 7, 1), f, 'oblique'))
    xn_list.append(Transition((4, 5, 1), (7, 7, 1), f, 'oblique'))
    xn_list.append(Transition((6, 5, 1), (7, 7, 1), f, 'oblique'))
    xn_list.append(Transition((3, 2, 2), (7, 7, 2), f, 'oblique'))
    xn_list.append(Transition((3, 4, 2), (7, 7, 2), f, 'oblique'))
    xn_list.append(Transition((1, 6, 2), (7, 7, 2), f, 'oblique'))
    xn_list.append(Transition((5, 6, 2), (7, 7, 2), f, 'oblique'))

    # Transitions for direct-from-behind collisions
    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'))
    xn_list.append(Transition((1, 7, 0), (7, 7, 0), f, 'rest'))
    xn_list.append(Transition((7, 4, 0), (7, 7, 0), f, 'rest'))
    xn_list.append(Transition((2, 7, 1), (7, 7, 1), f, 'rest'))
    xn_list.append(Transition((7, 5, 1), (7, 7, 1), f, 'rest'))
    xn_list.append(Transition((3, 7, 2), (7, 7, 2), f, 'rest'))
    xn_list.append(Transition((7, 6, 2), (7, 7, 2), f, 'rest'))

    # Gravity rules
    xn_list.append(Transition((1, 0, 0), (7, 0, 0), g, 'up to rest'))
    xn_list.append(Transition((1, 1, 0), (7, 1, 0), g, 'up to rest'))
    xn_list.append(Transition((1, 2, 0), (7, 2, 0), g, 'up to rest'))
    xn_list.append(Transition((1, 3, 0), (7, 3, 0), g, 'up to rest'))
    xn_list.append(Transition((1, 4, 0), (7, 4, 0), g, 'up to rest'))
    xn_list.append(Transition((1, 5, 0), (7, 5, 0), g, 'up to rest'))
    xn_list.append(Transition((1, 6, 0), (7, 6, 0), g, 'up to rest'))
    xn_list.append(Transition((1, 7, 0), (7, 7, 0), g, 'up to rest'))
    xn_list.append(Transition((0, 1, 0), (0, 7, 0), g, 'up to rest'))
    xn_list.append(Transition((1, 1, 0), (1, 7, 0), g, 'up to rest'))
    xn_list.append(Transition((2, 1, 0), (2, 7, 0), g, 'up to rest'))
    xn_list.append(Transition((3, 1, 0), (3, 7, 0), g, 'up to rest'))
    xn_list.append(Transition((4, 1, 0), (4, 7, 0), g, 'up to rest'))
    xn_list.append(Transition((5, 1, 0), (5, 7, 0), g, 'up to rest'))
    xn_list.append(Transition((6, 1, 0), (6, 7, 0), g, 'up to rest'))
    xn_list.append(Transition((7, 1, 0), (7, 7, 0), g, 'up to rest'))

    #xn_list.append( Transition((7,0,0), (4,0,0), g, 'rest to down') )
    #xn_list.append( Transition((7,1,0), (4,1,0), g, 'rest to down') )
    #xn_list.append( Transition((7,2,0), (4,2,0), g, 'rest to down') )
    #xn_list.append( Transition((7,3,0), (4,3,0), g, 'rest to down') )
    #xn_list.append( Transition((7,4,0), (4,4,0), g, 'rest to down') )
    #xn_list.append( Transition((7,5,0), (4,5,0), g, 'rest to down') )
    #xn_list.append( Transition((7,6,0), (4,6,0), g, 'rest to down') )
    #xn_list.append( Transition((7,7,0), (4,7,0), g, 'rest to down') )
    xn_list.append(Transition((0, 7, 0), (0, 4, 0), g, 'rest to down'))
    #xn_list.append( Transition((1,7,0), (1,4,0), g, 'rest to down') )
    #xn_list.append( Transition((2,7,0), (2,4,0), g, 'rest to down') )
    #xn_list.append( Transition((3,7,0), (3,4,0), g, 'rest to down') )
    #xn_list.append( Transition((4,7,0), (4,4,0), g, 'rest to down') )
    #xn_list.append( Transition((5,7,0), (5,4,0), g, 'rest to down') )
    #xn_list.append( Transition((6,7,0), (6,4,0), g, 'rest to down') )
    #xn_list.append( Transition((7,7,0), (7,4,0), g, 'rest to down') )
    xn_list.append(Transition((7, 0, 2), (3, 0, 2), g, 'rest to right-down'))
    xn_list.append(Transition((0, 7, 1), (0, 5, 1), g, 'rest to left-down'))

    xn_list.append(
        Transition((2, 0, 1), (3, 0, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((2, 1, 1), (3, 1, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((2, 2, 1), (3, 2, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((2, 3, 1), (3, 3, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((2, 4, 1), (3, 4, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((2, 5, 1), (3, 5, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((2, 6, 1), (3, 6, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((2, 7, 1), (3, 7, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((0, 2, 1), (0, 3, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((1, 2, 1), (1, 3, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((2, 2, 1), (2, 3, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((3, 2, 1), (3, 3, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((4, 2, 1), (4, 3, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((5, 2, 1), (5, 3, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((6, 2, 1), (6, 3, 1), g, 'right up to right down'))
    xn_list.append(
        Transition((7, 2, 1), (7, 3, 1), g, 'right up to right down'))

    xn_list.append(Transition((6, 0, 2), (5, 0, 2), g, 'left up to left down'))
    xn_list.append(Transition((6, 1, 2), (5, 1, 2), g, 'left up to left down'))
    xn_list.append(Transition((6, 2, 2), (5, 2, 2), g, 'left up to left down'))
    xn_list.append(Transition((6, 3, 2), (5, 3, 2), g, 'left up to left down'))
    xn_list.append(Transition((6, 4, 2), (5, 4, 2), g, 'left up to left down'))
    xn_list.append(Transition((6, 5, 2), (5, 5, 2), g, 'left up to left down'))
    xn_list.append(Transition((6, 6, 2), (5, 6, 2), g, 'left up to left down'))
    xn_list.append(Transition((6, 7, 2), (5, 7, 2), g, 'left up to left down'))
    xn_list.append(Transition((0, 6, 2), (0, 5, 2), g, 'left up to left down'))
    xn_list.append(Transition((1, 6, 2), (1, 5, 2), g, 'left up to left down'))
    xn_list.append(Transition((2, 6, 2), (2, 5, 2), g, 'left up to left down'))
    xn_list.append(Transition((3, 6, 2), (3, 5, 2), g, 'left up to left down'))
    xn_list.append(Transition((4, 6, 2), (4, 5, 2), g, 'left up to left down'))
    xn_list.append(Transition((5, 6, 2), (5, 5, 2), g, 'left up to left down'))
    xn_list.append(Transition((6, 6, 2), (6, 5, 2), g, 'left up to left down'))
    xn_list.append(Transition((7, 6, 2), (7, 5, 2), g, 'left up to left down'))

    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