Example #1
0
    def verify_sig_m_eps(self, ax, **kw):

        e_phi_data = np.loadtxt(self.phi_file)
        e_data, phi_data = e_phi_data.T
        E_c = self.get_E_c()

        rt = RTDofGraph(name='stress - strain',
                        var_x='eps_app',
                        idx_x=0,
                        var_y='sig_app',
                        idx_y=0,
                        record_on='update')
        ec = {
            # overload the default configuration
            'bcond_list':
            [BCDofProportional(max_strain=np.max(e_data), alpha_rad=0.0)],
            'rtrace_list': [rt],
        }

        mats_eval = MATS2DMicroplaneDamage(
            n_mp=30,
            E=E_c,
            nu=0.2,
            elastic_debug=False,
            stress_state='plane_stress',
            symmetrization='sum-type',
            model_version='compliance',
            phi_fn=PhiFnGeneral(
                mfn=MFnLineArray(xdata=e_data, ydata=phi_data)),
        )

        me = MATSExplore(
            KMAX=300,
            tolerance=5e-4,  # 0.01,
            RESETMAX=0,
            dim=MATS2DExplore(
                mats_eval=mats_eval,
                explorer_config=ec,
            ),
            store_fitted_phi_fn=True,
            log=False)

        #------------------------------------------------------------------
        # specify the parameters used within the calibration
        #------------------------------------------------------------------
        #

        me.n_steps = 200
        me.tloop.tline.step = 0.01
        me.format_ticks = True

        me.tloop.eval()

        rt.redraw()

        eps_m = rt.trace.xdata
        sig_m = rt.trace.ydata
        ax.plot(eps_m, sig_m, **kw)
Example #2
0
    def _get_explorer_config(self):
        '''Get the specific configuration of this material model in the explorer
        '''
        c = super(MATS2DEval, self)._get_explorer_config()

        from ibvpy.api import TLine
        from ibvpy.mats.mats2D.mats2D_explorer_bcond import BCDofProportional

        # overload the default configuration
        c['bcond_list'] = [
            BCDofProportional(max_strain=0.00016, alpha_rad=np.pi / 8.0)]
        c['tline'] = TLine(step=0.05, max=1)
        return c
Example #3
0
    def calibrate_damage_function(self, ax):

        #----------------------------------------------------------------------
        # Example using the mats2d_explore
        #----------------------------------------------------------------------
        rt = RTraceGraph(name='stress - strain',
                         var_x='eps_app',
                         idx_x=0,
                         var_y='sig_app',
                         idx_y=0,
                         record_on='update')

        ec = {
            # overload the default configuration
            'bcond_list': [BCDofProportional(
                max_strain=1.0,
                alpha_rad=0.0,
            )],
            'rtrace_list': [rt],
        }

        mats_eval = MATS2DMicroplaneDamage(
            n_mp=15,
            elastic_debug=False,
            stress_state='plane_stress',
            symmetrization='sum-type',
            model_version='compliance',
            phi_fn=PhiFnGeneral,
        )

        calib_params = dict(
            KMAX=300,
            n_steps=100,
            phi_max_factor=1.0,
            tolerance=5e-4,  # 0.01,
            RESETMAX=0,
            dim=MATS2DExplore(
                mats_eval=mats_eval,
                explorer_config=ec,
            ),
            store_fitted_phi_fn=True,
            log=False)
        self.trait_set(**calib_params)

        nu = 0.20

        self.format_ticks = True
        E_c = self.get_E_c()
        self.dim.mats_eval.E = E_c
        self.dim.mats_eval.nu = nu

        print('n_steps = %g used for calibration' % self.n_steps)
        print('max_eps = %g used for calibration' % self.max_eps)

        #------------------------------------------------------------------
        # set 'param_key' of 'fitter' to store calibration params in the name
        #------------------------------------------------------------------
        #
        age = 28
        param_key = '_age%g_Ec%g_nu%g_nsteps%g_smoothed' % (age, E_c, nu,
                                                            self.n_steps)

        self.param_key = param_key
        print('param_key = %s used in calibration name' % param_key)

        #------------------------------------------------------------------
        # run fitting procedure
        #------------------------------------------------------------------
        #
        self.init()
        self.fit_response()
        self.fitted_phi_fn
        # fitter.fitted_phi_fn.mpl_plot(ax)
        rt.redraw()
        ax.plot(rt.trace.xdata, rt.trace.ydata)
        self.mfn_line_array_target.mpl_plot(ax)
Example #4
0
def run():
    #-------------------------------------------------------------------------
    # Example using the mats2d_explore
    #-------------------------------------------------------------------------
    from ibvpy.mats.mats2D.mats2D_explore import MATS2DExplore
    from ibvpy.mats.mats2D.mats2D_rtrace_cylinder import MATS2DRTraceCylinder

    from ibvpy.mats.mats2D.mats2D_cmdm.mats2D_cmdm_rtrace_Gf_mic import \
        MATS2DMicroplaneDamageTraceGfmic, \
        MATS2DMicroplaneDamageTraceEtmic, MATS2DMicroplaneDamageTraceUtmic

    from ibvpy.mats.mats2D.mats2D_cmdm.mats2D_cmdm_rtrace_Gf_mac import \
        MATS2DMicroplaneDamageTraceGfmac, \
        MATS2DMicroplaneDamageTraceEtmac, MATS2DMicroplaneDamageTraceUtmac

    from ibvpy.mats.mats2D.mats2D_cmdm.mats2D_cmdm import \
        MATS2DMicroplaneDamage, MATS1DMicroplaneDamage

    from ibvpy.mats.matsXD.matsXD_cmdm import \
        PhiFnGeneral, PhiFnStrainHardening

    from ibvpy.api import RTraceGraph, RTraceArraySnapshot

    from mathkit.mfn import MFnLineArray
    from numpy import array, hstack

    from ibvpy.mats.mats2D.mats2D_explorer_bcond import BCDofProportional
    from os.path import join

    ec = {
        # overload the default configuration
        'bcond_list': [BCDofProportional(max_strain=1.0, alpha_rad=0.0)],
        'rtrace_list': [
            RTraceGraph(name='stress - strain',
                        var_x='eps_app',
                        idx_x=0,
                        var_y='sig_app',
                        idx_y=0,
                        record_on='iteration'),
        ],
    }

    mats_eval = MATS2DMicroplaneDamage(
        n_mp=15,
        # mats_eval = MATS1DMicroplaneDamage(
        elastic_debug=False,
        stress_state='plane_stress',
        symmetrization='sum-type',
        model_version='compliance',
        phi_fn=PhiFnGeneral,
    )

    #    print 'normals', mats_eval._MPN
    #    print 'weights', mats_eval._MPW

    fitter = MATSCalibDamageFn(
        KMAX=300,
        tolerance=5e-4,  # 0.01,
        RESETMAX=0,
        dim=MATS2DExplore(
            mats_eval=mats_eval,
            explorer_config=ec,
        ),
        store_fitted_phi_fn=True,
        log=False)

    #-------------------------------------------
    # run fitter for entire available test data:
    #-------------------------------------------

    calibrate_all = False

    if calibrate_all:
        from matresdev.db.exdb.ex_run_table import \
            ExRunClassExt


#         from matresdev.db.exdb.ex_composite_tensile_test import \
#             ExCompositeTensileTest
#         ex = ExRunClassExt(klass=ExCompositeTensileTest)
#         for ex_run in ex.ex_run_list:
#             if ex_run.ready_for_calibration:
#                 print 'FITTING', ex_run.ex_type.key
#                 # 'E_c' of each test is different, therefore 'mats_eval'
#                 # needs to be defined for each test separately.
#                 #
#                 E_c = ex_run.ex_type.E_c
#                 nu = ex_run.ex_type.ccs.concrete_mixture_ref.nu
#
#                 # run calibration
#                 #
#                 fitter.ex_run = ex_run
#                 fitter.dim.mats_eval.E = E_c
#                 fitter.dim.mats_eval.nu = nu
#                 fitter.init()
#                 fitter.fit_response()

    else:

        test_file = join(
            simdb.exdata_dir,
            'tensile_tests',
            'dog_bone',
            #                              'buttstrap_clamping',
            '2010-02-09_TT-10g-3cm-a-TR_TRC11',
            #                              'TT11-10a-average.DAT' )
            'TT-10g-3cm-a-TR-average.DAT')

        #-----------------------------------
        # tests for 'BT-3PT-12c-6cm-TU_ZiE'
        #-----------------------------------
        # 'ZiE-S1': test series no. 1 (age = 11d)
        #
        #                                 '2011-05-23_TT-12c-6cm-0-TU_ZiE',
        #                                 'TT-12c-6cm-0-TU-V2.DAT')

        # 'ZiE-S2': test series no. 2 (age = 9d)
        #
        #                                 '2011-06-10_TT-12c-6cm-0-TU_ZiE',
        #                                 'TT-12c-6cm-0-TU-V2.DAT')

        #-----------------------------------
        # tests for 'BT-4PT-12c-6cm-TU_SH4'
        # tests for 'ST-12c-6cm-TU' (fresh)
        #-----------------------------------
        # @todo: add missing front strain information from Aramis3d testing
        #
        #                               '2012-04-12_TT-12c-6cm-0-TU_SH4-Aramis3d',
        #                               'TT-12c-6cm-0-TU-SH4-V2.DAT')

        #                                '2012-02-14_TT-12c-6cm-0-TU_SH2',
        #                                'TT-12c-6cm-0-TU-SH2-V2.DAT')

        #                                '2012-02-14_TT-12c-6cm-0-TU_SH2',
        #                                'TT-12c-6cm-0-TU-SH2F-V3.DAT')

        # used for suco(!)
        #                                '2012-02-14_TT-12c-6cm-0-TU_SH2',
        #                                'TT-12c-6cm-0-TU-SH2-V1.DAT')

        #-----------------------------------
        # tests for 'BT-3PT-6c-2cm-TU_bs'
        #-----------------------------------
        # barrelshell
        #
        #                                 # TT-bs1
        #                                 '2013-05-17_TT-6c-2cm-0-TU_bs1',
        #                                 'TT-6c-2cm-0-TU-V3_bs1.DAT')
        #                                 # TT-bs2
        #                                 '2013-05-21-TT-6c-2cm-0-TU_bs2',
        #                                 'TT-6c-2cm-0-TU-V1_bs2.DAT')
        #                                 # TT-bs3
        #                                 '2013-06-12_TT-6c-2cm-0-TU_bs3',
        #                                 'TT-6c-2cm-0-TU-V1_bs3.DAT')
        #                                 # TTb-bs4-Aramis3d
        #                                  '2013-07-09_TTb-6c-2cm-0-TU_bs4-Aramis3d',
        #                                  'TTb-6c-2cm-0-TU-V2_bs4.DAT')

        #-----------------------------------
        # tests for 'TT-6c-2cm-90-TU'
        #-----------------------------------
        #
        #                                '2013-05-22_TTb-6c-2cm-90-TU-V3_bs1',
        #                                'TTb-6c-2cm-90-TU-V3_bs1.DAT')

        #                               '2013-05-17_TT-6c-2cm-0-TU_bs1',
        #                               'TT-6c-2cm-90-TU-V3_bs1.DAT')

        #        test_file = join(simdb.exdata_dir,
        #                               'tensile_tests',
        #                               'buttstrap_clamping',
        #                               '2013-07-18_TTb-6c-2cm-0-TU_bs5',
        #                               'TTb-6c-2cm-0-TU-V1_bs5.DAT')
        # #                               'TTb-6c-2cm-0-TU-V3_bs5.DAT')
        #
        #        test_file = join(simdb.exdata_dir,
        #                               'tensile_tests',
        #                               'buttstrap_clamping',
        #                               '2013-07-09_TTb-6c-2cm-0-TU_bs4-Aramis3d',
        #                               'TTb-6c-2cm-0-TU-V2_bs4.DAT')

        #-----------------------------------
        # tests for 'TT-6g-2cm-0-TU' (ARG-1200-TU)
        #-----------------------------------
        #
        # test series no.1
        #
        #        test_file = join(simdb.exdata_dir,
        #                               'tensile_tests',
        #                               'dog_bone',
        #                               '2012-12-10_TT-6g-2cm-0-TU_bs',
        #                               'TT-6g-2cm-0-V2.DAT')
        # test series no.3
        #
        #        test_file = join(simdb.exdata_dir,
        #                               'tensile_tests',
        #                               'buttstrap_clamping',
        #                               '2013-07-09_TTb-6g-2cm-0-TU_bs4-Aramis3d',
        #                               'TTb-6g-2cm-0-TU-V1_bs4.DAT')

        # test series NxM_1
        #
        #        test_file = join(simdb.exdata_dir,
        #                          'tensile_tests',
        #                          'buttstrap_clamping',
        #                          '2014-04-30_TTb-6c-2cm-0-TU_NxM1',
        #                          'TTb-6c-2cm-0-TU-V16_NxM1.DAT')

        #------------------------------------------------------------------
        # set 'ex_run' of 'fitter' to selected calibration test
        #------------------------------------------------------------------
        #
        ex_run = ExRun(data_file=test_file)
        fitter.ex_run = ex_run

        #------------------------------------------------------------------
        # specify the parameters used within the calibration
        #------------------------------------------------------------------
        #
        # get the composite E-modulus and Poisson's ratio as stored
        # in the experiment data base for the specified age of the tensile test
        #
        E_c = ex_run.ex_type.E_c
        print('E_c', E_c)

        #        # use the value as graphically determined from the tensile test (= initial stiffness for tension)
        #        E_c = 28000.

        # age, Em(age), and nu of the slab test or bending test determines the
        # calibration parameters. Those are used for calibration and are store in the 'param_key'
        # appendet to the calibration-test-key
        #
        age = 28

        # E-modulus of the concrete matrix at the age of testing
        # NOTE: value is more relevant as compression behavior is determined by it in the bending tests and slab tests;
        # behavior in the tensile zone is defined by calibrated 'phi_fn' with the predefined 'E_m'
        #        E_m = ex_run.ex_type.ccs.get_E_m_time(age)
        E_c = ex_run.ex_type.ccs.get_E_c_time(age)

        # use average E-modul from 0- and 90-degree direction for fitter in both directions
        # this yields the correct tensile behavior and returns the best average compressive behavior
        #
        #        E_c = 22313.4

        # alternatively use maximum E-modul from 90-direction also for 0-degree direction for fitting
        # this yields the correct tensile behavior also in the linear elastic regime for both directions corresponding to the
        # tensile test behavior (note that the compressive E-Modulus in this case is overestimated in 0-degree direction; minor influence
        # assumed as behavior is governed by inelastic tensile behavior and anisotropic redistrirbution;
        #
        #        E_c = 29940.2
        #        E_c = 29100.
        #        E_c = 22390.4
        #        E_c = 18709.5
        E_c = 28700.

        # smallest value for matrix E-modulus obtained from cylinder tests (d=150mm)
        #        E_m = 18709.5

        # set 'nu'
        # @todo: check values stored in 'mat_db'
        #
        nu = 0.20
        ex_run.ex_type.ccs.concrete_mixture_ref.nu = nu

        n_steps = 200
        fitter.n_steps = n_steps

        fitter.format_ticks = True

        fitter.ex_run.ex_type.age = age
        print('age = %g used for calibration' % age)
        fitter.ex_run = ex_run

        #        print 'E_m(age) = %g used for calibration' % E_m
        #        fitter.dim.mats_eval.E = E_m

        print('E_c(age) = %g used for calibration' % E_c)
        fitter.dim.mats_eval.E = E_c

        print('nu = %g used for calibration' % nu)
        fitter.dim.mats_eval.nu = nu

        print('n_steps = %g used for calibration' % n_steps)

        max_eps = fitter.max_eps
        print('max_eps = %g used for calibration' % max_eps)

        #------------------------------------------------------------------
        # set 'param_key' of 'fitter' to store calibration params in the name
        #------------------------------------------------------------------
        #
        #        param_key = '_age%g_Em%g_nu%g_nsteps%g' % (age, E_m, nu, n_steps)
        #        param_key = '_age%g_Ec%g_nu%g_nsteps%g__smoothed' % (age, E_c, nu, n_steps, max_eps)
        param_key = '_age%g_Ec%g_nu%g_nsteps%g_smoothed' % (age, E_c, nu,
                                                            n_steps)

        fitter.param_key = param_key
        print('param_key = %s used in calibration name' % param_key)

        #------------------------------------------------------------------
        # run fitting procedure
        #------------------------------------------------------------------
        #
        import pylab as p
        ax = p.subplot(111)
        fitter.mfn_line_array_target.mpl_plot(ax)
        p.show()

        fitter.init()
        fitter.fit_response()
        fitter.store()
        fitter.plot_trial_steps()

    return

    #---------------------------
    # basic testing of fitter methods:
    #---------------------------

    # set to True for basic testing of the methods:
    basic_tests = False

    if basic_tests:
        fitter.run_through()
        #    fitter.tloop.rtrace_mngr.rtrace_bound_list[0].configure_traits()
        fitter.tloop.rtrace_mngr.rtrace_bound_list[0].redraw()
        last_strain_run_through = fitter.tloop.rtrace_mngr.rtrace_bound_list[
            0].trace.xdata[:]
        last_stress_run_through = fitter.tloop.rtrace_mngr.rtrace_bound_list[
            0].trace.ydata[:]
        print('last strain (run-through) value', last_strain_run_through)
        print('last stress (run-through) value', last_stress_run_through)

        fitter.tloop.reset()
        fitter.run_step_by_step()
        # fitter.tloop.rtrace_mngr.rtrace_bound_list[0].configure_traits()
        fitter.tloop.rtrace_mngr.rtrace_bound_list[0].redraw()
        last_strain_step_by_step = fitter.tloop.rtrace_mngr.rtrace_bound_list[
            0].trace.xdata[:]
        last_stress_step_by_step = fitter.tloop.rtrace_mngr.rtrace_bound_list[
            0].trace.ydata[:]
        print('last stress (step-by-step) value', last_stress_step_by_step)

        fitter.run_trial_step()
        fitter.run_trial_step()
        fitter.tloop.rtrace_mngr.rtrace_bound_list[0].redraw()
        strain_after_trial_steps = fitter.tloop.rtrace_mngr.rtrace_bound_list[
            0].trace.xdata[:]
        stress_after_trial_steps = fitter.tloop.rtrace_mngr.rtrace_bound_list[
            0].trace.ydata[:]
        print('stress after trial', stress_after_trial_steps)

        fitter.init()
        # fitter.mats2D_eval.configure_traits()
        lof = fitter.get_lack_of_fit(1.0)
        print('1', lof)
        lof = fitter.get_lack_of_fit(0.9)
        print('2', lof)

        # fitter.tloop.rtrace_mngr.configure_traits()
        fitter.run_trial_step()

    else:
        from ibvpy.plugins.ibvpy_app import IBVPyApp
        ibvpy_app = IBVPyApp(ibv_resource=fitter)
        ibvpy_app.main()
Example #5
0
import numpy as np
import pylab as p

if __name__ == '__main__':

    elastic_debug = True
    # Tseval for a material model
    #
    tseval = MATS2DMicroplaneDamage(elastic_debug=elastic_debug)

    value, coeff = get_value_and_coeff(1., 0.0)

    #    bcond_alpha = BCDof(var='u', dof=0, value=value,
    bcond_alpha = BCDofProportional(var='u',
                                    dof=0,
                                    value=value,
                                    link_dofs=[1],
                                    link_coeffs=[coeff],
                                    time_function=lambda t: t)

    ts = TStepper(tse=tseval,
                  bcond_list=[bcond_alpha],
                  rtrace_list=[
                      RTDofGraph(name='strain 0 - stress 0',
                                 var_x='eps_app',
                                 idx_x=0,
                                 var_y='sig_app',
                                 idx_y=0,
                                 record_on='update'),
                      RTDofGraph(name='strain 1 - stress 1',
                                 var_x='eps_app',
                                 idx_x=1,
from mathkit.mfn import MFnLineArray
import pylab as p

if __name__ == '__main__':

    elastic_debug = True
    # Tseval for a material model
    #
    tseval = MATS2DMicroplaneDamage(elastic_debug=elastic_debug)

    value, coeff = get_value_and_coeff(1., 0.0)

#    bcond_alpha = BCDof(var='u', dof=0, value=value,
    bcond_alpha = BCDofProportional(var='u', dof=0, value=value,
                     link_dofs=[1],
                     link_coeffs=[coeff],
                     time_function=lambda t: t)

    ts = TStepper(tse=tseval,
             bcond_list=[ bcond_alpha
                         ],
             rtrace_list=[ RTraceGraph(name='strain 0 - stress 0',
                                  var_x='eps_app', idx_x=0,
                                  var_y='sig_app', idx_y=0,
                                  record_on='update'),
                         RTraceGraph(name='strain 1 - stress 1',
                                  var_x='eps_app', idx_x=1,
                                  var_y='sig_app', idx_y=1,
                                  record_on='update'),
                         RTraceGraph(name='strain 0 - stress 1',
                                  var_x='eps_app', idx_x=0,