def analysis(osi, dtmax, dtmin, gravity, ratio=0.5):
    """
    Create a OpenSees PFEMAnalysis object. 

    Parameters
    ----------
    osi: o3seespy.OpenSeesInstance
    dtmax: float
            Maximum time steps.
    dtmin: float
            Mimimum time steps.
    gravity: float
            Gravity acceleration used to move isolated particles.
    ratio: float, optional
            The ratio to reduce time steps if it was not converged. 
    """
    dtmax = float(dtmax)
    dtmin = float(dtmin)
    gravity = float(gravity)
    ratio = float(ratio)
    _parameters = [dtmax, dtmin, gravity, ratio]
    return osi.to_process("analysis", _parameters)