function update_velocity(cell_data) {

        /*
        This adds one-fourth of the collective pressure from surrounding cells to the 
        cell's X axis velocity.
        */
        cell_data.xv += (
            cell_data.up_left.pressure * 0.5
            + cell_data.left.pressure
            + cell_data.down_left.pressure * 0.5
            - cell_data.up_right.pressure * 0.5
            - cell_data.right.pressure
            - cell_data.down_right.pressure * 0.5
        ) * 0.25;
        
        //This does the same for the Y axis.
        cell_data.yv += (
            cell_data.up_left.pressure * 0.5
            + cell_data.up.pressure
            + cell_data.up_right.pressure * 0.5
            - cell_data.down_left.pressure * 0.5
            - cell_data.down.pressure
            - cell_data.down_right.pressure * 0.5
        ) * 0.25;
        
        /*
        This slowly decreases the cell's velocity over time so that the fluid stops
        if it's left alone.
        */
        cell_data.xv *= 0.99;
        cell_data.yv *= 0.99;
    }
/*
    This function updates the velocity value for an individual cell using the 
    velocities of neighboring cells.
    */
This function updates the velocity value for an individual cell using the
velocities of neighboring cells.
This function updates the velocity value for an individual cell using the velocities of neighboring cells .
function update_velocity(cell_data) {
        cell_data.xv += (
            cell_data.up_left.pressure * 0.5
            + cell_data.left.pressure
            + cell_data.down_left.pressure * 0.5
            - cell_data.up_right.pressure * 0.5
            - cell_data.right.pressure
            - cell_data.down_right.pressure * 0.5
        ) * 0.25;
        cell_data.yv += (
            cell_data.up_left.pressure * 0.5
            + cell_data.up.pressure
            + cell_data.up_right.pressure * 0.5
            - cell_data.down_left.pressure * 0.5
            - cell_data.down.pressure
            - cell_data.down_right.pressure * 0.5
        ) * 0.25;
        cell_data.xv *= 0.99;
        cell_data.yv *= 0.99;
    }
function update_velocity ( cell_data ) { cell_data . xv += ( cell_data . up_left . pressure * 0.5 + cell_data . left . pressure + cell_data . down_left . pressure * 0.5 - cell_data . up_right . pressure * 0.5 - cell_data . right . pressure - cell_data . down_right . pressure * 0.5 ) * 0.25 ; cell_data . yv += ( cell_data . up_left . pressure * 0.5 + cell_data . up . pressure + cell_data . up_right . pressure * 0.5 - cell_data . down_left . pressure * 0.5 - cell_data . down . pressure - cell_data . down_right . pressure * 0.5 ) * 0.25 ; cell_data . xv *= 0.99 ; cell_data . yv *= 0.99 ; }
This function updates the velocity value for an individual cell using the
velocities of neighboring cells.
This function updates the velocity value for an individual cell using the velocities of neighboring cells .
/*
        This adds one-fourth of the collective pressure from surrounding cells to the 
        cell's X axis velocity.
        */ //This does the same for the Y axis. /*
        This slowly decreases the cell's velocity over time so that the fluid stops
        if it's left alone.
        */