Profiling the code

Using PatchMesher to model a quarter of the plate

# sphinx_gallery_thumbnail_path = '_static/profiler.png'

SPARSE = False

import math
import sys
import numpy as np

from femedu.examples import Example

from femedu.domain import System, Node
from femedu.solver import NewtonRaphsonSolver, SparseSolver
from femedu.elements.linear import Triangle
from femedu.materials import PlaneStress
from femedu.mesher import *


class ExamplePlate14(Example):

    def problem(self):
        # ========== setting mesh parameters ==============

        Nx = 60        # number of elements in the mesh
        Ny = 40        # number of elements in the mesh

        Lx = 120.0    # length of plate in the x-direction
        Ly =  80.0    # length of plate in the y-direction
        R  = Ly / 2.

        # ========== setting material parameters ==============

        params = dict(
            E  = 200.,      # Young's modulus
            nu = 0.450,     # Poisson's ratio
            t  = 1.00       # thickness of the plate
        )

        # ========== setting load parameters ==============

        px  = 20.0         # uniform load normal to x=const
        py  =  0.0         # uniform load normal to y=const
        pxy =  0.0         # uniform shear load on x=const and y=const

        # ========== setting analysis parameters ==============

        target_load_level = 1.00     # reference load
        max_steps = 2                # number of load steps: 2 -> [0.0, 1.0]

        # define a list of target load levels
        load_levels = np.linspace(0, target_load_level, max_steps)

        #
        # ==== Build the system model ====
        #

        model = System()
        if SPARSE:
            model.setSolver(SparseSolver())
        else:
            model.setSolver(NewtonRaphsonSolver())

        # create nodes

        #  3---------2
        #  |         |
        #  |         |
        #  |         |
        #  1---------1

        pts = (
            ( 0, 0),
            (Lx, 0),
            (Lx, Ly),
            (0, Ly),
        )

        mesher = PatchMesher(model, pts[0], pts[1], pts[2], pts[3])
        nodes, elements = mesher.triangleMesh(Nx, Ny, Triangle, PlaneStress(params))

        # define support(s)

        ## find nodes at y==0 and x==0

        for node in nodes:
            X = node.getPos()
            if math.isclose(X[0], 0.0):
                node.fixDOF('ux')    # horizontal support left side
            if math.isclose(X[1], 0.0):
                node.fixDOF('uy')    # vertical support at y==0

        # ==== build the reference load ====

        # the section at the right end
        for elem, face in model.findFacesAlongLine((Lx, 0.0), (0.0, 1.0), orientation=+1):
            print('+', elem.getID(), face.id, ":", face.area)
            face.setLoad(px, pxy)

        model.plot(factor=0, title="undeformed system", filename="plate14_undeformed.png", show_bc=1, show_loads=1)

        model.setLoadFactor(1.0)
        model.solve()

        #model.plot(factor=1., filename="plate14_deformed.png")

        #model.solver.showKt(filename="plate14_spy_Kt.png")
        #np.save("plate14_Kt.npy",model.solver.Kt)

Run the example by creating an instance of the problem and executing it by calling Example.run()

This time, we are running the example in the profiler, writing profiling data to file.

    import cProfile

    ex = ExamplePlate14()

    if SPARSE:
        cProfile.run('ex.run()','profile_data_sparse.txt')
    else:
        cProfile.run('ex.run()','profile_data_full.txt')
undeformed system
+ Triangle_1081: nodes ( Node_838 Node_839 Node_899 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1082: nodes ( Node_900 Node_899 Node_839 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1082: nodes ( Node_900 Node_899 Node_839 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1201: nodes ( Node_899 Node_900 Node_960 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1202: nodes ( Node_961 Node_960 Node_900 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1202: nodes ( Node_961 Node_960 Node_900 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1321: nodes ( Node_960 Node_961 Node_1021 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1322: nodes ( Node_1022 Node_1021 Node_961 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1322: nodes ( Node_1022 Node_1021 Node_961 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1441: nodes ( Node_1021 Node_1022 Node_1082 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1442: nodes ( Node_1083 Node_1082 Node_1022 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1442: nodes ( Node_1083 Node_1082 Node_1022 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1561: nodes ( Node_1082 Node_1083 Node_1143 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1562: nodes ( Node_1144 Node_1143 Node_1083 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1562: nodes ( Node_1144 Node_1143 Node_1083 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1681: nodes ( Node_1143 Node_1144 Node_1204 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1682: nodes ( Node_1205 Node_1204 Node_1144 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1682: nodes ( Node_1205 Node_1204 Node_1144 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1801: nodes ( Node_1204 Node_1205 Node_1265 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1802: nodes ( Node_1266 Node_1265 Node_1205 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1802: nodes ( Node_1266 Node_1265 Node_1205 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1921: nodes ( Node_1265 Node_1266 Node_1326 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1922: nodes ( Node_1327 Node_1326 Node_1266 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_1922: nodes ( Node_1327 Node_1326 Node_1266 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2041: nodes ( Node_1326 Node_1327 Node_1387 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2042: nodes ( Node_1388 Node_1387 Node_1327 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2042: nodes ( Node_1388 Node_1387 Node_1327 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2161: nodes ( Node_1387 Node_1388 Node_1448 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2162: nodes ( Node_1449 Node_1448 Node_1388 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2162: nodes ( Node_1449 Node_1448 Node_1388 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2281: nodes ( Node_1448 Node_1449 Node_1509 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2282: nodes ( Node_1510 Node_1509 Node_1449 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2282: nodes ( Node_1510 Node_1509 Node_1449 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2401: nodes ( Node_1509 Node_1510 Node_1570 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2402: nodes ( Node_1571 Node_1570 Node_1510 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2402: nodes ( Node_1571 Node_1570 Node_1510 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2521: nodes ( Node_1570 Node_1571 Node_1631 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2522: nodes ( Node_1632 Node_1631 Node_1571 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2522: nodes ( Node_1632 Node_1631 Node_1571 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2641: nodes ( Node_1631 Node_1632 Node_1692 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2642: nodes ( Node_1693 Node_1692 Node_1632 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2642: nodes ( Node_1693 Node_1692 Node_1632 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2761: nodes ( Node_1692 Node_1693 Node_1753 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2762: nodes ( Node_1754 Node_1753 Node_1693 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2762: nodes ( Node_1754 Node_1753 Node_1693 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2881: nodes ( Node_1753 Node_1754 Node_1814 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2882: nodes ( Node_1815 Node_1814 Node_1754 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_2882: nodes ( Node_1815 Node_1814 Node_1754 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3001: nodes ( Node_1814 Node_1815 Node_1875 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3002: nodes ( Node_1876 Node_1875 Node_1815 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3002: nodes ( Node_1876 Node_1875 Node_1815 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3121: nodes ( Node_1875 Node_1876 Node_1936 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3122: nodes ( Node_1937 Node_1936 Node_1876 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3122: nodes ( Node_1937 Node_1936 Node_1876 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3241: nodes ( Node_1936 Node_1937 Node_1997 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3242: nodes ( Node_1998 Node_1997 Node_1937 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3242: nodes ( Node_1998 Node_1997 Node_1937 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3361: nodes ( Node_1997 Node_1998 Node_2058 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3362: nodes ( Node_2059 Node_2058 Node_1998 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3362: nodes ( Node_2059 Node_2058 Node_1998 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3481: nodes ( Node_2058 Node_2059 Node_2119 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3482: nodes ( Node_2120 Node_2119 Node_2059 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3482: nodes ( Node_2120 Node_2119 Node_2059 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3601: nodes ( Node_2119 Node_2120 Node_2180 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3602: nodes ( Node_2181 Node_2180 Node_2120 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3602: nodes ( Node_2181 Node_2180 Node_2120 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3721: nodes ( Node_2180 Node_2181 Node_2241 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3722: nodes ( Node_2242 Node_2241 Node_2181 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3722: nodes ( Node_2242 Node_2241 Node_2181 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3841: nodes ( Node_2241 Node_2242 Node_2302 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3842: nodes ( Node_2303 Node_2302 Node_2242 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3842: nodes ( Node_2303 Node_2302 Node_2242 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3961: nodes ( Node_2302 Node_2303 Node_2363 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3962: nodes ( Node_2364 Node_2363 Node_2303 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_3962: nodes ( Node_2364 Node_2363 Node_2303 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4081: nodes ( Node_2363 Node_2364 Node_2424 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4082: nodes ( Node_2425 Node_2424 Node_2364 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4082: nodes ( Node_2425 Node_2424 Node_2364 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4201: nodes ( Node_2424 Node_2425 Node_2485 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4202: nodes ( Node_2486 Node_2485 Node_2425 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4202: nodes ( Node_2486 Node_2485 Node_2425 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4321: nodes ( Node_2485 Node_2486 Node_2546 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4322: nodes ( Node_2547 Node_2546 Node_2486 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4322: nodes ( Node_2547 Node_2546 Node_2486 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4441: nodes ( Node_2546 Node_2547 Node_2607 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4442: nodes ( Node_2608 Node_2607 Node_2547 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4442: nodes ( Node_2608 Node_2607 Node_2547 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4561: nodes ( Node_2607 Node_2608 Node_2668 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4562: nodes ( Node_2669 Node_2668 Node_2608 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4562: nodes ( Node_2669 Node_2668 Node_2608 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4681: nodes ( Node_2668 Node_2669 Node_2729 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4682: nodes ( Node_2730 Node_2729 Node_2669 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4682: nodes ( Node_2730 Node_2729 Node_2669 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4801: nodes ( Node_2729 Node_2730 Node_2790 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4802: nodes ( Node_2791 Node_2790 Node_2730 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4802: nodes ( Node_2791 Node_2790 Node_2730 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4921: nodes ( Node_2790 Node_2791 Node_2851 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4922: nodes ( Node_2852 Node_2851 Node_2791 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_4922: nodes ( Node_2852 Node_2851 Node_2791 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5041: nodes ( Node_2851 Node_2852 Node_2912 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5042: nodes ( Node_2913 Node_2912 Node_2852 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5042: nodes ( Node_2913 Node_2912 Node_2852 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5161: nodes ( Node_2912 Node_2913 Node_2973 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5162: nodes ( Node_2974 Node_2973 Node_2913 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5162: nodes ( Node_2974 Node_2973 Node_2913 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5281: nodes ( Node_2973 Node_2974 Node_3034 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5282: nodes ( Node_3035 Node_3034 Node_2974 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5282: nodes ( Node_3035 Node_3034 Node_2974 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5401: nodes ( Node_3034 Node_3035 Node_3095 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5402: nodes ( Node_3096 Node_3095 Node_3035 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5402: nodes ( Node_3096 Node_3095 Node_3035 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5521: nodes ( Node_3095 Node_3096 Node_3156 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5522: nodes ( Node_3157 Node_3156 Node_3096 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5522: nodes ( Node_3157 Node_3156 Node_3096 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5641: nodes ( Node_3156 Node_3157 Node_3217 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5642: nodes ( Node_3218 Node_3217 Node_3157 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5642: nodes ( Node_3218 Node_3217 Node_3157 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5761: nodes ( Node_3217 Node_3218 Node_3278 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5762: nodes ( Node_3279 Node_3278 Node_3218 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Triangle_5762: nodes ( Node_3279 Node_3278 Node_3218 )
    material: PlaneStress
    strain: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=-0.000e+00
    stress: xx=0.000e+00 yy=0.000e+00 xy=0.000e+00 zz=0.000e+00
+ Elem_1082 1082.2 : [[2 0]]
+ Elem_1202 1202.2 : [[2 1.42109e-14]]
+ Elem_1322 1322.2 : [[2 -1.42109e-14]]
+ Elem_1442 1442.2 : [[2 0]]
+ Elem_1562 1562.2 : [[2 0]]
+ Elem_1682 1682.2 : [[2 0]]
+ Elem_1802 1802.2 : [[2 0]]
+ Elem_1922 1922.2 : [[2 0]]
+ Elem_2042 2042.2 : [[2 0]]
+ Elem_2162 2162.2 : [[2 0]]
+ Elem_2282 2282.2 : [[2 0]]
+ Elem_2402 2402.2 : [[2 0]]
+ Elem_2522 2522.2 : [[2 -1.42109e-14]]
+ Elem_2642 2642.2 : [[2 2.84217e-14]]
+ Elem_2762 2762.2 : [[2 -1.42109e-14]]
+ Elem_2882 2882.2 : [[2 1.42109e-14]]
+ Elem_3002 3002.2 : [[2 -1.42109e-14]]
+ Elem_3122 3122.2 : [[2 -1.42109e-14]]
+ Elem_3242 3242.2 : [[2 2.84217e-14]]
+ Elem_3362 3362.2 : [[2 -1.42109e-14]]
+ Elem_3482 3482.2 : [[2 1.42109e-14]]
+ Elem_3602 3602.2 : [[2 -1.42109e-14]]
+ Elem_3722 3722.2 : [[2 0]]
+ Elem_3842 3842.2 : [[2 0]]
+ Elem_3962 3962.2 : [[2 0]]
+ Elem_4082 4082.2 : [[2 0]]
+ Elem_4202 4202.2 : [[2 0]]
+ Elem_4322 4322.2 : [[2 0]]
+ Elem_4442 4442.2 : [[2 0]]
+ Elem_4562 4562.2 : [[2 0]]
+ Elem_4682 4682.2 : [[2 0]]
+ Elem_4802 4802.2 : [[2 0]]
+ Elem_4922 4922.2 : [[2 2.84217e-14]]
+ Elem_5042 5042.2 : [[2 -2.84217e-14]]
+ Elem_5162 5162.2 : [[2 0]]
+ Elem_5282 5282.2 : [[2 0]]
+ Elem_5402 5402.2 : [[2 0]]
+ Elem_5522 5522.2 : [[2 0]]
+ Elem_5642 5642.2 : [[2 0]]
+ Elem_5762 5762.2 : [[2 0]]
+

Now it’s time to process the profiling data

    import pstats
    from pstats import SortKey

    if SPARSE:
        p = pstats.Stats('profile_data_sparse.txt')
        p.strip_dirs() #.sort_stats(-1).print_stats()
        p.sort_stats(SortKey.NAME)
        #p.print_stats()

        p.sort_stats(SortKey.CUMULATIVE).print_stats(20)
        p.sort_stats(SortKey.TIME).print_stats(20)

    else:
        p = pstats.Stats('profile_data_full.txt')
        p.strip_dirs() #.sort_stats(-1).print_stats()
        p.sort_stats(SortKey.NAME)
        #p.print_stats()

        p.sort_stats(SortKey.CUMULATIVE).print_stats(20)
        p.sort_stats(SortKey.TIME).print_stats(20)
Fri Jan 17 19:10:14 2025    profile_data_full.txt

         20820541 function calls (20167994 primitive calls) in 31.220 seconds

   Ordered by: cumulative time
   List reduced from 1354 to 20 due to restriction <20>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000   18.845   18.845 System.py:504(solve)
        1    0.000    0.000   18.845   18.845 NewtonRaphsonSolver.py:13(solve)
        5    0.000    0.000   18.604    3.721 NewtonRaphsonSolver.py:111(assemble)
        5    2.255    0.451   18.604    3.721 Solver.py:166(assemble)
     35/3    0.026    0.001   12.851    4.284 text.py:358(_get_layout)
    43200    4.231    0.000   11.012    0.000 Triangle.py:80(updateState)
     81/7    0.000    0.000    9.081    1.297 text.py:65(_get_text_metrics_with_cache)
      9/4    0.000    0.000    9.080    2.270 text.py:73(_get_text_metrics_with_cache_impl)
     10/4    0.040    0.004    9.078    2.269 backend_agg.py:206(get_text_width_height_descent)
        2    0.000    0.000    8.401    4.201 Solver.py:395(checkResiduum)
    24000    0.206    0.000    6.950    0.000 Element.py:271(getForce)
     49/2    0.001    0.000    6.944    3.472 text.py:926(get_window_extent)
    19200    0.268    0.000    6.515    0.000 Element.py:348(getStiffness)
    72000    1.122    0.000    4.397    0.000 Triangle.py:159(computeSurfaceLoads)
     4902    0.041    0.000    3.266    0.001 _axes.py:1532(plot)
663450/182418    1.255    0.000    3.114    0.000 copy.py:119(deepcopy)
   216000    1.050    0.000    2.501    0.000 Face2D.py:54(computeNodalForces)
    28800    0.190    0.000    2.401    0.000 Element.py:286(getLoad)
    14706    0.118    0.000    2.288    0.000 lines.py:744(draw)
        1    0.217    0.217    2.269    2.269 Solver.py:454(getNodalReactions)


Fri Jan 17 19:10:14 2025    profile_data_full.txt

         20820541 function calls (20167994 primitive calls) in 31.220 seconds

   Ordered by: internal time
   List reduced from 1354 to 20 due to restriction <20>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    43200    4.231    0.000   11.012    0.000 Triangle.py:80(updateState)
        5    2.255    0.451   18.604    3.721 Solver.py:166(assemble)
        1    2.142    2.142    2.142    2.142 _linalg.py:320(solve)
   302400    1.364    0.000    1.692    0.000 numeric.py:876(outer)
  1150138    1.278    0.000    1.278    0.000 {built-in method numpy.array}
663450/182418    1.255    0.000    3.114    0.000 copy.py:119(deepcopy)
    72000    1.122    0.000    4.397    0.000 Triangle.py:159(computeSurfaceLoads)
   216000    1.050    0.000    2.501    0.000 Face2D.py:54(computeNodalForces)
    43201    0.970    0.000    1.247    0.000 PlaneStress.py:25(updateState)
     9806    0.965    0.000    1.563    0.000 backend_agg.py:93(draw_path)
   192082    0.759    0.000    1.745    0.000 Node.py:455(getDeformedPos)
   192490    0.603    0.000    0.950    0.000 Node.py:341(getDisp)
   244800    0.571    0.000    0.818    0.000 Node.py:506(getIdx4Element)
   218462    0.559    0.000    0.734    0.000 numeric.py:64(zeros_like)
  1779684    0.428    0.000    0.428    0.000 {method 'append' of 'list' objects}
   470592    0.420    0.000    0.585    0.000 copy.py:232(_keep_alive)
    39338    0.309    0.000    0.349    0.000 __init__.py:65(check_isinstance)
  1293472    0.296    0.000    0.344    0.000 {built-in method builtins.isinstance}
58946/29508    0.294    0.000    0.575    0.000 transforms.py:2431(get_affine)
    14400    0.289    0.000    0.289    0.000 {method 'index' of 'list' objects}

Total running time of the script: (0 minutes 31.073 seconds)

Gallery generated by Sphinx-Gallery