diff --git a/neml/drivers.py b/neml/drivers.py index a8aa4d9a..479b461b 100644 --- a/neml/drivers.py +++ b/neml/drivers.py @@ -360,7 +360,7 @@ def RJ(e_np1): def uniaxial_test(model, erate, T = 300.0, emax = 0.05, nsteps = 250, sdir = np.array([1,0,0,0,0,0]), verbose = False, offset = 0.2/100.0, history = None, tdir = np.array([0,1,0,0,0,0]), - check_dmg = False, rtol = 1e-6, atol = 1e-10, miter = 25, + check_dmg = False, dtol = 0.75, rtol = 1e-6, atol = 1e-10, miter = 25, full_results = False): """ Make a uniaxial stress/strain curve @@ -403,26 +403,21 @@ def uniaxial_test(model, erate, T = 300.0, emax = 0.05, nsteps = 250, if history is not None: driver.stored_int[0] = history - def inc_step(i, einc, ainc): - if i == 0: - einc, ainc = driver.erate_einc_step(sdir, erate, e_inc, T) - else: - einc, ainc = driver.erate_einc_step(sdir, erate, e_inc, T, - einc_guess = einc, ainc_guess = ainc) - return einc, ainc - - einc = None - ainc = None strain = [0.0] stress = [0.0] for i in range(nsteps): - if not check_dmg: - try: - einc, ainc = inc_step(i, einc, ainc) - except: - break - else: - einc, ainc = inc_step(i, einc, ainc) + try: + if i == 0: + einc, ainc = driver.erate_einc_step(sdir, erate, e_inc, T) + else: + einc, ainc = driver.erate_einc_step(sdir, erate, e_inc, T, + einc_guess = einc, ainc_guess = ainc) + except: + break + if driver.stored_int[-1][-2] > dtol: + if check_dmg: + raise Exception("Damage check exceeded") + break strain.append(np.dot(driver.strain_int[-1], sdir)) stress.append(np.dot(driver.stress_int[-1], sdir))