def get_max_value(solution, field=0):
    """
    Get the maximum value in a field in a solution.
    """

    max_val = 0.

    for state in solution.states:
        max_temp = state.q[field, :, :].max()
        if max_temp > max_val:
            max_val = max_temp

    return max_val