initial commit for run all step bash script
This commit is contained in:
parent
f6e9c2ad55
commit
e13b4a928f
4 changed files with 186 additions and 0 deletions
42
extract_all.py
Normal file
42
extract_all.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import argparse
|
||||
import datetime
|
||||
import numpy as np
|
||||
import dnstool
|
||||
from pycompact import CompactScheme
|
||||
|
||||
# Commandline argument parser
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-c", "--case", help="target case name", required=True)
|
||||
args = parser.parse_args()
|
||||
params = vars(args)
|
||||
|
||||
casename = params["case"]
|
||||
u_idx = 1
|
||||
y_idx = 4
|
||||
|
||||
cases = dnstool.case_library()
|
||||
|
||||
case = cases[casename]
|
||||
|
||||
nx, ny, nz = case.shape
|
||||
|
||||
cs = CompactScheme(nx, ny, nz, False, True, True, 4, 2, 2)
|
||||
|
||||
file1 = "u.dat"
|
||||
file2 = "c.dat"
|
||||
file3 = "ddxc.dat"
|
||||
|
||||
storage1 = np.memmap(file1, mode='w+', dtype=np.double, shape=(nx, len(case.data_files), ny, nz))
|
||||
storage2 = np.memmap(file2, mode='w+', dtype=np.double, shape=(nx, len(case.data_files), ny, nz))
|
||||
storage3 = np.memmap(file3, mode='w+', dtype=np.double, shape=(nx, len(case.data_files), ny, nz))
|
||||
|
||||
for i, fname in enumerate(case.data_files):
|
||||
print(datetime.datetime.now(), i, fname)
|
||||
time, u = case.read_single_field(fname, u_idx)
|
||||
time, y = case.read_single_field(fname, y_idx)
|
||||
c = (1. - y)
|
||||
storage1[:,i,:,:] = u.T
|
||||
storage2[:,i,:,:] = c.T
|
||||
storage3[:,i,:,:] = cs.ddx(c).T
|
||||
|
||||
storage.flush()
|
||||
51
fluctuation_product_u_ddxc.py
Normal file
51
fluctuation_product_u_ddxc.py
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import argparse
|
||||
import datetime
|
||||
import numpy as np
|
||||
import dnstool
|
||||
from pycompact import CompactScheme
|
||||
|
||||
# Commandline argument parser
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-c", "--case", help="target case name", required=True)
|
||||
args = parser.parse_args()
|
||||
params = vars(args)
|
||||
|
||||
casename = params["case"]
|
||||
|
||||
cases = dnstool.case_library()
|
||||
|
||||
case = cases[casename]
|
||||
|
||||
nx, ny, nz = case.shape
|
||||
|
||||
cs = CompactScheme(nx, ny, nz, False, True, True, 4, 2, 2)
|
||||
|
||||
|
||||
cfile = "c.dat"
|
||||
ufile = "u.dat"
|
||||
ddxcfile = "ddxc.dat"
|
||||
resfile = "uddxc.dat"
|
||||
|
||||
c = np.memmap(cfile, mode="r", dtype=np.double).reshape((512,-1,256,256))
|
||||
u = np.memmap(ufile, mode="r", dtype=np.double).reshape((512,-1,256,256))
|
||||
ddxc = np.memmap(ufile, mode="r", dtype=np.double).reshape((512,-1,256,256))
|
||||
storage = np.memmap(resfile, mode='w+', dtype=np.double, shape=(nx, len(case.data_files), ny, nz))
|
||||
|
||||
|
||||
for xidx in range(nx):
|
||||
|
||||
u_cstar =
|
||||
u_mean =
|
||||
u_mean_at_x = np.interp (c[xidx], u_cstar, u_mean)
|
||||
u_at_x = u[xidx]
|
||||
u_flux_at_x = u_at_x - u_mean_at_x
|
||||
|
||||
ddxc_cstar =
|
||||
ddxc_mean =
|
||||
ddxc_mean_at_x = np.interp (c[xidx], ddxc_cstar, ddxc_mean)
|
||||
ddxc_at_x = u[xidx]
|
||||
ddxc_flux_at_x = ddxc_at_x - ddxc_mean_at_x
|
||||
|
||||
storage[xidx,:,:,:] = u_flux_at_x * ddxc_flux_at_x
|
||||
|
||||
storage.flush()
|
||||
58
run_in_case_dir.sh
Executable file
58
run_in_case_dir.sh
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
# >>> conda initialize >>>
|
||||
# !! Contents within this block are managed by 'conda init' !!
|
||||
__conda_setup="$('/home/ignis/anaconda2/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__conda_setup"
|
||||
else
|
||||
if [ -f "/home/ignis/anaconda2/etc/profile.d/conda.sh" ]; then
|
||||
. "/home/ignis/anaconda2/etc/profile.d/conda.sh"
|
||||
else
|
||||
export PATH="/home/ignis/anaconda2/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
unset __conda_setup
|
||||
# <<< conda initialize <<<
|
||||
|
||||
conda activate fkde-jupyter-py3
|
||||
|
||||
|
||||
SCRIPT_ROOT=/home/ignis/dns/CNF2021-Figures
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo time python $SCRIPT_ROOT/extract_all.py -c $1
|
||||
|
||||
|
||||
#=============================================================================#
|
||||
|
||||
|
||||
echo Batch running - binning_v_given_c.py
|
||||
|
||||
export BIN_TARGET=u.dat
|
||||
sbatch --array=0,1 -J $1-u-c $SCRIPT_ROOT/sbatch-job-binning-ddxc-array
|
||||
echo sbatch --array=0,511 -J $1-u-c $SCRIPT_ROOT/sbatch-job-binning-ddxc-array
|
||||
|
||||
export BIN_TARGET=ddxc.dat
|
||||
echo sbatch --wait --array=0,511 -J $1-ddxc-c $SCRIPT_ROOT/sbatch-job-binning-ddxc-array
|
||||
|
||||
|
||||
#=============================================================================#
|
||||
|
||||
|
||||
echo time python $SCRIPT_ROOT/fluctuation_product_u_ddxc.py -c $1
|
||||
|
||||
|
||||
#=============================================================================#
|
||||
|
||||
|
||||
echo Batch Running - binning_v_given_c.py
|
||||
export BIN_TARGET=uddxc.dat
|
||||
echo sbatch --wait --array=0,511 -J $1-uddxc-c $SCRIPT_ROOT/sbatch-job-binning-ddxc-array
|
||||
|
||||
|
||||
#=============================================================================#
|
||||
echo Done
|
||||
35
sbatch-job-binning-ddxc-array
Normal file
35
sbatch-job-binning-ddxc-array
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
#SBATCH -J IC1-ddxc # Job name
|
||||
#SBATCH -o ddxc-binning.%j.out # Name of stdout output file (%j expands to jobId)
|
||||
#SBATCH -N 1 # Total number of nodes requested
|
||||
#SBATCH -n 1 # Total number of mpi tasks requested
|
||||
#SBATCH -c 4 # number of cpus required per task
|
||||
# #SBATCH --mail-user=ignis@postech.ac.kr
|
||||
# #SBATCH --mail-type=NONE
|
||||
|
||||
# Launch MPI-based executable
|
||||
|
||||
if [ -n "$SLURM_CPUS_PER_TASK" ]; then
|
||||
omp_threads=$SLURM_CPUS_PER_TASK
|
||||
else
|
||||
omp_threads=1
|
||||
fi
|
||||
export MKL_NUM_THREADS=$omp_threads
|
||||
export OMP_NUM_THREADS=$omp_threads
|
||||
export OPENBLAS_NUM_THREADS=$omp_threads
|
||||
|
||||
echo $OMP_NUM_THREADS / $XINDEX / $SLURM_ARRAY_TASK_ID
|
||||
|
||||
if [ -n "$SLURM_ARRAY_TASK_ID" ]; then
|
||||
echo Using Array Task ID
|
||||
XINDEX=$SLURM_ARRAY_TASK_ID
|
||||
elif [ -n "$XINDEX" ]; then
|
||||
echo XINDEX given explicitly
|
||||
else
|
||||
echo ERROR: XINDEX Required
|
||||
fi
|
||||
|
||||
|
||||
echo python /home/ignis/dns/CNF2021-Figures/binning_v_given_c.py -x $XINDEX -v $BIN_TARGET
|
||||
time python /home/ignis/dns/CNF2021-Figures/binning_v_given_c.py -x $XINDEX -v $BIN_TARGET
|
||||
Loading…
Add table
Reference in a new issue