Пример #1
0
 def strains( self ):
     mfn = MFnLineArray()
     mfn.xdata, mfn.ydata = self.values
     strains_fn = frompyfunc( mfn.get_diff, 1, 1 )
     strains = strains_fn( mfn.xdata )
     strains[0] = strains[1]
     strains[-2] = strains[-1]
     return strains
Пример #2
0
    def get_df_average( self, n_points ):
        '''derive the average phi-function based on all entries 
        in damage_function_list
        '''

        def get_y_average( self, x_average ): 
            '''get the y-values from the mfn-functions in df_list for 
            'x_average' and return the average.
            Note that the shape of 'mfn.xdata' does not necessarily needs to be equal in all
            'DamageFunctionEntries' as the number of steps used for calibration or the adaptive 
            refinement in 'tloop' might have been different for each case.
            '''  
            y_list = [ self.damage_function_list[i].damage_function.get_value( x_average ) \
                       for i in range(len( self.damage_function_list )) ]
            return sum(y_list) / len(y_list)
    
        get_y_average_vectorized = frompyfunc( get_y_average, 2, 1 )
        
        mfn = MFnLineArray()
        
        # take the smallest value of the strains for the average function. Beyond this value 
        # the average does not make sense anymore because it depends on the arbitrary number
        # of entries in the df_list  
        #
        xdata_min = min( self.damage_function_list[i].damage_function.xdata[-1] \
                         for i in range( len( self.damage_function_list ) ) )
        
        # number of sampling point used for the average phi function
        #
        mfn.xdata = linspace( 0., xdata_min, num = n_points )

        # get the corresponding average ydata values
        #
        mfn.ydata = self.get_y_average_vectorized( mfn.xdata )

        return mfn
Пример #3
0
    def get_df_average(self, n_points):
        '''derive the average phi-function based on all entries
        in damage_function_list
        '''

        def get_y_average(self, x_average):
            '''get the y-values from the mfn-functions in df_list for
            'x_average' and return the average.
            Note that the shape of 'mfn.xdata' does not necessarily needs to be equal in all
            'DamageFunctionEntries' as the number of steps used for calibration or the adaptive
            refinement in 'tloop' might have been different for each case.
            '''
            y_list = [ self.damage_function_list[i].damage_function.get_value(x_average) \
                       for i in range(len(self.damage_function_list)) ]
            return sum(y_list) / len(y_list)

        get_y_average_vectorized = frompyfunc(get_y_average, 2, 1)

        mfn = MFnLineArray()

        # take the smallest value of the strains for the average function. Beyond this value
        # the average does not make sense anymore because it depends on the arbitrary number
        # of entries in the df_list
        #
        xdata_min = min(self.damage_function_list[i].damage_function.xdata[-1] \
                         for i in range(len(self.damage_function_list)))

        # number of sampling point used for the average phi function
        #
        mfn.xdata = linspace(0., xdata_min, num=n_points)

        # get the corresponding average ydata values
        #
        mfn.ydata = self.get_y_average_vectorized(mfn.xdata)

        return mfn