In [2]:
import numpy as np
import os
from codeStore import support_fun as spf
import importlib
In [2]:
# case 1, ecoli (head Force) model in finite pipe.
ellipse_centerx_list = [0.75, 0.5, 0]
rot_theta_list = np.linspace(0, 2, 11) # true theta=rot_theta_list*np.pi
rs1_list = (0.1, 0.2, 0.3)
PoiseuilleStrength_list = np.linspace(-0.5, 0.5, 11)
# PoiseuilleStrength_list = (0, )
job_dir = 'case1a'
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
for ellipse_centerx_i in ellipse_centerx_list:
for rot_theta_i in rot_theta_list:
for rs1_i in rs1_list:
if rs1_i + ellipse_centerx_i < 1:
job_name = 'headF_x%.2f_rot%.2f_rs1%.2f' % (ellipse_centerx_i, rot_theta_i, rs1_i)
t_name = os.path.join(job_dir, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
spf.write_pbs_head(fpbs, job_name)
for PoiseuilleStrength_i in PoiseuilleStrength_list:
output_name = '%s_P%.2f' % (job_name, PoiseuilleStrength_i)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../head_Force_in_pipe.py ')
fpbs.write(' -f %s ' % output_name)
fpbs.write(' -sm %s ' % 'lg_rs')
fpbs.write(' -legendre_m %d ' % 3)
fpbs.write(' -legendre_k %d ' % 2)
fpbs.write(' -epsilon %f ' % 3)
fpbs.write(' -PoiseuilleStrength %f ' % PoiseuilleStrength_i)
fpbs.write(' -ecoli_tail_strength %f ' % 1)
fpbs.write(' -rs1 %f ' % rs1_i)
fpbs.write(' -rs2 %f ' % 0.1)
fpbs.write(' -ds %f ' % 0.01)
fpbs.write(' -ellipse_centerx %f ' % ellipse_centerx_i)
fpbs.write(' -ellipse_centery %f ' % 0)
fpbs.write(' -ellipse_centerz %f ' % 0)
fpbs.write(' -rot_theta %f ' % rot_theta_i)
fpbs.write(' -finite_pipe_length %f ' % 10)
fpbs.write(' -finite_pipe_cover %d ' % 1)
fpbs.write(' -finite_pipe_ntheta %d ' % 100)
fpbs.write(' -vtk_matname %s ' % 'pipe_20181209')
fpbs.write(' -ksp_max_it %d ' % 500)
fpbs.write(' > %s.txt \n\n' % output_name)
# write to .sh file
frun.write('qsub %s.pbs\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [3]:
# case 2, ecoli (head Force) model in finite pipe. motion loop
ellipse_centerx_list = (0.75, 0.5, 0)
rot_theta_list = (0, 1/3, ) # true theta=rot_theta_list*np.pi
rs1_list = (0.1, )
PoiseuilleStrength_list = (0, 0.05)
# PoiseuilleStrength_list = (0, )
PWD = os.getcwd()
job_dir = 'case2a'
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for ellipse_centerx_i in ellipse_centerx_list:
for rs1_i in rs1_list:
if rs1_i + ellipse_centerx_i < 1:
for rot_theta_i in rot_theta_list:
for PoiseuilleStrength_i in PoiseuilleStrength_list:
job_name = 'headF_x%.2f_rot%.2f_rs1%.2f_P%.2f' % \
(ellipse_centerx_i, rot_theta_i, rs1_i, PoiseuilleStrength_i)
print(job_name)
t_path = os.path.join(job_dir, job_name)
if not os.path.exists(t_path):
os.makedirs(t_path)
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
spf.write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../../motion_head_Force_pipe.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -sm %s ' % 'lg_rs')
fpbs.write(' -legendre_m %d ' % 3)
fpbs.write(' -legendre_k %d ' % 2)
fpbs.write(' -epsilon %f ' % 3)
fpbs.write(' -PoiseuilleStrength %f ' % PoiseuilleStrength_i)
fpbs.write(' -ecoli_tail_strength %f ' % 1)
fpbs.write(' -rs1 %f ' % rs1_i)
fpbs.write(' -rs2 %f ' % 0.1)
fpbs.write(' -ds %f ' % 0.01)
fpbs.write(' -ellipse_centerx %f ' % ellipse_centerx_i)
fpbs.write(' -ellipse_centery %f ' % 0)
fpbs.write(' -ellipse_centerz %f ' % 0)
fpbs.write(' -rot_theta %f ' % rot_theta_i)
fpbs.write(' -finite_pipe_length %f ' % 10)
fpbs.write(' -finite_pipe_cover %d ' % 1)
fpbs.write(' -finite_pipe_ntheta %d ' % 100)
fpbs.write(' -vtk_matname %s ' % 'pipe_20181209')
fpbs.write(' -ksp_max_it %d ' % 500)
fpbs.write(' -max_iter %d ' % 500)
fpbs.write(' -eval_dt %f ' % 0.01)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('cd $t_dir/%s\n' % job_name)
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [3]:
# ecoli_shear1, ecoli model in infinite shear flow. motion ecoli
# eval_dt_list = [0.1, 0.05, 0.01,]
# update_order_list = [1, 2, 3, 4, 5]
# # eval_dt_fct_list = []
# max_iter = 500
# job_dir = 'ecoli_shear1c'
# write_pbs_head = spf.write_pbs_head
# eval_dt_list = [1, 10, 100]
# update_order_list = [1, 2, 3, 4, 5]
# # eval_dt_fct_list = []
# max_iter = 500
# job_dir = 'ecoli_shear1d'
# write_pbs_head = spf.write_pbs_head
# eval_dt_list = [0.5, 2, 4, 8]
# update_order_list = [1, 2, 3, 4, 5]
# # eval_dt_fct_list = []
# max_iter = 500
# job_dir = 'ecoli_shear1e'
# write_pbs_head = spf.write_pbs_head
eval_dt_list = [0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05]
update_order_list = [1, 2, 3, 4, 5]
# eval_dt_fct_list = []
max_iter = 500
job_dir = 'ecoli_shear1f'
write_pbs_head = spf.write_pbs_head
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for eval_dt_i in eval_dt_list:
for update_order_i in update_order_list:
job_name = 'eq_dt%0.3f_O%1d' % (eval_dt_i, update_order_i)
print(job_name)
t_path = os.path.join(job_dir, job_name)
if not os.path.exists(t_path):
os.makedirs(t_path)
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../../motion_ecoli.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -sm %s ' % 'pf')
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rh1 %f ' % 0.1)
fpbs.write(' -rh2 %f ' % 0.03)
fpbs.write(' -ch %f ' % 3)
fpbs.write(' -nth %d ' % 20)
fpbs.write(' -eh %f ' % -1)
fpbs.write(' -ph %f ' % (2/3))
fpbs.write(' -hfct %f ' % 1)
fpbs.write(' -n_tail %d ' % 1)
fpbs.write(' -with_cover %d ' % 2)
fpbs.write(' -left_hand %d ' % 0)
fpbs.write(' -rs1 %f ' % 1.5)
fpbs.write(' -rs2 %f ' % 0.5)
fpbs.write(' -ds %f ' % 0.07)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -with_T_geo %d ' % 0)
fpbs.write(' -dist_hs %f ' % 0.5)
fpbs.write(' -ksp_max_it %d ' % 500)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -rel_wsz %f ' % 0)
fpbs.write(' -rel_whz %f ' % 1)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % max_iter)
fpbs.write(' -update_order %d ' % update_order_i)
fpbs.write(' -eval_dt %f ' % eval_dt_i)
fpbs.write(' -planeShearRatex %f ' % 0.003)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('cd $t_dir/%s\n' % job_name)
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [24]:
# head_shear, head-force model in infinite shear flow. motion ecoli
# update_order_list = [1, ]
# max_iter = 10001
# update_fun = 'Adams_Bashforth_Methods'
# job_dir = 'head_shear1a'
# rs2_list = np.array([0.1, 0.3, 0.5, 0.7, 0.9, 1, 3, 5, 7, 9])
# ds_list = np.array([0.012, 0.022, 0.030, 0.035, 0.042, 0.05, 0.10, 0.17, 0.23, 0.30])
# eval_dt_list = np.array([1, 0.15, 0.10, 0.03, 0.06, 0.06, 0.03, 0.03, 0.03, 0.03]) * 0.1
# z_list = np.linspace(-3, 3, 5)
# importlib.reload(spf)
# write_pbs_head = spf.write_pbs_head_newturb
# update_order_list = [1, ]
# max_iter = 10001
# update_fun = 'Adams_Bashforth_Methods'
# job_dir = 'head_shear1b'
# rs2_list = np.array([3, 5, 7, 9])
# ds_list = np.array([0.10, 0.17, 0.23, 0.30])
# eval_dt_list = np.array([0.15, 0.24, 0.3 , 0.45]) * 0.1
# z_list = np.linspace(-3, 3, 5)
# importlib.reload(spf)
# write_pbs_head = spf.write_pbs_head_newturb
# update_order_list = [1, 2, 3, 4, 5]
# max_iter = 10001
# update_fun = 'Adams_Bashforth_Methods'
# job_dir = 'head_shear1c'
# rs2_list = np.array([0.1, 9])
# ds_list = np.array([0.012, 0.30])
# eval_dt_list = np.array([1, 0.45]) * 0.1
# z_list = [3, ]
# importlib.reload(spf)
# write_pbs_head = spf.write_pbs_head_newturb
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for update_order_i in update_order_list:
for rs2_i, dsi, eval_dt_i in zip(rs2_list, ds_list, eval_dt_list):
for zi in z_list:
job_name = 'eq_a%05.2f_o%1d' % (rs2_i, update_order_i)
t_path = job_dir
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../motion_head_Force.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -sm %s ' % 'lg_rs')
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rs1 %f ' % 1)
fpbs.write(' -rs2 %f ' % rs2_i)
fpbs.write(' -ds %f ' % dsi)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -ellipse_centerz %f ' % zi)
fpbs.write(' -ksp_max_it %d ' % 500)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % max_iter)
fpbs.write(' -update_order %d ' % update_order_i)
fpbs.write(' -update_fun %s ' % update_fun)
fpbs.write(' -eval_dt %f ' % eval_dt_i)
fpbs.write(' -ecoli_tail_strength %f ' % 0.0)
fpbs.write(' -planeShearRatex %f ' % 1)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [112]:
# random (or given) ini direction P of ellipse
update_order_list = [1, ]
max_iter = 20001
update_fun = 'Adams_Bashforth_Methods'
job_dir = 'head_shear2'
z_list = np.zeros(1)
importlib.reload(spf)
write_pbs_head = spf.write_pbs_head_newturb
norm_theta_list = np.random.sample(5) * np.pi
norm_phi_list = np.random.sample(5) * 2 * np.pi
rs2_i = np.array([1 / 3])
dsi = np.array([0.03])
eval_dt_i = np.array([0.03])
zi = 0
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for norm_theta, norm_phi in zip(norm_theta_list, norm_phi_list):
job_name = 'eq_theta%5.3f_phi%5.3f' % (norm_theta, norm_phi)
t_path = job_dir
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../motion_head_Force.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -sm %s ' % 'lg_rs')
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rs1 %f ' % 1)
fpbs.write(' -rs2 %f ' % rs2_i)
fpbs.write(' -ds %f ' % dsi)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -ellipse_centerz %f ' % zi)
fpbs.write(' -ksp_max_it %d ' % 500)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % max_iter)
fpbs.write(' -update_order %d ' % update_order_i)
fpbs.write(' -update_fun %s ' % update_fun)
fpbs.write(' -eval_dt %f ' % eval_dt_i)
fpbs.write(' -ecoli_tail_strength %f ' % 0.0)
fpbs.write(' -planeShearRatex %f ' % 1)
fpbs.write(' -norm_theta %f ' % norm_theta)
fpbs.write(' -norm_phi %f ' % norm_phi)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [36]:
# head_shear, head-velocity model in infinite shear flow. motion ecoli
# two nondimentional parameters: /alpha=rs_1/rs_1, /kappa=|v|/(z*/tau)
update_order_list = [1, ]
max_iter = 3001
update_fun = 'Adams_Moulton_Methods'
job_dir = 'head_shear_velocity1a'
rs2_list = np.array([0.1, 1, 9])
ds_list = np.array([0.012, 0.1, 0.3])
eval_dt_list = np.array([1, 0.06, 0.45]) * 0.1
z_list = np.linspace(-1, 1, 5)
planeShearRatex = 2
ecoli_velocity = 1
importlib.reload(spf)
write_pbs_head = spf.write_pbs_head_newturb
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for update_order_i in update_order_list:
for rs2_i, dsi, eval_dt_i in zip(rs2_list, ds_list, eval_dt_list):
for zi in z_list:
job_name = 'eq_a%05.2f_z%05.2f' % (rs2_i, zi)
t_path = job_dir
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../motion_head_speed.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -sm %s ' % 'lg_rs')
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rs1 %f ' % 1)
fpbs.write(' -rs2 %f ' % rs2_i)
fpbs.write(' -ds %f ' % dsi)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -ellipse_centerz %f ' % zi)
fpbs.write(' -ecoli_velocity %f ' % ecoli_velocity)
fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
fpbs.write(' -ksp_max_it %d ' % 500)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % max_iter)
fpbs.write(' -update_order %d ' % update_order_i)
fpbs.write(' -update_fun %s ' % update_fun)
fpbs.write(' -eval_dt %f ' % eval_dt_i)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [48]:
# case motion_ecoli_speed_dbg
planeShearRatex_list = np.linspace(0, 9, 10)
job_dir = 'motion_ecoli_speed_dbg1'
importlib.reload(spf)
write_pbs_head = spf.write_pbs_head_newturb
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for planeShearRatex in planeShearRatex_list:
job_name = 'dbg_tau%05.2f' % planeShearRatex
t_path = job_dir
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('time mpirun -n 24 python ')
fpbs.write(' ../motion_ecoli_speed_dbg.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rh1 %f ' % 0.1)
fpbs.write(' -rh2 %f ' % 0.03)
fpbs.write(' -ch %f ' % 3)
fpbs.write(' -nth %d ' % 15)
fpbs.write(' -eh %f ' % -1)
fpbs.write(' -ph %f ' % (2/3))
fpbs.write(' -hfct %f ' % 1)
fpbs.write(' -n_tail %d ' % 1)
fpbs.write(' -with_cover %d ' % 2)
fpbs.write(' -left_hand %d ' % 0)
fpbs.write(' -rs1 %f ' % 1.5)
fpbs.write(' -rs2 %f ' % 0.5)
fpbs.write(' -ds %f ' % 0.1)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -with_T_geo %d ' % 0)
fpbs.write(' -dist_hs %f ' % 0.500000)
fpbs.write(' -ksp_max_it %d ' % 100)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -rel_wsz %f ' % 0)
fpbs.write(' -rel_whz %f ' % 1)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -sm %s ' % 'pf')
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % 1)
fpbs.write(' -update_order %d ' % 1)
fpbs.write(' -update_fun %s ' % 'Adams_Moulton_Methods')
fpbs.write(' -eval_dt %f ' % 0.01)
fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
fpbs.write(' -ecoli_velocity %f ' % 1)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [53]:
# # case motion_ecoli_speed,
# # planeShearRatex_list = np.array((0, 1/3, 1/2, 1, 2, 3, 10))
# # eval_dt_list = np.array((0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05))
# # max_iter = 100
# # update_order = 3
# # ksp_max_it = 200
# # update_fun = 'Adams_Moulton_Methods'
# # ecoli_velocity = 1
# # job_dir = 'motion_ecoli_speed1'
# # importlib.reload(spf)
# # write_pbs_head = spf.write_pbs_head_newturb
# PWD = os.getcwd()
# if not os.path.exists(job_dir):
# os.makedirs(job_dir)
# t_name = os.path.join(job_dir, 'run.sh')
# n_pbs = 0
# with open(t_name, 'w') as frun:
# # create .pbs file
# frun.write('t_dir=$PWD \n')
# for planeShearRatex, eval_dt in zip(planeShearRatex_list, eval_dt_list):
# job_name = 'dbg_tau%05.2f' % planeShearRatex
# t_path = job_dir
# t_name = os.path.join(t_path, '%s.pbs' % job_name)
# with open(t_name, 'w') as fpbs:
# write_pbs_head(fpbs, job_name)
# fpbs.write('mpirun -n 24 python ')
# fpbs.write(' ../motion_ecoli_speed.py ')
# fpbs.write(' -f %s ' % job_name)
# fpbs.write(' -pickProblem %d ' % 0)
# fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
# fpbs.write(' -rh1 %f ' % 0.1)
# fpbs.write(' -rh2 %f ' % 0.03)
# fpbs.write(' -ch %f ' % 3)
# fpbs.write(' -nth %d ' % 15)
# fpbs.write(' -eh %f ' % -1)
# fpbs.write(' -ph %f ' % (2/3))
# fpbs.write(' -hfct %f ' % 1)
# fpbs.write(' -n_tail %d ' % 1)
# fpbs.write(' -with_cover %d ' % 2)
# fpbs.write(' -left_hand %d ' % 0)
# fpbs.write(' -rs1 %f ' % 1.5)
# fpbs.write(' -rs2 %f ' % 0.5)
# fpbs.write(' -ds %f ' % 0.1)
# fpbs.write(' -es %f ' % -1)
# fpbs.write(' -with_T_geo %d ' % 0)
# fpbs.write(' -dist_hs %f ' % 0.5)
# fpbs.write(' -ksp_max_it %d ' % ksp_max_it)
# fpbs.write(' -plot_geo %d ' % 0)
# fpbs.write(' -rel_wsz %f ' % 0)
# fpbs.write(' -rel_whz %f ' % 100)
# fpbs.write(' -ffweight %f ' % 2)
# fpbs.write(' -sm %s ' % 'pf')
# fpbs.write(' -zoom_factor %f ' % 1)
# fpbs.write(' -max_iter %d ' % max_iter)
# fpbs.write(' -update_order %d ' % update_order)
# fpbs.write(' -update_fun %s ' % update_fun)
# fpbs.write(' -eval_dt %f ' % eval_dt)
# fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
# fpbs.write(' -ecoli_velocity %f ' % ecoli_velocity)
# fpbs.write(' > %s.txt \n\n' % job_name)
# # write to .sh file
# frun.write('qsub %s.pbs\n\n' % job_name)
# n_pbs = n_pbs + 1
# frun.write('\n')
# print('n_pbs = ', n_pbs)
#####################################################################################################################################
# case motion_ecoli_speed, each case store in a independent folder.
planeShearRatex_list = np.array((0, 1/3, 1/2, 1, 2, 3, 10))
eval_dt_list = np.array((0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02))
max_iter = 100
update_order = 3
ksp_max_it = 200
update_fun = 'Adams_Moulton_Methods'
ecoli_velocity = 1
ch = 3
nth = 15
job_dir = 'motion_ecoli_speed2'
importlib.reload(spf)
write_pbs_head = spf.write_pbs_head_newturb
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for planeShearRatex, eval_dt in zip(planeShearRatex_list, eval_dt_list):
job_name = 'dbg_tau%05.2f' % planeShearRatex
print(job_name)
t_path = os.path.join(job_dir, job_name)
if not os.path.exists(t_path):
os.makedirs(t_path)
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../../motion_ecoli_speed.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rh1 %f ' % 0.1)
fpbs.write(' -rh2 %f ' % 0.03)
fpbs.write(' -ch %f ' % ch)
fpbs.write(' -nth %d ' % nth)
fpbs.write(' -eh %f ' % -1)
fpbs.write(' -ph %f ' % (2/3))
fpbs.write(' -hfct %f ' % 1)
fpbs.write(' -n_tail %d ' % 1)
fpbs.write(' -with_cover %d ' % 2)
fpbs.write(' -left_hand %d ' % 0)
fpbs.write(' -rs1 %f ' % 1.5)
fpbs.write(' -rs2 %f ' % 0.5)
fpbs.write(' -ds %f ' % 0.1)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -with_T_geo %d ' % 0)
fpbs.write(' -dist_hs %f ' % 0.5)
fpbs.write(' -ksp_max_it %d ' % ksp_max_it)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -rel_wsz %f ' % 0)
fpbs.write(' -rel_whz %f ' % 100)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -sm %s ' % 'pf')
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % max_iter)
fpbs.write(' -update_order %d ' % update_order)
fpbs.write(' -update_fun %s ' % update_fun)
fpbs.write(' -eval_dt %f ' % eval_dt)
fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
fpbs.write(' -ecoli_velocity %f ' % ecoli_velocity)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('cd $t_dir/%s\n' % job_name)
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [74]:
# case motion_ecoli_torque, each case store in a independent folder.
rh1 = 0.1
rh2 = 0.03
main_fun_noIter = 0
sm = 'pf'
# planeShearRatex_list = np.array((0, 1/10, 1/5, 1/3, 1/2, 1, 2))
# eval_dt_list = np.array((3e-4, 3e-4, 3e-4, 3e-4, 3e-4, 3e-4, 3e-4))
# max_iter = 1e6
# update_order = 3
# ksp_max_it = 300
# update_fun = 'Adams_Moulton_Methods'
# ecoli_velocity = 1
# ch = 1
# nth = 15
# job_dir = 'motion_ecoli_torque1'
# importlib.reload(spf)
# write_pbs_head = spf.write_pbs_head_newturb
# planeShearRatex_list = np.array((0, 1/10, 1/5, 1/3, 1/2, 1, 2))
# eval_dt_list = np.array((6e-4, 6e-4, 6e-4, 6e-4, 6e-4, 6e-4, 6e-4))
# max_iter = 1e6
# update_order = 3
# ksp_max_it = 300
# update_fun = 'Adams_Moulton_Methods'
# ecoli_velocity = 1
# ch = 3
# nth = 15
# job_dir = 'motion_ecoli_torque2'
# importlib.reload(spf)
# write_pbs_head = spf.write_pbs_head_newturb
# planeShearRatex_list = np.array((0, 1/10, 1/5, 1/3, 1/2, 1, 2, 10))
# eval_dt_list = np.ones_like(planeShearRatex_list) * 0.002
# max_iter = 1e6
# update_order = 3
# ksp_max_it = 300
# update_fun = 'Adams_Moulton_Methods'
# ecoli_velocity = 1
# ch = 1
# nth = 15
# job_dir = 'motion_ecoli_torque3'
# importlib.reload(spf)
# write_pbs_head = spf.write_pbs_head_newturb
# planeShearRatex_list = np.array((0, 1/10, 1/5, 1/3, 1/2, 1, 2, 10))
# eval_dt_list = np.ones_like(planeShearRatex_list) * 0.004
# max_iter = 1e6
# update_order = 3
# ksp_max_it = 300
# update_fun = 'Adams_Moulton_Methods'
# ecoli_velocity = 1
# ch = 3
# nth = 15
# job_dir = 'motion_ecoli_torque4'
# importlib.reload(spf)
# write_pbs_head = spf.write_pbs_head_newturb
# planeShearRatex_list = np.array((0, 1/10, 1/5, 1/3, 1/2, 1, 2, 10))
# eval_dt_list = np.ones_like(planeShearRatex_list) * 0.004
# max_iter = 1e6
# update_order = 3
# ksp_max_it = 300
# update_fun = 'Adams_Moulton_Methods'
# ecoli_velocity = 1
# ch = 3
# nth = 15
# rh1 = 0.3
# rh2 = 0.1
# job_dir = 'motion_ecoli_torque5'
# main_fun_noIter = 1
# importlib.reload(spf)
# write_pbs_head = spf.write_pbs_head_newturb
planeShearRatex_list = np.array((0, 1/10, 1/5, 1/3, 1/2, 1, 2, 10))
eval_dt_list = np.ones_like(planeShearRatex_list) * 0.007
max_iter = 1e6
update_order = 3
ksp_max_it = 300
update_fun = 'Adams_Moulton_Methods'
ecoli_velocity = 1
ch = 3
nth = 15
rh1 = 0.3
rh2 = 0.1
job_dir = 'motion_ecoli_torque6'
main_fun_noIter = 1
importlib.reload(spf)
write_pbs_head = spf.write_pbs_head_newturb
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for planeShearRatex, eval_dt in zip(planeShearRatex_list, eval_dt_list):
job_name = 'dbg_tau%05.2f' % planeShearRatex
print(job_name)
t_path = os.path.join(job_dir, job_name)
if not os.path.exists(t_path):
os.makedirs(t_path)
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../../motion_ecoli_torque.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rh1 %f ' % rh1)
fpbs.write(' -rh2 %f ' % rh2)
fpbs.write(' -ch %f ' % ch)
fpbs.write(' -nth %d ' % nth)
fpbs.write(' -eh %f ' % -1)
fpbs.write(' -ph %f ' % (2/3))
fpbs.write(' -hfct %f ' % 1)
fpbs.write(' -n_tail %d ' % 1)
fpbs.write(' -with_cover %d ' % 2)
fpbs.write(' -left_hand %d ' % 0)
fpbs.write(' -rs1 %f ' % 1.5)
fpbs.write(' -rs2 %f ' % 0.5)
fpbs.write(' -ds %f ' % 0.07)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -with_T_geo %d ' % 0)
fpbs.write(' -dist_hs %f ' % 0.5)
fpbs.write(' -ksp_max_it %d ' % ksp_max_it)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -rel_wsz %f ' % 0)
fpbs.write(' -rel_whz %f ' % 100)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -sm %s ' % sm)
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % max_iter)
fpbs.write(' -update_order %d ' % update_order)
fpbs.write(' -update_fun %s ' % update_fun)
fpbs.write(' -eval_dt %f ' % eval_dt)
fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
fpbs.write(' -ecoli_velocity %f ' % ecoli_velocity)
fpbs.write(' -main_fun_noIter %d ' % main_fun_noIter)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('cd $t_dir/%s\n' % job_name)
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [5]:
# case motion_ecoli_passive, each case store in a independent folder.
ecoli_name = 'ecoli_B01'
planeShearRatex = 1
eval_dt = 0.007
max_iter = 1e6
update_order = 1
ksp_max_it = 300
update_fun = 'Adams_Moulton_Methods'
ecoli_velocity = 0
ch = 3
nth = 20
rh1 = 0.1
rh2 = 0.03
job_dir = 'motion_ecoli_passive1'
sm = 'pf'
importlib.reload(spf)
write_pbs_head = spf.write_pbs_head_newturb
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
job_name = '%s' % ecoli_name
print(job_name)
t_path = os.path.join(job_dir, job_name)
if not os.path.exists(t_path):
os.makedirs(t_path)
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../../motion_ecoli_torque.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rh1 %f ' % rh1)
fpbs.write(' -rh2 %f ' % rh2)
fpbs.write(' -ch %f ' % ch)
fpbs.write(' -nth %d ' % nth)
fpbs.write(' -eh %f ' % -1)
fpbs.write(' -ph %f ' % (2/3))
fpbs.write(' -hfct %f ' % 1)
fpbs.write(' -n_tail %d ' % 1)
fpbs.write(' -with_cover %d ' % 2)
fpbs.write(' -left_hand %d ' % 0)
fpbs.write(' -rs1 %f ' % 1.5)
fpbs.write(' -rs2 %f ' % 0.5)
fpbs.write(' -ds %f ' % 0.07)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -with_T_geo %d ' % 0)
fpbs.write(' -dist_hs %f ' % 0.5)
fpbs.write(' -ksp_max_it %d ' % ksp_max_it)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -rel_wsz %f ' % 0)
fpbs.write(' -rel_whz %f ' % 100)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -sm %s ' % sm)
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % max_iter)
fpbs.write(' -update_order %d ' % update_order)
fpbs.write(' -update_fun %s ' % update_fun)
fpbs.write(' -eval_dt %f ' % eval_dt)
fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
fpbs.write(' -ecoli_velocity %f ' % ecoli_velocity)
fpbs.write(' -passive_fun_noIter %d ' % 1)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('cd $t_dir/%s\n' % job_name)
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [8]:
# case motion_ecoli_torque, with different ini norm, each case store in a independent folder.
ecoli_name = 'ecoli_B01'
planeShearRatex = 1
eval_dt = 0.007
max_iter = 1e6
update_order = 1
ksp_max_it = 300
update_fun = 'Adams_Moulton_Methods'
ecoli_velocity = 1
ch = 3
nth = 20
rh1 = 0.1
rh2 = 0.03
job_dir = 'motion_ecoli_torque7'
sm = 'pf'
importlib.reload(spf)
write_pbs_head = spf.write_pbs_head_newturb
ini_rot_theta_list = np.array([0, 1/6, 1/6, 1/6, 2/6, 2/6, 2/6, 2/6]) * np.pi
ini_rot_phi_list = np.array([0, 1/6, 2/6, 3/6, 1/6, 2/6, 3/6, 4/6]) * np.pi
main_fun_noIter = 1
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for ini_rot_theta, ini_rot_phi in zip(ini_rot_theta_list, ini_rot_phi_list):
job_name = '%s_theta%4.2f_phi%4.2f' % (ecoli_name, ini_rot_theta, ini_rot_phi)
print(job_name)
t_path = os.path.join(job_dir, job_name)
if not os.path.exists(t_path):
os.makedirs(t_path)
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../../motion_ecoli_torque.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rh1 %f ' % rh1)
fpbs.write(' -rh2 %f ' % rh2)
fpbs.write(' -ch %f ' % ch)
fpbs.write(' -nth %d ' % nth)
fpbs.write(' -eh %f ' % -1)
fpbs.write(' -ph %f ' % (2/3))
fpbs.write(' -hfct %f ' % 1)
fpbs.write(' -n_tail %d ' % 1)
fpbs.write(' -with_cover %d ' % 2)
fpbs.write(' -left_hand %d ' % 0)
fpbs.write(' -rs1 %f ' % 1.5)
fpbs.write(' -rs2 %f ' % 0.5)
fpbs.write(' -ds %f ' % 0.07)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -with_T_geo %d ' % 0)
fpbs.write(' -dist_hs %f ' % 0.5)
fpbs.write(' -ksp_max_it %d ' % ksp_max_it)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -rel_wsz %f ' % 0)
fpbs.write(' -rel_whz %f ' % 100)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -sm %s ' % sm)
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % max_iter)
fpbs.write(' -update_order %d ' % update_order)
fpbs.write(' -update_fun %s ' % update_fun)
fpbs.write(' -eval_dt %f ' % eval_dt)
fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
fpbs.write(' -ecoli_velocity %f ' % ecoli_velocity)
fpbs.write(' -main_fun_noIter %d ' % main_fun_noIter)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('cd $t_dir/%s\n' % job_name)
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [101]:
# # case motion_helix_passive, each case store in a independent folder.
# rh1 = 0.1
# rh2 = 0.03
# main_fun_noIter = 0
# sm = 'pf'
# planeShearRatex_list = np.array((0.1, 1, 10))
# eval_dt_list = np.ones_like(planeShearRatex_list) * 0.3 / planeShearRatex_list
# max_iter = 1e6
# update_order = 3
# ksp_max_it = 300
# update_fun = 'Adams_Moulton_Methods'
# ch = 3
# nth = 20
# rh1 = 0.3
# rh2 = 0.1
# job_dir = 'motion_helix_passive1'
# main_fun_noIter = 1
# importlib.reload(spf)
# write_pbs_head = spf.write_pbs_head
# PWD = os.getcwd()
# if not os.path.exists(job_dir):
# os.makedirs(job_dir)
# t_name = os.path.join(job_dir, 'run.sh')
# n_pbs = 0
# with open(t_name, 'w') as frun:
# # create .pbs file
# frun.write('t_dir=$PWD \n')
# for planeShearRatex, eval_dt in zip(planeShearRatex_list, eval_dt_list):
# job_name = 'hlx_tau%05.2f' % planeShearRatex
# print(job_name)
# t_path = os.path.join(job_dir, job_name)
# if not os.path.exists(t_path):
# os.makedirs(t_path)
# t_name = os.path.join(t_path, '%s.pbs' % job_name)
# with open(t_name, 'w') as fpbs:
# write_pbs_head(fpbs, job_name)
# fpbs.write('mpirun -n 24 python ')
# fpbs.write(' ../../motion_helix_passive.py ')
# fpbs.write(' -f %s ' % job_name)
# fpbs.write(' -pickProblem %d ' % 0)
# fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
# fpbs.write(' -rh1 %f ' % rh1)
# fpbs.write(' -rh2 %f ' % rh2)
# fpbs.write(' -ch %f ' % ch)
# fpbs.write(' -nth %d ' % nth)
# fpbs.write(' -eh %f ' % -1)
# fpbs.write(' -ph %f ' % (2/3))
# fpbs.write(' -hfct %f ' % 1)
# fpbs.write(' -n_tail %d ' % 1)
# fpbs.write(' -with_cover %d ' % 2)
# fpbs.write(' -left_hand %d ' % 0)
# fpbs.write(' -rs1 %f ' % 1.5)
# fpbs.write(' -rs2 %f ' % 0.5)
# fpbs.write(' -ds %f ' % 0.07)
# fpbs.write(' -es %f ' % -1)
# fpbs.write(' -with_T_geo %d ' % 0)
# fpbs.write(' -dist_hs %f ' % 0.5)
# fpbs.write(' -ksp_max_it %d ' % ksp_max_it)
# fpbs.write(' -plot_geo %d ' % 0)
# fpbs.write(' -rel_wsz %f ' % 0)
# fpbs.write(' -rel_whz %f ' % 100)
# fpbs.write(' -ffweight %f ' % 2)
# fpbs.write(' -sm %s ' % sm)
# fpbs.write(' -zoom_factor %f ' % 1)
# fpbs.write(' -max_iter %d ' % max_iter)
# fpbs.write(' -update_order %d ' % update_order)
# fpbs.write(' -update_fun %s ' % update_fun)
# fpbs.write(' -eval_dt %f ' % eval_dt)
# fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
# fpbs.write(' -main_fun_noIter %d ' % main_fun_noIter)
# fpbs.write(' > %s.txt \n\n' % job_name)
# # write to .sh file
# frun.write('cd $t_dir/%s\n' % job_name)
# frun.write('qsub %s.pbs\n\n' % job_name)
# n_pbs = n_pbs + 1
# frun.write('\n')
# print('n_pbs = ', n_pbs)
######################################################################################################################################
# # planeShearRatex = 1
# # eval_dt = 0.3
# # n_tail_list = [2, 3, 4 ]
# # max_iter = 1e5
# # update_order = 3
# # ksp_max_it = 300
# # update_fun = 'Adams_Moulton_Methods'
# # ch = 3
# # nth = 20
# # rh1 = 0.1
# # rh2 = 0.03
# # job_dir = 'motion_helix_passive2b'
# # main_fun_noIter = 1
# # importlib.reload(spf)
# # write_pbs_head = spf.write_pbs_head
# # sm = 'pf'
# PWD = os.getcwd()
# if not os.path.exists(job_dir):
# os.makedirs(job_dir)
# t_name = os.path.join(job_dir, 'run.sh')
# n_pbs = 0
# with open(t_name, 'w') as frun:
# # create .pbs file
# frun.write('t_dir=$PWD \n')
# for n_tail in n_tail_list:
# job_name = 'hlx_ntail%d' % n_tail
# print(job_name)
# t_path = os.path.join(job_dir, job_name)
# if not os.path.exists(t_path):
# os.makedirs(t_path)
# t_name = os.path.join(t_path, '%s.pbs' % job_name)
# with open(t_name, 'w') as fpbs:
# write_pbs_head(fpbs, job_name)
# fpbs.write('mpirun -n 24 python ')
# fpbs.write(' ../../motion_helix_passive.py ')
# fpbs.write(' -f %s ' % job_name)
# fpbs.write(' -pickProblem %d ' % 0)
# fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
# fpbs.write(' -rh1 %f ' % rh1)
# fpbs.write(' -rh2 %f ' % rh2)
# fpbs.write(' -ch %f ' % ch)
# fpbs.write(' -nth %d ' % nth)
# fpbs.write(' -eh %f ' % -1)
# fpbs.write(' -ph %f ' % (2/3))
# fpbs.write(' -hfct %f ' % 1)
# fpbs.write(' -n_tail %d ' % n_tail)
# fpbs.write(' -with_cover %d ' % 2)
# fpbs.write(' -left_hand %d ' % 0)
# fpbs.write(' -rs1 %f ' % 1.5)
# fpbs.write(' -rs2 %f ' % 0.5)
# fpbs.write(' -ds %f ' % 0.07)
# fpbs.write(' -es %f ' % -1)
# fpbs.write(' -with_T_geo %d ' % 0)
# fpbs.write(' -dist_hs %f ' % 0.5)
# fpbs.write(' -ksp_max_it %d ' % ksp_max_it)
# fpbs.write(' -plot_geo %d ' % 0)
# fpbs.write(' -rel_wsz %f ' % 0)
# fpbs.write(' -rel_whz %f ' % 100)
# fpbs.write(' -ffweight %f ' % 2)
# fpbs.write(' -sm %s ' % sm)
# fpbs.write(' -zoom_factor %f ' % 1)
# fpbs.write(' -max_iter %d ' % max_iter)
# fpbs.write(' -update_order %d ' % update_order)
# fpbs.write(' -update_fun %s ' % update_fun)
# fpbs.write(' -eval_dt %f ' % eval_dt)
# fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
# fpbs.write(' -main_fun_noIter %d ' % main_fun_noIter)
# fpbs.write(' > %s.txt \n\n' % job_name)
# # write to .sh file
# frun.write('cd $t_dir/%s\n' % job_name)
# frun.write('qsub %s.pbs\n\n' % job_name)
# n_pbs = n_pbs + 1
# frun.write('\n')
# print('n_pbs = ', n_pbs)
######################################################################################################################################
planeShearRatex = 1
eval_dt = 0.5
n_tail_list = [1, ]
max_iter = 1e3
update_order = 3
ksp_max_it = 300
update_fun = 'Adams_Moulton_Methods'
ch = 3
nth = 20
rh1 = 0.1
rh2 = 0.03
job_dir = 'motion_helix_passive2c'
main_fun_noIter = 1
importlib.reload(spf)
write_pbs_head = spf.write_pbs_head_newturb
sm = 'pf'
ini_rot_theta_list = np.array([1/6, 1/6, 1/6, 2/6, 2/6, 2/6, 2/6]) * np.pi
ini_rot_phi_list = np.array([1/6, 2/6, 3/6, 1/6, 2/6, 3/6, 4/6]) * np.pi
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for n_tail in n_tail_list:
for ini_rot_theta, ini_rot_phi in zip(ini_rot_theta_list, ini_rot_phi_list):
job_name = 'hlx_ntail%d_theta%4.2f_phi%4.2f' % (n_tail, ini_rot_theta, ini_rot_phi)
print(job_name)
t_path = os.path.join(job_dir, job_name)
if not os.path.exists(t_path):
os.makedirs(t_path)
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../../motion_helix_passive.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rh1 %f ' % rh1)
fpbs.write(' -rh2 %f ' % rh2)
fpbs.write(' -ch %f ' % ch)
fpbs.write(' -nth %d ' % nth)
fpbs.write(' -eh %f ' % -1)
fpbs.write(' -ph %f ' % (2/3))
fpbs.write(' -hfct %f ' % 1)
fpbs.write(' -n_tail %d ' % n_tail)
fpbs.write(' -with_cover %d ' % 2)
fpbs.write(' -left_hand %d ' % 0)
fpbs.write(' -rs1 %f ' % 1.5)
fpbs.write(' -rs2 %f ' % 0.5)
fpbs.write(' -ds %f ' % 0.07)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -with_T_geo %d ' % 0)
fpbs.write(' -dist_hs %f ' % 0.5)
fpbs.write(' -ksp_max_it %d ' % ksp_max_it)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -rel_wsz %f ' % 0)
fpbs.write(' -rel_whz %f ' % 100)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -sm %s ' % sm)
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % max_iter)
fpbs.write(' -update_order %d ' % update_order)
fpbs.write(' -update_fun %s ' % update_fun)
fpbs.write(' -eval_dt %f ' % eval_dt)
fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
fpbs.write(' -main_fun_noIter %d ' % main_fun_noIter)
fpbs.write(' -ini_rot_theta %f ' % ini_rot_theta)
fpbs.write(' -ini_rot_phi %f ' % ini_rot_phi)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('cd $t_dir/%s\n' % job_name)
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [105]:
# case motion_helix_passive, each case store in a independent folder.
planeShearRatex = 1
ini_rot_theta, ini_rot_phi = 0, 0
# eval_dt = 0.3
# n_tail_list = [2, 3, 4 ]
# max_iter = 1e5
# update_order = 3
# ksp_max_it = 300
# update_fun = 'Adams_Moulton_Methods'
# ch = 3
# nth = 20
# rh1 = 0.1
# rh2 = 0.03
# job_dir = 'motion_helix_passive2b'
# main_fun_noIter = 1
# importlib.reload(spf)
# write_pbs_head = spf.write_pbs_head
# sm = 'pf'
ini_rot_theta, ini_rot_phi = np.pi * np.array((1/4, 1/4))
eval_dt = 0.3
n_tail_list = [2, 3, 4 ]
max_iter = 1e5
update_order = 3
ksp_max_it = 300
update_fun = 'Adams_Moulton_Methods'
ch = 3
nth = 20
rh1 = 0.1
rh2 = 0.03
job_dir = 'motion_helix_passive2d'
main_fun_noIter = 1
importlib.reload(spf)
write_pbs_head = spf.write_pbs_head
sm = 'pf'
PWD = os.getcwd()
if not os.path.exists(job_dir):
os.makedirs(job_dir)
t_name = os.path.join(job_dir, 'run.sh')
n_pbs = 0
with open(t_name, 'w') as frun:
# create .pbs file
frun.write('t_dir=$PWD \n')
for n_tail in n_tail_list:
job_name = 'hlx_ntail%d' % n_tail
print(job_name)
t_path = os.path.join(job_dir, job_name)
if not os.path.exists(t_path):
os.makedirs(t_path)
t_name = os.path.join(t_path, '%s.pbs' % job_name)
with open(t_name, 'w') as fpbs:
write_pbs_head(fpbs, job_name)
fpbs.write('mpirun -n 24 python ')
fpbs.write(' ../../motion_helix_passive.py ')
fpbs.write(' -f %s ' % job_name)
fpbs.write(' -pickProblem %d ' % 0)
fpbs.write(' -save_singleEcoli_vtk %d ' % 0)
fpbs.write(' -rh1 %f ' % rh1)
fpbs.write(' -rh2 %f ' % rh2)
fpbs.write(' -ch %f ' % ch)
fpbs.write(' -nth %d ' % nth)
fpbs.write(' -eh %f ' % -1)
fpbs.write(' -ph %f ' % (2/3))
fpbs.write(' -hfct %f ' % 1)
fpbs.write(' -n_tail %d ' % n_tail)
fpbs.write(' -with_cover %d ' % 2)
fpbs.write(' -left_hand %d ' % 0)
fpbs.write(' -rs1 %f ' % 1.5)
fpbs.write(' -rs2 %f ' % 0.5)
fpbs.write(' -ds %f ' % 0.07)
fpbs.write(' -es %f ' % -1)
fpbs.write(' -with_T_geo %d ' % 0)
fpbs.write(' -dist_hs %f ' % 0.5)
fpbs.write(' -ksp_max_it %d ' % ksp_max_it)
fpbs.write(' -plot_geo %d ' % 0)
fpbs.write(' -rel_wsz %f ' % 0)
fpbs.write(' -rel_whz %f ' % 100)
fpbs.write(' -ffweight %f ' % 2)
fpbs.write(' -sm %s ' % sm)
fpbs.write(' -zoom_factor %f ' % 1)
fpbs.write(' -max_iter %d ' % max_iter)
fpbs.write(' -update_order %d ' % update_order)
fpbs.write(' -update_fun %s ' % update_fun)
fpbs.write(' -eval_dt %f ' % eval_dt)
fpbs.write(' -planeShearRatex %f ' % planeShearRatex)
fpbs.write(' -main_fun_noIter %d ' % main_fun_noIter)
fpbs.write(' -ini_rot_theta %f ' % ini_rot_theta)
fpbs.write(' -ini_rot_phi %f ' % ini_rot_phi)
fpbs.write(' > %s.txt \n\n' % job_name)
# write to .sh file
frun.write('cd $t_dir/%s\n' % job_name)
frun.write('qsub %s.pbs\n\n' % job_name)
n_pbs = n_pbs + 1
frun.write('\n')
print('n_pbs = ', n_pbs)
In [98]:
ini_rot_theta_list
Out[98]:
In [ ]: