예제 #1
0
           'innerdonut', 'outerdonut', 'random', 'trans']

H = 9
el = 21
n_pc_tot = 20
loading = "1"
prop = "yield"

wrt_file = 'log_%s.txt' % (time.strftime("%Y-%m-%d_h%Hm%M"))

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

"""Gather data from vtk files"""
for ii in xrange(len(set_id_cal)):
    vtk.read_euler(el, strt_cal[ii], ns_cal[ii], set_id_cal[ii],
                   dir_cal[ii], wrt_file, 0)
for ii in xrange(len(set_id_val)):
    vtk.read_euler(el, strt_val[ii], ns_val[ii], set_id_val[ii],
                   dir_val[ii], wrt_file, 0)

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

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

for ii in xrange(len(set_id_cal)):
    # gr.Eeff(el, ns_cal[ii], set_id_cal[ii], step, dir_cal[ii], wrt_file)
    # gr.Eeff(el, ns_val[ii], set_id_val[ii], step, dir_val[ii], wrt_file)
    gr.FIP(el, ns_cal[ii], set_id_cal[ii], step, dir_cal[ii], wrt_file)
예제 #2
0
for step in xrange(1, 2):

    wrt_file = 'log_step%s_%s.txt' % (step, time.strftime("%Y-%m-%d_h%Hm%M"))

    ## 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

    tensor_ID = 1

    ## Gather data from calibration vtk files

    dir_cal = 'cal_equi'

    vtk.read_euler(el, ns_cal, set_id_cal, step, dir_cal, wrt_file, 0)

    for comp in compl:
        vtk.read_meas(el, ns_cal, set_id_cal, step, comp, tensor_ID, dir_cal,
                      wrt_file)

    ## Gather data from validation vtk files

    dir_val = 'val_basal'

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

    for comp in compl:
        vtk.read_meas(el, ns_val, set_id_val, step, comp, tensor_ID, dir_val,
                      wrt_file)
예제 #3
0
set_id_cal = C['set_id_cal']
strt_cal = C['strt_cal']
ns_cal = C['ns_cal']
dir_cal = C['dir_cal']

set_id_val = C['set_id_val']
strt_val = C['strt_val']
ns_val = C['ns_val']
dir_val = C['dir_val']

f = h5py.File("spatial.hdf5", 'w')
f.close()
"""Gather data from vtk files"""
for ii in xrange(len(set_id_cal)):
    vtk.read_euler(strt_cal[ii], ns_cal[ii], set_id_cal[ii], dir_cal[ii], 1)
for ii in xrange(len(set_id_val)):
    vtk.read_euler(strt_val[ii], ns_val[ii], set_id_val[ii], dir_val[ii], 1)
"""Compute GSH coefficients to create microstructure function in real and
fourier space"""

for ii in xrange(len(set_id_cal)):
    get_M.get_M(ns_cal[ii], set_id_cal[ii])
for ii in xrange(len(set_id_val)):
    get_M.get_M(ns_val[ii], set_id_val[ii])
"""Compute the periodic statistics for the microstructures"""
for ii in xrange(len(set_id_cal)):
    corr.correlate(ns_cal[ii], set_id_cal[ii])
for ii in xrange(len(set_id_val)):
    corr.correlate(ns_val[ii], set_id_val[ii])
"""Perform PCA on correlations"""
예제 #4
0
    # if tensorID == 1, we read the strain tensor
    # if tensorID == 2, we read the plastic strain tensor

    tensor_ID = 1

    # # Gather data from calibration vtk files

    # vtk_r.read_euler(el, ns_cal, set_id_cal, step, dir_cal, wrt_file, 1)

    # for comp in compl:
    #     vtk_r.read_meas(el, ns_cal, set_id_cal, step, comp, tensor_ID, dir_cal,
    #                     wrt_file)

    # Gather data from validation vtk files

    vtk_r.read_euler(el, ns_val, set_id_val, step, dir_val, wrt_file, 1)

    # for comp in compl:
    #     vtk_r.read_meas(el, ns_val, set_id_val, step, comp, tensor_ID, dir_val,
    #                     wrt_file)

    # read grain IDs from the VTK files
    vtk_r.read_scalar(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_cal, set_id_cal, step, wrt_file)

    # Convert the orientations from the validation datasets from bunge euler
    # angles to GSH coefficients
    gsh.euler_to_gsh(el, H, ns_val, set_id_val, step, wrt_file)
예제 #5
0
    tensor_ID = 0

    #    ## Gather data from calibration vtk files
    #
    #    dir_cal = 'cal'
    #
    #    vtk.read_euler(ns_cal,set_id_cal,step,vtk_filename,dir_cal, wrt_file, 0)
    #
    #    for comp in compl:
    #        vtk.read_meas(ns_cal,set_id_cal,step,comp,vtk_filename,tensor_ID,dir_cal,wrt_file)

    ## Gather data from validation vtk files

    dir_val = 'val'

    vtk.read_euler(ns_val, set_id_val, step, vtk_filename, dir_val, wrt_file)

    for comp in compl:
        vtk.read_meas(ns_val, set_id_val, step, comp, vtk_filename, tensor_ID,
                      dir_val, wrt_file, 1)

#    ## Convert the orientations from the calibration datasets from bunge euler angles
#    ## to GSH coefficients
#    gsh.euler_to_gsh(ns_cal,set_id_cal,step,wrt_file)

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

    #    ## Generate the fftn of the calibration microstructure function
    #    msf.micr_func(ns_cal,set_id_cal,step,wrt_file)
예제 #6
0
step = 1
n_pc_tot = 20

wrt_file = 'log_%s.txt' % (time.strftime("%Y-%m-%d_h%Hm%M"))

f = h5py.File("spatial_stats.hdf5", 'w')
f.close()
"""
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 vtk files"""
for ii in xrange(len(set_id_cal)):
    vtk.read_euler(el, ns_cal[ii], set_id_cal[ii], step, dir_cal[ii], wrt_file,
                   1)
    vtk.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()
f = h5py.File("responses_for_linkage.hdf5", 'w')
f.close()

for ii in xrange(len(set_id_cal)):
    # gr.Eeff(el, ns_cal[ii], set_id_cal[ii], step, dir_cal[ii], wrt_file)
    # gr.Eeff(el, ns_val[ii], set_id_val[ii], step, dir_val[ii], wrt_file)
    gr.FIP(el, ns_cal[ii], set_id_cal[ii], step, dir_cal[ii], wrt_file)
    gr.FIP(el, ns_val[ii], set_id_val[ii], step, dir_val[ii], wrt_file)
"""Compute GSH coefficients to create microstructure function in real and
예제 #7
0
C = const()

ns_cal = C['ns_cal']
set_id_cal = C['set_id_cal']
dir_cal = C['dir_cal']

ns_val = C['ns_val']
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)
예제 #8
0
compl = ['11', '22', '33', '12', '13', '23']
# compl = ['11']

for step in xrange(1, 2):

    wrt_file = 'log_step%s_%s.txt' % (step, time.strftime("%Y-%m-%d_h%Hm%M"))
    """
    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)
    """get the plastic strain tensor from CPFEM"""
    for comp in compl:
        vtk.read_meas(el, ns_val, set_id_val, step, comp, 2, 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,
예제 #9
0
el = 21
step = 6

wrt_file = 'log_%s.txt' % (time.strftime("%Y-%m-%d_h%Hm%M"))

f = h5py.File("spatial_stats.hdf5", 'w')
f.close()
"""
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 calibration vtk files"""
for ii in xrange(len(set_id_D3D)):
    vtk.read_euler(el, ns_D3D[ii], set_id_D3D[ii], step, dir_D3D[ii], wrt_file,
                   1)

# gen.delta(el, ns_cal[1], set_id_cal[1], step, wrt_file)

# vfrac = np.array([.1, .05])
# gen.inclusion(el, ns_cal[2], set_id_cal[2], step, wrt_file, vfrac)

# gen.bicrystal(el, ns_cal[0], set_id_cal[0], step, wrt_file)
"""Compute GSH coefficients to create microstructure function in real and
fourier space"""
for ii in xrange(len(set_id_cal)):
    get_M.get_M(el, H, ns_cal[ii], set_id_cal[ii], step, wrt_file)
"""Compute the periodic statistics for the microstructures"""
for ii in xrange(len(set_id_cal)):
    corr.correlate(el, ns_cal[ii], H, set_id_cal[ii], step, wrt_file)
"""Perform PCA on correlations"""