# 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
}```

## 23 Replies to “Custom p-y curve example in PyPile”

1. nabil zgh says:

pypile.exe -32bit send to me please

1. Yong says:

Hi Nabil, 32 bit version is not available any more.

2. Yashwant says:

Hello

Is it not possible to generate P -Y curve for depth above 10mts?

Thanks-

1. Yong says:

p-y curves will be generated within the pile embedment length.

1. Yashwant says:

Hello
Is there any provision to obtain the curve from SPT(Standard Penetration Test ) Value?
Thank You.

3. Yashwant says:

Hi,
Does the software calulate the value of P(Soil Reaction)

Thanks and Regards.

1. Yong says:

Yes, it does. In 0.6.0, Export->Export Result Graph->Soil Resistance with Depth.

1. Yashwant says:

Thank You.
Would you kindly let me know the approach used in solving the problem? Is it by FDM approach or undimensional approach.

Thanks and Regards

1. Yong says:

FDM is used in PyPile.

1. Yashwant says:

Is there any method to analyse a pile in rock and subjected to lateral loading?

2. Yong says:

Brittle Rock model and Elastic Perfectly Plastic Soil model can be used for hard and weak rocks.

4. Tanit R. says:

How to find Soil Spring

1. Yong says:

In one of the following versions, I will provide a function to export the P-y curves at specified levels, which means nonlinear spring will be available or constant secant spring can be obtained for a certain lateral movement.

5. fabio says:

Thank for your help,
Now it’s everything ok and it works!

6. fabio says:

Hi, I try to insert the API curves for sand, this is the code I’ve inserted:
function PyFunction(y, depth, top, bottom, r, r_ave, c, c_ave, phi, e50, k, u0, u1, b, cyclic){
var P

var p_shallow = ( 2.7 * depth + 3.2 * b ) * r * depth
var p_depth = 60 * r * depth
var p_ultimate = Math.min(p_shallow , p_depth)

var load= k * depth * y / (0.9 * p_ultimate)

P = 0.9 * p_ultimate * (Math.exp(load) – Math.exp(-1 * load)) * Math.pow(( Math.exp(load) + Math.exp(-1 * load),-1))
return P
}

I’ve found a problem during the execution of the function, even though, the message has been “Calculation succeeded” the results seemed like no computation has been made.

1. Yong says:

I copied and ran your code. It worked.
Can you save and send me your file?

1. fabio says:

yes, where i can send you the file?

1. Yong says:
1. fabio says:

Sended

2. Yong says:

Hi Fabio,
Please see the code below:
function PyFunction(y, depth, top, bottom, r, c, phi, e50, k, u0, u1, b, cyclic){
var P
var p_shallow = ( 2.7 * depth + 3.2 * b ) * r * depth
var p_depth = 60 * r * depth
var p_ultimate = Math.min(p_shallow , p_depth)
if (p_ultimate < 1e-5) p_ultimate = 1e-5 var load= k * depth * y / (0.9 * p_ultimate) P = 0.9 * p_ultimate * (Math.exp(load) - Math.exp(- load)) / ( Math.exp(load) + Math.exp(- load)) return P } Three problems caused the unsuccessful running: 1, the function definition actually changed a bit in 0.5.0. Please see the definition above. The default PyFunction definition will be updated in the next release. 2, the lower bound of p_ultimate should be limited to a small value, because p_ultimate is a divisor and cannot be 0. 3, one of the minus sign in your P = 0.9 * p_ultimate.... actually is a hyphen.

7. Fabio says:

Hello, i’m using your program for my thesis, first of all thank for pypile.
I would like to know how can I modify the p-y curves, the complete procedure if is possible.
Fabio.

1. Yong says:

Hi Fabio, You can customize your p-y curves by selecting
1) custom soil by curve in Soil Model dialog and input the top and bottom data points, and the value between the points will be interpolated linearly and the value at over the max defined movement is value at the max defined movement;
2) custom soil by function and write your own JavaScript function to generate any types of curves. See the post above. Please note the function will generate a curve defined by users instead of modifying an existing curve.
In JavaScript function
function PyFunction(y, depth, top, bottom, r, r_ave, c, c_ave, phi, e50, k, u0, u1, b, cyclic)
you can use the arguments the way you want. The basic meaning of the arguments are:
y: movement
depth: current calculation depth
top: layer top depth
bottom: layer bottom depth
r: soil unit weight
r_ave: average unit weight above the calculation depth
c: cohesion
c_ave: average cohesion above the calculation depth
phi: friction angle
1. Fabio says: