Skip to content

Commit

Permalink
updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
benranderson committed Jun 11, 2018
1 parent 95c77d0 commit c913ad0
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 81 deletions.
5 changes: 3 additions & 2 deletions wallthick/dnvf101.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""
Offshore Standard DNV-OS-F101 Subsea Pipeline Systems August 2012
"""

from scipy.interpolate import interp1d
# import matplotlib.pyplot as plt

title = "DNV-OS-F101"
year = 2012
TITLE = "DNV-OS-F101"
YEAR = 2012

"""
(Table 2-4)
Expand Down
180 changes: 101 additions & 79 deletions wallthick/pd8010.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,84 +12,106 @@
import scipy.optimize
import json

TITLE = "PD 8010-2"
YEAR = 2015

n_s = 0.72


def internal_pressure(P_d, P_h):
"""Return total internal pressure [Pa].
:param float P_d: Design pressure [Pa]
:param float P_h: Pressure head [Pa]
"""
return P_d + P_h


def water_depths(h, H_t, H_w):
"""Return the minimum and maximum water depth [m] as a tuple.
:param float h: Water depth [m]
:param float H_t: Tide height [m]
:param float H_w: Wave height [m]
"""
d_min = h - (H_w/2)
d_max = h + H_t + (H_w/2)
return d_min, d_max


def external_pressure(rho, g, d):
"""Return the external pressure [Pa] at water depth.
:param float rho: Water density [kg/m^3]
:param float g: Acceleration of gravity [m/s/s]
:param float d: Water depth [m]
"""
return rho * g * d


def hoop_pressure_thin(t, D_o, P_o, sig):
"""
Number [Pa], Number [Pa], Number [m], Number [Pa] -> Number [m]
Returns the internal pressure that induces a stress, sig, in a thin
wall pipe of thickness t.
"""Return the internal pressure [Pa] that induces a stress, sig, in a thin wall pipe
of thickness t - PD8010-2 Equation (3).
Equation (3)
:param float t: Wall thickness [m]
:param float D_o: Outside diamter [m]
:param float P_o: External pressure [Pa]
:param float sig: Stress [Pa]
"""
return ((sig * 2 * t) / D_o) + P_o


def hoop_pressure_thick(t, D_o, P_o, sig):
"""
Number [Pa], Number [Pa], Number [m], Number [Pa] -> Number [m]
Returns the internal pressure that induces a stress, sig, in a thick
walled pipe of thickness t.
"""Return the internal pressure [Pa] that induces a stress, sig, in a thick walled
pipe of thickness t - PD8010-2 Equation (5).
Equation (5)
:param float t: Wall thickness [m]
:param float D_o: Outside diamter [m]
:param float P_o: External pressure [Pa]
:param float sig: Stress [Pa]
"""
return ((sig * (D_o**2 - (D_o - 2 * t)**2)) / (D_o**2 + (D_o - 2 * t)**2)) + P_o


def hoop_thickness_thin(P_i, P_o, D_o, sig_y_d):
"""
Number [Pa], Number [Pa], Number [m], Number [Pa] -> Number [m]
Returns the minimum wall thickness for internal pressure containment for a
thin walled pipe.
"""Return the minimum wall thickness [m] for internal pressure containment for a
thin walled pipe - PD8010-2 Equation (3).
Equation (3)
:param float P_i: Internal pressure [Pa]
:param float P_o: External pressure [Pa]
:param float D_o: Outside diameter [m]
:param float sig_y_d: De-rated yield strength [Pa]
"""
return abs(P_i - P_o) * D_o / (2 * n_s * sig_y_d)


def hoop_thickness_thick(P_i, P_o, D_o, sig_y_d):
"""
Number [Pa], Number [Pa], Number [m], Number [Pa] -> Number [m]
"""Return the minimum wall thickness [m] for internal pressure containment for a
thick walled pipe - PD8010-2 Equation (5).
Returns the minimum wall thickness for internal pressure containment for a
thick walled pipe.
Equation (5)
:param float P_i: Internal pressure [Pa]
:param float P_o: External pressure [Pa]
:param float D_o: Outside diameter [m]
:param float sig_y_d: De-rated yield strength [Pa]
"""
eq = math.sqrt((((n_s*sig_y_d - abs(P_i - P_o))) * D_o**2) /
(n_s*sig_y_d + abs(P_i - P_o)))
return 0.5 * (D_o - eq)


def hoop_thickness(P_i, P_o_min, D_o, sig_y_d):
"""
Number [Pa], Number [Pa], Number [m], Number [Pa] -> Number [m]
Returns the minimum (note not nominal) wall thickness for internal pressure
"""Return the minimum (note not nominal) wall thickness for internal pressure
containment.
Considers:
- Allowable hoop stress
- Worst case maximum pressure difference
- Appropriate wall thickness theory, i.e. thick or thin
:param float P_i: Internal pressure [Pa]
:param float P_o_min: Minimum external pressure [Pa]
:param float D_o: Outside diameter [m]
:param float sig_y_d: De-rated yield strength [Pa]
"""
t_min_thin = hoop_thickness_thin(P_i, P_o_min, D_o, sig_y_d)

Expand All @@ -103,16 +125,13 @@ def hoop_thickness(P_i, P_o_min, D_o, sig_y_d):


def req_thickness(t_min, t_corr, f_tol):
'''
Number [m], Number [m], Number [-] -> Number [m]
Returns the required wall thickness based on the following mechanical
allowances:
- Corrosion allowance
- Fabrication tolerance
"""Return the required wall thickness [m] based on the mechanical allowances -
extrapolated from PD8010-2 Equation (4).
Exrapolated from Equation (4)
'''
:param float t_min: Minimum wall thickness [m]
:param float t_corr: Corrosion allowance [m]
:param float f_tol: Fabrication tolerance [-]
"""
try:
return (t_min + t_corr) / (1 - f_tol)
except ZeroDivisionError:
Expand All @@ -125,47 +144,41 @@ def req_thickness(t_min, t_corr, f_tol):


def collapse_thickness(P_o, sig_y_d, E, v, D_o, f_0):
"""
Number [Pa], Number [Pa], Number [Pa], Number [-], Number [m], Number [-]
-> Number [m]
Returns the nominal wall thickness for local buckling due to external
pressure.
"""Return the nominal wall thickness [m] for local buckling due to external
pressure - PD8010-2 Clause G.1.2.
Considers the worst case maximum external over pressure, i.e.:
- Minimum internal pressure (zero)
- Maximum external pressure (at water depth, d)
(Clause G.1.2)
- Minimum internal pressure(zero)
- Maximum external pressure(at water depth, d)
:param float P_o: External pressure [Pa]
:param float sig_y_d: De-rated yield strength [Pa]
:param float E: Young's modulus [Pa]
:param float v: Poisson's ratio [-]
:param float D_o: Outside diameter [m]
:param float f_0: Pipeline ovality [-]
"""

def P_e(t):
"""
Number [m] -> Number [Pa]
"""Return the critical pressure [Pa] for an elastic critical tube - PD8010-2
Equation (G.2).
Returns the critical pressure for an elastic critical tube.
Equation (G.2)
:param float t: Wall thickness [m]
"""
return 2 * E / (1 - v**2) * (t / D_o)**3

def P_y(t):
"""
Number [m] -> Number [Pa]
Returns the yield pressure.
"""Return the yield pressure [Pa] - PD8010-2 Equation (G.3).
Equation (G.3)
:param float t: Wall thickness [m]
"""
return 2 * sig_y_d * (t / D_o)

def char_resist(t):
"""
Number [m] -> Number [Pa]
Returns the characteristic resistance for external pressure
"""Return the characteristic resistance [m] for external pressure - PD8010-2
Equation (G.1).
Equation (G.1)
:param float t: Wall thickness [m]
"""
term_1 = ((P_o / P_e(t)) - 1)
term_2 = ((P_o / P_y(t))**2 - 1)
Expand All @@ -179,15 +192,13 @@ def char_resist(t):


def buckle_thickness(D_o, P_p, sig_y):
"""
Number [m], Number [Pa], Number [Pa] -> Number [m]
Returns the nominal buckle thickness based on the propagation pressure.
"""Return the nominal buckle thickness [t] based on the propagation pressure.
Considers the worst case maximum external pressure and ignores internal
pressure.
pressure - PD8010-2 Equation (G.21).
Equation (G.21)
:param float D_o: Outside Diameter [m]
:param float P_p: Propagation pressure [Pa]
:param float sig_y: Yield strength [Pa]
"""
return D_o * (P_p / (10.7 * sig_y))**(4 / 9)

Expand All @@ -197,17 +208,22 @@ def buckle_thickness(D_o, P_p, sig_y):


def strength_test_pressure(t_sel, f_tol, sig_y, D_o, P_d, P_o, P_h):
"""
InputData -> Number [Pa]
Returns the strength test pressure, i.e. the minimum of:
"""Return the strength test pressure, i.e. the minimum of:
- 1.5 * design pressure:
Note that hydrostatic head is not multiplied by 1.5 (interpreted by
last paragraph of Section 11.5.2)
- the pressure that induces a hoop stress of 90 percent SMYS at nominal
wall thickness.
(Section 11.5.1, Ref.1)
PD8010-2 Section 11.5.1, Ref.1.
:param float t_sel: Selected wall thickness [m]
:param float f_tol: fabrication tolerance [-]
:param float sig_y: Yield strength [Pa]
:param float D_o: Outside Diameter [m]
:param float P_d: Design pressure [Pa]
:param float P_o: External pressure [Pa]
:param float P_h: Pressure head [Pa]
"""

# Determine nominal wall thickness (no corrosion)
Expand All @@ -230,6 +246,8 @@ def strength_test_pressure(t_sel, f_tol, sig_y, D_o, P_d, P_o, P_h):


class Pd8010(object):
"""A PD8010-2 design code object.
"""

def __init__(self, data):
self.t_sel = data['t_sel']
Expand All @@ -253,6 +271,8 @@ def __init__(self, data):

@property
def t_h(self):
"""Required wall thickness [m] to satify bursting criteria.
"""
P_i = internal_pressure(self.P_d, self.P_h)
# min water depth
d, _ = water_depths(self.h, self.H_t, self.H_w)
Expand All @@ -262,6 +282,8 @@ def t_h(self):

@property
def t_c(self):
"""Required wall thickness [m] to satify collapse criteria.
"""
P_i = internal_pressure(self.P_d, self.P_h)
# max water depth
_, d = water_depths(self.h, self.H_t, self.H_w)
Expand All @@ -272,6 +294,8 @@ def t_c(self):

@property
def t_b(self):
"""Required wall thickness [m] to satify buckling criteria.
"""
# max water depth
_, d = water_depths(self.h, self.H_t, self.H_w)
# propagation pressure equal to max external pressure
Expand All @@ -280,7 +304,8 @@ def t_b(self):

@property
def P_st(self):
''' Strength test pressure '''
"""Strength test pressure [Pa].
"""
# min water depth
d, _ = water_depths(self.h, self.H_t, self.H_w)
P_o = external_pressure(self.rho_w, self.g, d)
Expand All @@ -289,9 +314,6 @@ def P_st(self):

@property
def P_lt(self):
"""
Return leak test pressure: 1.1 * MAOP (design pressure) at LAT
Section 11.5.3
"""Leak test pressure [Pa] - PD8010-2 Section 11.5.3.
"""
return 1.1 * self.P_d

0 comments on commit c913ad0

Please sign in to comment.