コード例 #1
0
def plotVoltage():
    mesh = globalvars.data["Mesh"]
    ElemType = mesh["ElemType"]
    nodal_temp = []
    globalvars.results["Voltage"] = []
    for inode in range(len(globalvars.data["Mesh"]["Nodes"])):
        idire = globalvars.madgln[inode, 0]
        temp = globalvars.u_vec[idire]
        nodal_temp.append(temp)

        nodal_temp_res = {
            "Node": inode+1,
            "Voltage": "{:10.4e}".format(temp),
        }

        globalvars.results["Voltage"].append(nodal_temp_res)
    
    if (ElemType == "BAR02" or ElemType == "BAR03"):
        plotNodalBarResult("Voltage", r"$Voltage$ (V)", nodal_temp)
コード例 #2
0
def plotTemperatures():
    mesh = globalvars.data["Mesh"]
    ElemType = mesh["ElemType"]
    nodal_temp = []
    globalvars.results["Temperatures"] = []
    for inode in range(len(globalvars.data["Mesh"]["Nodes"])):
        idire = globalvars.madgln[inode, 0]
        temp = globalvars.u_vec[idire]
        nodal_temp.append(temp)

        nodal_temp_res = {
            "Node": inode+1,
            "Temp": "{:10.4e}".format(temp),
        }

        globalvars.results["Temperatures"].append(nodal_temp_res)
    
    if(ElemType == "TR03" or ElemType == "TR06" or ElemType == "QU04" or ElemType == "QU08" or ElemType == "QU09"):
        plot_contour(mesh, nodal_temp, "Temperatures", r"$Temp$ ($^\circ$C)")
    elif (ElemType == "BAR02" or ElemType == "BAR03"):
        plotNodalBarResult("Temperatures", r"$Temp$ ($^\circ$C)", nodal_temp)
コード例 #3
0
def plotDisplacements():
    mesh = globalvars.data["Mesh"]
    ElemType = mesh["ElemType"]
    ndof = globalvars.ndof
    nodal_disp_x = []
    nodal_disp_y = []
    globalvars.results["Displacements"] = []
    for inode in range(len(globalvars.data["Mesh"]["Nodes"])):
        idire_x = globalvars.madgln[inode, 0]
        disp_x = globalvars.u_vec[idire_x]
        nodal_disp_x.append(disp_x)

        if(ndof == 1):
            nodal_disp_res = {
                "Node": inode+1,
                "Disp_x": "{:10.4e}".format(disp_x),
            }
        elif(ndof == 2):
            idire_y = globalvars.madgln[inode, 1]
            disp_y = globalvars.u_vec[idire_y]
            nodal_disp_y.append(disp_y)
            nodal_disp_res = {
                "Node": inode+1,
                "Disp_x": "{:10.4e}".format(disp_x),
                "Disp_y": "{:10.4e}".format(disp_y)
            }

        globalvars.results["Displacements"].append(nodal_disp_res)
    
    if(ElemType == "TR03" or ElemType == "TR06" or ElemType == "QU04" or ElemType == "QU08" or ElemType == "QU09"):
        plot_contour(mesh, nodal_disp_x, "Displacements x", r"$u_x$ (m)")
        plot_contour(mesh, nodal_disp_y, "Displacements y", r"$u_y$ (m)")
    elif (ElemType == "BAR02" or ElemType == "BAR03"):
        plt.rcParams["axes.spines.right"] = True
        plt.rcParams["axes.spines.top"] = True
        plotNodalBarResult("Displacements", r"$u_x$ (m)", nodal_disp_x)
    elif (ElemType == "TRUSS02"):
        plt.rcParams["axes.spines.right"] = True
        plt.rcParams["axes.spines.top"] = True
        plotNodalBarResult("Horizontal displacements", r"$u_x$ (m)", nodal_disp_x)
        plotNodalBarResult("Vertical displacements", r"$u_y$ (m)", nodal_disp_y)
        if ("Show_deformed" in globalvars.data["Postprocess"] and globalvars.data["Postprocess"]["Show_deformed"]):
            plotDeformed(globalvars.u_vec, "Deformed")