134 lines
2.8 KiB
Python
134 lines
2.8 KiB
Python
|
|
def setup_case():
|
|
import numpy as np
|
|
import sys
|
|
|
|
|
|
########### section 1 choice of differencing scheme ###########
|
|
scheme='h' #hybrid
|
|
scheme_turb='h' #hybrid upwind-central
|
|
|
|
########### section 2 turbulence models ###########
|
|
cmu=0.09
|
|
kom = False
|
|
keps = True
|
|
c_eps_1=1.5
|
|
c_eps_2 = 1.9
|
|
prand_eps=1.4
|
|
prand_k=1.4
|
|
#dummy vals
|
|
c_omega_1 = 5./9.
|
|
c_omega_2 = 3./40.
|
|
prand_omega = 2.0
|
|
urf_omega = 0.5
|
|
|
|
########### section 3 restart/save ###########
|
|
restart = False
|
|
save = True
|
|
|
|
########### section 4 fluid properties ###########
|
|
viscos=3.57E-5
|
|
|
|
########### section 5 relaxation factors ###########
|
|
urfvis=0.5
|
|
urf_vel=0.5
|
|
urf_k=0.5
|
|
urf_p=1.0
|
|
urf_eps=0.5
|
|
|
|
########### section 6 number of iteration and convergence criterira ###########
|
|
maxit=2000
|
|
min_iter=1
|
|
sormax=5e-5
|
|
|
|
solver_vel='lgmres'
|
|
solver_pp='pyamg'
|
|
solver_turb='gmres'
|
|
|
|
nsweep_vel=50
|
|
nsweep_pp=50
|
|
nsweep_turb=50
|
|
convergence_limit_u=-1e-6
|
|
convergence_limit_v=-1e-6
|
|
convergence_limit_k=-1e-6 # use absolute conv. criterion
|
|
convergence_limit_om=-1e-6 # use absolute conv. criterion
|
|
convergence_limit_eps=-1e-6 # use absolute conv. criterion
|
|
convergence_limit_pp=5e-2
|
|
|
|
########### section 7 all variables are printed during the iteration at node ###########
|
|
imon=ni-10
|
|
jmon=int(nj/2)
|
|
|
|
########### section 8 save data for post-processing ###########
|
|
vtk=False
|
|
save_all_files=False
|
|
vtk_file_name='bound'
|
|
|
|
########### section 9 residual scaling parameters ###########
|
|
uin=1
|
|
resnorm_p=uin*y2d[1,-1]
|
|
resnorm_vel=uin**2*y2d[1,-1]
|
|
|
|
|
|
########### Section 10 boundary conditions ###########
|
|
|
|
# boundary conditions for u
|
|
u_bc_west=np.ones(nj)
|
|
u_bc_east=np.zeros(nj)
|
|
u_bc_south=np.zeros(ni)
|
|
u_bc_north=np.zeros(ni)
|
|
|
|
u_bc_west_type='d'
|
|
u_bc_east_type='n'
|
|
u_bc_south_type='d'
|
|
u_bc_north_type='n'
|
|
|
|
# boundary conditions for v
|
|
v_bc_west=np.zeros(nj)
|
|
v_bc_east=np.zeros(nj)
|
|
v_bc_south=np.zeros(ni)
|
|
v_bc_north=np.zeros(ni)
|
|
|
|
v_bc_west_type='d'
|
|
v_bc_east_type='n'
|
|
v_bc_south_type='d'
|
|
v_bc_north_type='d'
|
|
|
|
# boundary conditions for p
|
|
p_bc_west=np.zeros(nj)
|
|
p_bc_east=np.zeros(nj)
|
|
p_bc_south=np.zeros(ni)
|
|
p_bc_north=np.zeros(ni)
|
|
|
|
p_bc_west_type='n'
|
|
p_bc_east_type='n'
|
|
p_bc_south_type='n'
|
|
p_bc_north_type='n'
|
|
|
|
# boundary conditions for k
|
|
k_bc_west=np.ones(nj)*1e-2
|
|
k_bc_west[10:]=1e-5
|
|
k_bc_east=np.zeros(nj)
|
|
k_bc_south=np.zeros(ni)
|
|
k_bc_north=np.ones(ni)*1e-5
|
|
|
|
k_bc_west_type='d'
|
|
k_bc_east_type='n'
|
|
k_bc_south_type='d'
|
|
k_bc_north_type='n'
|
|
|
|
# boundary conditions
|
|
eps_bc_west=np.ones(nj)*1e-8
|
|
eps_bc_east=np.zeros(nj)
|
|
eps_bc_south=np.zeros(ni)
|
|
eps_bc_north=np.zeros(ni)
|
|
|
|
eps_bc_west_type='d'
|
|
eps_bc_east_type='n'
|
|
eps_bc_south_type='d'
|
|
eps_bc_north_type='n'
|
|
|
|
return
|
|
|
|
|