def modify(src,inp,cg_mesh_orig,cg_mesh_mod,rpath,wpath,Z_path,dth_path,nkl): # src : location of random_blade fortran code # inp : location of CGNS files # cg_mesh_orig : name of original CGNS file # cg_mesh_mod : name of modified CGNS file # rpath : name of original blade surface file # wpath : name of modified blade surface file # Z_path : where to store the Z values # nkl : number of KL modes to use in generating geometries os.chdir(inp) # switch to alternate mesh file if original destroyed if not os.path.exists(cg_mesh_orig): cg_mesh_orig = cg_mesh_orig[:-5]+'1.cgns' if not os.path.exists(cg_mesh_orig): cg_mesh_orig = cg_mesh_orig[:-5]+'2.cgns' # convert CGNS files to HDF format os.system('adf2hdf ' + cg_mesh_orig) # copy CGNS files shutil.copy(cg_mesh_orig, cg_mesh_mod) # write mesh surface out os.system(src+'random_blade '+cg_mesh_orig) # perturb the mesh surface perturb_surf_gaussian.perturb(inp+rpath, inp+wpath, inp+'kl_modes/', Z_path, dth_path, nkl) # read in perturbation to CGNS mesh os.system(src+'random_blade '+cg_mesh_orig+' '+cg_mesh_mod) # convert CGNS file back to ADF format os.system('hdf2adf ' + cg_mesh_orig) os.system('hdf2adf ' + cg_mesh_mod)
import perturb_surf_gaussian import mod_mesh_kl import os, shutil src = '/mnt/pwfiles/ericdow/random_blade/src/' inp = '/mnt/pwfiles/ericdow/random_blade/input/rotor37_coarse/' runs = '/mt/pwfiles/ericdow/random_blade/runs/' cg_mesh_orig = 'utcfd_out.cgns' cg_mesh_mod = 'utcfd_out_mod.cgns' rpath = 'blade_surf.dat' wpath = 'blade_surf_mod.dat' perturb_surf_gaussian.perturb(rpath, wpath) ''' # 33 total PCA modes npca = 33 perturb_surf_pca.perturb(rpath, wpath, inp+'pca/','Z.dat',npca) '''
import perturb_surf_gaussian import os, shutil ut_src = '/mnt/pwfiles/ericdow/utcfd/bin/' src = '/mnt/pwfiles/ericdow/random_blade/src/' inp = '/mnt/pwfiles/ericdow/random_blade/input/rotor37_coarse/' runs = '/mnt/pwfiles/ericdow/random_blade/runs/' cg_mesh_orig = 'utcfd_out.cgns' cg_mesh_mod = 'utcfd_out_mod.cgns' rpath = 'blade_surf.dat' wpath = 'blade_surf_mod.dat' # number of KL modes to use in generating geometries nkl = 50 # perturb the mesh surface perturb_surf_gaussian.perturb(inp+rpath, 'foo.dat', inp+'kl_modes/', 'foo.dat', 'foo.dat', nkl)