Skip to content

Commit

Permalink
Included check for damage reaching damage tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
janzenchoi authored and reverendbedford committed Aug 18, 2023
1 parent 2348ba2 commit 34a29b2
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions neml/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))

Expand Down

0 comments on commit 34a29b2

Please sign in to comment.