Custom p-y curve example in PyPile

Users can customize their p-y curves using JavaScript in PyPile, which provides great flexibility to create p-y curves for any type of soils. The following code is an example to show how to use JavaScript to create p-y curve for stiff clay without free water presence (Reese).

The parameters of this function are specified by users or obtained from current and upper soil layers. The function returns lateral force P based on the deflection y and its user-defined p-y model.

function PyFunction(y, depth, top, bottom, r, r_ave, c, c_ave, phi, e50, k, u0, u1, b, cyclic){
    var P

    var J = 0.5
    var Pu = Math.min((3 + r_ave / c * depth + J / b * depth) * c * b, 9 * c * b)
    var y50 = 2.5 * e50 * b

    if (y < 16 * y50) {
        P = 0.5 * Math.pow(y / y50, 0.25) * Pu
    }
    else {
        P = Pu
    }

    return P
}