コード例 #1
0
def FIP(el, ns, set_id, step, newdir, wrt_file):

    # get the fip values
    read.read_fip(el, ns, set_id, step, newdir, wrt_file)
    """read the fip values into memory"""

    f = h5py.File("responses.hdf5", 'a')
    fip = f.get('fip_%s' % set_id)[...]
    f.close()
    """calculate the maximum fip per SVE"""
    maxfip = np.max(fip, axis=1)

    msg = 'fip set: %s' % str(maxfip)
    rr.WP(msg, wrt_file)

    f = h5py.File("responses_for_linkage.hdf5", 'a')
    f.create_dataset('fip_%s' % set_id, data=maxfip)
    f.close()
コード例 #2
0
if tensorID == 1, we read the strain tensor
if tensorID == 2, we read the plastic strain tensor
"""
"""Gather data from vtk files"""
for ii in xrange(len(set_id_cal)):
    vr.read_euler(el, ns_cal[ii], set_id_cal[ii], step, dir_cal[ii], wrt_file,
                  1)
    vr.read_euler(el, ns_val[ii], set_id_val[ii], step, dir_val[ii], wrt_file,
                  1)
"""get the data for the linkage"""

f = h5py.File("responses.hdf5", 'w')
f.close()

for ii in xrange(len(set_id_cal)):
    vr.read_fip(el, ns_cal[ii], set_id_cal[ii], step, dir_cal[ii], wrt_file)
    vr.read_fip(el, ns_cal[ii], set_id_val[ii], step, dir_val[ii], wrt_file)
"""Compute GSH coefficients to create microstructure function in real and
fourier space"""

for ii in xrange(len(set_id_cal)):
    gm.get_mf(el, H, ns_cal[ii], set_id_cal[ii], step, wrt_file)
    gm.get_mf(el, H, ns_val[ii], set_id_val[ii], step, wrt_file)
"""find the gsh coefficient sets associated with the nearest neighbors in
the calibration and validation microstructures"""

for ii in xrange(len(set_id_cal)):
    gn.neighbors(el, ns_cal[ii], H, ext, set_id_cal[ii], wrt_file)
    gn.neighbors(el, ns_val[ii], H, ext, set_id_val[ii], wrt_file)
"""perform the regression to calibrate the real-space, limited range
MKS function"""
コード例 #3
0
set_id_val = C['set_id_val']
dir_val = C['dir_val']

f = h5py.File("spatial.hdf5", 'w')
f.close()

"""Gather data from vtk files"""
vr.read_euler(ns_cal, set_id_cal, dir_cal, 1)
vr.read_euler(ns_val, set_id_val, dir_val, 1)

"""get the data for the linkage"""

f = h5py.File("responses.hdf5", 'w')
f.close()

vr.read_fip(ns_cal, set_id_cal, dir_cal)
vr.read_fip(ns_cal, set_id_val, dir_val)

"""Compute GSH coefficients to create microstructure function in real and
fourier space"""

gm.get_mf(ns_cal, set_id_cal)
gm.get_mf(ns_val, set_id_val)

"""find the gsh coefficient sets associated with the nearest neighbors in
the calibration and validation microstructures"""

gn.neighbors(ns_cal, set_id_cal)
gn.neighbors(ns_val, set_id_val)

"""run scripts prepare for regression"""
コード例 #4
0
    """
    The tensorID determines the type of tensor data read from the .vtk file
    if tensorID == 0, we read the stress tensor
    if tensorID == 1, we read the strain tensor
    if tensorID == 2, we read the plastic strain tensor
    """
    """Gather data from validation vtk files"""
    tensorID = 1

    vtk.read_euler(el, ns_val, set_id_val, step, dir_val, wrt_file, tensorID)

    for comp in compl:
        vtk.read_meas(el, ns_val, set_id_val, step, comp, tensorID, dir_val,
                      wrt_file)

    vtk.read_fip(el, ns_val, set_id_val, step, dir_val, wrt_file)

    # """Convert the orientations from the calibration datasets from bunge euler
    # angles to GSH coefficients"""
    # gsh.euler_to_gsh(el, H, ns_val, set_id_val, step, wrt_file)

    # """Perform the validation"""
    # for comp in compl:
    #     validation.validation(el, H, ns_cal, ns_val, set_id_cal, set_id_val,
    #                           step, comp, typ, wrt_file)

    # """Get error metrics for each total strain component"""
    # newID = 'rmks'
    # traID = 'r'
    # for comp in compl:
    #     rtex.results(el, ns_val, set_id_val, step, typ, comp,