Commits

Panagiotis Mavrogiorgos committed af9c6b8

Less dict calls in main_loop for the externalTassios model.

Comments (0)

Files changed (2)

 SIGNIFICANT_SLIP = 0.001
 ## The length of the infinitestimal element in meters. 1/100 is one cm.
 ## For development 1/100 is suggested. For final analysis 1/1000.
-INFINITESIMAL_LENGTH = 1/100
+INFINITESIMAL_LENGTH = 1/10
 ## the length (in m) where we suppose an omoiothetic decrease of the bond-slip law.
 LENGTH_OF_OMOIOTHECY = 0.05
 ## The name of the folder where the data of the analysis are going to be pickled
 DATA_FOLDER = "data"
 ## If True then omoiothecy length is taken under consideration for the front of the specimen.
-OMOIOTHECY_FRONT = True
-#OMOIOTHECY_FRONT = False
+#OMOIOTHECY_FRONT = True
+OMOIOTHECY_FRONT = False
 ## If True then omoiothecy length is taken under consideration for the back of the specimen.
 #OMOIOTHECY_BACK = True
 OMOIOTHECY_BACK = False

pull_out_tests.py

 # Licence : GPL v3
 ##------------------------------------------------------------------------------
 
-from __future__ import division
-from __future__ import print_function
+from __future__ import division, print_function
 from copy import copy as ccopy
 from math import pi
 
                        TOLERANCE, MAX_ITERATIONS)
 #from plot import *
 
-
 class Data(object):
     def __init__(self, L, Ds, Dc):
         super(Data, self).__init__()
         slip = self.slip
         bond = self.bond
 
+        ey = self.S.ey
+        eu = self.S.eu
+
         for i in range(1, np):
             Ss[i] = Ss[i-1] - DSs[i-1]
             Sc[i] = Sc[i-1] - (Ss[i] - Ss[i-1]) * rho
             ec[i] = self.C.get_strain(Sc[i])
             s[i] = s[i-1] - ((es[i-1] + es[i]) - (ec[i-1] + ec[i])) * temp1
             t[i] = interpolation(slip[i], bond[i], s[i])
-            tred[i] = t[i] * self.S.yield_reduction_CEB(es[i]) * Ko[i]
+            Ky = 1
+            if es[i] > ey and es[i] < eu:
+                Ky = self.S.yield_reduction_CEB(es[i])
+            else:
+                Ky = 1
+            #tred[i] = t[i] * self.S.yield_reduction_CEB(es[i]) * Ko[i]
+            tred[i] = t[i] * Ky * Ko[i]
             DSs[i] = tred[i] * temp2
 
         self.Ss = Ss
         self.pull_load(P)
         self.store_laws_and_data(self.db)
 
-        self.print_summary(self.db)
+        #self.print_summary(self.db)
         1
 
     def run_recycling_negative(self, P, times):
         1
 
 class PullOutExternalTassios(PullOutClassicTassios):
-    def __init__(self, fck, fyk, L, Ds, Dc, lb):
+    def __init__(self, fck, fyk, L, Ds, Dc, lext):
         super(PullOutExternalTassios, self).__init__(fck, fyk, L, Ds, Dc)
 
-        assert L >= lb, "L must be greater than lb!!!"
+        assert L >= lext, "L must be greater than lext!!!"
 
-        self.lb = lb / 1000
+        self.lext = lext / 1000
         self.tex = [0.] * self.np
 
         #self.C.get_concrete_strain = self.get_concrete_strain
 
-    def _calc_external_stresses(self, P, lb):
+    def _calc_external_stresses(self, P, lext):
 
-        te0 = (3/8) * (self.Ds**2 / self.Dc) * (self.S.fy / lb) * (P / self.S.fy)
+        te0 = (3/8) * (self.Ds**2 / self.Dc) * (self.S.fy / lext) * (P / self.S.fy)
 
-        lp = int(self.lb / self.Dx) + 1
+        lp = int(self.lext / self.Dx) + 1
 
         for i in range(self.np):
             if i < lp:
         For a given boundary condition at the loaded end,
         calculates the specimen, node by node.
         """
-        for i in xrange(1, self.np):
-            self.Ss[i] = self.Ss[i-1] - self.DSs[i-1]
-            self.Sc[i] = (self.Sc[i-1] - (self.Ss[i] - self.Ss[i-1]) * self.rho -
-                          self.tex[i] * 4 * self.Dx / self.Dc)
-            self.es[i] = self.S.get_strain(self.strain[i], self.stress[i],
-                                                     self.Ss[i])
-            self.ec[i] = self.C.get_strain(self.Sc[i])
-            self.s[i] = (self.s[i-1] - ((self.es[i-1] + self.es[i]) -
-                                        (self.ec[i-1] + self.ec[i])) *
-                                        self.Dx * 1000 / 2)
+        np = self.np
+        Ss = self.Ss
+        Sc = self.Sc
+        es = self.es
+        ec = self.ec
+        s = self.s
+        t = self.t
+        tred = self.tred
+        DSs = self.DSs
+        Ko = self.Ko
+        tex = self.tex
+
+        rho = self.rho
+        Dx = self.Dx
+        Ds = self.Ds
+        Dc = self.Dc
+        temp1 = Dx * 1000 / 2
+        temp2 = 4 * Dx / Ds
+        temp3 = 4 * Dx / Dc
+
+        stress = self.stress
+        strain = self.strain
+        slip = self.slip
+        bond = self.bond
+
+        ey = self.S.ey
+        eu = self.S.eu
+
+        for i in xrange(1, np):
+            Ss[i] = Ss[i-1] - DSs[i-1]
+            self.Sc[i] = (Sc[i-1] - (Ss[i] - Ss[i-1]) * rho -
+                          tex[i] * temp3)
+            es[i] = interpolation(stress[i], strain[i], Ss[i])
+            ec[i] = self.C.get_strain(Sc[i])
+            s[i] = s[i-1] - ((es[i-1] + es[i]) - (ec[i-1] + ec[i])) * temp1
             self.t[i] = self.B.get_bond(self.slip[i], self.bond[i], self.s[i])
-            Ky = self.S.yield_reduction_CEB(self.es[i])
-            self.tred[i] = self.t[i] * Ky * self.Ko[i]
-            self.DSs[i] = 4 * self.tred[i] * self.Dx / self.Ds
+            Ky = 1
+            if es[i] > ey and es[i] < eu:
+                Ky = self.S.yield_reduction_CEB(es[i])
+            #self.tred[i] = self.t[i] * Ky * self.Ko[i]
+            tred[i] = t[i] * Ky * Ko[i]
+            DSs[i] = tred[i] * temp2
+
+        self.Ss = Ss
+        self.Sc = Sc
+        self.es = es
+        self.ec = ec
+        self.t = t
+        self.tred = tred
+        self.s = s
+        self.DSs = DSs
+
+        #for i in xrange(1, self.np):
+            #self.Ss[i] = self.Ss[i-1] - self.DSs[i-1]
+            #self.Sc[i] = (self.Sc[i-1] - (self.Ss[i] - self.Ss[i-1]) * self.rho -
+                          #self.tex[i] * 4 * self.Dx / self.Dc)
+            #self.es[i] = self.S.get_strain(self.strain[i], self.stress[i],
+                                                     #self.Ss[i])
+            #self.ec[i] = self.C.get_strain(self.Sc[i])
+            #self.s[i] = (self.s[i-1] - ((self.es[i-1] + self.es[i]) -
+                                        #(self.ec[i-1] + self.ec[i])) *
+                                        #self.Dx * 1000 / 2)
+            #self.t[i] = self.B.get_bond(self.slip[i], self.bond[i], self.s[i])
+            #Ky = self.S.yield_reduction_CEB(self.es[i])
+            #self.tred[i] = self.t[i] * Ky * self.Ko[i]
+            #self.DSs[i] = 4 * self.tred[i] * self.Dx / self.Ds
 
     def run(self, P):
 
         self.define_monotonic_laws(1)
-        self._calc_external_stresses(0, self.lb)
+        self._calc_external_stresses(0, self.lext)
         self.pull_load(0)
         self.store_laws_and_data(self.db)
 
-        self._calc_external_stresses(P, self.lb)
+        self._calc_external_stresses(P, self.lext)
         self.pull_load(P)
         self.store_laws_and_data(self.db)
 
     def run_recycling_positive(self, P, times):
 
         self.define_monotonic_laws(1)
-        self._calc_external_stresses(0, self.lb)
+        self._calc_external_stresses(0, self.lext)
         self.pull_load(0)
         self.store_laws_and_data(self.db)
 
         for i in range(times):
-            self._calc_external_stresses(P, self.lb)
+            self._calc_external_stresses(P, self.lext)
             self.pull_load(P)
             self.store_laws_and_data(self.db)
             self.define_unloading_laws()
-            self._calc_external_stresses(0, self.lb)
+            self._calc_external_stresses(0, self.lext)
             self.pull_unload(P)
-            self._calc_external_stresses(-P, self.lb)
+            self._calc_external_stresses(-P, self.lext)
             self.push_load(P)
             self.store_laws_and_data(self.db)
             self.define_reloading_laws()
-            self._calc_external_stresses(0, self.lb)
+            self._calc_external_stresses(0, self.lext)
             self.push_unload(P)
 
         # finish with a pull-out
-        self._calc_external_stresses(P, self.lb)
+        self._calc_external_stresses(P, self.lext)
         self.pull_load(P)
         self.store_laws_and_data(self.db)
 
-        self.print_summary(self.db)
+        #self.print_summary(self.db)
         1
 
 class PullOutClassicEligenhausen(PullOutClassic):