In [19]:
import numpy as np
import os
from codeStore import support_fun as spf
import importlib
PWD = os.getcwd()

In [3]:
importlib.reload(spf)
ini_psi_type = 'rand'
use_node = 3
ncpu_node = 24
def comm_do_calculate(ini_theta, ini_phi, ini_psi, max_t, rtol, atol, eval_dt, 
                      calculate_fun, update_fun, table_name, omega_tail):
    ts = 'python ../../do_calculate.py  '
    ts = ts + ' -ini_theta %f -ini_phi %f -ini_psi %f' % (ini_theta, ini_phi, ini_psi)
    ts = ts + ' -max_t %f -rtol %e -atol %e -eval_dt %e' % (max_t, rtol, atol, eval_dt)
    ts = ts + ' -calculate_fun %s -update_fun %s -table_name %s' % (calculate_fun, update_fun, table_name)
    ts = ts + ' -omega_tail %f' % omega_tail
    return ts

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao0_wm1'
# job_dir = 'ecoC01B05_bulk_psi-0a'
# omega_tail = 1
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0'
# job_dir = 'ecoC01B05_passive_psi-0a'
# omega_tail = 0
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.01'
# job_dir = 'ecoC01B05_wt0.01_psi-0a'
# omega_tail = 0.01
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.1'
# job_dir = 'ecoC01B05_wt0.1_psi-0a'
# omega_tail = 0.1
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.2'
# job_dir = 'ecoC01B05_wt0.2_psi-0a'
# omega_tail = 0.2
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.3'
# job_dir = 'ecoC01B05_wt0.3_psi-0a'
# omega_tail = 0.3
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.4'
# job_dir = 'ecoC01B05_wt0.4_psi-0a'
# omega_tail = 0.4
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.5'
# job_dir = 'ecoC01B05_wt0.5_psi-0a'
# omega_tail = 0.5
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.6'
# job_dir = 'ecoC01B05_wt0.6_psi-0a'
# omega_tail = 0.6
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.7'
# job_dir = 'ecoC01B05_wt0.7_psi-0a'
# omega_tail = 0.7
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.8'
# job_dir = 'ecoC01B05_wt0.8_psi-0a'
# omega_tail = 0.8
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.9'
# job_dir = 'ecoC01B05_wt0.9_psi-0a'
# omega_tail = 0.9
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm1'
# job_dir = 'ecoC01B05_wt1_psi-0a'
# omega_tail = 1
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 5000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm10'
# job_dir = 'ecoC01B05_wt10_psi-0a'
# omega_tail = 10
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 1000, 1e-6, 1e-9, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm100'
# job_dir = 'ecoC01B05_wt100_psi-0a'
# omega_tail = 100
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-12, 1e-15, 1e-3, '5bs'
# calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
# table_name = 'ecoC01B05_tao1_wm0.5'
# job_dir = 'ecoC01B05_wt0.5_psi-0b'
# omega_tail = 0.5
# n_theta, n_phi = 23, 45 # num of cpus and num of jobs
# write_pbs_head = spf.write_pbs_head
# ini_psi_type = 0
# phi_list = np.linspace(0, 2 * np.pi, n_phi)
# theta_list = np.linspace(0, np.pi, n_theta)

########################################################################################################
t_path = os.path.join(PWD, job_dir)
if not os.path.exists(t_path):
    os.makedirs(t_path)
# generate all comment file. 
theta_list, phi_list = np.meshgrid(theta_list, phi_list)
comm_list = []
t_name0 = os.path.join(t_path, 'comm_list.sh')
with open(t_name0, 'w') as fcomm:
    for i0, (ini_theta, ini_phi) in enumerate(zip(theta_list.ravel(), phi_list.ravel())):
        ini_psi = np.random.sample(1) if ini_psi_type is 'rand' else ini_psi_type
        ts = comm_do_calculate(ini_theta, ini_phi, ini_psi, max_t, rtol, atol, eval_dt, 
                               calculate_fun, update_fun, table_name, omega_tail)
        comm_list.append(ts)
        fcomm.write(ts)
        fcomm.write('\n\n')
n_case = len(comm_list)
# generate .pbs file and .csh file
n_pbs = 0
n_job_pbs = use_node * ncpu_node
t_name0 = os.path.join(t_path, 'main_run.sh')
with open(t_name0, 'w') as frun:
    frun.write('t_dir=$PWD \n\n')
    for t1 in np.arange((n_case // n_job_pbs) + 1): 
        use_comm = comm_list[t1*n_job_pbs : np.min(((t1+1)*n_job_pbs, n_case))]
        n_use_comm = len(use_comm)
        tnode = np.ceil(n_use_comm / ncpu_node)
        pbs_name = 'run%03d.pbs' % t1
        csh_name = 'run%03d.csh' % t1
        # generate .pbs file
        t_name = os.path.join(t_path, pbs_name)
        with open(t_name, 'w') as fpbs:
            pbs_head = '%s_%s' % (job_dir, pbs_name)
            write_pbs_head(fpbs, pbs_head, nodes=tnode) 
            t2 = 'seq 0 %d | parallel -j %d -u ' % (n_use_comm-1, ncpu_node)
            t2 = t2 + ' --sshloginfile $PBS_NODEFILE --sshdelay 0.1 '
            t2 = t2 + '"cd $PWD; echo $PWD; bash %s {} true " \n\n ' % csh_name
            fpbs.write(t2)
        # generate .csh file for submit
        t_name = os.path.join(t_path, csh_name)
        with open(t_name, 'w') as fcsh:
            fcsh.write('#!/bin/csh -fe \n\n')
            t2 = 'comm_list=('
            for t3 in use_comm:
                t2 = t2 + '"%s" ' % t3
            t2 = t2 + ') \n\n'
            fcsh.write(t2)
            fcsh.write('echo ${comm_list[$1]} \n')
            fcsh.write('if [ ${2:-false} = true ]; then \n')
            fcsh.write('    ${comm_list[$1]} \n')
            fcsh.write('fi \n\n')
        frun.write('qsub %s\n\n' % pbs_name)
        n_pbs = n_pbs + 1
    frun.write('\n')
print(t_path)
print('n_pbs = ', n_pbs)


/home/zhangji/stokes_flow_master/head_Force/do_calculate_table/ecoC01B05_wt0.7_psi-0b
n_pbs =  15

In [18]:
importlib.reload(spf)
ini_psi_type = 'rand'
use_node = 3
njob_node = 24
n_job_pbs = use_node * njob_node
random_order = True

def comm_do_calculate(ini_theta, ini_phi, ini_psi, max_t, rtol, atol, eval_dt, 
                      calculate_fun, update_fun, table_name, omega_tail):
    ts = 'python ../../do_calculate.py  '
    ts = ts + ' -ini_theta %f -ini_phi %f -ini_psi %f' % (ini_theta, ini_phi, ini_psi)
    ts = ts + ' -max_t %f -rtol %e -atol %e -eval_dt %e' % (max_t, rtol, atol, eval_dt)
    ts = ts + ' -calculate_fun %s -update_fun %s -table_name %s' % (calculate_fun, update_fun, table_name)
    ts = ts + ' -omega_tail %f' % omega_tail
    return ts

max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-12, 1e-15, 1e-3, '5bs'
calculate_fun = 'do_calculate_ecoli_Petsc4nPsi'
table_name = 'ecoC01B05_tao1_wm0.7'
job_dir = 'ecoC01B05_wt0.7_psi-0c'
omega_tail = 0.7
n_theta, n_phi = 23, 45 # num of cpus and num of jobs
write_pbs_head = spf.write_pbs_head
ini_psi_type = 0
phi_list = np.linspace(0, 2 * np.pi, n_phi)
theta_list = np.linspace(0, np.pi, n_theta)
use_node = 15
n_job_pbs = 10000

########################################################################################################
t_path = os.path.join(PWD, job_dir)
if not os.path.exists(t_path):
    os.makedirs(t_path)
# generate all comment file. 
theta_list, phi_list = np.meshgrid(theta_list, phi_list)
comm_list = []
txt_list = []
for i0, (ini_theta, ini_phi) in enumerate(zip(theta_list.ravel(), phi_list.ravel())):
    ini_psi = np.random.sample(1) if ini_psi_type is 'rand' else ini_psi_type
    f = 'th%5.3f_ph%5.3f_ps%5.3f' % (ini_theta, ini_phi, ini_psi)
    ts = comm_do_calculate(ini_theta, ini_phi, ini_psi, max_t, rtol, atol, eval_dt, 
                           calculate_fun, update_fun, table_name, omega_tail)
    comm_list.append(ts)
    txt_list.append(f)
spf.write_main_run_comm_list(comm_list, txt_list, use_node, njob_node, job_dir, 
                             write_pbs_head, n_job_pbs, random_order=random_order)


exist folder /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/ecoC01B05_wt0.7_psi-0c
input 1035 cases.
generate 1 pbs files in total.
 --->>random order mode is ON. 
Command of first case is:
python ../../do_calculate.py   -ini_theta 0.713998 -ini_phi 5.854786 -ini_psi 0.000000 -max_t 10000.000000 -rtol 1.000000e-12 -atol 1.000000e-15 -eval_dt 1.000000e-03 -calculate_fun do_calculate_ecoli_Petsc4nPsi -update_fun 5bs -table_name ecoC01B05_tao1_wm0.7 -omega_tail 0.700000
Out[18]:
True

In [ ]:

new theory version


In [86]:
importlib.reload(spf)
use_node = 3
njob_node = 24
n_job_pbs = use_node * njob_node
random_order = True
ini_t = 0

def comm_do_ShearFlowPetsc4nPsiObj(ini_theta, ini_phi, ini_psi, max_t, rtol, atol, eval_dt, 
                                   update_fun, table_name, omega_tail, flow_strength=1, ini_t=0, ):
    calculate_fun = 'do_ShearFlowPetsc4nPsiObj'
    ts = 'python ../../do_calculate.py  '
    ts = ts + ' -ini_theta %f -ini_phi %f -ini_psi %f' % (ini_theta, ini_phi, ini_psi)
    ts = ts + ' -max_t %f -rtol %e -atol %e -eval_dt %e' % (max_t, rtol, atol, eval_dt)
    ts = ts + ' -calculate_fun %s -update_fun %s -table_name %s' % (calculate_fun, update_fun, table_name)
    ts = ts + ' -omega_tail %f -flow_strength %f -ini_t %f' % (omega_tail, flow_strength, ini_t)
    return ts

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_passive_psi_rada'
# omega_tail, flow_strength = 0, 1
# write_pbs_head = spf.write_pbs_head_q03
# n_rand_case = 10000
# use_node = 10
# n_job_pbs = 10000000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.1_psi_rada'
# omega_tail, flow_strength = 0.1, 1
# write_pbs_head = spf.write_pbs_head
# n_rand_case = 10000
# use_node = 10
# n_job_pbs = 10000000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.3_psi_rada'
# omega_tail, flow_strength = 0.3, 1
# write_pbs_head = spf.write_pbs_head_q03
# n_rand_case = 10000
# use_node = 10
# n_job_pbs = 10000000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.5_psi_rada'
# omega_tail, flow_strength = 0.5, 1
# write_pbs_head = spf.write_pbs_head
# n_rand_case = 10000
# use_node = 3
# n_job_pbs = 10000000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.7_psi_rada'
# omega_tail, flow_strength = 0.7, 1
# write_pbs_head = spf.write_pbs_head
# n_rand_case = 10000
# use_node = 3
# n_job_pbs = 10000000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.9_psi_rada'
# omega_tail, flow_strength = 0.9, 1
# write_pbs_head = spf.write_pbs_head
# n_rand_case = 10000
# use_node = 3
# n_job_pbs = 10000000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_passive_psi_radb'
# omega_tail, flow_strength = 0, 1
# write_pbs_head = spf.write_pbs_head_newturb
# n_rand_case = 10000
# use_node = 1
# n_job_pbs = 1000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.1_psi_radb'
# omega_tail, flow_strength = 0.1, 1
# write_pbs_head = spf.write_pbs_head_newturb
# n_rand_case = 10000
# use_node = 1
# n_job_pbs = 1000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.3_psi_radb'
# omega_tail, flow_strength = 0.3, 1
# write_pbs_head = spf.write_pbs_head_newturb
# n_rand_case = 10000
# use_node = 1
# n_job_pbs = 1000

max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
table_name = 'ecoC01B05_baseFlow'
job_dir = 'ecoC01B05_wt0.5_psi_radb'
omega_tail, flow_strength = 0.5, 1
write_pbs_head = spf.write_pbs_head_newturb
n_rand_case = 10000
use_node = 1
n_job_pbs = 1000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.7_psi_radb'
# omega_tail, flow_strength = 0.7, 1
# write_pbs_head = spf.write_pbs_head_newturb
# n_rand_case = 10000
# use_node = 1
# n_job_pbs = 1000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.9_psi_radb'
# omega_tail, flow_strength = 0.9, 1
# write_pbs_head = spf.write_pbs_head_newturb
# n_rand_case = 10000
# use_node = 1
# n_job_pbs = 1000

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.6_psi_rada'
# omega_tail, flow_strength = 0.6, 1
# write_pbs_head = spf.write_pbs_head
# n_rand_case = 10000
# use_node = 7
# n_job_pbs = n_rand_case

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.55_psi_rada'
# omega_tail, flow_strength = 0.55, 1
# write_pbs_head = spf.write_pbs_head
# n_rand_case = 10000
# use_node = 7
# n_job_pbs = n_rand_case

# max_t, rtol, atol, eval_dt, update_fun = 10000, 1e-9, 1e-12, 1e-3, '5bs'
# table_name = 'ecoC01B05_baseFlow'
# job_dir = 'ecoC01B05_wt0.65_psi_rada'
# omega_tail, flow_strength = 0.65, 1
# write_pbs_head = spf.write_pbs_head
# n_rand_case = 10000
# use_node = 7
# n_job_pbs = n_rand_case

########################################################################################################
t_path = os.path.join(PWD, job_dir)
if not os.path.exists(t_path):
    os.makedirs(t_path)
# generate all comment file. 
comm_list = []
txt_list = []
for i0 in range(n_rand_case):
    ini_theta, ini_phi, ini_psi = np.random.sample(3) * np.pi * (1, 2, 2)
    f = 'th%07.5f_ph%07.5f_ps%07.5f' % (ini_theta, ini_phi, ini_psi)
    ts = comm_do_ShearFlowPetsc4nPsiObj(ini_theta, ini_phi, ini_psi, max_t, rtol, atol, eval_dt, 
                                        update_fun, table_name, omega_tail, flow_strength, ini_t)
    comm_list.append(ts)
    txt_list.append(f)
spf.write_main_run_comm_list(comm_list, txt_list, use_node, njob_node, job_dir, 
                             write_pbs_head, n_job_pbs, random_order=random_order)


exist folder /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/ecoC01B05_wt0.6_psi_rada
input 10000 cases.
generate 1 pbs files in total.
 --->>random order mode is ON. 
Command of first case is:
python ../../do_calculate.py   -ini_theta 1.711141 -ini_phi 3.000346 -ini_psi 1.631145 -max_t 10000.000000 -rtol 1.000000e-09 -atol 1.000000e-12 -eval_dt 1.000000e-03 -calculate_fun do_ShearFlowPetsc4nPsiObj -update_fun 5bs -table_name ecoC01B05_baseFlow -omega_tail 0.600000 -flow_strength 1.000000 -ini_t 0.000000
Out[86]:
True

In [55]:
spf.write_pbs_head_newturb is '<function codeStore.support_fun.write_pbs_head_newturb(fpbs, job_name, nodes=1)>'


Out[55]:
False