Skip to content

Material

fpc.material

material.py - material science and strength of materials.

This class covers how materials deform and fail under load: Hooke's law, the stress-strain relationship, beam bending, thermal expansion, and column buckling. These are the calculations that decide whether a part is stiff enough, strong enough, and stable enough.

Material

Strength-of-materials and material-property calculations.

Source code in fpc/material.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
class Material:
    """Strength-of-materials and material-property calculations."""

    def stress(self, *, force, area):
        """Engineering stress: sigma = F / A.

        :param force: applied axial force [N]
        :param area: original cross-sectional area [m^2]
        :returns: stress [Pa]
        """
        return force / area

    def strain(self, *, change_in_length, original_length):
        """Engineering strain: epsilon = dL / L0 (dimensionless).

        :param change_in_length: change in length dL [m]
        :param original_length: original length L0 [m]
        :returns: strain [-]
        """
        return change_in_length / original_length

    def youngs_modulus(self, *, stress, strain):
        """Young's modulus (stiffness) from Hooke's law: E = sigma / strain.

        :param stress: applied stress [Pa]
        :param strain: resulting strain [-]
        :returns: Young's modulus [Pa]
        """
        return stress / strain

    def axial_deformation(self, *, force, length, area, modulus):
        """Axial stretch/compression of a bar: dL = F*L / (A*E).

        :param force: axial force [N]
        :param length: original length L [m]
        :param area: cross-sectional area A [m^2]
        :param modulus: Young's modulus E [Pa]
        :returns: change in length [m]
        """
        return force * length / (area * modulus)

    def bending_stress(self, *, moment, distance, moment_of_inertia):
        """Bending (flexural) stress in a beam: sigma = M*c / I.

        :param moment: bending moment M [N*m]
        :param distance: distance from neutral axis to the fibre c [m]
        :param moment_of_inertia: second moment of area I [m^4]
        :returns: bending stress [Pa]
        """
        return moment * distance / moment_of_inertia

    def thermal_expansion(self, *, coefficient, original_length, delta_temperature):
        """Length change from temperature: dL = alpha * L0 * dT.

        :param coefficient: linear expansion coefficient alpha [1/K]
        :param original_length: original length L0 [m]
        :param delta_temperature: temperature change dT [K]
        :returns: change in length [m]
        """
        return coefficient * original_length * delta_temperature

    def euler_buckling_load(self, *, modulus, moment_of_inertia, length, end_factor=1.0):
        """Critical buckling load of a slender column (Euler's formula).

        P_cr = pi^2 * E * I / (K*L)^2.

        :param modulus: Young's modulus E [Pa]
        :param moment_of_inertia: smallest second moment of area I [m^4]
        :param length: unsupported column length L [m]
        :param end_factor: effective-length factor K (1.0 pinned-pinned,
            0.5 fixed-fixed, 2.0 fixed-free), defaults to pinned-pinned
        :returns: critical axial load [N]
        """
        effective_length = end_factor * length
        return math.pi**2 * modulus * moment_of_inertia / effective_length**2

stress(*, force, area)

Engineering stress: sigma = F / A.

Parameters:

Name Type Description Default
force

applied axial force [N]

required
area

original cross-sectional area [m^2]

required

Returns:

Type Description

stress [Pa]

Source code in fpc/material.py
18
19
20
21
22
23
24
25
def stress(self, *, force, area):
    """Engineering stress: sigma = F / A.

    :param force: applied axial force [N]
    :param area: original cross-sectional area [m^2]
    :returns: stress [Pa]
    """
    return force / area

strain(*, change_in_length, original_length)

Engineering strain: epsilon = dL / L0 (dimensionless).

Parameters:

Name Type Description Default
change_in_length

change in length dL [m]

required
original_length

original length L0 [m]

required

Returns:

Type Description

strain [-]

Source code in fpc/material.py
27
28
29
30
31
32
33
34
def strain(self, *, change_in_length, original_length):
    """Engineering strain: epsilon = dL / L0 (dimensionless).

    :param change_in_length: change in length dL [m]
    :param original_length: original length L0 [m]
    :returns: strain [-]
    """
    return change_in_length / original_length

youngs_modulus(*, stress, strain)

Young's modulus (stiffness) from Hooke's law: E = sigma / strain.

Parameters:

Name Type Description Default
stress

applied stress [Pa]

required
strain

resulting strain [-]

required

Returns:

Type Description

Young's modulus [Pa]

Source code in fpc/material.py
36
37
38
39
40
41
42
43
def youngs_modulus(self, *, stress, strain):
    """Young's modulus (stiffness) from Hooke's law: E = sigma / strain.

    :param stress: applied stress [Pa]
    :param strain: resulting strain [-]
    :returns: Young's modulus [Pa]
    """
    return stress / strain

axial_deformation(*, force, length, area, modulus)

Axial stretch/compression of a bar: dL = FL / (AE).

Parameters:

Name Type Description Default
force

axial force [N]

required
length

original length L [m]

required
area

cross-sectional area A [m^2]

required
modulus

Young's modulus E [Pa]

required

Returns:

Type Description

change in length [m]

Source code in fpc/material.py
45
46
47
48
49
50
51
52
53
54
def axial_deformation(self, *, force, length, area, modulus):
    """Axial stretch/compression of a bar: dL = F*L / (A*E).

    :param force: axial force [N]
    :param length: original length L [m]
    :param area: cross-sectional area A [m^2]
    :param modulus: Young's modulus E [Pa]
    :returns: change in length [m]
    """
    return force * length / (area * modulus)

bending_stress(*, moment, distance, moment_of_inertia)

Bending (flexural) stress in a beam: sigma = M*c / I.

Parameters:

Name Type Description Default
moment

bending moment M [N*m]

required
distance

distance from neutral axis to the fibre c [m]

required
moment_of_inertia

second moment of area I [m^4]

required

Returns:

Type Description

bending stress [Pa]

Source code in fpc/material.py
56
57
58
59
60
61
62
63
64
def bending_stress(self, *, moment, distance, moment_of_inertia):
    """Bending (flexural) stress in a beam: sigma = M*c / I.

    :param moment: bending moment M [N*m]
    :param distance: distance from neutral axis to the fibre c [m]
    :param moment_of_inertia: second moment of area I [m^4]
    :returns: bending stress [Pa]
    """
    return moment * distance / moment_of_inertia

thermal_expansion(*, coefficient, original_length, delta_temperature)

Length change from temperature: dL = alpha * L0 * dT.

Parameters:

Name Type Description Default
coefficient

linear expansion coefficient alpha [1/K]

required
original_length

original length L0 [m]

required
delta_temperature

temperature change dT [K]

required

Returns:

Type Description

change in length [m]

Source code in fpc/material.py
66
67
68
69
70
71
72
73
74
def thermal_expansion(self, *, coefficient, original_length, delta_temperature):
    """Length change from temperature: dL = alpha * L0 * dT.

    :param coefficient: linear expansion coefficient alpha [1/K]
    :param original_length: original length L0 [m]
    :param delta_temperature: temperature change dT [K]
    :returns: change in length [m]
    """
    return coefficient * original_length * delta_temperature

euler_buckling_load(*, modulus, moment_of_inertia, length, end_factor=1.0)

Critical buckling load of a slender column (Euler's formula).

P_cr = pi^2 * E * I / (K*L)^2.

Parameters:

Name Type Description Default
modulus

Young's modulus E [Pa]

required
moment_of_inertia

smallest second moment of area I [m^4]

required
length

unsupported column length L [m]

required
end_factor

effective-length factor K (1.0 pinned-pinned, 0.5 fixed-fixed, 2.0 fixed-free), defaults to pinned-pinned

1.0

Returns:

Type Description

critical axial load [N]

Source code in fpc/material.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
def euler_buckling_load(self, *, modulus, moment_of_inertia, length, end_factor=1.0):
    """Critical buckling load of a slender column (Euler's formula).

    P_cr = pi^2 * E * I / (K*L)^2.

    :param modulus: Young's modulus E [Pa]
    :param moment_of_inertia: smallest second moment of area I [m^4]
    :param length: unsupported column length L [m]
    :param end_factor: effective-length factor K (1.0 pinned-pinned,
        0.5 fixed-fixed, 2.0 fixed-free), defaults to pinned-pinned
    :returns: critical axial load [N]
    """
    effective_length = end_factor * length
    return math.pi**2 * modulus * moment_of_inertia / effective_length**2