Esempio n. 1
0
    def calcStaticWindloadDeflection(self, F_p_j):
        # ------------
        # preprocessor
        # ---------

        # Adding loads
        self.load_case = cases.LoadCase()

        # Loop over all nodes
        for j in range(len(F_p_j)):
            # Search for node by z coordinate
            z_j = self.node_coords_load[j]
            for i in range(len(self.node_coords)):
                if z_j == self.node_coords[i]:
                    # Add loading to this node
                    F_p = np.mean(F_p_j[j])        #[in KN]
                    self.load_case.add_nodal_load(node=self.nodes[i], val=F_p , dof=0) 
                    # Check applied loading
                    # print('at z = '+ str(z_j) )
                    # print('F_p  = '+ str(F_p) )

        # an analysis case relates a support case to a load case
        analysis_case = cases.AnalysisCase(freedom_case=self.freedom_case, load_case=self.load_case)

        # ------
        # solver
        # ------

        # you can easily change the solver settings
        settings = SolverSettings()
        settings.linear_static.time_info = False

        # the linear static solver is an object and acts on the analysis object
        solver = LinearStatic(analysis=self.analysis, analysis_cases=[analysis_case], solver_settings=settings)
        solver.solve()

        # ----
        # post
        # ----
        # there are plenty of post processing options!
        # self.analysis.post.plot_geom(analysis_case=analysis_case)
        # self.analysis.post.plot_geom(analysis_case=analysis_case, deformed=True, def_scale=1e2)
        # self.analysis.post.plot_frame_forces(analysis_case=analysis_case, shear=True)
        # self.analysis.post.plot_frame_forces(analysis_case=analysis_case, moment=True)
        # self.analysis.post.plot_reactions(analysis_case=analysis_case)
        
        # Support reactions, to check bending moment for validation
        for support in analysis_case.freedom_case.items:
            if support.dof in [5]:
                reaction = support.get_reaction(analysis_case=analysis_case)
        
        # print('Base mom. Mx = ' + str(reaction))

        # read out deformation at top 
        delta_tip = self.nodes[0].get_displacements(analysis_case)[0]
       
        return delta_tip
    

# ------------------------------------------------------------------------------
# Functions
# ------------------------------------------------------------------------------   
Esempio n. 2
0
    def calcMeanDeflection(self, fname, F_p_j, H_fs, E, I, nz, z_lev_fs):
        # Setting up static calculation
        # ------------
        # preprocessor
        # ---------

        # constants & lists
        L = H_fs                        # length of the beam [m]
        n = nz                          # no of nodes [-]
        z = np.append(L, z_lev_fs)      # coordinates [m], append top of building
        z = np.append(z, 0)             # coordinates [m], append support node

        # everything starts with the analysis object
        analysis = FrameAnalysis2D()

        # materials and sections are objects
        mat_dummy = Material("Dummy", E, 0.3, 1, colour='w')
        section = Section(area=1, ixx=I)

        # nodes are objects
        nodes = []
        for i in range(0,n+2): #! n+2 (support, tip)
            node = analysis.create_node(coords=[0, z[i]])
            nodes.append(node)

        # and so are beams!
        beams = []
        for i in range(0,n+1): #! n+1 (support, tip)
            beam = analysis.create_element(
                el_type='EB2-2D', nodes=[nodes[i], nodes[i+1]], material=mat_dummy, section=section)
            beams.append(beam)

        # boundary conditions are objects
        freedom_case = cases.FreedomCase()
        freedom_case.add_nodal_support(node=nodes[-1], val=0, dof=0)
        freedom_case.add_nodal_support(node=nodes[-1], val=0, dof=1)
        freedom_case.add_nodal_support(node=nodes[-1], val=0, dof=5)

        # so are loads!
        load_case = cases.LoadCase()

        for i in range(n):
            F_p = np.mean(F_p_j[i])        #[in KN]
            load_case.add_nodal_load(node=nodes[i+1], val=F_p , dof=0) # i+1 (support, tip)

        # an analysis case relates a support case to a load case
        analysis_case = cases.AnalysisCase(freedom_case=freedom_case, load_case=load_case)

        # ------
        # solver
        # ------

        # you can easily change the solver settings
        settings = SolverSettings()
        settings.linear_static.time_info = False

        # the linear static solver is an object and acts on the analysis object
        solver = LinearStatic(analysis=analysis, analysis_cases=[analysis_case], solver_settings=settings)
        solver.solve()

        # ----
        # post
        # ----
        # there are plenty of post processing options!
        # analysis.post.plot_geom(analysis_case=analysis_case)
        # analysis.post.plot_geom(analysis_case=analysis_case, deformed=True, def_scale=1e2)
        # analysis.post.plot_frame_forces(analysis_case=analysis_case, shear=True)
        # analysis.post.plot_frame_forces(analysis_case=analysis_case, moment=True)
        # analysis.post.plot_reactions(analysis_case=analysis_case)
        
        # Support reactions, to check bending moment for validation
        for support in analysis_case.freedom_case.items:
            if support.dof in [5]:
                reaction = support.get_reaction(analysis_case=analysis_case)

        # read out deformation at top 
        self.delta_p_mean = nodes[0].get_displacements(analysis_case)[0]

        writeToTxt(fname, "delta_p_mean:    " + '{:02.3f}'.format(self.delta_p_mean))