From 510ac9632f4314900bff4ab3509455bee5daed98 Mon Sep 17 00:00:00 2001 From: staleylanl Date: Thu, 18 Apr 2024 14:42:11 -0600 Subject: [PATCH] A bit of reformatting for readability. --- impala/physics/test.py | 72 +++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/impala/physics/test.py b/impala/physics/test.py index 991180e..072e400 100644 --- a/impala/physics/test.py +++ b/impala/physics/test.py @@ -1,43 +1,57 @@ + import numpy as np import physical_models_vec as physics consts = { - 'alpha' : 0.2, - 'beta' : 0.33, - 'matomic': 45.9, - 'Tmelt0' : 2110., - 'rho0' : 4.419, - 'Cv0' : 0.525e-5, - 'G0' : 0.4, - 'chi' : 1.0, - 'sgB' : 6.44e-4 - } + 'alpha' : 0.2, + 'beta' : 0.33, + 'matomic' : 45.9, + 'Tmelt0' : 2110., + 'rho0' : 4.419, + 'Cv0' : 0.525e-5, + 'G0' : 0.4, + 'chi' : 1.0, + 'sgB' : 6.44e-4 +} params = { - 'theta' : np.array([0.1]), - 'p' : np.array([2.]), - 's0' : np.array([0.02]), - 'sInf' : np.array([0.01]), - 'kappa' : np.array([0.3]), + 'theta' : np.array([0.1]), + 'p' : np.array([2.]), + 's0' : np.array([0.02]), + 'sInf' : np.array([0.01]), + 'kappa' : np.array([0.3]), 'lgamma' : np.array([-12.]), - 'y0' : np.array([0.01]), - 'yInf' : np.array([0.003]), - 'y1' : np.array([0.09]), - 'y2' : np.array([0.7]), - } + 'y0' : np.array([0.01]), + 'yInf' : np.array([0.003]), + 'y1' : np.array([0.09]), + 'y2' : np.array([0.7]) +} ptw = physics.MaterialModel( - flow_stress_model=physics.PTW_Yield_Stress, shear_modulus_model=physics.Stein_Shear_Modulus, - ) + flow_stress_model = physics.PTW_Yield_Stress, + shear_modulus_model = physics.Stein_Shear_Modulus +) -edot = 2500. * 1e-6 # 2500/s -temp = 1000 # K -emax = 0.6 +edot = 2500. * 1e-6 # 2500/s +temp = 1000 # K +emax = 0.6 nhist = 100 -sim_strain_histories = physics.generate_strain_history_new(emax=np.array([emax]), edot=np.array([edot]), nhist=nhist) -ptw.initialize(params, consts) -ptw.initialize_state(T = np.array([temp]), stress = np.zeros(1), strain = np.zeros(1)) + +sim_strain_histories = physics.generate_strain_history_new( + emax = np.array([emax]), + edot = np.array([edot]), + nhist = nhist +) + +ptw.initialize(params,consts) + +ptw.initialize_state( + T = np.array([temp]), + stress = np.zeros(1), + strain = np.zeros(1) +) + sim_state_histories = ptw.compute_state_history(sim_strain_histories) -sim_strains = sim_state_histories[:,1].T # 2d array: ntot, Nhist +sim_strains = sim_state_histories[:,1].T # 2d array: ntot, Nhist sim_stresses = sim_state_histories[:,2].T # 2d array: ntot, Nhist import matplotlib.pyplot as plt