Exemplo n.º 1
0
def modulus(el, ns, set_id, step, newdir, wrt_file):

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

    compd = {'11': 0, '22': 4, '33': 8, '12': 1, '13': 6, '23': 5}
    """
    comp = '11'

    # get the stress tensors
    tensor_id = 0
    read.read_meas(el, ns, set_id, step, comp, tensor_id, newdir, wrt_file)
    # get the strain tensors
    tensor_id = 1
    read.read_meas(el, ns, set_id, step, comp, tensor_id, newdir, wrt_file)

    """get the mean stresses and strains (11 component) for each SVE"""

    typ = ['sigma', 'epsilon_t', 'epsilon_p']

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

    print '%s_%s' % (typ[0], set_id)
    sig = f.get('%s_%s' % (typ[0], set_id))[...]
    sig_mean = np.mean(sig, axis=(1, 2, 3))

    print '%s_%s' % (typ[1], set_id)
    eps = f.get('%s_%s' % (typ[1], set_id))[...]
    eps_mean = np.mean(eps, axis=(1, 2, 3))

    f.close()

    """calculate the effective modulus for a particular component"""

    Eeff = sig_mean/eps_mean

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

    f = h5py.File("linkage.hdf5", 'a')
    f.create_dataset('Eeff_%s' % set_id, data=Eeff)
    f.close()
Exemplo n.º 2
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

    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)

    ## 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)
Exemplo n.º 3
0
import numpy as np
import functions_polycrystal as rr

plt.close('all')

el = 21
ns = 1
set_id_new = 'new'
set_id_old = 'old'
step = 1

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

vtk_filename_new = 'Results_Ti64_RandomMicroFZfinal_21x21x21_AbqInp_PowerLaw_%s_data_v2_0%s.vtk' %('%s',step)
vtk_filename_old = 'Results_Ti64_RandomMicroFZfinal_21x21x21_AbqInp_PowerLaw_%s_data_v2_0%s_old.vtk' %('%s',step)


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

## get field of interest from vtk file
for comp in xrange(9):
    vtk.read_meas(el,ns,set_id_old,step,comp,vtk_filename_old, tensor_ID, wrt_file)
    vtk.read_meas(el,ns,set_id_new,step,comp,vtk_filename_new, tensor_ID, wrt_file)
    
results.results_all(el,ns,set_id_old,set_id_new,step,'sigma')
    
Exemplo n.º 4
0
el = 21
step = 1
comp = '22'

for case in xrange(4):

    ns_val = ns_val_list[case]
    set_id_val = set_id_val_list[case]
    dir_val = dir_val_list[case]

    # 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 = 0
    typ = 'sigma'

    vtk_r.read_meas(el, ns_val, set_id_val, step, typ, comp, tensor_ID,
                    dir_val)

    tensor_ID = 1
    typ = 'epsilon'

    vtk_r.read_meas(el, ns_val, set_id_val, step, typ, comp, tensor_ID,
                    dir_val)

# hst.make_hist(el, ns_val_list, set_id_val_list, step, comp, 'epsilon')
# hst.make_hist(el, ns_val_list, set_id_val_list, step, comp, 'sigma')
Exemplo n.º 5
0
    #
    #    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)

    ## Generate the fftn of the validation microstructure function
    msf.micr_func(ns_val, set_id_val, step, wrt_file)
## 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 = 0

## Gather data from calibration vtk files

dir_cal = 'vtk_cal_stress_all_comp'

vtk.read_euler(ns_cal, set_id_cal, vtk_filename, dir_cal, wrt_file)

for comp in xrange(9):
    vtk.read_meas(ns_cal, set_id_cal, comp, vtk_filename, tensor_ID, dir_cal,
                  wrt_file)

## Gather data from validation vtk files

dir_val = 'vtk_val_stress_all_comp'

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

for comp in xrange(9):
    vtk.read_meas(ns_val, set_id_val, comp, vtk_filename, tensor_ID, dir_val,
                  wrt_file)

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